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.PurApAccountingLine;
19: import org.kuali.module.purap.bo.PurchaseOrderAccount;
20: import org.kuali.module.purap.bo.PurchaseOrderItem;
21: import org.kuali.test.fixtures.AccountingLineFixture;
22:
23: /**
24: * Fixture class for Purchase Order Accounting Line.
25: */
26: public enum PurchaseOrderAccountingLineFixture {
27: BASIC_PO_ACCOUNT_1(PurApAccountingLineFixture.BASIC_ACCOUNT_1, // PurApAccountingLineFixture
28: AccountingLineFixture.LINE1 // AccountingLineFixture
29: );
30:
31: private PurApAccountingLineFixture purApAccountingLineFixture;
32: private AccountingLineFixture accountingLineFixture;
33:
34: /**
35: * Private Constructor.
36: */
37: private PurchaseOrderAccountingLineFixture(
38: PurApAccountingLineFixture purApAccountingLineFixture,
39: AccountingLineFixture accountingLineFixture) {
40: this .purApAccountingLineFixture = purApAccountingLineFixture;
41: this .accountingLineFixture = accountingLineFixture;
42: }
43:
44: /**
45: * Creates a PurAp Accounting Line using the specified PurAp Accounting Line Fixture and Accounting Line Fixture.
46: *
47: * @param clazz the Purchase Order Account class.
48: * @param puralFixture the specified PurAp Accounting Line Fixture.
49: * @param alFixture the specified Accounting Line Fixture.
50: * @return the created PurAp Accounting Line.
51: */
52: public PurApAccountingLine createPurApAccountingLine(Class clazz,
53: PurApAccountingLineFixture puralFixture,
54: AccountingLineFixture alFixture) {
55: PurApAccountingLine line = null;
56: line = (PurApAccountingLine) puralFixture
57: .createPurApAccountingLine(PurchaseOrderAccount.class,
58: alFixture);
59: return line;
60: }
61:
62: /**
63: * Creates a PurAp Accounting Line from this fixture and adds it to the specified item.
64: *
65: * @param item the specified item.
66: */
67: public void addTo(PurchaseOrderItem item) {
68: item.getSourceAccountingLines().add(
69: createPurApAccountingLine(
70: item.getAccountingLineClass(),
71: purApAccountingLineFixture,
72: accountingLineFixture));
73: }
74: }
|