View Javadoc
1   /*
2    * Copyright 2006-2009 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  
17  package org.kuali.ole.gl.businessobject;
18  
19  import java.sql.Date;
20  
21  import org.kuali.rice.krad.util.ObjectUtils;
22  
23  /**
24   * General Ledger business object for BalanceHistory.
25   */
26  public class BalanceHistory extends Balance implements LedgerBalanceHistory {
27      /**
28       * Default constructor.
29       */
30      public BalanceHistory() {
31          super();
32      }
33  
34      /**
35       * Constructs a BalanceHistory.java.
36       * 
37       * @param transaction
38       */
39      public BalanceHistory(OriginEntryInformation originEntry) {
40          this();
41          this.setChartOfAccountsCode(originEntry.getChartOfAccountsCode());
42          this.setAccountNumber(originEntry.getAccountNumber());
43          this.setBalanceTypeCode(originEntry.getFinancialBalanceTypeCode());
44          this.setObjectCode(originEntry.getFinancialObjectCode());
45          this.setObjectTypeCode(originEntry.getFinancialObjectTypeCode());
46          this.setSubObjectCode(originEntry.getFinancialSubObjectCode());
47          this.setUniversityFiscalYear(originEntry.getUniversityFiscalYear());
48          this.setSubAccountNumber(originEntry.getSubAccountNumber());
49      }
50      
51      /**
52       * Compare amounts
53       * 
54       * @param balance
55       * @see org.kuali.ole.gl.businessobject.Balance#addAmount(java.lang.String, org.kuali.rice.core.api.util.type.KualiDecimal)
56       */
57      public boolean compareAmounts(Balance balance) {
58          if (ObjectUtils.isNotNull(balance)
59                  && balance.getAccountLineAnnualBalanceAmount().equals(this.getAccountLineAnnualBalanceAmount())
60                  && balance.getBeginningBalanceLineAmount().equals(this.getBeginningBalanceLineAmount())
61                  && balance.getContractsGrantsBeginningBalanceAmount().equals(this.getContractsGrantsBeginningBalanceAmount())
62                  && balance.getMonth1Amount().equals(this.getMonth1Amount())
63                  && balance.getMonth2Amount().equals(this.getMonth2Amount())
64                  && balance.getMonth3Amount().equals(this.getMonth3Amount())
65                  && balance.getMonth4Amount().equals(this.getMonth4Amount())
66                  && balance.getMonth5Amount().equals(this.getMonth5Amount())
67                  && balance.getMonth6Amount().equals(this.getMonth6Amount())
68                  && balance.getMonth7Amount().equals(this.getMonth7Amount())
69                  && balance.getMonth8Amount().equals(this.getMonth8Amount())
70                  && balance.getMonth9Amount().equals(this.getMonth9Amount())
71                  && balance.getMonth10Amount().equals(this.getMonth10Amount())
72                  && balance.getMonth11Amount().equals(this.getMonth11Amount())
73                  && balance.getMonth12Amount().equals(this.getMonth12Amount())
74                  && balance.getMonth13Amount().equals(this.getMonth13Amount())) {
75              return true;
76          }
77          
78          return false;
79      }
80      
81      /**
82       * History does not track this field.
83       * @see org.kuali.ole.gl.businessobject.Balance#getTimestamp()
84       */
85      @Override
86      public Date getTimestamp() {
87          throw new UnsupportedOperationException();
88      }
89  
90      /**
91       * History does not track this field.
92       * @see org.kuali.ole.gl.businessobject.Balance#setTimestamp(java.sql.Date)
93       */
94      @Override
95      public void setTimestamp(Date timestamp) {
96          throw new UnsupportedOperationException();
97      }
98      
99  
100     /**
101      * Because financialBalanceTypeCode is named differently in Labor and GL.
102      * 
103      * @return Returns the balanceTypeCode.
104      */
105     public String getFinancialBalanceTypeCode() {
106         return getBalanceTypeCode();
107     }
108 
109     /**
110      * Because financialBalanceTypeCode is named differently in Labor and GL.
111      * 
112      * @param financialBalanceTypeCode The balanceTypeCode to set.
113      */
114     public void setFinancialBalanceTypeCode(String financialBalanceTypeCode) {
115         this.setBalanceTypeCode(financialBalanceTypeCode);
116     }
117     
118     /**
119      * Because financialBalanceTypeCode is named differently in Labor and GL.
120      * 
121      * @return Returns the objectCode.
122      */
123     public String getFinancialObjectCode() {
124         return getObjectCode();
125     }
126 
127     /**
128      * Because financialBalanceTypeCode is named differently in Labor and GL.
129      * 
130      * @param financialObjectCode The objectCode to set.
131      */
132     public void setFinancialObjectCode(String financialObjectCode) {
133         this.setObjectCode(financialObjectCode);
134     }
135     
136     /**
137      * Because financialBalanceTypeCode is named differently in Labor and GL.
138      * 
139      * @return Returns the objectTypeCode.
140      */
141     public String getFinancialObjectTypeCode() {
142         return getObjectTypeCode();
143     }
144 
145     /**
146      * Because financialBalanceTypeCode is named differently in Labor and GL.
147      * 
148      * @param financialObjectTypeCode The objectTypeCode to set.
149      */
150     public void setFinancialObjectTypeCode(String financialObjectTypeCode) {
151         this.setObjectTypeCode(financialObjectTypeCode);
152     }
153     
154     /**
155      * Because financialBalanceTypeCode is named differently in Labor and GL.
156      * 
157      * @return Returns the subObjectCode.
158      */
159     public String getFinancialSubObjectCode() {
160         return getSubObjectCode();
161     }
162 
163     /**
164      * Because financialBalanceTypeCode is named differently in Labor and GL.
165      * 
166      * @param financialSubObjectCode The subObjectCode to set.
167      */
168     public void setFinancialSubObjectCode(String financialSubObjectCode) {
169         this.setSubObjectCode(financialSubObjectCode);
170     }
171 }