001 /*
002 * Copyright 2011 The Kuali Foundation.
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017 package org.kuali.kfs.gl.businessobject;
018
019 import java.sql.Date;
020
021 import org.kuali.rice.kns.util.ObjectUtils;
022
023 /**
024 * General Ledger business object for BalanceHistory.
025 */
026 public class BalanceHistory extends Balance implements LedgerBalanceHistory {
027 /**
028 * Default constructor.
029 */
030 public BalanceHistory() {
031 super();
032 }
033
034 /**
035 * Constructs a BalanceHistory.java.
036 *
037 * @param transaction
038 */
039 public BalanceHistory(OriginEntryInformation originEntry) {
040 this();
041 this.setChartOfAccountsCode(originEntry.getChartOfAccountsCode());
042 this.setAccountNumber(originEntry.getAccountNumber());
043 this.setBalanceTypeCode(originEntry.getFinancialBalanceTypeCode());
044 this.setObjectCode(originEntry.getFinancialObjectCode());
045 this.setObjectTypeCode(originEntry.getFinancialObjectTypeCode());
046 this.setSubObjectCode(originEntry.getFinancialSubObjectCode());
047 this.setUniversityFiscalYear(originEntry.getUniversityFiscalYear());
048 this.setSubAccountNumber(originEntry.getSubAccountNumber());
049 }
050
051 /**
052 * Compare amounts
053 *
054 * @param balance
055 * @see org.kuali.kfs.gl.businessobject.Balance#addAmount(java.lang.String, org.kuali.rice.kns.util.KualiDecimal)
056 */
057 public boolean compareAmounts(Balance balance) {
058 if (ObjectUtils.isNotNull(balance)
059 && balance.getAccountLineAnnualBalanceAmount().equals(this.getAccountLineAnnualBalanceAmount())
060 && balance.getBeginningBalanceLineAmount().equals(this.getBeginningBalanceLineAmount())
061 && balance.getContractsGrantsBeginningBalanceAmount().equals(this.getContractsGrantsBeginningBalanceAmount())
062 && balance.getMonth1Amount().equals(this.getMonth1Amount())
063 && balance.getMonth2Amount().equals(this.getMonth2Amount())
064 && balance.getMonth3Amount().equals(this.getMonth3Amount())
065 && balance.getMonth4Amount().equals(this.getMonth4Amount())
066 && balance.getMonth5Amount().equals(this.getMonth5Amount())
067 && balance.getMonth6Amount().equals(this.getMonth6Amount())
068 && balance.getMonth7Amount().equals(this.getMonth7Amount())
069 && balance.getMonth8Amount().equals(this.getMonth8Amount())
070 && balance.getMonth9Amount().equals(this.getMonth9Amount())
071 && balance.getMonth10Amount().equals(this.getMonth10Amount())
072 && balance.getMonth11Amount().equals(this.getMonth11Amount())
073 && balance.getMonth12Amount().equals(this.getMonth12Amount())
074 && balance.getMonth13Amount().equals(this.getMonth13Amount())) {
075 return true;
076 }
077
078 return false;
079 }
080
081 /**
082 * History does not track this field.
083 * @see org.kuali.kfs.gl.businessobject.Balance#getTimestamp()
084 */
085 @Override
086 public Date getTimestamp() {
087 throw new UnsupportedOperationException();
088 }
089
090 /**
091 * History does not track this field.
092 * @see org.kuali.kfs.gl.businessobject.Balance#setTimestamp(java.sql.Date)
093 */
094 @Override
095 public void setTimestamp(Date timestamp) {
096 throw new UnsupportedOperationException();
097 }
098
099
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 }