Package org.spw.controller

Examples of org.spw.controller.VolunteerController


   
    public String buttonDelete_action() {
        RowKey rk = tableRowGroup1.getRowKey();
        if (rk != null) {
            Volunteer volunteer = (Volunteer) list.getObject(rk);
            new VolunteerController().delete(volunteer);
        }
        try {
            list.refreshList();
        } catch (CriteriaException ex) {
            error(ex.getMessage());
View Full Code Here


            id = new Long(value);
        } catch (NumberFormatException ex) {
            throw new ConverterException("Incorrect id for Volunteer[" + value +"]");
        }
       
        VolunteerController ctrl = new VolunteerController();
        return ctrl.read(id);
    }
View Full Code Here

    protected RequestBean1 getRequestBean1() {
        return (RequestBean1)getBean("RequestBean1");
    }
   
    public String buttonValidate_action() {
        VolunteerController ctrlVolunteer = new VolunteerController();
        PersonController ctrlPerson = new PersonController();
        Volunteer volunteer = getSessionBean1().getVolunteer();
        // parse the next of Kin & the parents
        Person contactNextOfKin = null;
        Person contactParent;
        if (nextOfKin.getText().length() > 0) {
            contactNextOfKin = ctrlPerson.parse((String) nextOfKin.getValue());
            if (contactNextOfKin != null) {
                volunteer.setNextOfKin(contactNextOfKin);
            }
        }
        if (volunteer.isParentsSameAsNextOfKin()) {
            volunteer.setParents(contactNextOfKin);
        } else {
            if (parents.getText().length() > 0) {
                contactParent = ctrlPerson.parse((String) parents.getValue());
                if (contactParent != null) {
                    volunteer.setParents(contactParent);
                }
            }
        }
       
        // Remove previous Person if creation of Volunteer from a Person
        if (getSessionBean1().getPerson() !=  null &&
                getSessionBean1().getPerson().getIdContact() == volunteer.getIdContact() ) {
            ctrlPerson.delete(getSessionBean1().getPerson());
        }
        // Persit the new object
        ctrlVolunteer.update(volunteer);
       
        //Set the person property for info display
        getSessionBean1().setPerson(volunteer);
        return "success";
    }
View Full Code Here

    }
   
    void persist(final Volunteer volunteer,
            final VolunteerApplication application,
            final Program previousProgram) {
        final VolunteerController volunteerCtrl = new VolunteerController();
              
        volunteerCtrl.addApplication(volunteer, application, previousProgram);
        //todo: message if type change
        //info("The volunteer has now a type of " + newType);
    }
View Full Code Here

   
    public String buttonDelete_action() {
        RowKey rk = tableRowGroup1.getRowKey();
        if (rk != null) {
            Volunteer volunteer = (Volunteer) list.getObject(rk);
            new VolunteerController().delete(volunteer);
        }
        try {
            list.refreshList();
        } catch (CriteriaException ex) {
            error(ex.getMessage());
View Full Code Here

            id = new Long(value);
        } catch (NumberFormatException ex) {
            throw new ConverterException("Incorrect id for Volunteer[" + value +"]");
        }
       
        VolunteerController ctrl = new VolunteerController();
        return ctrl.read(id);
    }
View Full Code Here

    protected RequestBean1 getRequestBean1() {
        return (RequestBean1)getBean("RequestBean1");
    }
   
    public String buttonValidate_action() {
        VolunteerController ctrlVolunteer = new VolunteerController();
        PersonController ctrlPerson = new PersonController();
        Volunteer volunteer = getSessionBean1().getVolunteer();
        // parse the next of Kin & the parents
        Person contactNextOfKin = null;
        Person contactParent;
        if (nextOfKin.getText().length() > 0) {
            contactNextOfKin = ctrlPerson.parse((String) nextOfKin.getValue());
            if (contactNextOfKin != null) {
                volunteer.setNextOfKin(contactNextOfKin);
            }
        }
        if (volunteer.isParentsSameAsNextOfKin()) {
            volunteer.setParents(contactNextOfKin);
        } else {
            if (parents.getText().length() > 0) {
                contactParent = ctrlPerson.parse((String) parents.getValue());
                if (contactParent != null) {
                    volunteer.setParents(contactParent);
                }
            }
        }
       
        // Remove previous Person if creation of Volunteer from a Person
        if (getSessionBean1().getPerson() !=  null &&
                getSessionBean1().getPerson().getIdContact() == volunteer.getIdContact() ) {
            ctrlPerson.delete(getSessionBean1().getPerson());
        }
        // Persit the new object
        ctrlVolunteer.update(volunteer);
       
        //Set the person property for info display
        getSessionBean1().setPerson(volunteer);
        return "success";
    }
View Full Code Here

    @Override
    protected void setUp() throws Exception
    {
        super.setUp();
        applicationCtrl = new VolunteerApplicationController();
        volunteerCtrl = new VolunteerController();
        programCtrl = new ProgramController();
       
        assertTrue(programCtrl.getPrograms().size() > 0);
        anyProgram = programCtrl.getPrograms().get(0);
    }
View Full Code Here

     * Test of toElement method, of class org.spw.volunteer.report.xml.VolunteerDetailsFundraisingXmlReport.
     */
    public void testToElement() throws Exception{
        System.out.println("toElement");
        ProgramController programCtrl = new ProgramController();
        VolunteerController voCtrl = new VolunteerController();
       
        // Create
        Volunteer volunteer = new Volunteer();
        volunteer.setFirstName(getName());
        volunteer.setLastName(getName());
        volunteer.setTypeVolunteer("Accepted");
        volunteer.setYearApplyingFor(1900);
        voCtrl.create(volunteer);

       
        VolunteerApplication application = new VolunteerApplication();
        List<Program> programs = programCtrl.getPrograms();
        assertFalse("No programs, must have at leat one for this test.",
View Full Code Here

    }
   
    void persist(final Volunteer volunteer,
            final VolunteerApplication application,
            final Program previousProgram) {
        final VolunteerController volunteerCtrl = new VolunteerController();
              
        volunteerCtrl.addApplication(volunteer, application, previousProgram);
        //todo: message if type change
        //info("The volunteer has now a type of " + newType);
    }
View Full Code Here

TOP

Related Classes of org.spw.controller.VolunteerController

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.