Package org.spw.model

Examples of org.spw.model.Contact


    }
   
    public String buttonDeleteAttended_action() {
        RowKey rk = tableRowGroup1.getRowKey();
        if (rk != null) {
            Contact contact= (Contact) getSessionBean1().getAttendedDataProvider().getObject(rk);
            removeAttended(contact);
        }
        getSessionBean1().getAttendedDataProvider().refreshList();
       
        return null;
View Full Code Here


    }
   
    public String buttonDeleteOrganized_action() {
        RowKey rk = tableRowGroup2.getRowKey();
        if (rk != null) {
            Contact contact= (Contact) getSessionBean1().getOrganizedByDataProvider().getObject(rk);
            removeOrganizedBy(contact);
        }
        getSessionBean1().getOrganizedByDataProvider().refreshList();
       
        return null;
View Full Code Here

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

        boolean found1 = false;
        boolean found2 = false;
        System.out.println("addDonation");
       
        ContactController instance = new ContactController();
        Contact contact = instance.read(testPersons.get(0).getIdContact());
        Donation donation1 = new Donation();
        donation1.setDueDate(new Date());
        donation1.setProposalTitle(getName());
        donation1.setReasonNotFunded(getName());
        donation1.setStatus("Test1");
View Full Code Here

        System.out.println("removeDonation");
       
        ContactController instance = new ContactController();
        DonationController donationCtrl = new DonationController();

        Contact contact = instance.read(testPersons.get(0).getIdContact());
        Donation donation1 = new Donation();
        donation1.setDueDate(new Date());
        donation1.setProposalTitle(getName());
        donation1.setReasonNotFunded(getName());
        donation1.setStatus("Test1");
        donation1.setAmount(new BigDecimal(1.11));
       
        Donation donation2 = new Donation();
        donation2.setDueDate(new Date());
        donation2.setProposalTitle(getName());
        donation2.setReasonNotFunded(getName());
        donation2.setStatus("Test2");
        donation2.setAmount(new BigDecimal(2.22));
       
        donation1.setDonor(contact);
        donation2.setDonor(contact);
        donation1 = instance.addDonation(donation1);
        donation2 = instance.addDonation(donation2);
        contact = instance.removeDonation(donation1);
        contact = instance.removeDonation(donation2);
        for(Donation aDonation : contact.getDonations()) {
            if (aDonation.getProposalTitle().equals(getName())
            && aDonation.getReasonNotFunded().equals(getName())
            && aDonation.getStatus().equals("Test1")
            && aDonation.getAmount().equals(new BigDecimal(1.11))) {
                found1 = true;
View Full Code Here

       
        boolean found1 = false;
        boolean found2 = false;
       
        ContactController instance = new ContactController();
        Contact contact = instance.read(testPersons.get(0).getIdContact());
        Document doc1 = new Document();
        doc1.setContact(contact);
        doc1.setDocumentType("Test1");
        doc1.setTitle(getName());
       
View Full Code Here

        boolean found1 = false;
        boolean found2 = false;
       
        ContactController instance = new ContactController();
        DocumentController docCtrl = new DocumentController();
        Contact contact = instance.read(testPersons.get(0).getIdContact());
        Document doc1 = new Document();
        doc1.setContact(contact);
        doc1.setDocumentType("Test1");
        doc1.setTitle(getName());
       
        Document doc2 = new Document();
        doc2.setContact(contact);
        doc2.setDocumentType("Test2");
        doc2.setTitle(getName());
       
        doc1 = instance.addDocument(doc1);
        doc2 = instance.addDocument(doc2);
        assertEquals(contact, doc1.getContact());
        assertEquals(contact, doc2.getContact());

        contact = instance.removeDocument(doc1);
        contact = instance.removeDocument(doc2);
        for(Document aDoc : contact.getDocumentLinks()) {
            if (aDoc.getTitle().equals(getName())
            && aDoc.getDocumentType().equals("Test1")) {
                found1 = true;
                break;
            }
View Full Code Here

        }
    }
   
    public Contact read(Long key) {
        EntityManager em = emf.createEntityManager();
        Contact retValue = null;
        try {
            retValue = em.find(Contact.class, key);
        } catch (Exception e) {
            Logger.getLogger(ContactController.class.getName()).log(Level.SEVERE, "Error reading " + key, e);
            if (em.getTransaction().isActive())
View Full Code Here

        }
        return retValue;
    }
   
    public Contact update(Contact object) {
        Contact result = null;
        EntityManager em = emf.createEntityManager();
        em.getTransaction().begin();
        try {
            result = em.merge(object);
            em.getTransaction().commit();
View Full Code Here

   
    public void delete(Contact object) {
        EntityManager em = emf.createEntityManager();
        em.getTransaction().begin();
        try {
            Contact entity = em.find(Contact.class, object.getIdContact());
            em.remove(entity);
            em.getTransaction().commit();
        } catch (Exception e) {
            Logger.getLogger(ContactController.class.getName()).log(Level.SEVERE, "Error deleting " + object, e);
            if (em.getTransaction().isActive())
View Full Code Here

TOP

Related Classes of org.spw.model.Contact

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.