Package server.hibernate

Examples of server.hibernate.Typeworkshift


     * Test of createNewTypewWorkShift method, of class ServiceFacadeSmeny.
     */
    @Test
    public void testCreateNewTypewWorkShift_Typeworkshift() {
        System.out.println("createNewTypewWorkShift");
        Typeworkshift typeWorkshift = new Typeworkshift();
        typeWorkshift.setName("TestFacade");                      
        Date date = new Date(10000);               
        typeWorkshift.setFromTime(date);
       
        date = new Date(20000);
        typeWorkshift.setToTime(date);  
                      
        typeWorkshift.setStatus(1);              
        typeWorkshift.setIdWorkshiftRole(1);
        this.serviceFacadeSmeny.createNewTypewWorkShift(typeWorkshift);
       
        Typeworkshift testType = Typeworkshift.findByName(typeWorkshift.getName());
               
        assertEquals(typeWorkshift.getName(), testType.getName());
        assertEquals(typeWorkshift.getIdWorkshiftRole(), testType.getIdWorkshiftRole());
        assertEquals(typeWorkshift.getFromTime(), testType.getFromTime());
        assertEquals(typeWorkshift.getToTime(), testType.getToTime());    
    }
View Full Code Here


    public static void displayTypeWorkshift(List resultList){
        System.out.println("Name\t\t Status");
        for(Object o: resultList){
                //Actor actor = (Actor)o;
                //System.out.println(actor.getFirstName() + " " + actor.getLastName());
                Typeworkshift typeworkshift = (Typeworkshift)o;
                System.out.println(typeworkshift.getName() + "\t" + typeworkshift.getStatus() + "\t" + typeworkshift.getFromTime() + "\t" + typeworkshift.getToTime() + "\t" + typeworkshift.getIdTypeWorkshift());
            }
    }
View Full Code Here

       
        if (typeWorkshifts != null) {
            tableData = new Object[typeWorkshifts.size()][5];
            int i = 0, j = 0;
            for (Object o : typeWorkshifts) {
                Typeworkshift shift = (Typeworkshift) o;
                tableData[i][j++] = shift.getName();
                tableData[i][j++] = sdf.format(shift.getFromTime());                
                tableData[i][j++] = sdf.format(shift.getToTime());

                for (Object obj : rolesList) {
                    Role role = (Role) obj;
                    if (role.getRoleId() == shift.getIdWorkshiftRole()) {
                        tableData[i][j++] = role.getName();
                        break;
                    }
                }
                //tableData[i][j++] = shift.getIdWorkshiftRole(); //predelat na jmeno role
                tableData[i][j++] = shift.getStatus();

                System.out.println(shift.getName() + " "
                        + shift.getFromTime() + " "
                        + shift.getToTime() + " "
                        + shift.getIdWorkshiftRole() + " "
                        + shift.getStatus());
                j = 0;

                i++;
            }
        }
View Full Code Here

            JOptionPane.showMessageDialog(null, "Typ směny stejného názvu již existuje.", "Chybně zadaná data", JOptionPane.ERROR_MESSAGE);
            return;
        };
        String roleString = (String)this.workRoleComboBox.getSelectedItem();
       
        Typeworkshift tw = new Typeworkshift();
        tw.setName(name);
                       
        Date date = (Date) fromSpinner.getValue();               
        tw.setFromTime(date);
       
        date = (Date) toSpinner.getValue();
        tw.setToTime(date);  
       
        if(tw.getFromTime().equals(tw.getToTime())) {
            JOptionPane.showMessageDialog(null, "Čas \"Od\" musí být různý \"Do.\"", "Chybně zadaná data", JOptionPane.ERROR_MESSAGE);
            return;
        }
       
        tw.setStatus(1);      
        //List l =  Test.executeHQLQuery("from Role r where r.name='" + roleString + "'");
        Role role = ServiceFacade.getInstance().getRoleByName(roleString);
        tw.setIdWorkshiftRole(role.getRoleId());
        System.out.println("TW: " + tw.getName() + " " + tw.getFromTime() + " " + tw.getToTime());
        //Test.saveToDb(tw);       
        ServiceFacade.getInstance().createNewTypewWorkShift(tw);
        this.loadAllData();
        this.shiftTable.setModel(SmenyController.getInstance().getModelTypeWorkShift());
              
View Full Code Here

     */
    @Test
    public void testCreateWorkshiftType() {
        System.out.println("createWorkshiftType");
       
        Typeworkshift tw = new Typeworkshift();
        tw.setName("TestWorkShift");                      
        Date date = new Date(10000);               
        tw.setFromTime(date);
       
        date = new Date(20000);
        tw.setToTime(date);  
                      
        tw.setStatus(1);              
        tw.setIdWorkshiftRole(1);
               
        instance.createWorkshiftType(tw);
       
        testType = Typeworkshift.findByName(tw.getName());
               
        assertEquals(tw.getName(), testType.getName());
        assertEquals(tw.getIdWorkshiftRole(), testType.getIdWorkshiftRole());
        assertEquals(tw.getFromTime(), testType.getFromTime());
        assertEquals(tw.getToTime(), testType.getToTime());               
    }
View Full Code Here

TOP

Related Classes of server.hibernate.Typeworkshift

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.