Package org.spw.controller

Examples of org.spw.controller.ContactController


   
    protected void tearDown() throws Exception {
        DonationController donationCtrl = new DonationController();
        Donation donation = donationCtrl.read(id);
        donationCtrl.delete(donation);
        ContactController contactCtrl = new ContactController();
        Contact contact = contactCtrl.read(id);
        contactCtrl.delete(contact);
    }
View Full Code Here


        donation = donationCtrl.read(id);
        assertEquals(donation.getIdDonation(), id);
        assertEquals(donation.getDonor(), contact);
        assertEquals(donation.getDonor().getIdContact(), id);
        assertEquals(donation.getDonor().getFirstName(), this.getName());
        ContactController contactCtrl = new ContactController();
        contact = contactCtrl.read(id);
        assertTrue(contact.getDonations().contains(donation));
    }
View Full Code Here

    protected void tearDown() throws Exception {
        super.tearDown();
        DonationController donationCtrl = new DonationController();
        Donation donation = donationCtrl.read(id);
        donationCtrl.delete(donation);
        ContactController contactCtrl = new ContactController();
        Contact contact = contactCtrl.read(id);
        contactCtrl.delete(contact);
    }
View Full Code Here

   
    public void contact_complete(FacesContext context, String prefix, CompletionResult result) {
        if (prefix == null || prefix.trim().length() < 1) {
            return;
        }
        java.util.List<Contact> contacts = new ContactController().
                getContactsBeginningBy(prefix, MAX_AUTOCOMPLETE);
        for (Contact contact : contacts) {
            result.addItem(contact.toString());
        }
    }
View Full Code Here

    }
   
    private void deleteCommunication(Communication communication) {
        Contact contact = getContact();
        contact.getParticipate().remove(communication);
        new ContactController().update(contact);
        new CommunicationController().delete(communication);
       
    }
View Full Code Here

    }

    private void addCommunication() {
        String[] selected = getSessionBean1().getChoices();
        CommunicationController comCtl = new CommunicationController();
        ContactController contactCtl = new ContactController();
        Contact contact = getContact();
        Communication communication = getCommunication();
       
        //Create communication (needed for new object)
        communication = comCtl.update(communication);
       
        //Insert the participants after converting the array to List
        java.util.List<Contact> participants = new ArrayList<Contact>();
        participants.add(contact);
        if (selected != null) {
            for (int i= 0; i < selected.length; i++) {
                Contact aParticipant = contactCtl.parse("["+selected[i]+"]");
                if (aParticipant != null && !aParticipant.equals(contact)) {
                    participants.add(aParticipant);
                }
            }
        }
        communication = comCtl.updateParticipants(communication, participants);

        // update the current properties in the session
        setCommunication(communication);
        contact = contactCtl.read(contact.getIdContact());
        setContact(contact);
    }
View Full Code Here

    }
   
    private void deleteCommunication(Communication communication) {
        Contact contact = getContact();
        contact.getParticipate().remove(communication);
        new ContactController().update(contact);
        new CommunicationController().delete(communication);
       
    }
View Full Code Here

     * Add a Faces message if the list can't be refresh (it's the case if
     * the object was created from a list).
     */
    public void refreshListCommunicationsContact() {
        aList.clear();
        contact = new ContactController().read(getContact().getIdContact());
        aList.addAll(contact.getParticipate());
    }
View Full Code Here

    }

    private void addCommunication() {
        String[] selected = getSessionBean1().getChoices();
        CommunicationController comCtl = new CommunicationController();
        ContactController contactCtl = new ContactController();
        Contact contact = getContact();
        Communication communication = getCommunication();
       
        //Create communication (needed for new object)
        communication = comCtl.update(communication);
       
        //Insert the participants after converting the array to List
        java.util.List<Contact> participants = new ArrayList<Contact>();
        participants.add(contact);
        if (selected != null) {
            for (int i= 0; i < selected.length; i++) {
                Contact aParticipant = contactCtl.parse("["+selected[i]+"]");
                if (aParticipant != null && !aParticipant.equals(contact)) {
                    participants.add(aParticipant);
                }
            }
        }
        communication = comCtl.updateParticipants(communication, participants);

        // update the current properties in the session
        setCommunication(communication);
        contact = contactCtl.read(contact.getIdContact());
        setContact(contact);
    }
View Full Code Here

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

TOP

Related Classes of org.spw.controller.ContactController

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.