Examples of Communication


Examples of org.spw.model.Communication

     * Creates a new instance of CommunicationDataProvider
     */
    public CommunicationDataProvider() {
        aList = new ArrayList<Communication>();
        // Put in dummy data for design time
        aList.add(new Communication());
       
        // Wrap the list
        setList(aList);
    }
View Full Code Here

Examples of org.spw.model.Communication

       
        // </editor-fold>
        // Perform application initialization that must complete
        // *after* managed components are initialized
        if (getCommunication() == null) {
            setCommunication(new Communication());
        }
    }
View Full Code Here

Examples of org.spw.model.Communication

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

Examples of org.spw.model.Communication

        super(testName);
    }
   
    protected void setUp() throws Exception {
        //Action completed
        Communication com1 = new Communication();
        com1.setIdCommunication(TEST_ID_COMPLETED);
        com1.setActionToBeConducted("Test already done");
        com1.setDateOfCompletion(new Date());
        com1.setTopic(getName());
        comCtrl.create(com1);
        //No action to complete
        Communication com2 = new Communication();
        com2.setIdCommunication(TEST_ID_NO_ACTION);
        com2.setTopic(getName());
        comCtrl.create(com2);
        //Action to complete
        Communication com3 = new Communication();
        com3.setIdCommunication(TEST_ID_NOT_COMPLETED);
        com3.setActionToBeConducted("Test to be done");
        com3.setTopic(getName());
        comCtrl.create(com3);
    }
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

        com3.setTopic(getName());
        comCtrl.create(com3);
    }
   
    protected void tearDown() throws Exception {
        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;
View Full Code Here

Examples of org.spw.model.Communication

            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
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.