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