Package org.spw.model

Examples of org.spw.model.FundraisingPlan


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


                    em.remove(p);
                }
            }
            // add the new ones
            for (int i = 0; i < plan.length; i++) {
                FundraisingPlan p = new FundraisingPlan();
                p.setFundraising(fundraising);
                p.setMonthSelected(monthSelected);
                p.setMonthFunding(plan[i].getMonthFunding());
                p.setAmount(plan[i].getAmount());
                fundraising.getFundraisingPlans().add(p);
                plan[i] = p;
            }
            //update
            fundraising = em.merge(fundraising);
View Full Code Here

                }
            }
            // add the new ones (begin from the selected month, can't be before
            for (int i = (monthSelected -1) ; i < monthPlan.length; i++) {
                if (monthPlan[i] == null) {
                    FundraisingPlan p = new FundraisingPlan();
                    p.setFundraising(fundraising);
                    p.setMonthSelected(monthSelected);
                    p.setMonthFunding(i+1);
                    monthPlan[i] = p;
                }
            }
        } catch (Exception e) {
            Logger.getLogger(FundraisingController.class.getName()).log(Level.SEVERE, "Error reading " + year, e);
View Full Code Here

        assertNull(object);
       
        int year = 1900;
        int month = 1;
        FundraisingPlan[] plan = new FundraisingPlan[2];
        FundraisingPlan p1 = new FundraisingPlan();
        p1.setMonthSelected(month);
        p1.setMonthFunding(1);
        p1.setAmount(new BigDecimal(100));
        plan[0] = p1;
        FundraisingPlan p2 = new FundraisingPlan();
        p2.setMonthSelected(month);
        p2.setMonthFunding(2);
        p2.setAmount(new BigDecimal(3500));
        plan[1] = p2;
       
        instance = new FundraisingController();
       
        instance.addFundraisingsPlan(year, month, plan);
View Full Code Here

        System.out.println("addFundraisingsPlan");
       
        int year = 1900;
        int month = 1;
        FundraisingPlan[] plan = new FundraisingPlan[2];
        FundraisingPlan p1 = new FundraisingPlan();
        p1.setMonthSelected(month);
        p1.setMonthFunding(1);
        p1.setAmount(new BigDecimal(100));
        plan[0] = p1;
        FundraisingPlan p2 = new FundraisingPlan();
        p2.setMonthSelected(month);
        p2.setMonthFunding(2);
        p2.setAmount(new BigDecimal(3500));
        plan[1] = p2;
       
        FundraisingController instance = new FundraisingController();
       
        instance.addFundraisingsPlan(year, month, plan);
       
        Fundraising result = instance.read(year);
        assertEquals(2, result.getFundraisingPlans().size());
        for (FundraisingPlan item: result.getFundraisingPlans()) {
            assertEquals(month, item.getMonthSelected());
            assertTrue(item.getMonthFunding() > 0);
            assertTrue(item.getAmount().compareTo(new BigDecimal(99.99)) > 0);
        }
       
        plan = new FundraisingPlan[3];
        plan[0] = result.getFundraisingPlans().get(0);
        p2 = new FundraisingPlan();
        p2.setMonthSelected(month);
        p2.setMonthFunding(2);
        p2.setAmount(new BigDecimal(2500));
        plan[1] = p2;
        FundraisingPlan p3 = new FundraisingPlan();
        p3.setMonthSelected(month);
        p3.setMonthFunding(2);
        p3.setAmount(new BigDecimal(1500));
        plan[2] = p3;
        instance.addFundraisingsPlan(year, month, plan);
        result = instance.read(year);
        assertEquals(3, result.getFundraisingPlans().size());
        for (FundraisingPlan item: result.getFundraisingPlans()) {
View Full Code Here

        int year = 1900;
        int month = 2;
        FundraisingController instance = new FundraisingController();

        FundraisingPlan[] plan = new FundraisingPlan[2];
        FundraisingPlan p1 = new FundraisingPlan();
        p1.setMonthSelected(month);
        p1.setMonthFunding(1);
        p1.setAmount(new BigDecimal(100));
        plan[0] = p1;
        FundraisingPlan p2 = new FundraisingPlan();
        p2.setMonthSelected(month);
        p2.setMonthFunding(2);
        p2.setAmount(new BigDecimal(3500));
        plan[1] = p2;
        instance.addFundraisingsPlan(year, month, plan);
       
        boolean found[] = new boolean[12];
        FundraisingPlan[] result = instance.getFundraisingsPlan(year, month);
View Full Code Here

        fr.setTarget(new BigDecimal(3600));
        ctrl.create(fr);
        int year = 1900;
        int month = 1;
        FundraisingPlan[] plan = new FundraisingPlan[2];
        FundraisingPlan p1 = new FundraisingPlan();
        p1.setMonthSelected(month);
        p1.setMonthFunding(1);
        p1.setAmount(new BigDecimal(100));
        plan[0] = p1;
        FundraisingPlan p2 = new FundraisingPlan();
        p2.setMonthSelected(month);
        p2.setMonthFunding(2);
        p2.setAmount(new BigDecimal(3500));
        plan[1] = p2;
               
        ctrl.addFundraisingsPlan(year, month, plan);       
    }
View Full Code Here

        instance.setMonth(month);
        instance.refreshList();
       
        assertEquals(12,instance.getList().size());
        for (Object item: instance.getList()) {
            FundraisingPlan plan = (FundraisingPlan) item;
            assertEquals(month, plan.getMonthSelected());
            assertTrue(plan.getMonthFunding() > 0);
        }
       
    }
View Full Code Here

                    em.remove(p);
                }
            }
            // add the new ones
            for (int i = 0; i < plan.length; i++) {
                FundraisingPlan p = new FundraisingPlan();
                p.setFundraising(fundraising);
                p.setMonthSelected(monthSelected);
                p.setMonthFunding(plan[i].getMonthFunding());
                p.setAmount(plan[i].getAmount());
                fundraising.getFundraisingPlans().add(p);
                plan[i] = p;
            }
            //update
            fundraising = em.merge(fundraising);
View Full Code Here

                }
            }
            // add the new ones (begin from the selected month, can't be before
            for (int i = (monthSelected -1) ; i < monthPlan.length; i++) {
                if (monthPlan[i] == null) {
                    FundraisingPlan p = new FundraisingPlan();
                    p.setFundraising(fundraising);
                    p.setMonthSelected(monthSelected);
                    p.setMonthFunding(i+1);
                    monthPlan[i] = p;
                }
            }
        } catch (Exception e) {
            Logger.getLogger(FundraisingController.class.getName()).log(Level.SEVERE, "Error reading " + year, e);
View Full Code Here

TOP

Related Classes of org.spw.model.FundraisingPlan

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.