01: /*
02: * Copyright 2007 The Kuali Foundation.
03: *
04: * Licensed under the Educational Community License, Version 1.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.opensource.org/licenses/ecl1.php
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package org.kuali.module.vendor.fixtures;
17:
18: import java.util.ArrayList;
19: import java.util.List;
20:
21: import org.kuali.core.util.KualiDecimal;
22: import org.kuali.core.util.ObjectUtils;
23: import org.kuali.module.vendor.bo.VendorContract;
24: import org.kuali.module.vendor.bo.VendorContractOrganization;
25: import org.kuali.module.vendor.fixtures.VendorTestConstants.ContractPOLimitAmts;
26:
27: public enum VendorContractPurchaseOrderLimitAmountPresenceFixture {
28:
29: NO_EXCLUDES(ContractPOLimitAmts.highLimit,
30: ContractPOLimitAmts.lowLimit, null, null, null, null), TWO_N_EXCLUDES_ON_FIRST_TWO_LIMITS(
31: ContractPOLimitAmts.highLimit,
32: ContractPOLimitAmts.lowLimit, false, false, false, false), TWO_N_EXCLUDES_ON_FIRST_LIMIT_ON_FIRST(
33: ContractPOLimitAmts.highLimit, null, false, false, null,
34: null), ONE_Y_EXCLUDE_ON_FIRST_NO_LIMIT_ON_FIRST(null, null,
35: true, false, null, null), ;
36:
37: private KualiDecimal limit1;
38: private KualiDecimal limit2;
39: private Boolean exclude11;
40: private Boolean exclude12;
41: private Boolean exclude21;
42: private Boolean exclude22;
43:
44: private VendorContractPurchaseOrderLimitAmountPresenceFixture(
45: KualiDecimal limit1, KualiDecimal limit2,
46: Boolean exclude11, Boolean exclude12, Boolean exclude21,
47: Boolean exclude22) {
48: this .limit1 = limit1;
49: this .limit2 = limit2;
50: this .exclude11 = exclude11;
51: this .exclude12 = exclude12;
52: this .exclude21 = exclude21;
53: this .exclude22 = exclude22;
54: }
55:
56: public List populateContracts() {
57: VendorContract contract1 = new VendorContract();
58: VendorContract contract2 = new VendorContract();
59: VendorContractOrganization org11 = new VendorContractOrganization();
60: VendorContractOrganization org12 = new VendorContractOrganization();
61: VendorContractOrganization org21 = new VendorContractOrganization();
62: VendorContractOrganization org22 = new VendorContractOrganization();
63: org11.setVendorContractPurchaseOrderLimitAmount(limit1);
64: org12.setVendorContractPurchaseOrderLimitAmount(limit1);
65: org21.setVendorContractPurchaseOrderLimitAmount(limit2);
66: org22.setVendorContractPurchaseOrderLimitAmount(limit2);
67: if (ObjectUtils.isNotNull(exclude11)) {
68: org11.setVendorContractExcludeIndicator(exclude11);
69: }
70: if (ObjectUtils.isNotNull(exclude12)) {
71: org12.setVendorContractExcludeIndicator(exclude12);
72: }
73: if (ObjectUtils.isNotNull(exclude21)) {
74: org21.setVendorContractExcludeIndicator(exclude21);
75: }
76: if (ObjectUtils.isNotNull(exclude22)) {
77: org22.setVendorContractExcludeIndicator(exclude22);
78: }
79: List<VendorContractOrganization> orgList1 = new ArrayList();
80: orgList1.add(org11);
81: orgList1.add(org12);
82: List<VendorContractOrganization> orgList2 = new ArrayList();
83: orgList2.add(org21);
84: orgList2.add(org22);
85: contract1.setVendorContractOrganizations(orgList1);
86: contract2.setVendorContractOrganizations(orgList2);
87: List<VendorContract> contracts = new ArrayList();
88: contracts.add(contract1);
89: contracts.add(contract2);
90: return contracts;
91: }
92: }
|