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.purap.fixtures;
017:
018: import org.kuali.core.service.DocumentService;
019: import org.kuali.kfs.context.SpringContext;
020: import org.kuali.module.purap.PurapConstants.CreditMemoStatuses;
021: import org.kuali.module.purap.PurapConstants.PaymentRequestStatuses;
022: import org.kuali.module.purap.PurapConstants.PurchaseOrderStatuses;
023: import org.kuali.module.purap.PurapConstants.RequisitionStatuses;
024: import org.kuali.module.purap.document.PurchasingAccountsPayableDocument;
025: import org.kuali.test.DocumentTestUtils;
026:
027: import edu.iu.uis.eden.exception.WorkflowException;
028:
029: public enum PurchasingAccountsPayableDocumentFixture {
030:
031: // REQUISITION FIXTURES
032: REQ_ONLY_REQUIRED_FIELDS(null, // purapDocumentIdentifier
033: RequisitionStatuses.IN_PROCESS, // statusCode
034: null, // vendorHeaderGeneratedIdentifier
035: null, // vendorDetailAssignedIdentifier
036: null, // vendorName
037: null, // vendorLine1Address
038: null, // vendorLine2Address
039: null, // vendorCityName
040: null, // vendorStateCode
041: null, // vendorPostalCode
042: null, // vendorCountryCode
043: null, // vendorCustomerNumber
044: null), // accountsPayablePurchasingDocumentLinkIdentifier
045: REQ_WITH_MANUALLY_ENTERED_VENDOR(null,
046: RequisitionStatuses.IN_PROCESS, null, null,
047: "Colts Gear Shop", "111 Champs St", null, "Indy Rocks",
048: "IN", "11111", "US", null, null),
049: // APO FIXTURES
050: REQ_VALID_APO(null, // purapDocumentIdentifier
051: RequisitionStatuses.IN_PROCESS, // statusCode
052: 1002, // vendorHeaderGeneratedIdentifier
053: 0, // vendorDetailAssignedIdentifier
054: "ABC Cleaning Services", // vendorName
055: "123456 BROAD ST", // vendorLine1Address
056: null, // vendorLine2Address
057: "TRUMANSBURG", // vendorCityName
058: "NY", // vendorStateCode
059: "14886", // vendorPostalCode
060: "US", // vendorCountryCode
061: null, // vendorCustomerNumber
062: null), // accountsPayablePurchasingDocumentLinkIdentifier
063: REQ_ALTERNATE_APO(null, // purapDocumentIdentifier
064: RequisitionStatuses.IN_PROCESS, // statusCode
065: 1016, // vendorHeaderGeneratedIdentifier
066: 0, // vendorDetailAssignedIdentifier
067: "Physik Instrument L. P.", // vendorName
068: "16 AUBURN ST", // vendorLine1Address
069: null, // vendorLine2Address
070: "AUBURN", // vendorCityName
071: "MA", // vendorStateCode
072: "01501", // vendorPostalCode
073: "US", // vendorCountryCode
074: null, // vendorCustomerNumber
075: null), // accountsPayablePurchasingDocumentLinkIdentifier
076:
077: // PURCHASE ORDER FIXTURES
078: // TODO f2f: fix the PO one because actually, the vendor must be selected from the database
079: PO_ONLY_REQUIRED_FIELDS(null, // purapDocumentIdentifier
080: PurchaseOrderStatuses.IN_PROCESS, // statusCode
081: 1000, // vendorHeaderGeneratedIdentifier
082: 0, // vendorDetailAssignedIdentifier
083: "ABC Cleaning Services", // vendorName
084: "123456 BROAD ST", // vendorLine1Address
085: null, // vendorLine2Address
086: "TRUMANSBURG", // vendorCityName
087: "NY", // vendorStateCode
088: "14886", // vendorPostalCode
089: "US", // vendorCountryCode
090: null, // vendorCustomerNumber
091: null), // accountsPayablePurchasingDocumentLinkIdentifier
092: PO_WITH_MANUALLY_ENTERED_VENDOR(null,
093: PurchaseOrderStatuses.IN_PROCESS, 1000, 0,
094: "ABC Cleaning Services", "123456 BROAD ST", null,
095: "TRUMANSBURG", "NY", "14886", "US", null, null),
096:
097: // PAYMENT REQUEST FIXTURES
098: PREQ_ONLY_REQUIRED_FIELDS(null, // purapDocumentIdentifier
099: PaymentRequestStatuses.IN_PROCESS, // statusCode
100: 1010, // vendorHeaderGeneratedIdentifier
101: 2, // vendorDetailAssignedIdentifier
102: "DIVISION 2 OF PO BASIC", // vendorName
103: "9988 8TH STREET", // vendorLine1Address
104: null, // vendorLine2Address
105: "A PLACE IN THE SUN", // vendorCityName
106: "CA", // vendorStateCode
107: "99888", // vendorPostalCode
108: "US", // vendorCountryCode
109: null, // vendorCustomerNumber
110: null // accountsPayablePurchasingDocumentLinkIdentifier
111: ),
112:
113: // CREDIT MEMO FIXTURES
114: CM_ONLY_REQUIRED_FIELDS(null, // purapDocumentIdentifier
115: CreditMemoStatuses.IN_PROCESS, // statusCode
116: 1000, // vendorHeaderGeneratedIdentifier
117: 0, // vendorDetailAssignedIdentifier
118: "ABC Cleaning Services", // vendorName
119: "123456 BROAD ST", // vendorLine1Address
120: null, // vendorLine2Address
121: "TRUMANSBURG", // vendorCityName
122: "NY", // vendorStateCode
123: "14886", // vendorPostalCode
124: "US", // vendorCountryCode
125: null, // vendorCustomerNumber
126: null), // accountsPayablePurchasingDocumentLinkIdentifier
127: REQ_MULTI_QUANTITY(null, // purapDocumentIdentifier
128: RequisitionStatuses.IN_PROCESS, // statusCode
129: 1002, // vendorHeaderGeneratedIdentifier
130: 0, // vendorDetailAssignedIdentifier
131: "MK CORPORATION ACTIVE", // vendorName
132: "3894 SOUTH ST", // vendorLine1Address
133: "P.O. BOX 3455", // vendorLine2Address
134: "SPRINGFIELD", // vendorCityName
135: "IL", // vendorStateCode
136: "33555", // vendorPostalCode
137: "US", // vendorCountryCode
138: null, // vendorCustomerNumber
139: null), // accountsPayablePurchasingDocumentLinkIdentifier
140: REQ_MULTI_NON_QUANTITY(null, // purapDocumentIdentifier
141: RequisitionStatuses.IN_PROCESS, // statusCode
142: 1016, // vendorHeaderGeneratedIdentifier
143: 0, // vendorDetailAssignedIdentifier
144: "PHYSIK INSTRUMENT L.P.", // vendorName
145: "16 AUBURN ST", // vendorLine1Address
146: null, // vendorLine2Address
147: "AUBURN", // vendorCityName
148: "MA", // vendorStateCode
149: "01501", // vendorPostalCode
150: "US", // vendorCountryCode
151: null, // vendorCustomerNumber
152: null), // accountsPayablePurchasingDocumentLinkIdentifier
153: ;
154:
155: public final Integer purapDocumentIdentifier;
156: public final String statusCode;
157: public final Integer vendorHeaderGeneratedIdentifier;
158: public final Integer vendorDetailAssignedIdentifier;
159: public final String vendorName;
160: public final String vendorLine1Address;
161: public final String vendorLine2Address;
162: public final String vendorCityName;
163: public final String vendorStateCode;
164: public final String vendorPostalCode;
165: public final String vendorCountryCode;
166: public final String vendorCustomerNumber;
167: public final Integer accountsPayablePurchasingDocumentLinkIdentifier;
168:
169: private PurchasingAccountsPayableDocumentFixture(
170: Integer purapDocumentIdentifier, String statusCode,
171: Integer vendorHeaderGeneratedIdentifier,
172: Integer vendorDetailAssignedIdentifier, String vendorName,
173: String vendorLine1Address, String vendorLine2Address,
174: String vendorCityName, String vendorStateCode,
175: String vendorPostalCode, String vendorCountryCode,
176: String vendorCustomerNumber,
177: Integer accountsPayablePurchasingDocumentLinkIdentifier) {
178: this .purapDocumentIdentifier = purapDocumentIdentifier;
179: this .statusCode = statusCode;
180: this .vendorHeaderGeneratedIdentifier = vendorHeaderGeneratedIdentifier;
181: this .vendorDetailAssignedIdentifier = vendorDetailAssignedIdentifier;
182: this .vendorName = vendorName;
183: this .vendorLine1Address = vendorLine1Address;
184: this .vendorLine2Address = vendorLine2Address;
185: this .vendorCityName = vendorCityName;
186: this .vendorStateCode = vendorStateCode;
187: this .vendorPostalCode = vendorPostalCode;
188: this .vendorCountryCode = vendorCountryCode;
189: this .vendorCustomerNumber = vendorCustomerNumber;
190: this .accountsPayablePurchasingDocumentLinkIdentifier = accountsPayablePurchasingDocumentLinkIdentifier;
191: }
192:
193: public PurchasingAccountsPayableDocument createPurchasingAccountsPayableDocument(
194: Class clazz) {
195: PurchasingAccountsPayableDocument doc = null;
196: try {
197: doc = (PurchasingAccountsPayableDocument) DocumentTestUtils
198: .createDocument(SpringContext
199: .getBean(DocumentService.class), clazz);
200: } catch (WorkflowException e) {
201: throw new RuntimeException("Document creation failed.");
202: }
203: doc.setPurapDocumentIdentifier(this .purapDocumentIdentifier);
204: doc.setStatusCode(this .statusCode);
205: doc
206: .setVendorHeaderGeneratedIdentifier(this .vendorHeaderGeneratedIdentifier);
207: doc
208: .setVendorDetailAssignedIdentifier(this .vendorDetailAssignedIdentifier);
209: doc.setVendorName(this .vendorName);
210: doc.setVendorLine1Address(this .vendorLine1Address);
211: doc.setVendorLine2Address(this .vendorLine2Address);
212: doc.setVendorCityName(this .vendorCityName);
213: doc.setVendorStateCode(this .vendorStateCode);
214: doc.setVendorPostalCode(this .vendorPostalCode);
215: doc.setVendorCountryCode(this .vendorCountryCode);
216: doc.setVendorCustomerNumber(this .vendorCustomerNumber);
217: doc
218: .setAccountsPayablePurchasingDocumentLinkIdentifier(this .accountsPayablePurchasingDocumentLinkIdentifier);
219:
220: // TODO f2f: (chris) add items and accounts
221:
222: return doc;
223: }
224:
225: }
|