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.purap.fixtures;
17:
18: import java.util.List;
19:
20: import org.kuali.kfs.bo.SourceAccountingLine;
21: import org.kuali.module.purap.PurapConstants.ItemTypeCodes;
22: import org.kuali.module.purap.bo.AccountsPayableItem;
23: import org.kuali.module.purap.bo.PaymentRequestItem;
24: import org.kuali.module.purap.bo.PurApAccountingLine;
25: import org.kuali.module.purap.document.PaymentRequestDocument;
26:
27: public enum PaymentRequestItemFixture {
28:
29: PREQ_QTY_UNRESTRICTED_ITEM_1(
30: PurApItemFixture.BASIC_QTY_ITEM_1, // purApItemFixture
31: new PaymentRequestAccountingLineFixture[] { PaymentRequestAccountingLineFixture.BASIC_PREQ_ACCOUNT_1 } // paymentRequestAccountMultiFixtures
32: );
33:
34: private PurApItemFixture purApItemFixture;
35: private PaymentRequestAccountingLineFixture[] paymentRequestAccountingLineFixtures;
36:
37: private PaymentRequestItemFixture(
38: PurApItemFixture purApItemFixture,
39: PaymentRequestAccountingLineFixture[] paymentRequestAccountingLineFixtures) {
40: this .purApItemFixture = purApItemFixture;
41: this .paymentRequestAccountingLineFixtures = paymentRequestAccountingLineFixtures;
42: }
43:
44: public void addTo(PaymentRequestDocument paymentRequestDocument) {
45: PaymentRequestItem item = null;
46: item = (PaymentRequestItem) this .createPaymentRequestItem();
47: paymentRequestDocument.addItem(item);
48: // iterate over the accounts
49: for (PaymentRequestAccountingLineFixture paymentRequestAccountingLineFixture : paymentRequestAccountingLineFixtures) {
50: paymentRequestAccountingLineFixture.addTo(item);
51: }
52: }
53:
54: public AccountsPayableItem createPaymentRequestItem() {
55: PaymentRequestItem item = (PaymentRequestItem) purApItemFixture
56: .createPurApItem(PaymentRequestItem.class);
57: return item;
58: }
59:
60: }
|