Examples of Volunteer


Examples of org.spw.model.Volunteer

    }
   
    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);
       
View Full Code Here

Examples of org.spw.model.Volunteer

        return (ApplicationBean1)getBean("ApplicationBean1");
    }
   
    public String buttonValidate_action() {
        VolunteerApplication application = getVolunteerApplication();
        Volunteer volunteer = getVolunteer();
        Program previousProgram = getProgram();
        persist(volunteer, application, previousProgram);
       
        return "success";
    }
View Full Code Here

Examples of org.spw.model.Volunteer

    protected void setUp() throws Exception {
    }
   
    protected void tearDown() throws Exception {
        VolunteerController vc = new VolunteerController();
        Volunteer v = vc.read(TEST_ID);
        if (v != null) vc.delete(v);
        VolunteerApplicationController vac = new VolunteerApplicationController();
        VolunteerApplication va = vac.read(TEST_ID);
        if (va != null) vac.delete(va);
       
View Full Code Here

Examples of org.spw.model.Volunteer

       
        String volunteer = "";
        VolunteerController instance = new VolunteerController();
       
        // --- Tests incorrects cases (return null)
        Volunteer expResult = null;
        //test empty string
        Volunteer result = instance.parse(volunteer);
        assertEquals("Parsing empty string should give a null volunteer",
                expResult, result);
       
        // test null string
        volunteer = null;
        result = instance.parse(volunteer);
        assertEquals("Parsing empty string should give a null volunteer",
                expResult, result);
       
        // test incorrect number
        volunteer = "[199999999]"; //this case can't occur until few thousand of years
        result = instance.parse(volunteer);
        assertEquals("Parsing empty string should give a null volunteer",
                expResult, result);
       
        // --- Test correct case
        // test correct number
        expResult = new Volunteer();
        expResult.setNote("Test case");
        instance.create(expResult);
        volunteer = "[" + expResult.getIdContact().toString() + "]";
        result = instance.parse(volunteer);
        assertEquals("Parsing empty string should give a null volunteer",
View Full Code Here

Examples of org.spw.model.Volunteer

     * Test of addApplication method, of class org.spw.controller.VolunteerController.
     */
    public void testAddApplication() {
        System.out.println("addApplication");
       
        Volunteer volunteer = new Volunteer();
        volunteer.setIdContact(TEST_ID);
        volunteer.setFirstName(getName());
        volunteer.setLastName(getName());
        volunteer.setTypeVolunteer("Potential");
       
        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));
View Full Code Here

Examples of org.spw.model.Volunteer

     * @param application the volunteer application to add or update
     * @param previousProgram if the program has changed, the program before the change
     * @return A new version of the volunteer after the state has been persisted
     */
    public Volunteer addApplication(Volunteer volunteer, VolunteerApplication application, Program previousProgram) {
        Volunteer result = null;
        EntityManager em = emf.createEntityManager();
        em.getTransaction().begin();
        try {
            //Persist the application
            application.setVolunteer(volunteer);
View Full Code Here

Examples of org.spw.model.Volunteer

            getSessionBean1().getCommunicationDataProvider().refreshListCommunicationsContact();
            // Set the contribution data provider for this contact
            getSessionBean1().getContributionDataProvider().clearObjectList();
            if (getSessionBean1().getPerson() != null &&
                    (getSessionBean1().getPerson() instanceof Volunteer)) {
                Volunteer volunteer = ((Volunteer) getSessionBean1().getPerson());
                if (volunteer.getApplication() != null) {
                    getSessionBean1().getContributionDataProvider().
                            setApplication(volunteer.getApplication());
                    getSessionBean1().getContributionDataProvider().refreshList();
                }
            }
        }
    }
View Full Code Here

Examples of org.spw.model.Volunteer

        Person person = getSessionBean1().getPerson();
        // if Person, create an instance of Volunteer
        if (person instanceof Volunteer) {
            return null;
        } else {
            getSessionBean1().setVolunteer(new Volunteer((Person) person));
        }
       
        return "editVolunteer";
    }
View Full Code Here

Examples of org.spw.model.Volunteer

       
        for ( Object obj : prop.values() ) {
          System.out.println( "Property: " + obj.toString() );
        }
        Set<Contact> set = new HashSet<Contact>();
        Contact contact1 = new Volunteer();
        String sMailTo = prop.getProperty( "mail.to");
        contact1.setEmail( sMailTo);
        contact1.setFirstName("Patrice");
        contact1.setIdContact(1L);
        Contact contact2 = new Partnership();
        contact2.setEmail( "Pablo@localhost" );
        contact2.setFirstName("Pablo");
        contact2.setIdContact(2L);
        set.add(contact1);
View Full Code Here

Examples of org.spw.model.Volunteer

        "\"address1\",\"address2\",\"Australia\",\"email\",\"fax\","
            + "\"firstName\",9999999,\"lastName\","
            + "\"locality\",\"mobile\",\"firstName, lastName[9999999]\","
            + "\"note\",\"positionOccupied\",\"postalCode\",\"stateAddress\","
            + "\"title\",\"workPhone\"", exporter.getValues());
    Contact volunteer = new Volunteer();
    volunteer.setAddress1("address1");
    volunteer.setAddress2("address2");
    volunteer.setCountry(australia);
    volunteer.setEmail("email");
    volunteer.setFax("fax");
    volunteer.setFirstName("firstName");
    volunteer.setIdContact(9999999L);
    volunteer.setLastName("lastName");
    volunteer.setLocality("locality");
    volunteer.setMobile("mobile");
    volunteer.setNote("note");
    volunteer.setPositionOccupied("positionOccupied");
    volunteer.setPostalCode("postalCode");
    volunteer.setStateAddress("stateAddress");
    volunteer.setTitle("title");
    volunteer.setWorkPhone("workPhone");
    exporter.setModel(volunteer);
    assertEquals(
        "\"address1\",\"address2\",\"Australia\",\"email\",\"fax\","
            + "\"firstName\",9999999,\"lastName\","
            + "\"locality\",\"mobile\",\"firstName, lastName[9999999]\","
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.