View Javadoc
1   /*
2    * Copyright 2005-2006 The Kuali Foundation
3    * 
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    * http://www.opensource.org/licenses/ecl2.php
9    * 
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.ole.coa.businessobject;
17  
18  import java.io.Serializable;
19  import java.util.LinkedHashMap;
20  import javax.persistence.Column;
21  import javax.persistence.Entity;
22  import javax.persistence.Id;
23  import javax.persistence.IdClass;
24  import javax.persistence.Table;
25  import org.apache.commons.lang.builder.CompareToBuilder;
26  import org.apache.commons.lang.builder.EqualsBuilder;
27  import org.apache.commons.lang.builder.HashCodeBuilder;
28  import org.apache.commons.lang.builder.ToStringBuilder;
29  import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
30  
31  /**
32   * Account Guideline Business Object
33   */
34  @Entity
35  @Table(name = "CA_ACCT_GDLNPRPS_T")
36  @IdClass(AccountGuideline.AccountGuidelineId.class)
37  public class AccountGuideline extends PersistableBusinessObjectBase {
38  
39      private static final long serialVersionUID = 807136405105252199L;
40  
41      @Id
42      @Column(name = "FIN_COA_CD")
43      private String chartOfAccountsCode;
44  
45      @Id
46      @Column(name = "ACCOUNT_NBR")
47      private String accountNumber;
48  
49      @Column(name = "ACCT_EXP_GDLN_TXT")
50      private String accountExpenseGuidelineText;
51  
52      @Column(name = "ACCT_INC_GDLN_TXT")
53      private String accountIncomeGuidelineText;
54  
55      @Column(name = "ACCT_PURPOSE_TXT")
56      private String accountPurposeText;
57  
58      /**
59       * @return Returns the accountExpenseGuidelineText.
60       */
61      public String getAccountExpenseGuidelineText() {
62          return accountExpenseGuidelineText;
63      }
64  
65      /**
66       * @param accountExpenseGuidelineText The accountExpenseGuidelineText to set.
67       */
68      public void setAccountExpenseGuidelineText(String accountExpenseGuidelineText) {
69          this.accountExpenseGuidelineText = accountExpenseGuidelineText;
70      }
71  
72      /**
73       * @return Returns the accountIncomeGuidelineText.
74       */
75      public String getAccountIncomeGuidelineText() {
76          return accountIncomeGuidelineText;
77      }
78  
79      /**
80       * @param accountIncomeGuidelineText The accountIncomeGuidelineText to set.
81       */
82      public void setAccountIncomeGuidelineText(String accountIncomeGuidelineText) {
83          this.accountIncomeGuidelineText = accountIncomeGuidelineText;
84      }
85  
86      /**
87       * @return Returns the accountNbr.
88       */
89      public String getAccountNumber() {
90          return accountNumber;
91      }
92  
93      /**
94       * @param accountNbr The accountNbr to set.
95       */
96      public void setAccountNumber(String accountNbr) {
97          this.accountNumber = accountNbr;
98      }
99  
100     /**
101      * @return Returns the accountPurposeText.
102      */
103     public String getAccountPurposeText() {
104         return accountPurposeText;
105     }
106 
107     /**
108      * @param accountPurposeText The accountPurposeText to set.
109      */
110     public void setAccountPurposeText(String accountPurposeText) {
111         this.accountPurposeText = accountPurposeText;
112     }
113 
114     /**
115      * @return Returns the chartOfAccountsCode.
116      */
117     public String getChartOfAccountsCode() {
118         return chartOfAccountsCode;
119     }
120 
121     /**
122      * @param chartOfAccountsCode The chartOfAccountsCode to set.
123      */
124     public void setChartOfAccountsCode(String chartOfAccountsCode) {
125         this.chartOfAccountsCode = chartOfAccountsCode;
126     }
127 
128     /**
129      * @see org.kuali.rice.krad.bo.BusinessObjectBase#toStringMapper()
130      */
131     protected LinkedHashMap toStringMapper() {
132         LinkedHashMap m = new LinkedHashMap();
133        if (this.chartOfAccountsCode != null) {
134            m.put("chartOfAccountsCode", this.chartOfAccountsCode.toString());
135        }
136        if (this.accountNumber != null) {
137            m.put("accountNumber", this.accountNumber.toString());
138        }
139         return m;
140     }
141 
142     public static final class AccountGuidelineId implements Serializable, Comparable<AccountGuidelineId> {
143 
144         private String chartOfAccountsCode;
145 
146         private String accountNumber;
147 
148         public String getChartOfAccountsCode() {
149             return this.chartOfAccountsCode;
150         }
151 
152         public void setChartOfAccountsCode(String chartOfAccountsCode) {
153             this.chartOfAccountsCode = chartOfAccountsCode;
154         }
155 
156         public String getAccountNumber() {
157             return this.accountNumber;
158         }
159 
160         public void setAccountNumber(String accountNumber) {
161             this.accountNumber = accountNumber;
162         }
163 
164         @Override
165         public String toString() {
166             return new ToStringBuilder(this).append("chartOfAccountsCode", this.chartOfAccountsCode).append("accountNumber", this.accountNumber).toString();
167         }
168 
169         @Override
170         public boolean equals(Object other) {
171             if (other == null)
172                 return false;
173             if (other == this)
174                 return true;
175             if (other.getClass() != this.getClass())
176                 return false;
177             final AccountGuidelineId rhs = (AccountGuidelineId) other;
178             return new EqualsBuilder().append(this.chartOfAccountsCode, rhs.chartOfAccountsCode).append(this.accountNumber, rhs.accountNumber).isEquals();
179         }
180 
181         @Override
182         public int hashCode() {
183             return new HashCodeBuilder(17, 37).append(this.chartOfAccountsCode).append(this.accountNumber).toHashCode();
184         }
185 
186         @Override
187         public int compareTo(AccountGuidelineId other) {
188             return new CompareToBuilder().append(this.chartOfAccountsCode, other.chartOfAccountsCode).append(this.accountNumber, other.accountNumber).toComparison();
189         }
190     }
191 }