Package org.spw.model

Examples of org.spw.model.VolunteerApplication


        prg.setStartDate(cal.getTime());
        prg.setNumberVolunteer(12);
        prg.setProgramAcronym("TEST");
        prg = prgCtrl.update(prg);
       
        VolunteerApplication va = new VolunteerApplication();
        va.setAcceptanceFeeReceived(new Date());
        va.setAcceptanceLettersSent(new Date());
        va.setVolunteer(vo);
        va.setProgram(prg);
        va = vaCtrl.update(va);
       
        vCtrl.addApplication(vo, va, prg);
    }
View Full Code Here


    }

    public String buttonValidate_action() {
        VolunteerApplicationController ctrl = new VolunteerApplicationController();
        Contribution contribution = getSessionBean1().getContribution();
        VolunteerApplication application = getSessionBean1().getContributionDataProvider().getApplication();
        if (!application.getContributions().contains(contribution)) {
            application.addContribution(contribution);
        }
        ctrl.update(application);
       
        return "success";
    }
View Full Code Here

        int nbApplications1 = anyProgram.getApplications().size();
        Edit instance = new Edit();

        // Create a fresh new application
        VolunteerApplication application = new VolunteerApplication();
        application.setProgram(anyProgram);

        // Create and persist the volunteer
        Volunteer volunteer = new Volunteer();
        volunteer.setFirstName(getName());
        volunteer.setLastName(getName());
        volunteer.setTypeVolunteer("Potential");
        volunteer = volunteerCtrl.update(volunteer);

        // test the method
        instance.persist(volunteer, application, null);

        assertNotNull(volunteer.getIdContact());
        assertNotNull(application.getIdApplication());

        VolunteerApplication resultApplication = applicationCtrl.read(application.getIdApplication());

        assertNotNull(resultApplication);
        assertNotNull(resultApplication.getVolunteer());
        assertEquals(volunteer.getIdContact(), resultApplication.getVolunteer().getIdContact());
        assertEquals("Potential", resultApplication.getVolunteer().getTypeVolunteer());

        Program resultProgram = programCtrl.read(anyProgram.getIdProgram());
        ArrayList<VolunteerApplication> applications =
                new ArrayList<VolunteerApplication>(resultProgram.getApplications());
        assertTrue("Cannot find the application in the program", applications.contains(application));
View Full Code Here

        volunteer.setTypeVolunteer("Accepted");
        volunteer.setYearApplyingFor(1900);
        voCtrl.create(volunteer);

       
        VolunteerApplication application = new VolunteerApplication();
        List<Program> programs = programCtrl.getPrograms();
        assertFalse("No programs, must have at leat one for this test.",
                programs.size() == 0);
        Program program = programs.get(0);
        application.setProgram(program);
        application.setAcceptanceFeeReceived(new Date());
        volunteer.setApplication(application);
       
        for (int i=1; i < 5; i++) {
            Contribution contrib = new Contribution();
            contrib.setApplication(application);
            contrib.setContributionAmount(new BigDecimal(i));
            contrib.setContributionValue(new BigDecimal(i*8));
            contrib.setCurrency("TST");
            contrib.setDateContribution(new Date());
            if ((i%3) == 0)
                contrib.setGiftAidable(true);
            contrib.setIdContribution(new Long(i));
            if (i == 1)
                contrib.setInitialFee(true);
            if (i < 3 )
                contrib.setMeansOfPayment("Cheque");
            else
                contrib.setMeansOfPayment("JustGiving");
            contrib.setPayer(getName());
            contrib.setReference(Integer.toString(i));
            application.addContribution(contrib);
        }
       
        VolunteerDetailsFundraisingXmlReport instance =
                new VolunteerDetailsFundraisingXmlReport(volunteer);
       
View Full Code Here

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

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

        return result;
    }
   

    public VolunteerApplication addContribution(VolunteerApplication object, Contribution contribution) {
        VolunteerApplication result = null;
        EntityManager em = emf.createEntityManager();
        em.getTransaction().begin();
        try {
            object.addContribution(contribution);
            result = em.merge(object);
View Full Code Here

        }
        return result;
    }

    public VolunteerApplication removeContribution(VolunteerApplication object, Contribution contribution) {
        VolunteerApplication result = null;
        EntityManager em = emf.createEntityManager();
        em.getTransaction().begin();
        try {
            contribution = em.find(Contribution.class, contribution.getIdContribution());
            object.removeContribution(contribution);
View Full Code Here

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

        int begin = applicationString.lastIndexOf('[') + 1;
        int last  = applicationString.lastIndexOf(']');
        if (begin < 0 || last < 0 || begin > last) return null;
       
        String number = applicationString.substring(begin, last);
        VolunteerApplication retValue = null;
        try {
            retValue = read(Long.parseLong(number));
        } catch (NumberFormatException ex) {
            //incorrect number, could not appen
            Logger.getLogger(VolunteerApplicationController.class.getName()).severe(applicationString +
View Full Code Here

TOP

Related Classes of org.spw.model.VolunteerApplication

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.