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.math.BigDecimal;
19:
20: import org.kuali.core.util.KualiDecimal;
21: import org.kuali.kfs.KFSConstants;
22: import org.kuali.module.purap.bo.PurApAccountingLine;
23: import org.kuali.test.fixtures.AccountingLineFixture;
24:
25: public enum PurApAccountingLineFixture {
26: BASIC_ACCOUNT_1(null, // accountIdentifier;
27: null, // itemIdentifier;
28: new BigDecimal("100"), // accountLinePercent;
29: null // alternateAmountForGLEntryCreation;
30: ), BASIC_ACCOUNT_2(null, // accountIdentifier;
31: null, // itemIdentifier;
32: new BigDecimal("100"), // accountLinePercent;
33: null // alternateAmountForGLEntryCreation;
34: ), ACCOUNT_50_PERCENT(null, // accountIdentifier;
35: null, // itemIdentifier;
36: new BigDecimal("50"), // accountLinePercent;
37: null // alternateAmountForGLEntryCreation;
38: ), REQ_ACCOUNT_MULTI(null, // accountIdentifier;
39: null, // itemIdentifier;
40: new BigDecimal("100"), // accountLinePercent;
41: null // alternateAmountForGLEntryCreation;
42: );
43:
44: private Integer accountIdentifier;
45: private Integer itemIdentifier;
46: private BigDecimal accountLinePercent;
47: private KualiDecimal alternateAmountForGLEntryCreation;
48:
49: private PurApAccountingLineFixture(Integer accountIdentifier,
50: Integer itemIdentifier, BigDecimal accountLinePercent,
51: KualiDecimal alternateAmountForGLEntryCreation) {
52: this .accountIdentifier = accountIdentifier;
53: this .itemIdentifier = itemIdentifier;
54: this .accountLinePercent = accountLinePercent;
55: this .alternateAmountForGLEntryCreation = alternateAmountForGLEntryCreation;
56: }
57:
58: public PurApAccountingLine createPurApAccountingLine(Class clazz,
59: AccountingLineFixture alFixture) {
60: PurApAccountingLine line = null;
61: try {
62: // TODO: what should this debit code really be
63: line = (PurApAccountingLine) alFixture
64: .createAccountingLine(clazz,
65: KFSConstants.GL_DEBIT_CODE);
66: } catch (InstantiationException e) {
67: throw new RuntimeException("item creation failed. class = "
68: + clazz);
69: } catch (IllegalAccessException e) {
70: throw new RuntimeException("item creation failed. class = "
71: + clazz);
72: }
73: line.setAccountIdentifier(this.accountIdentifier);
74: line.setItemIdentifier(this.itemIdentifier);
75: line.setAccountLinePercent(this.accountLinePercent);
76: line
77: .setAlternateAmountForGLEntryCreation(this.alternateAmountForGLEntryCreation);
78: line.refreshNonUpdateableReferences();
79: return line;
80: }
81:
82: }
|