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.test.fixtures;
17:
18: import org.kuali.core.service.BusinessObjectService;
19: import org.kuali.module.chart.bo.Account;
20: import org.kuali.module.chart.bo.SubFundGroup;
21: import org.kuali.module.gl.bo.Balance;
22:
23: public enum BalanceFixture {
24: BALANCE_PASS1("GF", "ABCD", "1111", "ABCDEF", "", ""), BALANCE_FAIL1(
25: "AB", "ABCD", "1111", "ABCDEF", "", ""), BALANCE_FAIL2(
26: "GF", "BALS", "1111", "ABCDEF", "", ""), BALANCE_FAIL3(
27: "GF", "ABCD", "9890", "ABCDEF", "", ""), BALANCE_FAIL4(
28: "GF", "ABCD", "1111", "MPRACT", "", ""), ;
29:
30: public final String fundGroupCode;
31: public final String organizationCode;
32: public final String objectCode;
33: public final String subFundGroupCode;
34: public final String chartOfAccountsCode;
35: public final String accountNumber;
36:
37: private BalanceFixture(String fundGroupCode,
38: String organizationCode, String objectCode,
39: String subFundGroupCode, String chartOfAccountsCode,
40: String accountNumber) {
41: this .fundGroupCode = fundGroupCode;
42: this .organizationCode = organizationCode;
43: this .objectCode = objectCode;
44: this .subFundGroupCode = subFundGroupCode;
45: this .chartOfAccountsCode = chartOfAccountsCode;
46: this .accountNumber = accountNumber;
47: }
48:
49: @SuppressWarnings("deprecation")
50: public Balance createBalance() {
51: Balance balance = new Balance();
52:
53: balance.setAccount(new Account());
54: balance.getAccount().setSubFundGroup(new SubFundGroup());
55:
56: balance.getAccount().getSubFundGroup().setFundGroupCode(
57: this .fundGroupCode);
58: balance.getAccount().setOrganizationCode(this .organizationCode);
59: balance.setObjectCode(this .objectCode);
60: balance.getAccount().setSubFundGroupCode(this .subFundGroupCode);
61: balance.getAccount().setChartOfAccountsCode(
62: this .chartOfAccountsCode);
63: balance.getAccount().setAccountNumber(this .accountNumber);
64:
65: return balance;
66: }
67:
68: public Balance createBalance(
69: BusinessObjectService businessObjectService) {
70: return (Balance) businessObjectService.retrieve(this
71: .createBalance());
72: }
73: }
|