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 java.sql.Date;
019:
020: import org.kuali.core.util.KualiDecimal;
021: import org.kuali.module.purap.document.PurchaseOrderDocument;
022: import org.kuali.module.purap.fixtures.PurapTestConstants.PO;
023:
024: /**
025: * Fixture class for Purchase Order Document.
026: */
027: public enum PurchaseOrderDocumentFixture {
028:
029: // TODO f2f: fix the REQ id
030: PO_ONLY_REQUIRED_FIELDS(
031: PO.CREATE_DATE, // purchaseOrderCreateDate
032: PO.REQ_ID, // requisitionIdentifier
033: "LPRC", // purchaseOrderVendorChoiceCode
034: null, // recurringPaymentFrequencyCode
035: null, // recurringPaymentAmount
036: null, // recurringPaymentDate
037: null, // initialPaymentAmount
038: null, // initialPaymentDate
039: null, // finalPaymentAmount
040: null, // finalPaymentDate
041: null, // purchaseOrderInitialOpenDate
042: null, // purchaseOrderLastTransmitDate
043: null, // purchaseOrderQuoteDueDate
044: null, // purchaseOrderQuoteTypeCode
045: null, // purchaseOrderQuoteVendorNoteText
046: false, // purchaseOrderConfirmedIndicator
047: null, // purchaseOrderCommodityDescription
048: null, // purchaseOrderPreviousIdentifier
049: null, // alternateVendorHeaderGeneratedIdentifier
050: null, // alternateVendorDetailAssignedIdentifier
051: null, // newQuoteVendorHeaderGeneratedIdentifier
052: null, // newQuoteVendorDetailAssignedIdentifier
053: null, // alternateVendorName
054: true, // purchaseOrderCurrentIndicator
055: false, // pendingActionIndicator
056: null, // purchaseOrderFirstTransmissionDate
057: PurchasingAccountsPayableDocumentFixture.PO_ONLY_REQUIRED_FIELDS, // purapDocumentFixture
058: PurchasingDocumentFixture.PO_ONLY_REQUIRED_FIELDS, // purchasingDocumentFixture
059: new PurchaseOrderItemFixture[] { PurchaseOrderItemFixture.PO_QTY_UNRESTRICTED_ITEM_1 } // purchaseOrderItemMultiFixtures
060: );
061:
062: public final Date purchaseOrderCreateDate;
063: public final Integer requisitionIdentifier;
064: public final String purchaseOrderVendorChoiceCode;
065: public final String recurringPaymentFrequencyCode;
066: public final KualiDecimal recurringPaymentAmount;
067: public final Date recurringPaymentDate;
068: public final KualiDecimal initialPaymentAmount;
069: public final Date initialPaymentDate;
070: public final KualiDecimal finalPaymentAmount;
071: public final Date finalPaymentDate;
072: public final Date purchaseOrderInitialOpenDate;
073: public final Date purchaseOrderLastTransmitDate;
074: public final Date purchaseOrderQuoteDueDate;
075: public final String purchaseOrderQuoteTypeCode;
076: public final String purchaseOrderQuoteVendorNoteText;
077: public final boolean purchaseOrderConfirmedIndicator;
078: public final String purchaseOrderCommodityDescription;
079: public final Integer purchaseOrderPreviousIdentifier;
080: public final Integer alternateVendorHeaderGeneratedIdentifier;
081: public final Integer alternateVendorDetailAssignedIdentifier;
082: public final Integer newQuoteVendorHeaderGeneratedIdentifier;
083: public final Integer newQuoteVendorDetailAssignedIdentifier;
084: public final String alternateVendorName;
085: public final boolean purchaseOrderCurrentIndicator;
086: public final boolean pendingActionIndicator;
087: public final Date purchaseOrderFirstTransmissionDate;
088: private PurchasingAccountsPayableDocumentFixture purapDocumentFixture;
089: private PurchasingDocumentFixture purchasingDocumentFixture;
090: private PurchaseOrderItemFixture[] purchaseOrderItemFixtures;
091:
092: /**
093: * Private Constructor.
094: */
095: private PurchaseOrderDocumentFixture(
096: Date purchaseOrderCreateDate,
097: Integer requisitionIdentifier,
098: String purchaseOrderVendorChoiceCode,
099: String recurringPaymentFrequencyCode,
100: KualiDecimal recurringPaymentAmount,
101: Date recurringPaymentDate,
102: KualiDecimal initialPaymentAmount,
103: Date initialPaymentDate,
104: KualiDecimal finalPaymentAmount,
105: Date finalPaymentDate,
106: Date purchaseOrderInitialOpenDate,
107: Date purchaseOrderLastTransmitDate,
108: Date purchaseOrderQuoteDueDate,
109: String purchaseOrderQuoteTypeCode,
110: String purchaseOrderQuoteVendorNoteText,
111: boolean purchaseOrderConfirmedIndicator,
112: String purchaseOrderCommodityDescription,
113: Integer purchaseOrderPreviousIdentifier,
114: Integer alternateVendorHeaderGeneratedIdentifier,
115: Integer alternateVendorDetailAssignedIdentifier,
116: Integer newQuoteVendorHeaderGeneratedIdentifier,
117: Integer newQuoteVendorDetailAssignedIdentifier,
118: String alternateVendorName,
119: boolean purchaseOrderCurrentIndicator,
120: boolean pendingActionIndicator,
121: Date purchaseOrderFirstTransmissionDate,
122: PurchasingAccountsPayableDocumentFixture purapDocumentFixture,
123: PurchasingDocumentFixture purchasingDocumentFixture,
124: PurchaseOrderItemFixture[] purchaseOrderItemFixtures) {
125: this .purchaseOrderCreateDate = purchaseOrderCreateDate;
126: this .requisitionIdentifier = requisitionIdentifier;
127: this .purchaseOrderVendorChoiceCode = purchaseOrderVendorChoiceCode;
128: this .recurringPaymentFrequencyCode = recurringPaymentFrequencyCode;
129: this .recurringPaymentAmount = recurringPaymentAmount;
130: this .recurringPaymentDate = recurringPaymentDate;
131: this .initialPaymentAmount = initialPaymentAmount;
132: this .initialPaymentDate = initialPaymentDate;
133: this .finalPaymentAmount = finalPaymentAmount;
134: this .finalPaymentDate = finalPaymentDate;
135: this .purchaseOrderInitialOpenDate = purchaseOrderInitialOpenDate;
136: this .purchaseOrderLastTransmitDate = purchaseOrderLastTransmitDate;
137: this .purchaseOrderQuoteDueDate = purchaseOrderQuoteDueDate;
138: this .purchaseOrderQuoteTypeCode = purchaseOrderQuoteTypeCode;
139: this .purchaseOrderQuoteVendorNoteText = purchaseOrderQuoteVendorNoteText;
140: this .purchaseOrderConfirmedIndicator = purchaseOrderConfirmedIndicator;
141: this .purchaseOrderCommodityDescription = purchaseOrderCommodityDescription;
142: this .purchaseOrderPreviousIdentifier = purchaseOrderPreviousIdentifier;
143: this .alternateVendorHeaderGeneratedIdentifier = alternateVendorHeaderGeneratedIdentifier;
144: this .alternateVendorDetailAssignedIdentifier = alternateVendorDetailAssignedIdentifier;
145: this .newQuoteVendorHeaderGeneratedIdentifier = newQuoteVendorHeaderGeneratedIdentifier;
146: this .newQuoteVendorDetailAssignedIdentifier = newQuoteVendorDetailAssignedIdentifier;
147: this .alternateVendorName = alternateVendorName;
148: this .purchaseOrderCurrentIndicator = purchaseOrderCurrentIndicator;
149: this .pendingActionIndicator = pendingActionIndicator;
150: this .purchaseOrderFirstTransmissionDate = purchaseOrderFirstTransmissionDate;
151: this .purapDocumentFixture = purapDocumentFixture;
152: this .purchasingDocumentFixture = purchasingDocumentFixture;
153: this .purchaseOrderItemFixtures = purchaseOrderItemFixtures;
154: }
155:
156: /**
157: * Creates a Purchase Order Document using this Fixture.
158: *
159: * @return the created Purchase Order Document.
160: */
161: public PurchaseOrderDocument createPurchaseOrderDocument() {
162: PurchaseOrderDocument doc = purchasingDocumentFixture
163: .createPurchaseOrderDocument(purapDocumentFixture);
164: doc.setPurchaseOrderCreateDate(this .purchaseOrderCreateDate);
165: doc.setRequisitionIdentifier(this .requisitionIdentifier);
166: doc
167: .setPurchaseOrderVendorChoiceCode(this .purchaseOrderVendorChoiceCode);
168: doc
169: .setRecurringPaymentFrequencyCode(this .recurringPaymentFrequencyCode);
170: doc.setRecurringPaymentAmount(this .recurringPaymentAmount);
171: doc.setRecurringPaymentDate(this .recurringPaymentDate);
172: doc.setInitialPaymentAmount(this .initialPaymentAmount);
173: doc.setInitialPaymentDate(this .initialPaymentDate);
174: doc.setFinalPaymentAmount(this .finalPaymentAmount);
175: doc.setFinalPaymentDate(this .finalPaymentDate);
176: doc
177: .setPurchaseOrderInitialOpenDate(this .purchaseOrderInitialOpenDate);
178: doc
179: .setPurchaseOrderLastTransmitDate(this .purchaseOrderLastTransmitDate);
180: doc
181: .setPurchaseOrderQuoteDueDate(this .purchaseOrderQuoteDueDate);
182: doc
183: .setPurchaseOrderQuoteTypeCode(this .purchaseOrderQuoteTypeCode);
184: doc
185: .setPurchaseOrderQuoteVendorNoteText(this .purchaseOrderQuoteVendorNoteText);
186: doc
187: .setPurchaseOrderConfirmedIndicator(this .purchaseOrderConfirmedIndicator);
188: doc
189: .setPurchaseOrderCommodityDescription(this .purchaseOrderCommodityDescription);
190: doc
191: .setPurchaseOrderPreviousIdentifier(this .purchaseOrderPreviousIdentifier);
192: doc
193: .setAlternateVendorHeaderGeneratedIdentifier(this .alternateVendorHeaderGeneratedIdentifier);
194: doc
195: .setAlternateVendorDetailAssignedIdentifier(this .alternateVendorDetailAssignedIdentifier);
196: doc
197: .setNewQuoteVendorHeaderGeneratedIdentifier(this .newQuoteVendorHeaderGeneratedIdentifier);
198: doc
199: .setNewQuoteVendorDetailAssignedIdentifier(this .newQuoteVendorDetailAssignedIdentifier);
200: doc.setAlternateVendorName(this .alternateVendorName);
201: doc
202: .setPurchaseOrderCurrentIndicator(this .purchaseOrderCurrentIndicator);
203: doc.setPendingActionIndicator(this .pendingActionIndicator);
204: doc
205: .setPurchaseOrderFirstTransmissionDate(this .purchaseOrderFirstTransmissionDate);
206:
207: for (PurchaseOrderItemFixture purchaseOrderItemFixture : purchaseOrderItemFixtures) {
208: purchaseOrderItemFixture.addTo(doc);
209: }
210:
211: return doc;
212: }
213: }
|