1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.kuali.kfs.module.ar.fixture;
20
21 import java.sql.Date;
22 import java.util.ArrayList;
23 import java.util.List;
24
25 import org.kuali.kfs.integration.cg.ContractsAndGrantsBillingAgency;
26 import org.kuali.kfs.integration.cg.ContractsAndGrantsBillingAward;
27 import org.kuali.kfs.module.ar.ArConstants;
28 import org.kuali.kfs.module.ar.businessobject.DunningCampaign;
29 import org.kuali.kfs.module.cg.businessobject.Agency;
30 import org.kuali.kfs.module.cg.businessobject.Award;
31 import org.kuali.kfs.module.cg.businessobject.AwardAccount;
32 import org.kuali.kfs.module.cg.businessobject.AwardOrganization;
33 import org.kuali.kfs.module.cg.businessobject.BillingFrequency;
34 import org.kuali.rice.core.api.util.type.KualiDecimal;
35 import org.kuali.rice.krad.util.ObjectUtils;
36
37
38
39
40 public enum ARAwardFixture {
41
42 CG_AWARD1(new Long(11), "2011-10-01", "2011-09-22", null, new KualiDecimal(0), new KualiDecimal(0), new KualiDecimal(0), false, null, true, null),
43 CG_AWARD2(new Long(11), "2011-07-01", "1969-06-30", Date.valueOf("1969-01-01"), new KualiDecimal(7708.00), new KualiDecimal(2016.00), KualiDecimal.ZERO, false, null, true, null),
44 CG_AWARD3(new Long(1234), "2011-01-01", "2011-09-22", Date.valueOf("2011-10-01"), new KualiDecimal(0), new KualiDecimal(0), new KualiDecimal(0), false, null, true, null),
45 CG_AWARD4(new Long(11), "2011-07-01", new Date(System.currentTimeMillis() + 604800000).toString(), Date.valueOf("1969-01-01"), new KualiDecimal(7708.00), new KualiDecimal(2016.00), KualiDecimal.ZERO, false, ArConstants.INV_AWARD, true, BillingFrequencyFixture.BILL_FREQ_MON.createBillingFrequency()),
46 CG_AWARD5(new Long(11), "2011-07-01", "1969-06-30", Date.valueOf("1969-01-01"), new KualiDecimal(7708.00), new KualiDecimal(2016.00), KualiDecimal.ZERO, false, ArConstants.INV_AWARD, true, BillingFrequencyFixture.BILL_FREQ_MON.createBillingFrequency()),
47 CG_AWARD6(new Long(11), "2011-07-01", new Date(System.currentTimeMillis() + 604800000).toString(), Date.valueOf("1969-01-01"), new KualiDecimal(7708.00), new KualiDecimal(2016.00), new KualiDecimal(1000000.00), false, ArConstants.INV_AWARD, true, BillingFrequencyFixture.BILL_FREQ_MON.createBillingFrequency()),
48 CG_AWARD7(new Long(11), "2011-07-01", new Date(System.currentTimeMillis() + 604800000).toString(), Date.valueOf("1969-01-01"), new KualiDecimal(7708.00), new KualiDecimal(2016.00), null, false, null, true, BillingFrequencyFixture.BILL_FREQ_MON.createBillingFrequency()),
49 CG_AWARD8(new Long(11), "2011-07-01", "1969-06-30", Date.valueOf("1969-01-01"), new KualiDecimal(7708.00), new KualiDecimal(2016.00), KualiDecimal.ZERO, false, ArConstants.INV_AWARD, true, null),
50 CG_AWARD9(new Long(11), "2011-07-01", new Date(System.currentTimeMillis() + 604800000).toString(), Date.valueOf("1969-01-01"), new KualiDecimal(7708.00), new KualiDecimal(2016.00), KualiDecimal.ZERO, false, ArConstants.INV_AWARD, true, BillingFrequencyFixture.BILL_FREQ_LOCB.createBillingFrequency()),
51 CG_AWARD10(new Long(11), "2011-07-01", new Date(System.currentTimeMillis() + 604800000).toString(), Date.valueOf("1969-01-01"), new KualiDecimal(100000.00), KualiDecimal.ZERO, KualiDecimal.ZERO, false, ArConstants.INV_AWARD, true, BillingFrequencyFixture.BILL_FREQ_LOCB.createBillingFrequency()),
52 CG_AWARD_INV_AWARD(new Long(11), "2011-10-01", "2011-09-22", Date.valueOf("2011-10-01"), new KualiDecimal(0), new KualiDecimal(0), new KualiDecimal(0), false, ArConstants.INV_AWARD, true, null),
53 CG_AWARD_INV_ACCOUNT(new Long(11), "2011-10-01", "2011-09-22", Date.valueOf("2011-10-01"), new KualiDecimal(0), new KualiDecimal(0), new KualiDecimal(0), false, ArConstants.INCOME_ACCOUNT, true, BillingFrequencyFixture.BILL_FREQ_MON.createBillingFrequency()),
54 CG_AWARD_INV_CCA(new Long(11), "2011-10-01", "2011-09-22", Date.valueOf("2011-10-01"), null, null, null, false, ArConstants.INV_CONTRACT_CONTROL_ACCOUNT, true, null),
55 CG_AWARD_MONTHLY_BILLED_DATE_NULL(new Long(11), "2011-01-01", "2011-09-22", null, new KualiDecimal(0), new KualiDecimal(0), new KualiDecimal(0), false, ArConstants.INV_AWARD, true, BillingFrequencyFixture.BILL_FREQ_MON.createBillingFrequency()),
56 CG_AWARD_MILESTONE_BILLED_DATE_NULL(new Long(111), "2011-01-01", "2011-09-22", null, new KualiDecimal(0), new KualiDecimal(0), new KualiDecimal(0), false, ArConstants.INV_AWARD, true, BillingFrequencyFixture.BILL_FREQ_MS.createBillingFrequency()),
57 CG_AWARD_PREDETERMINED_BILLED_DATE_NULL(new Long(111), "2011-01-01", "2011-09-22", null, new KualiDecimal(0), new KualiDecimal(0), new KualiDecimal(0), false, ArConstants.INV_AWARD, true, BillingFrequencyFixture.BILL_FREQ_PDBS.createBillingFrequency()),
58 CG_AWARD_QUAR_BILLED_DATE_NULL(new Long(111), "2011-01-01", "2011-09-22", null, new KualiDecimal(0), new KualiDecimal(0), new KualiDecimal(0), false, ArConstants.INV_AWARD, true, BillingFrequencyFixture.BILL_FREQ_QUAR.createBillingFrequency()),
59 CG_AWARD_SEMI_ANN_BILLED_DATE_NULL(new Long(111), "2011-01-01", "2011-09-22", null, new KualiDecimal(0), new KualiDecimal(0), new KualiDecimal(0), false, ArConstants.INV_AWARD, true, BillingFrequencyFixture.BILL_FREQ_SEMI_ANN.createBillingFrequency()),
60 CG_AWARD_ANNUAL_BILLED_DATE_NULL(new Long(111), "2011-01-01", "2011-09-22", null, new KualiDecimal(0), new KualiDecimal(0), new KualiDecimal(0), false, ArConstants.INV_AWARD, true, BillingFrequencyFixture.BILL_FREQ_ANNUALLY.createBillingFrequency()),
61 CG_AWARD_LOCB_BILLED_DATE_NULL(new Long(111), "2011-01-01", "2011-09-22", null, new KualiDecimal(0), new KualiDecimal(0), new KualiDecimal(0), false, ArConstants.INV_AWARD, true, BillingFrequencyFixture.BILL_FREQ_LOCB.createBillingFrequency()),
62 CG_AWARD_MONTHLY_BILLED_DATE_VALID(new Long(111), "2011-01-01", "2011-09-22", Date.valueOf("2011-09-30"), new KualiDecimal(1000), new KualiDecimal(1000), new KualiDecimal(0), false, ArConstants.INV_AWARD, true, BillingFrequencyFixture.BILL_FREQ_MON.createBillingFrequency()),
63 CG_AWARD_MILESTONE_BILLED_DATE_VALID(new Long(111), "2011-01-01", "2011-09-22", Date.valueOf("2011-09-30"), new KualiDecimal(0), new KualiDecimal(0), new KualiDecimal(0), false, ArConstants.INV_AWARD, true, BillingFrequencyFixture.BILL_FREQ_MS.createBillingFrequency()),
64 CG_AWARD_PREDETERMINED_BILLED_DATE_VALID(new Long(111), "2011-01-01", "2011-09-22", Date.valueOf("2011-09-30"), new KualiDecimal(0), new KualiDecimal(0), new KualiDecimal(0), false, ArConstants.INV_AWARD, true, BillingFrequencyFixture.BILL_FREQ_PDBS.createBillingFrequency()),
65 CG_AWARD_QUAR_BILLED_DATE_VALID(new Long(111), "2011-01-01", "2011-09-22", Date.valueOf("2011-06-30"), new KualiDecimal(0), new KualiDecimal(0), new KualiDecimal(0), false, ArConstants.INV_AWARD, true, BillingFrequencyFixture.BILL_FREQ_QUAR.createBillingFrequency()),
66 CG_AWARD_SEMI_ANN_BILLED_DATE_VALID(new Long(111), "2011-01-01", "2011-09-22", Date.valueOf("2011-06-30"), new KualiDecimal(0), new KualiDecimal(0), new KualiDecimal(0), false, ArConstants.INV_AWARD, true, BillingFrequencyFixture.BILL_FREQ_SEMI_ANN.createBillingFrequency()),
67 CG_AWARD_ANNUAL_BILLED_DATE_VALID(new Long(111), "2011-01-01", "2011-09-22", Date.valueOf("2010-06-30"), new KualiDecimal(0), new KualiDecimal(0), new KualiDecimal(0), false, ArConstants.INV_AWARD, true, BillingFrequencyFixture.BILL_FREQ_ANNUALLY.createBillingFrequency()),
68 CG_AWARD_LOCB_BILLED_DATE_VALID(new Long(111), "2011-01-01", "2011-09-22", Date.valueOf("2010-12-13"), new KualiDecimal(0), new KualiDecimal(0), new KualiDecimal(0), false, ArConstants.INV_AWARD, true, BillingFrequencyFixture.BILL_FREQ_LOCB.createBillingFrequency()),
69 CG_AWARD_MONTHLY_INVALID_DATES(new Long(11), "2012-01-01", "2011-09-22", new Date(System.currentTimeMillis() + 604800000), new KualiDecimal(0), new KualiDecimal(0), new KualiDecimal(0), false, ArConstants.INV_AWARD, true, BillingFrequencyFixture.BILL_FREQ_MON.createBillingFrequency());
70
71 private Long proposalNumber;
72 private String awardBeginningDate;
73 private String awardEndingDate;
74 private Date lastBilledDate;
75
76 private KualiDecimal awardDirectCostAmount;
77 private KualiDecimal awardIndirectCostAmount;
78 private KualiDecimal minInvoiceAmount;
79 private KualiDecimal awardTotalAmount;
80 private boolean excludedFromInvoicing;
81 private String invoicingOptionCode;
82 private boolean active;
83 private BillingFrequency billingFrequency;
84
85 private ARAwardFixture(Long proposalNumber, String awardBeginningDate, String awardEndingDate, Date lastBilledDate, KualiDecimal awardDirectCostAmount, KualiDecimal awardIndirectCostAmount, KualiDecimal minInvoiceAmount, boolean excludedFromInvoicing, String invoicingOptionCode, boolean active, BillingFrequency billingFrequency) {
86
87 this.proposalNumber = proposalNumber;
88 this.awardBeginningDate = awardBeginningDate;
89 this.awardEndingDate = awardEndingDate;
90 this.lastBilledDate = lastBilledDate;
91 this.awardDirectCostAmount = awardDirectCostAmount;
92 this.awardIndirectCostAmount = awardIndirectCostAmount;
93 this.minInvoiceAmount = minInvoiceAmount;
94 this.excludedFromInvoicing = excludedFromInvoicing;
95 this.invoicingOptionCode = invoicingOptionCode;
96 this.active = active;
97 this.billingFrequency = billingFrequency;
98
99 }
100
101 public ContractsAndGrantsBillingAward createAward() {
102 Award award = new Award();
103 award.setProposalNumber(this.proposalNumber);
104 award.setAwardBeginningDate(Date.valueOf(this.awardBeginningDate));
105 award.setAwardEndingDate(Date.valueOf(this.awardEndingDate));
106 award.setAwardDirectCostAmount(this.awardDirectCostAmount);
107 award.setAwardIndirectCostAmount(this.awardIndirectCostAmount);
108 award.setMinInvoiceAmount(this.minInvoiceAmount);
109 award.setExcludedFromInvoicing(this.excludedFromInvoicing);
110 award.setInvoicingOptionCode(this.invoicingOptionCode);
111 award.setActive(this.active);
112 award.setBillingFrequency(billingFrequency);
113 if (ObjectUtils.isNotNull(billingFrequency)) {
114 award.setBillingFrequencyCode(billingFrequency.getFrequency());
115 }
116
117 award.getActiveAwardAccounts().clear();
118 AwardAccount awardAccount_1 = ARAwardAccountFixture.AWD_ACCT_1.createAwardAccount();
119 AwardAccount awardAccount_2 = ARAwardAccountFixture.AWD_ACCT_2.createAwardAccount();
120
121 if (ObjectUtils.isNotNull(this.lastBilledDate)) {
122 awardAccount_1.setCurrentLastBilledDate(this.lastBilledDate);
123 awardAccount_2.setCurrentLastBilledDate(this.lastBilledDate);
124 }
125
126 List<AwardAccount> awardAccounts = new ArrayList<AwardAccount>();
127 awardAccounts.add(awardAccount_1);
128 awardAccounts.add(awardAccount_2);
129 award.setAwardAccounts(awardAccounts);
130
131 BillingFrequencyFixture.BILL_FREQ_LOCB.createBillingFrequency();
132
133
134 award.setAutoApproveIndicator(true);
135
136 return award;
137 }
138
139 public Award setAgencyFromFixture(Award award) {
140 ContractsAndGrantsBillingAgency agency = ARAgencyFixture.CG_AGENCY1.createAgency();
141 award.setAgency((Agency)agency);
142 award.setAgencyNumber(agency.getAgencyNumber());
143 return award;
144 }
145
146 public Award setDunningCampaignFromFixture(Award award) {
147 DunningCampaign dunningCampaign = DunningCampaignFixture.AR_DUNC1.createDunningCampaign();
148 award.setDunningCampaign(dunningCampaign.getCampaignID());
149 return award;
150 }
151
152 public Award setAwardOrganizationFromFixture(Award award) {
153 AwardOrganization awardOrganization = ARAwardOrganizationFixture.AWD_ORG1.createAwardOrganization();
154 award.getAwardOrganizations().add(awardOrganization);
155 return award;
156 }
157
158 }