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.module.ld.businessobject;
018
019 import java.sql.Date;
020 import java.sql.Timestamp;
021
022 import org.kuali.kfs.gl.businessobject.Balance;
023 import org.kuali.kfs.gl.businessobject.LedgerBalanceHistory;
024 import org.kuali.rice.kns.util.ObjectUtils;
025
026 /**
027 * Labor business object for LedgerBalanceHistory.
028 */
029 public class LaborBalanceHistory extends LedgerBalance implements LedgerBalanceHistory {
030 /**
031 * Default constructor.
032 */
033 public LaborBalanceHistory() {
034 super();
035 }
036
037 /**
038 * Constructs a LedgerBalance.java.
039 *
040 * @param transaction
041 */
042 public LaborBalanceHistory(LaborOriginEntry laborOriginEntry) {
043 this();
044 this.setChartOfAccountsCode(laborOriginEntry.getChartOfAccountsCode());
045 this.setAccountNumber(laborOriginEntry.getAccountNumber());
046 this.setFinancialBalanceTypeCode(laborOriginEntry.getFinancialBalanceTypeCode());
047 this.setEmplid(laborOriginEntry.getEmplid());
048 this.setFinancialObjectCode(laborOriginEntry.getFinancialObjectCode());
049 this.setFinancialObjectTypeCode(laborOriginEntry.getFinancialObjectTypeCode());
050 this.setFinancialSubObjectCode(laborOriginEntry.getFinancialSubObjectCode());
051 this.setPositionNumber(laborOriginEntry.getPositionNumber());
052 this.setUniversityFiscalYear(laborOriginEntry.getUniversityFiscalYear());
053 this.setSubAccountNumber(laborOriginEntry.getSubAccountNumber());
054 }
055
056 /**
057 * Compare amounts
058 *
059 * @param balance
060 * @see org.kuali.kfs.gl.businessobject.Balance#addAmount(java.lang.String, org.kuali.rice.kns.util.KualiDecimal)
061 */
062 public boolean compareAmounts(Balance balance) {
063 if (!(balance instanceof LedgerBalance)) {
064 throw new IllegalArgumentException("balance needs to be of type LedgerBalance");
065 }
066
067 LedgerBalance ledgerBalance = (LedgerBalance) balance;
068
069 if (ObjectUtils.isNotNull(ledgerBalance)
070 && ledgerBalance.getAccountLineAnnualBalanceAmount().equals(this.getAccountLineAnnualBalanceAmount())
071 && ledgerBalance.getFinancialBeginningBalanceLineAmount().equals(this.getFinancialBeginningBalanceLineAmount())
072 && ledgerBalance.getContractsGrantsBeginningBalanceAmount().equals(this.getContractsGrantsBeginningBalanceAmount())
073 && ledgerBalance.getMonth1Amount().equals(this.getMonth1Amount())
074 && ledgerBalance.getMonth2Amount().equals(this.getMonth2Amount())
075 && ledgerBalance.getMonth3Amount().equals(this.getMonth3Amount())
076 && ledgerBalance.getMonth4Amount().equals(this.getMonth4Amount())
077 && ledgerBalance.getMonth5Amount().equals(this.getMonth5Amount())
078 && ledgerBalance.getMonth6Amount().equals(this.getMonth6Amount())
079 && ledgerBalance.getMonth7Amount().equals(this.getMonth7Amount())
080 && ledgerBalance.getMonth8Amount().equals(this.getMonth8Amount())
081 && ledgerBalance.getMonth9Amount().equals(this.getMonth9Amount())
082 && ledgerBalance.getMonth10Amount().equals(this.getMonth10Amount())
083 && ledgerBalance.getMonth11Amount().equals(this.getMonth11Amount())
084 && ledgerBalance.getMonth12Amount().equals(this.getMonth12Amount())
085 && ledgerBalance.getMonth13Amount().equals(this.getMonth13Amount())) {
086 return true;
087 }
088
089 return false;
090 }
091
092 /**
093 * It's called financialObjectCode
094 * @see org.kuali.kfs.gl.businessobject.Balance#getObjectCode()
095 */
096 @Override
097 public String getObjectCode() {
098 return this.getFinancialObjectCode();
099 }
100
101 /**
102 * It's called financialObjectCode
103 * @see org.kuali.kfs.gl.businessobject.Balance#setObjectCode(java.lang.String)
104 */
105 @Override
106 public void setObjectCode(String objectCode) {
107 this.setFinancialObjectCode(objectCode);
108 }
109
110 /**
111 * It's called financialSubObjectCode
112 * @see org.kuali.kfs.gl.businessobject.Balance#getSubObjectCode()
113 */
114 @Override
115 public String getSubObjectCode() {
116 return this.getFinancialSubObjectCode();
117 }
118
119 /**
120 * It's called financialSubObjectCode
121 * @see org.kuali.kfs.gl.businessobject.Balance#setSubObjectCode(java.lang.String)
122 */
123 @Override
124 public void setSubObjectCode(String subObjectCode) {
125 this.setFinancialSubObjectCode(subObjectCode);
126 }
127
128 /**
129 * It's called financialObjectTypeCode
130 * @see org.kuali.kfs.gl.businessobject.Balance#getObjectTypeCode()
131 */
132 @Override
133 public String getObjectTypeCode() {
134 return this.getFinancialObjectTypeCode();
135 }
136
137 /**
138 * It's called financialObjectTypeCode
139 * @see org.kuali.kfs.gl.businessobject.Balance#setObjectTypeCode(java.lang.String)
140 */
141 @Override
142 public void setObjectTypeCode(String objectTypeCode) {
143 this.setFinancialObjectTypeCode(objectTypeCode);
144 }
145
146 /**
147 * It's called financialBalanceTypeCode
148 * @see org.kuali.kfs.module.ld.businessobject.LedgerBalance#getBalanceTypeCode()
149 */
150 @Override
151 public String getBalanceTypeCode() {
152 return this.getFinancialBalanceTypeCode();
153 }
154
155 /**
156 * It's called financialBalanceTypeCode
157 * @see org.kuali.kfs.module.ld.businessobject.LedgerBalance#setBalanceTypeCode(java.lang.String)
158 */
159 @Override
160 public void setBalanceTypeCode(String balanceTypeCode) {
161 this.setFinancialBalanceTypeCode(balanceTypeCode);
162 }
163
164 /**
165 * History does not track this field.
166 * @see org.kuali.kfs.gl.businessobject.Balance#getTimestamp()
167 */
168 @Override
169 public Date getTimestamp() {
170 throw new UnsupportedOperationException();
171 }
172
173 /**
174 * History does not track this field.
175 * @see org.kuali.kfs.gl.businessobject.Balance#setTimestamp(java.sql.Date)
176 */
177 @Override
178 public void setTimestamp(Date timestamp) {
179 throw new UnsupportedOperationException();
180 }
181
182 /**
183 * History does not track this field.
184 * @see org.kuali.kfs.module.ld.businessobject.LedgerBalance#getTransactionDateTimeStamp()
185 */
186 @Override
187 public Timestamp getTransactionDateTimeStamp() {
188 throw new UnsupportedOperationException();
189 }
190
191 /**
192 * History does not track this field.
193 * @see org.kuali.kfs.module.ld.businessobject.LedgerBalance#setTransactionDateTimeStamp(java.sql.Timestamp)
194 */
195 @Override
196 public void setTransactionDateTimeStamp(Timestamp transactionDateTimeStamp) {
197 throw new UnsupportedOperationException();
198 }
199 }