01: /*
02: * Copyright 2006-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 java.sql.Timestamp;
19:
20: import org.apache.commons.lang.StringUtils;
21: import org.kuali.core.service.BusinessObjectService;
22: import org.kuali.module.chart.bo.Account;
23:
24: public enum AccountFixture {
25: ACTIVE_ACCOUNT(null, null, false, null, null,
26: "2101-09-30 00:00:00.000000000"), CLOSED_ACCOUNT(null,
27: null, true, null, null, null), EXPIRIED_ACCOUNT(null,
28: "1031467", false, "BL", "2331489",
29: "2001-09-30 00:00:00.000000000"), EXPIRIED_ACCOUNT_NO_CONTINUATION(
30: null, null, false, null, null,
31: "2001-09-30 00:00:00.000000000"), EXPIRIED_ACCOUNT_EXPIRIED_AND_OPEN_CONTINUATION(
32: null, "fixture1", false, "BL", "4631644",
33: "2001-09-30 00:00:00.000000000"), EXPIRIED_ACCOUNT_EXPIRIED_AND_CLOSED_CONTINUATION(
34: null, "fixture1", false, "BL", "4031425",
35: "2001-09-30 00:00:00.000000000"), ACCOUNT_PRESENCE_ACCOUNT(
36: "BL", "4031416", false, null, null, null), ACCOUNT_NON_PRESENCE_ACCOUNT(
37: "BA", "6044900", false, null, null, null), ACCOUNT_PRESENCE_ACCOUNT_WITH_EXPIRED(
38: "BL", "4831483", false, null, null,
39: "2001-09-30 00:00:00.000000000"), ACCOUNT_PRESENCE_ACCOUNT_BUT_CLOSED(
40: "BL", "4831483", false, null, null, null), ;
41:
42: public final String accountNumber;
43: public final String chartOfAccountsCode;
44: public final boolean accountClosedIndicator;
45: private final String accountExpirationDate;
46: public final String continuationFinChrtOfAcctCd;
47: public final String continuationAccountNumber;
48:
49: private AccountFixture(String chartOfAccountsCode,
50: String accountNumber, boolean accountClosedIndicator,
51: String continuationFinChrtOfAcctCd,
52: String continuationAccountNumber,
53: String accountExpirationDate) {
54: this .accountNumber = accountNumber;
55: this .chartOfAccountsCode = chartOfAccountsCode;
56: this .accountClosedIndicator = accountClosedIndicator;
57: this .accountExpirationDate = accountExpirationDate;
58: this .continuationFinChrtOfAcctCd = continuationFinChrtOfAcctCd;
59: this .continuationAccountNumber = continuationAccountNumber;
60: }
61:
62: public Account createAccount() {
63: Account account = new Account();
64: account.setAccountNumber(this .accountNumber);
65: account.setChartOfAccountsCode(this .chartOfAccountsCode);
66: account.setAccountClosedIndicator(this .accountClosedIndicator);
67: account
68: .setContinuationAccountNumber(this .continuationAccountNumber);
69: account
70: .setContinuationFinChrtOfAcctCd(this .continuationFinChrtOfAcctCd);
71: if (StringUtils.isNotBlank(this .accountExpirationDate)) {
72: account
73: .setAccountExpirationDate(getAccountExpirationDate());
74: }
75:
76: return account;
77: }
78:
79: public Account createAccount(
80: BusinessObjectService businessObjectService) {
81: return (Account) businessObjectService.retrieve(this
82: .createAccount());
83: }
84:
85: public Timestamp getAccountExpirationDate() {
86: return Timestamp.valueOf(this.accountExpirationDate);
87: }
88:
89: }
|