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.math.BigDecimal;
020
021 import org.apache.commons.lang.ObjectUtils;
022 import org.kuali.kfs.module.ld.LaborConstants;
023 import org.kuali.kfs.sys.context.SpringContext;
024 import org.kuali.rice.kim.bo.Person;
025 import org.kuali.rice.kim.service.PersonService;
026 import org.kuali.rice.kns.util.KualiDecimal;
027
028 /**
029 * Labor business object for Employee Funding.
030 */
031 public class EmployeeFunding extends LedgerBalance {
032
033 private String name;
034 private String csfDeleteCode;
035 private String csfFundingStatusCode;
036 private BigDecimal csfTimePercent;
037 private BigDecimal csfFullTimeEmploymentQuantity;
038 private KualiDecimal csfAmount;
039 private KualiDecimal currentAmount;
040 private KualiDecimal outstandingEncumbrance;
041 private KualiDecimal totalAmount;
042
043 /**
044 * Although the title of this class is EmployeeFunding, it is really a representation of the AccountStatusCurrentFunds business
045 * object, however it is generated using the fiscal year and employee ID.
046 */
047 public EmployeeFunding() {
048 super();
049 this.setMonth1Amount(KualiDecimal.ZERO);
050 this.setCurrentAmount(KualiDecimal.ZERO);
051 this.setOutstandingEncumbrance(KualiDecimal.ZERO);
052 this.setTotalAmount(KualiDecimal.ZERO);
053 }
054
055 /**
056 * Gets the person name.
057 *
058 * @return Returns the PersonName.
059 */
060 public String getName() {
061 Person person = this.getLedgerPerson();
062 if (person == null) {
063 return LaborConstants.BalanceInquiries.UnknownPersonName;
064 }
065
066 return person.getName();
067 }
068
069 /**
070 * Sets the persons name.
071 *
072 * @param personName The personName to set.
073 */
074
075 public void setName(String personName) {
076 this.name = personName;
077 }
078
079 /**
080 * Gets the csfAmount
081 *
082 * @return Returns the csfAmount.
083 */
084 public KualiDecimal getCsfAmount() {
085 return csfAmount;
086 }
087
088 /**
089 * Sets the csfAmount.
090 *
091 * @param csfAmount The csfAmount to set.
092 */
093 public void setCsfAmount(KualiDecimal csfAmount) {
094 this.csfAmount = csfAmount;
095 }
096
097 /**
098 * Gets the csfDeleteCode.
099 *
100 * @return Returns the csfDeleteCode.
101 */
102 public String getCsfDeleteCode() {
103 return csfDeleteCode;
104 }
105
106 /**
107 * Sets the csfDeleteCode.
108 *
109 * @param csfDeleteCode The csfDeleteCode to set.
110 */
111 public void setCsfDeleteCode(String csfDeleteCode) {
112 this.csfDeleteCode = csfDeleteCode;
113 }
114
115 /**
116 * Gets the csfFundingStatusCode.
117 *
118 * @return Returns the csfFundingStatusCode.
119 */
120 public String getCsfFundingStatusCode() {
121 return csfFundingStatusCode;
122 }
123
124 /**
125 * Sets the csfFundingStatusCode.
126 *
127 * @param csfFundingStatusCode The csfFundingStatusCode to set.
128 */
129 public void setCsfFundingStatusCode(String csfFundingStatusCode) {
130 this.csfFundingStatusCode = csfFundingStatusCode;
131 }
132
133 /**
134 * Gets the csfTimePercent.
135 *
136 * @return Returns the csfTimePercent.
137 */
138 public BigDecimal getCsfTimePercent() {
139 return csfTimePercent;
140 }
141
142 /**
143 * Sets the csfTimePercent.
144 *
145 * @param csfTimePercent The csfTimePercent to set.
146 */
147 public void setCsfTimePercent(BigDecimal csfTimePercent) {
148 this.csfTimePercent = csfTimePercent;
149 }
150
151 /**
152 * Gets the currentAmount.
153 *
154 * @return Returns the currentAmount.
155 */
156 public KualiDecimal getCurrentAmount() {
157 return currentAmount;
158 }
159
160 /**
161 * Sets the currentAmount.
162 *
163 * @param currentAmount The currentAmount to set.
164 */
165 public void setCurrentAmount(KualiDecimal currentAmount) {
166 this.currentAmount = currentAmount;
167 }
168
169 /**
170 * Gets the outstandingEncumbrance.
171 *
172 * @return Returns the outstandingEncumbrance.
173 */
174 public KualiDecimal getOutstandingEncumbrance() {
175 return outstandingEncumbrance;
176 }
177
178 /**
179 * Sets the outstandingEncumbrance.
180 *
181 * @param outstandingEncumbrance The outstandingEncumbrance to set.
182 */
183 public void setOutstandingEncumbrance(KualiDecimal outstandingEncumbrance) {
184 this.outstandingEncumbrance = outstandingEncumbrance;
185 }
186
187 /**
188 * Returns a total amount based upon adding any outstanding encumberence records to the annual balance amount.
189 *
190 * @return TotalAmount
191 */
192 public KualiDecimal getTotalAmount() {
193 return this.currentAmount.add(this.outstandingEncumbrance);
194 }
195
196 /**
197 * Sets the total amount.
198 *
199 * @param totalAmount The totalAmount to set.
200 */
201 public void setTotalAmount(KualiDecimal totalAmount) {
202 this.totalAmount = totalAmount;
203 }
204
205 /**
206 * @see java.lang.Object#hashCode()
207 */
208 @Override
209 public int hashCode() {
210 final int PRIME = 31;
211 int result = 1;
212 result = PRIME * result + ((getAccountNumber() == null) ? 0 : getAccountNumber().hashCode());
213 result = PRIME * result + ((getChartOfAccountsCode() == null) ? 0 : getChartOfAccountsCode().hashCode());
214 result = PRIME * result + ((getFinancialObjectCode() == null) ? 0 : getFinancialObjectCode().hashCode());
215 result = PRIME * result + ((getFinancialSubObjectCode() == null) ? 0 : getFinancialSubObjectCode().hashCode());
216 result = PRIME * result + ((getSubAccountNumber() == null) ? 0 : getSubAccountNumber().hashCode());
217 result = PRIME * result + ((getUniversityFiscalYear() == null) ? 0 : getUniversityFiscalYear().hashCode());
218 result = PRIME * result + ((getEmplid() == null) ? 0 : getEmplid().hashCode());
219 result = PRIME * result + ((getPositionNumber() == null) ? 0 : getPositionNumber().hashCode());
220
221 return result;
222 }
223
224 /**
225 * @see java.lang.Object#equals(java.lang.Object)
226 */
227 @Override
228 public boolean equals(Object obj) {
229 if (this == obj)
230 return true;
231 if (obj == null)
232 return false;
233 if (getClass() != obj.getClass())
234 return false;
235
236 final EmployeeFunding other = (EmployeeFunding) obj;
237
238 if (!ObjectUtils.equals(getAccountNumber(), other.getAccountNumber())) {
239 return false;
240 }
241 else if (!ObjectUtils.equals(getChartOfAccountsCode(), other.getChartOfAccountsCode())) {
242 return false;
243 }
244 else if (!ObjectUtils.equals(getFinancialObjectCode(), other.getFinancialObjectCode())) {
245 return false;
246 }
247 else if (!ObjectUtils.equals(getFinancialSubObjectCode(), other.getFinancialSubObjectCode())) {
248 return false;
249 }
250 else if (!ObjectUtils.equals(getSubAccountNumber(), other.getSubAccountNumber())) {
251 return false;
252 }
253 else if (!ObjectUtils.equals(getUniversityFiscalYear(), other.getUniversityFiscalYear())) {
254 return false;
255 }
256 else if (!ObjectUtils.equals(getEmplid(), other.getEmplid())) {
257 return false;
258 }
259 else if (!ObjectUtils.equals(getPositionNumber(), other.getPositionNumber())) {
260 return false;
261 }
262
263 return true;
264 }
265
266 /**
267 * Gets the csfFullTimeEmploymentQuantity.
268 *
269 * @return Returns the csfFullTimeEmploymentQuantity.
270 */
271 public BigDecimal getCsfFullTimeEmploymentQuantity() {
272 return csfFullTimeEmploymentQuantity;
273 }
274
275 /**
276 * Sets the csfFullTimeEmploymentQuantity.
277 *
278 * @param csfFullTimeEmploymentQuantity The csfFullTimeEmploymentQuantity to set.
279 */
280 public void setCsfFullTimeEmploymentQuantity(BigDecimal csfFullTimeEmploymentQuantity) {
281 this.csfFullTimeEmploymentQuantity = csfFullTimeEmploymentQuantity;
282 }
283 }
284