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 org.kuali.module.purap.bo.AccountsPayableItem;
19: import org.kuali.module.purap.bo.CreditMemoItem;
20: import org.kuali.module.purap.bo.PurchasingItem;
21: import org.kuali.module.purap.bo.RequisitionItem;
22: import org.kuali.module.purap.document.CreditMemoDocument;
23:
24: public enum CreditMemoItemFixture {
25:
26: CM_QTY_UNRESTRICTED_ITEM_1(
27: PurApItemFixture.BASIC_QTY_ITEM_1, // purApItemFixture
28: new CreditMemoAccountingLineFixture[] { CreditMemoAccountingLineFixture.BASIC_CM_ACCOUNT_1 } // creditMemoAccountMultiFixtures
29: ),
30:
31: CM_ITEM_NO_APO(
32: PurApItemFixture.BASIC_QTY_ITEM_NO_APO, // purApItemFixture
33: new CreditMemoAccountingLineFixture[] { CreditMemoAccountingLineFixture.BASIC_CM_ACCOUNT_1 } // creditMemoAccountMultiFixtures
34: ),
35:
36: /*
37: * CM_QTY_APO_ITEM_1 ( false, // itemRestrictedIndicator PurApItemFixture.APO_QTY_ITEM_1, // purApItemFixture new
38: * CreditMemoAccountingLineFixture[] {CreditMemoAccountingLineFixture.APO_CM_ACCOUNT_1} // creditMemoAccountMultiFixtures ),
39: * CM_SERVICE_APO_ITEM_1 ( false, // itemRestrictedIndicator PurApItemFixture.APO_SERVICE_ITEM_1, // purApItemFixture new
40: * RequisitionAccountingLineFixture[] {CreditMemoAccountingLineFixture.APO_CM_ACCOUNT_2,
41: * CreditMemoAccountingLineFixture.APO_CM_ACCOUNT_3} // creditMemoAccountMultiFixtures ), CM_FREIGHT_ITEM_1 ( false, //
42: * itemRestrictedIndicator PurApItemFixture.APO_FREIGHT_ITEM_1, // purApItemFixture new CreditMemoAccountingLineFixture[]
43: * {RequisitionAccountingLineFixture.APO_REQ_ACCOUNT_4} // creditMemoAccountMultiFixtures ),
44: */
45:
46: ;
47:
48: //private boolean itemRestrictedIndicator;
49: private PurApItemFixture purApItemFixture;
50: private CreditMemoAccountingLineFixture[] creditMemoAccountingLineFixtures;
51:
52: private CreditMemoItemFixture(
53: PurApItemFixture purApItemFixture,
54: CreditMemoAccountingLineFixture[] creditMemoAccountingLineFixtures) {
55: this .purApItemFixture = purApItemFixture;
56: this .creditMemoAccountingLineFixtures = creditMemoAccountingLineFixtures;
57: }
58:
59: public void addTo(CreditMemoDocument creditMemoDocument) {
60: CreditMemoItem item = null;
61: item = (CreditMemoItem) this .createCreditMemoItem();
62: creditMemoDocument.addItem(item);
63: // iterate over the accounts
64: for (CreditMemoAccountingLineFixture creditMemoAccountMultiFixture : creditMemoAccountingLineFixtures) {
65: creditMemoAccountMultiFixture.addTo(item);
66: }
67: }
68:
69: public AccountsPayableItem createCreditMemoItem() {
70: CreditMemoItem item = (CreditMemoItem) purApItemFixture
71: .createPurApItem(CreditMemoItem.class);
72: return item;
73: }
74: }
|