Package org.spw.model

Examples of org.spw.model.Program


   
    public String buttonDelete_action() {
        RowKey rk = tableRowGroup1.getRowKey();
        if (rk != null) {
            ProgramController  ctrl = new ProgramController();
            Program program = (Program)list.getObject(rk);
            ctrl.delete(program);
            list.refreshList();
        }
       
        return null;
View Full Code Here


    }
   
    public String buttonEdit_action() {
        RowKey rk = tableRowGroup1.getRowKey();
        if (rk != null) {
            Program program = (Program)list.getObject(rk);
            getSessionBean1().setProgram(program);
        }
        return "edit";
    }
View Full Code Here

        }
        return "edit";
    }
   
    public String buttonAdd_action() {
        getSessionBean1().setProgram(new Program());
       
        return "new";
    }
View Full Code Here

    }
   
    public String buttonVolunteer_action() {
        RowKey rk = tableRowGroup1.getRowKey();
        if (rk != null) {
            Program program = (Program)list.getObject(rk);
            getSessionBean1().setProgram(program);
            java.util.List<Volunteer> contacts = new ArrayList();
            for (VolunteerApplication application : program.getApplications()) {
                contacts.add(application.getVolunteer());
            }
            getSessionBean1().getContactDataProvider().
                    setContactList(contacts);
        }
View Full Code Here

public class ProgramDataProvider extends ObjectListDataProvider {
    private ArrayList<Program> aList = new ArrayList<Program>();
    /** Creates a new instance of ProgramDataProvider */
    public ProgramDataProvider() {
        // Put in dummy data for design time
        aList.add(new Program());

        // Wrap the list
        setList(aList);       
    }
View Full Code Here

        VolunteerApplication application = new VolunteerApplication();
        application.setIdApplication(TEST_ID);
       
        //obtain a program
        ProgramController pc = new ProgramController();
        Program aProgram = pc.getPrograms().get(0);
        application.setProgram(aProgram);
       
        VolunteerController instance = new VolunteerController();
       
        Volunteer result = instance.addApplication(volunteer, application, null);
        assertNotNull(result);
        assertEquals(volunteer, result);
        assertEquals(application, result.getApplication());
        assertEquals(aProgram, result.getApplication().getProgram());
       
        aProgram = pc.read(aProgram.getIdProgram());
        List<VolunteerApplication> theApplications =
                new ArrayList<VolunteerApplication> (aProgram.getApplications());
        assertTrue("Cannot find the inserted application in the program", theApplications.contains(application));

        //Check the application
        VolunteerApplicationController vac = new VolunteerApplicationController ();
        application = vac.read(application.getIdApplication());
        assertEquals(volunteer, application.getVolunteer());
       
        // Change the program
        Program anotherProgram = pc.getPrograms().get(1);
        application.setProgram(anotherProgram);
        volunteer = instance.addApplication(volunteer, application, aProgram);
        aProgram = pc.read(aProgram.getIdProgram());
        theApplications =
                new ArrayList<VolunteerApplication> (aProgram.getApplications());
        assertFalse("Find the stale application in the previous program", theApplications.contains(application));
        anotherProgram= pc.read(anotherProgram.getIdProgram());
        theApplications =
                new ArrayList<VolunteerApplication> (anotherProgram.getApplications());
        assertTrue("Cannot find the application in the new program", theApplications.contains(application));
       
    }
View Full Code Here

    public ProgramControllerTest(String testName) {
        super(testName);
    }
   
    protected void setUp() throws Exception {
        Program test = new Program();
        test.setIdProgram(TEST_ID);
        test.setProgramAcronym("TEST");
        test.setProgram(getName());
        test.setStartDate(new Date());
        test.setEndDate(new Date());
        ctrl.create(test);
       
        Calendar cal = Calendar.getInstance();
        cal.clear();
       
        test.setIdProgram(TEST_ID+1);
        test.setProgramAcronym("TEST");
        test.setProgram(getName());
        cal.set(2007, 1, 1); //1st of Feb 2007
        test.setStartDate(cal.getTime());
        cal.set(2007, 11, 31); //31st of Dec 2007
        test.setEndDate(cal.getTime());
        ctrl.create(test);
       
        cal = Calendar.getInstance();
        test.setIdProgram(TEST_ID+2);
        test.setProgramAcronym("TEST");
        test.setProgram(getName());
        cal.set(2006, 1, 1); //1st of Feb 2006
        test.setStartDate(cal.getTime());
        cal.set(2006, 11, 31); //31st of Dec 2006
        test.setEndDate(cal.getTime());
        ctrl.create(test);
       
        test.setIdProgram(TEST_ID+3);
        test.setProgramAcronym("TEST");
        test.setProgram(getName());
        cal.set(2008, 0, 1); //1st of Jan 2008
        test.setStartDate(cal.getTime());
        cal.set(2008, 11, 31); //31st of Dec 2008
        test.setEndDate(cal.getTime());
        ctrl.create(test);
    }
View Full Code Here

    public String getAsString(FacesContext context, UIComponent component, Object value) {
        if (value == null) return null;
        if (!(value instanceof Program)) {
            throw new ConverterException("Error converting Program, got a " + value.getClass().getName());
        }
        Program obj = (Program) value;
        return Long.toString(obj.getIdProgram());
    }
View Full Code Here

       
        // </editor-fold>
        // Perform application initialization that must complete
        // *after* managed components are initialized
        if (getSessionBean1().getProgram() == null) {
            getSessionBean1().setProgram(new Program());
        }
       
        if (getSessionBean1().getProgram().getCountry() != null) {
            country.setValue(getSessionBean1().
                    getProgram().getCountry().toString().trim());
View Full Code Here

    }
   
    public String buttonValidate_action() {
        // Persist the new object
        ProgramController ctrl = new ProgramController();
        Program object = getSessionBean1().getProgram();
        ctrl.update(object);
        return "success";
    }
View Full Code Here

TOP

Related Classes of org.spw.model.Program

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.