001: /*
002: * Copyright 2007 The Kuali Foundation.
003: *
004: * Licensed under the Educational Community License, Version 1.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.opensource.org/licenses/ecl1.php
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016: package org.kuali.module.vendor.fixtures;
017:
018: import org.kuali.module.vendor.bo.VendorAddress;
019: import org.kuali.module.vendor.bo.VendorContract;
020: import org.kuali.module.vendor.bo.VendorDetail;
021: import org.kuali.module.vendor.bo.VendorHeader;
022: import org.kuali.module.vendor.bo.VendorShippingSpecialCondition;
023: import org.kuali.module.vendor.bo.VendorSupplierDiversity;
024: import org.kuali.module.vendor.fixtures.VendorTestConstants.VendorParts;
025:
026: public enum VendorRoutingChangesFixture {
027:
028: COMPLETE_NO_CHANGES(VendorParts.CODE1, VendorParts.CODE1,
029: VendorParts.CODE1, VendorParts.NAME, VendorParts.CODE1,
030: VendorParts.CODE1, VendorParts.CODE1, VendorParts.CODE1,
031: VendorParts.CODE1, VendorParts.CODE1, VendorParts.CODE1,
032: VendorParts.CODE1, VendorParts.CODE1, VendorParts.NAME,
033: VendorParts.CODE1, VendorParts.CODE1, VendorParts.CODE1,
034: VendorParts.CODE1, VendorParts.CODE1, VendorParts.CODE1), COMPLETE_VH_CHANGE(
035: VendorParts.CODE1, VendorParts.CODE1, VendorParts.CODE1,
036: VendorParts.NAME, VendorParts.CODE1, VendorParts.CODE1,
037: VendorParts.CODE1, VendorParts.CODE1, VendorParts.CODE1,
038: VendorParts.CODE1, VendorParts.CODE2, VendorParts.CODE1,
039: VendorParts.CODE1, VendorParts.NAME, VendorParts.CODE1,
040: VendorParts.CODE1, VendorParts.CODE1, VendorParts.CODE1,
041: VendorParts.CODE1, VendorParts.CODE1), COMPLETE_VSD1_CHANGE(
042: VendorParts.CODE1, VendorParts.CODE1, VendorParts.CODE1,
043: VendorParts.NAME, VendorParts.CODE1, VendorParts.CODE1,
044: VendorParts.CODE1, VendorParts.CODE1, VendorParts.CODE1,
045: VendorParts.CODE1, VendorParts.CODE1, VendorParts.CODE2,
046: VendorParts.CODE1, VendorParts.NAME, VendorParts.CODE1,
047: VendorParts.CODE1, VendorParts.CODE1, VendorParts.CODE1,
048: VendorParts.CODE1, VendorParts.CODE1), COMPLETE_VSSC1_CHANGE(
049: VendorParts.CODE1, VendorParts.CODE1, VendorParts.CODE1,
050: VendorParts.NAME, VendorParts.CODE1, VendorParts.CODE1,
051: VendorParts.CODE1, VendorParts.CODE1, VendorParts.CODE1,
052: VendorParts.CODE1, VendorParts.CODE1, VendorParts.CODE1,
053: VendorParts.CODE1, VendorParts.NAME, VendorParts.CODE1,
054: VendorParts.CODE1, VendorParts.CODE1, VendorParts.CODE1,
055: VendorParts.CODE2, VendorParts.CODE1), COMPLETE_VA2_CHANGE(
056: VendorParts.CODE1, VendorParts.CODE1, VendorParts.CODE1,
057: VendorParts.NAME, VendorParts.CODE1, VendorParts.CODE2,
058: VendorParts.CODE1, VendorParts.CODE1, VendorParts.CODE1,
059: VendorParts.CODE1, VendorParts.CODE1, VendorParts.CODE1,
060: VendorParts.CODE1, VendorParts.NAME, VendorParts.CODE1,
061: VendorParts.CODE1, VendorParts.CODE1, VendorParts.CODE1,
062: VendorParts.CODE1, VendorParts.CODE1), NULL_OLDS(null,
063: null, null, null, null, null, null, null, null, null,
064: VendorParts.CODE1, VendorParts.CODE1, VendorParts.CODE1,
065: VendorParts.NAME, VendorParts.CODE1, VendorParts.CODE1,
066: VendorParts.CODE1, VendorParts.CODE1, VendorParts.CODE1,
067: VendorParts.CODE1), NULL_NEWS(VendorParts.CODE1,
068: VendorParts.CODE1, VendorParts.CODE1, VendorParts.NAME,
069: VendorParts.CODE1, VendorParts.CODE1, VendorParts.CODE1,
070: VendorParts.CODE1, VendorParts.CODE1, VendorParts.CODE1,
071: null, null, null, null, null, null, null, null, null, null), NULL_ALL(
072: null, null, null, null, null, null, null, null, null, null,
073: null, null, null, null, null, null, null, null, null, null), ;
074:
075: private String oldVHdr_vtCd;
076: private String oldSupDiv1_vsdCd;
077: private String oldSupDiv2_vsdCd;
078: private String oldVDtl_remitName;
079: private String oldVAddr1_vatCd;
080: private String oldVAddr2_vatCd;
081: private String oldVCtr1_pocsCd;
082: private String oldVCtr2_pocsCd;
083: private String oldVSSCond1_vsscCd;
084: private String oldVSSCond2_vsscCd;
085:
086: private String newVHdr_vtCd;
087: private String newSupDiv1_vsdCd;
088: private String newSupDiv2_vsdCd;
089: private String newVDtl_remitName;
090: private String newVAddr1_vatCd;
091: private String newVAddr2_vatCd;
092: private String newVCtr1_pocsCd;
093: private String newVCtr2_pocsCd;
094: private String newVSSCond1_vsscCd;
095: private String newVSSCond2_vsscCd;
096:
097: /**
098: * This constructor can be used by broad tests of the change detection logic.
099: */
100: private VendorRoutingChangesFixture(String oldVHdr_vtCd,
101: String oldSupDiv1_vsdCd, String oldSupDiv2_vsdCd,
102: String oldVDtl_remitName, String oldVAddr1_vatCd,
103: String oldVAddr2_vatCd, String oldVCtr1_pocsCd,
104: String oldVCtr2_pocsCd, String oldVSSCond1_vsscCd,
105: String oldVSSCond2_vsscCd, String newVHdr_vtCd,
106: String newSupDiv1_vsdCd, String newSupDiv2_vsdCd,
107: String newVDtl_remitName, String newVAddr1_vatCd,
108: String newVAddr2_vatCd, String newVCtr1_pocsCd,
109: String newVCtr2_pocsCd, String newVSSCond1_vsscCd,
110: String newVSSCond2_vsscCd) {
111: this .oldVHdr_vtCd = oldVHdr_vtCd;
112: this .oldSupDiv1_vsdCd = oldSupDiv1_vsdCd;
113: this .oldSupDiv2_vsdCd = oldSupDiv2_vsdCd;
114: this .oldVDtl_remitName = oldVDtl_remitName;
115: this .oldVAddr1_vatCd = oldVAddr1_vatCd;
116: this .oldVAddr2_vatCd = oldVAddr2_vatCd;
117: this .oldVCtr1_pocsCd = oldVCtr1_pocsCd;
118: this .oldVCtr2_pocsCd = oldVCtr2_pocsCd;
119: this .oldVSSCond1_vsscCd = oldVSSCond1_vsscCd;
120: this .oldVSSCond2_vsscCd = oldVSSCond2_vsscCd;
121: this .newVHdr_vtCd = newVHdr_vtCd;
122: this .newSupDiv1_vsdCd = newSupDiv1_vsdCd;
123: this .newSupDiv2_vsdCd = newSupDiv2_vsdCd;
124: this .newVDtl_remitName = newVDtl_remitName;
125: this .newVAddr1_vatCd = newVAddr1_vatCd;
126: this .newVAddr2_vatCd = newVAddr2_vatCd;
127: this .newVCtr1_pocsCd = newVCtr1_pocsCd;
128: this .newVCtr2_pocsCd = newVCtr2_pocsCd;
129: this .newVSSCond1_vsscCd = newVSSCond1_vsscCd;
130: this .newVSSCond2_vsscCd = newVSSCond2_vsscCd;
131: }
132:
133: public void populate(VendorDetail oldVDtl, VendorHeader oldVHdr,
134: VendorDetail newVDtl, VendorHeader newVHdr) {
135:
136: // Old Vendor Header
137: oldVHdr.setVendorTypeCode(this .oldVHdr_vtCd);
138:
139: VendorSupplierDiversity oldVsd1 = new VendorSupplierDiversity();
140: oldVsd1.setVendorSupplierDiversityCode(this .oldSupDiv1_vsdCd);
141: VendorSupplierDiversity oldVsd2 = new VendorSupplierDiversity();
142: oldVsd2.setVendorSupplierDiversityCode(this .oldSupDiv2_vsdCd);
143: oldVHdr.getVendorSupplierDiversities().add(0, oldVsd1);
144: oldVHdr.getVendorSupplierDiversities().add(1, oldVsd2);
145:
146: // Old Vendor Detail
147: oldVDtl.setVendorRemitName(this .oldVDtl_remitName);
148:
149: VendorAddress oldVa1 = new VendorAddress();
150: oldVa1.setVendorAddressTypeCode(this .oldVAddr1_vatCd);
151: VendorAddress oldVa2 = new VendorAddress();
152: oldVa2.setVendorAddressTypeCode(this .oldVAddr2_vatCd);
153: oldVDtl.getVendorAddresses().add(0, oldVa1);
154: oldVDtl.getVendorAddresses().add(0, oldVa2);
155:
156: VendorContract oldVc1 = new VendorContract();
157: oldVc1.setPurchaseOrderCostSourceCode(this .oldVCtr1_pocsCd);
158: VendorContract oldVc2 = new VendorContract();
159: oldVc2.setPurchaseOrderCostSourceCode(this .oldVCtr2_pocsCd);
160: oldVDtl.getVendorContracts().add(0, oldVc1);
161: oldVDtl.getVendorContracts().add(1, oldVc2);
162:
163: VendorShippingSpecialCondition oldVssc1 = new VendorShippingSpecialCondition();
164: oldVssc1
165: .setVendorShippingSpecialConditionCode(this .oldVSSCond1_vsscCd);
166: VendorShippingSpecialCondition oldVssc2 = new VendorShippingSpecialCondition();
167: oldVssc2
168: .setVendorShippingSpecialConditionCode(this .oldVSSCond2_vsscCd);
169: oldVDtl.getVendorShippingSpecialConditions().add(0, oldVssc1);
170: oldVDtl.getVendorShippingSpecialConditions().add(1, oldVssc2);
171:
172: // New Vendor Header
173: newVHdr.setVendorTypeCode(this .newVHdr_vtCd);
174:
175: VendorSupplierDiversity newVsd1 = new VendorSupplierDiversity();
176: newVsd1.setVendorSupplierDiversityCode(this .newSupDiv1_vsdCd);
177: VendorSupplierDiversity newVsd2 = new VendorSupplierDiversity();
178: newVsd2.setVendorSupplierDiversityCode(this .newSupDiv2_vsdCd);
179: newVHdr.getVendorSupplierDiversities().add(0, newVsd1);
180: newVHdr.getVendorSupplierDiversities().add(1, newVsd2);
181:
182: // New Vendor Detail
183: newVDtl.setVendorRemitName(this .newVDtl_remitName);
184:
185: VendorAddress newVa1 = new VendorAddress();
186: newVa1.setVendorAddressTypeCode(this .newVAddr1_vatCd);
187: VendorAddress newVa2 = new VendorAddress();
188: newVa2.setVendorAddressTypeCode(this .newVAddr2_vatCd);
189: newVDtl.getVendorAddresses().add(0, newVa1);
190: newVDtl.getVendorAddresses().add(0, newVa2);
191:
192: VendorContract newVc1 = new VendorContract();
193: newVc1.setPurchaseOrderCostSourceCode(this .newVCtr1_pocsCd);
194: VendorContract newVc2 = new VendorContract();
195: newVc2.setPurchaseOrderCostSourceCode(this .newVCtr2_pocsCd);
196: newVDtl.getVendorContracts().add(0, newVc1);
197: newVDtl.getVendorContracts().add(1, newVc2);
198:
199: VendorShippingSpecialCondition newVssc1 = new VendorShippingSpecialCondition();
200: newVssc1
201: .setVendorShippingSpecialConditionCode(this .newVSSCond1_vsscCd);
202: VendorShippingSpecialCondition newVssc2 = new VendorShippingSpecialCondition();
203: newVssc2
204: .setVendorShippingSpecialConditionCode(this .newVSSCond2_vsscCd);
205: newVDtl.getVendorShippingSpecialConditions().add(0, newVssc1);
206: newVDtl.getVendorShippingSpecialConditions().add(1, newVssc2);
207: }
208:
209: }
|