Examples of Communication


Examples of org.spw.model.Communication

    }
   
    public String buttonCompleted_action() {
        RowKey rk = tableRowGroup1.getRowKey();
        if (rk != null) {
            Communication communication = (Communication)getSessionBean1().
                    getCommunicationDataProvider().getObject(rk);
            communication.setDateOfCompletion(new Date());
            new CommunicationController().update(communication);
        }
        // Refresh
        actionsNotCompletedList.refreshListActionsNotCompleted();
       
View Full Code Here

Examples of org.spw.model.Communication

    }
   
    public String buttonEditCommunication_action() {
        RowKey rk = tableRowGroup1.getRowKey();
        if (rk != null) {
            Communication communication = (Communication) actionsNotCompletedList.getObject(rk);
            if (! communication.getParticipants().isEmpty()) {
                Contact contact = communication.getParticipants().get(0);
                if (contact instanceof Partnership) {
                    getSessionBean1().setPartnership((Partnership) contact);
                    return "infoPartnership";
                } else if (contact instanceof Person) {
                    getSessionBean1().setPerson((Person) contact);
View Full Code Here

Examples of org.spw.model.Communication

        }
    }
   
    private void historize(Contact contact) {
        CommunicationController comCtl = new CommunicationController();
        Communication com = new Communication();
        com.setDateCommunication(new Date());
        com.setMedia("Email");
        com.setTopic(this.getSubject());
        List<Contact> participants = new ArrayList<Contact>(1);
        participants.add(contact);
        com.setParticipants(participants);
        comCtl.create(com);
    }
View Full Code Here

Examples of org.spw.model.Communication

     * @param key The unique ID of the object
     * @return a communication if found, null otherwise
     */
    public Communication read(Long key) {
        EntityManager em = emf.createEntityManager();
        Communication retValue = null;
        try {
            retValue = em.find(Communication.class, key);
        } catch (Exception e) {
            Logger.getLogger(CommunicationController.class.getName()).log(Level.SEVERE, "Error reading " + key, e);
            if (em.getTransaction().isActive())
View Full Code Here

Examples of org.spw.model.Communication

     * Update an existing communication. If it's a new Communication, create it.
     * @param object The communication to update
     * @return the new object communication after the persistence operation
     */
    public Communication update(Communication object) {
        Communication result = null;
        EntityManager em = emf.createEntityManager();
        em.getTransaction().begin();
        try {
            result = em.merge(object);
            em.getTransaction().commit();
View Full Code Here

Examples of org.spw.model.Communication

     */
    public void delete(Communication object) {
        EntityManager em = emf.createEntityManager();
        em.getTransaction().begin();
        try {
            Communication entity = em.find(Communication.class, object.getIdCommunication());
            // remove communication from contact removed from the list
            for(Contact contact : entity.getParticipants()) {
                contact.getParticipate().remove(entity);
                em.merge(contact);
            }
           
            em.remove(entity);
View Full Code Here

Examples of org.spw.model.Communication

     * @return the new communication object after being persisted
     */
    public Communication updateParticipants(Communication communication,
            List<Contact> newParticipants) {
        // First persist the communication with all the contacts
        Communication result = null;
        EntityManager em = emf.createEntityManager();
        em.getTransaction().begin();
        try {
            // remove communication from contact removed from the list
            for(Contact contact : communication.getParticipants()) {
View Full Code Here

Examples of org.spw.model.Communication

        contactCtrl = new ContactController();
        testContact = new Contact();
        testContact.setFirstName(getName());
        contactCtrl.create(testContact);
        //Action completed with a participant
        completedWithContact = new Communication();
        completedWithContact.setActionToBeConducted("Test already done");
        completedWithContact.setDateOfCompletion(new Date());
        completedWithContact.setTopic(getName());
        List participants = new ArrayList();
        participants.add(testContact);
        completedWithContact.setParticipants(participants);
        comCtrl.create(completedWithContact);
        testContact.getParticipate().add(completedWithContact);
        contactCtrl.update(testContact);
        //No action to complete
        noAction = new Communication();
        noAction.setTopic(getName());
        comCtrl.create(noAction);
        //Action to complete
        withActionToComplete = new Communication();
        withActionToComplete.setActionToBeConducted("Test to be done");
        withActionToComplete.setTopic(getName());
        comCtrl.create(withActionToComplete);
    }
View Full Code Here

Examples of org.spw.model.Communication

        List<Communication> result = instance.getList();
        assertFalse("The list must not be empty",
                result.isEmpty());
        assertFalse("The list must contain only one item",
                result.size() > 1);
        Communication retrievedCom = result.get(0);
        assertEquals(completedWithContact, retrievedCom);
        List<Contact> participants = retrievedCom.getParticipants();
        assertEquals("The list of participants must have one contact",
                1, participants.size());
        assertEquals("The list of participants must contain only the created contact",
                contact, participants.get(0));
    }
View Full Code Here

Examples of org.spw.model.Communication

        }
    }
   
    private void historize(Contact contact) {
        CommunicationController comCtl = new CommunicationController();
        Communication com = new Communication();
        com.setDateCommunication(new Date());
        com.setMedia("Email");
        com.setTopic(this.getSubject());
        List<Contact> participants = new ArrayList<Contact>(1);
        participants.add(contact);
        com.setParticipants(participants);
        comCtl.create(com);
    }
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.