Examples of Volunteer


Examples of org.spw.model.Volunteer

    /**
     * Creates a new instance of VolunteerDataProvider
     */
    public VolunteerDataProvider() {
        // Put in dummy data for design time
        aList.add(new Volunteer());
       
        // Wrap the list
        setList(aList);
    }
View Full Code Here

Examples of org.spw.model.Volunteer

     * @param application the volunteer application to add or update
     * @param previousProgram if the program has changed, the program before the change
     * @return A new version of the volunteer after the state has been persisted
     */
    public Volunteer addApplication(Volunteer volunteer, VolunteerApplication application, Program previousProgram) {
        Volunteer result = null;
        EntityManager em = emf.createEntityManager();
        em.getTransaction().begin();
        try {
            //Persist the application
            application.setVolunteer(volunteer);
View Full Code Here

Examples of org.spw.model.Volunteer

    public String getAsString(FacesContext context, UIComponent component, Object value) {
        if (value == null) return null;
        if (!(value instanceof Volunteer)) {
            throw new ConverterException("Error converting Volunteer, got a " + value.getClass().getName());
        }
        Volunteer obj = (Volunteer) value;
        return Long.toString(obj.getIdContact());
    }
View Full Code Here

Examples of org.spw.model.Volunteer

       
        // </editor-fold>
        // Perform application initialization that must complete
        // *after* managed components are initialized
        if (getSessionBean1().getVolunteer() == null) {
            getSessionBean1().setVolunteer(new Volunteer());
        }
        if (getSessionBean1().getVolunteer().getYearApplyingFor() == 0) {
            yearApplyingFor.setText(
                    java.util.Calendar.getInstance().get(java.util.Calendar.YEAR));
        }
View Full Code Here

Examples of org.spw.model.Volunteer

     * handled a postback and then navigated to a different page).  Customize
     * this method to allocate resources that will be required for rendering
     * this page.</p>
     */
    public void prerender() {
        Volunteer volunteer = getSessionBean1().
                getVolunteer();
        if (volunteer != null && volunteer.getNextOfKin() != null) {
            nextOfKin.setValue(volunteer.getNextOfKin().toString());
        }
        if (volunteer != null && volunteer.getParents() != null
                && !volunteer.isParentsSameAsNextOfKin())
            parents.setValue(volunteer.getParents().toString());
    }
View Full Code Here

Examples of org.spw.model.Volunteer

        programs = new ProgramController().getProgramsYear(year);
        volunteersByMonth = new ArrayList[13];
        Calendar cal = Calendar.getInstance();
        for (Program program: programs) {
            for (VolunteerApplication application : program.getApplications()) {
                Volunteer volunteer = application.getVolunteer();
                int monthSelected=1;
                if (application.getAcceptanceFeeReceived() != null) {
                    cal.setTime(application.getAcceptanceFeeReceived());
                    monthSelected = cal.get(Calendar.MONTH) + 1; // month from 1 to 12
                }
View Full Code Here

Examples of org.spw.model.Volunteer

    private static final ProgramController prgCtrl = new ProgramController();
   
    @Override
    protected void setUp() throws Exception {
        super.setUp();
        Volunteer vo = new Volunteer();
        vo.setFirstName(getName());
        vo.setLastName(getName());
        vo.setYearApplyingFor(1900);
        vo.setTypeVolunteer("Accepted");
        vo = vCtrl.update(vo);
       
        Program prg = new Program();
        prg.setProgram(getName());
        Calendar cal = Calendar.getInstance();
View Full Code Here

Examples of org.spw.model.Volunteer

        // 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());
View Full Code Here

Examples of org.spw.model.Volunteer

        System.out.println("toElement");
        ProgramController programCtrl = new ProgramController();
        VolunteerController voCtrl = new VolunteerController();
       
        // Create
        Volunteer volunteer = new Volunteer();
        volunteer.setFirstName(getName());
        volunteer.setLastName(getName());
        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);
       
        SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy");
        String today = df.format(new Date());
        SimpleDateFormat dfMonth = new SimpleDateFormat("MMM-yyyy");
        String thisMonth = dfMonth.format(new Date());
        String expResult = "<volunteerDetails><date>" +
                today + "</date><id>" + volunteer.getIdContact() +
                "</id><name>testToElement, testToElement[" + volunteer.getIdContact() +
                "]</name><selected>" + thisMonth +
                "</selected><programme>" + program +
                "</programme><totalDonated>56</totalDonated><target>3600</target><remaining>3544</remaining>" +
                "<contributions><contribution fee=\"true\" payment=\"Cheque\"><reference>1</reference><date>" +
                today + "</date><amount>8</amount><payer>testToElement</payer><gift> </gift></contribution><contribution fee=\"false\" payment=\"Cheque\"><reference>2</reference><date>" +
View Full Code Here

Examples of org.spw.model.Volunteer

    }

    @Override
    protected void setUp() throws Exception {
        super.setUp();
        Volunteer vo = new Volunteer();
        vo.setFirstName(getName());
        vo.setLastName(getName());
        vo.setYearApplyingFor(1900);
        vo.setTypeVolunteer("Accepted");
        vo.setGrade("PG");
        vo = vCtrl.update(vo);
       
        Program prg = new Program();
        prg.setProgram(getName());
        Calendar cal = Calendar.getInstance();
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.