Package org.spw.model

Examples of org.spw.model.Person


    /**
     * Creates a new instance of PersonDataProvider
     */
    public PersonDataProvider() {
        // Put in dummy data for design time
        aList.add(new Person());
       
        // Wrap the list
        setList(aList);
    }
View Full Code Here


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

       
        return "success";
    }
   
    public String buttonCancel_action() {
        Person object = getSessionBean1().getPerson();
        //cancel of new creation, return to list
        if (object == null || object.getIdContact() == null) {
            return "cancel";
        } else {//return to info
            return "success";
        }
    }
View Full Code Here

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

        Communication com;
        comCtrl.delete(comCtrl.read(TEST_ID_COMPLETED));
        comCtrl.delete(comCtrl.read(TEST_ID_NO_ACTION));
        comCtrl.delete(comCtrl.read(TEST_ID_NOT_COMPLETED));
       
        Person person;
        for(int i=0; i < 10; i++) {
            person = pCtrl.read(TEST_ID_CONTACT1 + i);
            if (person != null)
                pCtrl.delete(person);
        }
View Full Code Here

    public void testUpdateParticipants() {
        System.out.println("updateParticipants");
       
        List<Contact> participants = new ArrayList<Contact>();
        for(int i=0; i < 10; i++) {
            Person person = new Person();
            person.setIdContact(TEST_ID_CONTACT1 + i);
            person.setFirstName(getName());
            person.setLastName(getName() + " #" + i);
            person = pCtrl.update(person);
            participants.add(person);
        }
       
        Communication com = new Communication();
        com.setIdCommunication(TEST_ID_COMPLETED);
        com.setActionToBeConducted(getName());
        com.setDateCommunication(new Date());
        com.setDateOfCompletion(new Date());
        com.setMedia("test");
        com.setTopic(getName());
        com = comCtrl.update(com);
        com = comCtrl.updateParticipants(com, participants);
        assertEquals(10, com.getParticipants().size());
        Person person;
        for(int i=0; i < 10; i++) {
            person = pCtrl.read(TEST_ID_CONTACT1 + i);
            assertTrue(person.getParticipate().contains(com));
        }
       
        //try to remove one participant and check if the relation is updated for both side
        participants = new ArrayList(com.getParticipants());
        person = pCtrl.read(TEST_ID_CONTACT1);
        assertTrue(participants.remove(person));
       
        com = comCtrl.updateParticipants(com, participants);
        // check the removed participant doesn't contain the communication
        person = pCtrl.read(person.getIdContact());
        assertFalse(person.getParticipate().contains(com));
        //check new list size
        assertEquals(9, com.getParticipants().size());
    }
View Full Code Here

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

    }

    public String buttonInfo_action() {
        RowKey rk = tableRowGroup1.getRowKey();
        if (rk != null) {
            Person person = (Person)getSessionBean1().
                    getContactDataProvider().getObject(rk);
            getSessionBean1().setPerson(person);
        }
       
        return "infoPerson";
View Full Code Here

        super(testName);
    }
   
    @Override
    protected void setUp() throws Exception {
        Person p1 = new Person();
        p1.setFirstName(TEST_FIRSTNAME_ABC1);
        p1.setLastName(getName());
        ctrl.create(p1);
        testPersons.add(p1);
        for(int i=0; i < 8; i++) {
            Person p = new Person();
            p.setFirstName(TEST_FIRSTNAME_ABC1 + i);
            p.setLastName(getName());
            ctrl.create(p);
            testPersons.add(p);
        }
        Person p2 = new Person();
        p2.setFirstName(TEST_FIRSTNAME_BBC);
        p2.setLastName(getName());
        ctrl.create(p2);
        testPersons.add(p2);
    }
View Full Code Here

    /**
     * Test of create method, of class org.spw.controller.ContactController.
     */
    public void testCreate() {
        // check create a double thows an exception
        Person p1 = new Person();
        p1.setIdContact(testPersons.get(0).getIdContact());
        p1.setFirstName(TEST_FIRSTNAME_ABC1);
        p1.setLastName(getName());
        try {
            ctrl.create(p1);
            fail("create a double should send an error");
        } catch (EntityExistsException eee) {
            //OK
View Full Code Here

TOP

Related Classes of org.spw.model.Person

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.