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.bc.businessobject;
018
019 import java.math.BigDecimal;
020 import java.sql.Date;
021 import java.sql.Timestamp;
022 import java.util.LinkedHashMap;
023
024 import org.kuali.kfs.coa.businessobject.Account;
025 import org.kuali.kfs.coa.businessobject.Chart;
026 import org.kuali.kfs.coa.businessobject.ObjectCode;
027 import org.kuali.kfs.coa.businessobject.SubAccount;
028 import org.kuali.kfs.coa.businessobject.SubObjectCode;
029 import org.kuali.kfs.module.ld.LaborConstants;
030 import org.kuali.kfs.sys.businessobject.SystemOptions;
031 import org.kuali.kfs.sys.context.SpringContext;
032 import org.kuali.rice.kim.bo.Person;
033 import org.kuali.rice.kim.service.PersonService;
034 import org.kuali.rice.kns.bo.PersistableBusinessObjectBase;
035 import org.kuali.rice.kns.util.KualiDecimal;
036
037 /**
038 *
039 */
040 public class CalculatedSalaryFoundationTracker extends PersistableBusinessObjectBase {
041
042 private Integer universityFiscalYear;
043 private String chartOfAccountsCode;
044 private String accountNumber;
045 private String subAccountNumber;
046 private String financialObjectCode;
047 private String financialSubObjectCode;
048 private String positionNumber;
049 private String emplid;
050 private String name;
051 private Timestamp csfCreateTimestamp;
052 private String csfDeleteCode;
053 private KualiDecimal csfAmount;
054 private BigDecimal csfFullTimeEmploymentQuantity;
055 private BigDecimal csfTimePercent;
056 private String csfFundingStatusCode;
057 private Integer employeeRecord;
058 private String earnCode;
059 private Integer additionalSequence;
060 private Date effectiveDate;
061 private Integer effectiveSequence;
062
063 private ObjectCode financialObject;
064 private Chart chartOfAccounts;
065 private Account account;
066 private SubAccount subAccount;
067 private SubObjectCode financialSubObject;
068 private CalculatedSalaryFoundationTrackerOverride calculatedSalaryFoundationTrackerOverride;
069
070 private transient SystemOptions universityFiscal;
071 private final int PERCENTAGE_SCALE = 2;
072
073 /**
074 * Default constructor.
075 */
076 public CalculatedSalaryFoundationTracker() {
077
078 }
079
080 /**
081 * Gets the universityFiscalYear attribute.
082 *
083 * @return Returns the universityFiscalYear
084 */
085 public Integer getUniversityFiscalYear() {
086 return universityFiscalYear;
087 }
088
089 /**
090 * Sets the universityFiscalYear attribute.
091 *
092 * @param universityFiscalYear The universityFiscalYear to set.
093 */
094 public void setUniversityFiscalYear(Integer universityFiscalYear) {
095 this.universityFiscalYear = universityFiscalYear;
096 }
097
098
099 /**
100 * Gets the chartOfAccountsCode attribute.
101 *
102 * @return Returns the chartOfAccountsCode
103 */
104 public String getChartOfAccountsCode() {
105 return chartOfAccountsCode;
106 }
107
108 /**
109 * Sets the chartOfAccountsCode attribute.
110 *
111 * @param chartOfAccountsCode The chartOfAccountsCode to set.
112 */
113 public void setChartOfAccountsCode(String chartOfAccountsCode) {
114 this.chartOfAccountsCode = chartOfAccountsCode;
115 }
116
117
118 /**
119 * Gets the accountNumber attribute.
120 *
121 * @return Returns the accountNumber
122 */
123 public String getAccountNumber() {
124 return accountNumber;
125 }
126
127 /**
128 * Sets the accountNumber attribute.
129 *
130 * @param accountNumber The accountNumber to set.
131 */
132 public void setAccountNumber(String accountNumber) {
133 this.accountNumber = accountNumber;
134 }
135
136
137 /**
138 * Gets the subAccountNumber attribute.
139 *
140 * @return Returns the subAccountNumber
141 */
142 public String getSubAccountNumber() {
143 return subAccountNumber;
144 }
145
146 /**
147 * Sets the subAccountNumber attribute.
148 *
149 * @param subAccountNumber The subAccountNumber to set.
150 */
151 public void setSubAccountNumber(String subAccountNumber) {
152 this.subAccountNumber = subAccountNumber;
153 }
154
155
156 /**
157 * Gets the financialObjectCode attribute.
158 *
159 * @return Returns the financialObjectCode
160 */
161 public String getFinancialObjectCode() {
162 return financialObjectCode;
163 }
164
165 /**
166 * Sets the financialObjectCode attribute.
167 *
168 * @param financialObjectCode The financialObjectCode to set.
169 */
170 public void setFinancialObjectCode(String financialObjectCode) {
171 this.financialObjectCode = financialObjectCode;
172 }
173
174
175 /**
176 * Gets the financialSubObjectCode attribute.
177 *
178 * @return Returns the financialSubObjectCode
179 */
180 public String getFinancialSubObjectCode() {
181 return financialSubObjectCode;
182 }
183
184 /**
185 * Sets the financialSubObjectCode attribute.
186 *
187 * @param financialSubObjectCode The financialSubObjectCode to set.
188 */
189 public void setFinancialSubObjectCode(String financialSubObjectCode) {
190 this.financialSubObjectCode = financialSubObjectCode;
191 }
192
193
194 /**
195 * Gets the positionNumber attribute.
196 *
197 * @return Returns the positionNumber
198 */
199 public String getPositionNumber() {
200 return positionNumber;
201 }
202
203 /**
204 * Sets the positionNumber attribute.
205 *
206 * @param positionNumber The positionNumber to set.
207 */
208 public void setPositionNumber(String positionNumber) {
209 this.positionNumber = positionNumber;
210 }
211
212
213 /**
214 * Gets the emplid attribute.
215 *
216 * @return Returns the emplid
217 */
218 public String getEmplid() {
219 return emplid;
220 }
221
222 /**
223 * Sets the emplid attribute.
224 *
225 * @param emplid The emplid to set.
226 */
227 public void setEmplid(String emplid) {
228 this.emplid = emplid;
229 }
230
231
232 /**
233 * Gets the csfCreateTimestamp attribute.
234 *
235 * @return Returns the csfCreateTimestamp
236 */
237 public Timestamp getCsfCreateTimestamp() {
238 return csfCreateTimestamp;
239 }
240
241 /**
242 * Sets the csfCreateTimestamp attribute.
243 *
244 * @param csfCreateTimestamp The csfCreateTimestamp to set.
245 */
246 public void setCsfCreateTimestamp(Timestamp csfCreateTimestamp) {
247 this.csfCreateTimestamp = csfCreateTimestamp;
248 }
249
250
251 /**
252 * Gets the csfDeleteCode attribute.
253 *
254 * @return Returns the csfDeleteCode
255 */
256 public String getCsfDeleteCode() {
257 return csfDeleteCode;
258 }
259
260 /**
261 * Sets the csfDeleteCode attribute.
262 *
263 * @param csfDeleteCode The csfDeleteCode to set.
264 */
265 public void setCsfDeleteCode(String csfDeleteCode) {
266 this.csfDeleteCode = csfDeleteCode;
267 }
268
269
270 /**
271 * Gets the csfAmount attribute.
272 *
273 * @return Returns the csfAmount
274 */
275 public KualiDecimal getCsfAmount() {
276 return csfAmount;
277 }
278
279 /**
280 * Sets the csfAmount attribute.
281 *
282 * @param csfAmount The csfAmount to set.
283 */
284 public void setCsfAmount(KualiDecimal csfAmount) {
285 this.csfAmount = csfAmount;
286 }
287
288
289 /**
290 * Gets the csfFullTimeEmploymentQuantity attribute.
291 *
292 * @return Returns the csfFullTimeEmploymentQuantity
293 */
294 public BigDecimal getCsfFullTimeEmploymentQuantity() {
295 return csfFullTimeEmploymentQuantity;
296 }
297
298 /**
299 * Sets the csfFullTimeEmploymentQuantity attribute.
300 *
301 * @param csfFullTimeEmploymentQuantity The csfFullTimeEmploymentQuantity to set.
302 */
303 public void setCsfFullTimeEmploymentQuantity(BigDecimal csfFullTimeEmploymentQuantity) {
304 this.csfFullTimeEmploymentQuantity = csfFullTimeEmploymentQuantity;
305 }
306
307
308 /**
309 * Gets the csfTimePercent attribute. Returns 2 decimal places, reguardless.
310 *
311 * @return Returns the csfTimePercent
312 */
313 public BigDecimal getCsfTimePercent() {
314
315 BigDecimal bigDecValue = (BigDecimal) this.csfTimePercent;
316 bigDecValue = bigDecValue.setScale(PERCENTAGE_SCALE, BigDecimal.ROUND_HALF_UP);
317 return bigDecValue;
318 }
319
320 /**
321 * Sets the csfTimePercent attribute.
322 *
323 * @param csfTimePercent The csfTimePercent to set.
324 */
325 public void setCsfTimePercent(BigDecimal csfTimePercent) {
326 this.csfTimePercent = csfTimePercent;
327 }
328
329
330 /**
331 * Gets the csfFundingStatusCode attribute.
332 *
333 * @return Returns the csfFundingStatusCode
334 */
335 public String getCsfFundingStatusCode() {
336 return csfFundingStatusCode;
337 }
338
339 /**
340 * Sets the csfFundingStatusCode attribute.
341 *
342 * @param csfFundingStatusCode The csfFundingStatusCode to set.
343 */
344 public void setCsfFundingStatusCode(String csfFundingStatusCode) {
345 this.csfFundingStatusCode = csfFundingStatusCode;
346 }
347
348
349 /**
350 * Gets the employeeRecord attribute.
351 *
352 * @return Returns the employeeRecord
353 */
354 public Integer getEmployeeRecord() {
355 return employeeRecord;
356 }
357
358 /**
359 * Sets the employeeRecord attribute.
360 *
361 * @param employeeRecord The employeeRecord to set.
362 */
363 public void setEmployeeRecord(Integer employeeRecord) {
364 this.employeeRecord = employeeRecord;
365 }
366
367
368 /**
369 * Gets the earnCode attribute.
370 *
371 * @return Returns the earnCode
372 */
373 public String getEarnCode() {
374 return earnCode;
375 }
376
377 /**
378 * Sets the earnCode attribute.
379 *
380 * @param earnCode The earnCode to set.
381 */
382 public void setEarnCode(String earnCode) {
383 this.earnCode = earnCode;
384 }
385
386
387 /**
388 * Gets the additionalSequence attribute.
389 *
390 * @return Returns the additionalSequence
391 */
392 public Integer getAdditionalSequence() {
393 return additionalSequence;
394 }
395
396 /**
397 * Sets the additionalSequence attribute.
398 *
399 * @param additionalSequence The additionalSequence to set.
400 */
401 public void setAdditionalSequence(Integer additionalSequence) {
402 this.additionalSequence = additionalSequence;
403 }
404
405
406 /**
407 * Gets the effectiveDate attribute.
408 *
409 * @return Returns the effectiveDate
410 */
411 public Date getEffectiveDate() {
412 return effectiveDate;
413 }
414
415 /**
416 * Sets the effectiveDate attribute.
417 *
418 * @param effectiveDate The effectiveDate to set.
419 */
420 public void setEffectiveDate(Date effectiveDate) {
421 this.effectiveDate = effectiveDate;
422 }
423
424
425 /**
426 * Gets the effectiveSequence attribute.
427 *
428 * @return Returns the effectiveSequence
429 */
430 public Integer getEffectiveSequence() {
431 return effectiveSequence;
432 }
433
434 /**
435 * Sets the effectiveSequence attribute.
436 *
437 * @param effectiveSequence The effectiveSequence to set.
438 */
439 public void setEffectiveSequence(Integer effectiveSequence) {
440 this.effectiveSequence = effectiveSequence;
441 }
442
443
444 /**
445 * Gets the financialObject attribute.
446 *
447 * @return Returns the financialObject
448 */
449 public ObjectCode getFinancialObject() {
450 return financialObject;
451 }
452
453 /**
454 * Sets the financialObject attribute.
455 *
456 * @param financialObject The financialObject to set.
457 * @deprecated
458 */
459 public void setFinancialObject(ObjectCode financialObject) {
460 this.financialObject = financialObject;
461 }
462
463 /**
464 * Gets the chartOfAccounts attribute.
465 *
466 * @return Returns the chartOfAccounts
467 */
468 public Chart getChartOfAccounts() {
469 return chartOfAccounts;
470 }
471
472 /**
473 * Sets the chartOfAccounts attribute.
474 *
475 * @param chartOfAccounts The chartOfAccounts to set.
476 * @deprecated
477 */
478 public void setChartOfAccounts(Chart chartOfAccounts) {
479 this.chartOfAccounts = chartOfAccounts;
480 }
481
482 /**
483 * Gets the account attribute.
484 *
485 * @return Returns the account
486 */
487 public Account getAccount() {
488 return account;
489 }
490
491 /**
492 * Sets the account attribute.
493 *
494 * @param account The account to set.
495 * @deprecated
496 */
497 public void setAccount(Account account) {
498 this.account = account;
499 }
500
501 /**
502 * @return Returns the subAccount.
503 */
504 public SubAccount getSubAccount() {
505 return subAccount;
506 }
507
508 /**
509 * @param subAccount The subAccount to set.
510 * @deprecated
511 */
512 public void setSubAccount(SubAccount subAccount) {
513 this.subAccount = subAccount;
514 }
515
516
517 /**
518 * Gets the universityFiscal attribute.
519 *
520 * @return Returns the universityFiscal.
521 */
522 public SystemOptions getUniversityFiscal() {
523 return universityFiscal;
524 }
525
526 /**
527 * Sets the universityFiscal attribute value.
528 *
529 * @param universityFiscal The universityFiscal to set.
530 */
531 public void setUniversityFiscal(SystemOptions universityFiscal) {
532 this.universityFiscal = universityFiscal;
533 }
534
535 /**
536 * @see org.kuali.rice.kns.bo.BusinessObjectBase#toStringMapper()
537 */
538 protected LinkedHashMap toStringMapper() {
539 LinkedHashMap m = new LinkedHashMap();
540 if (this.universityFiscalYear != null) {
541 m.put("universityFiscalYear", this.universityFiscalYear.toString());
542 }
543 m.put("chartOfAccountsCode", this.chartOfAccountsCode);
544 m.put("accountNumber", this.accountNumber);
545 m.put("subAccountNumber", this.subAccountNumber);
546 m.put("financialObjectCode", this.financialObjectCode);
547 m.put("financialSubObjectCode", this.financialSubObjectCode);
548 m.put("positionNumber", this.positionNumber);
549 m.put("emplid", this.emplid);
550 if (this.csfCreateTimestamp != null) {
551 m.put("csfCreateTimestamp", this.csfCreateTimestamp.toString());
552 }
553 return m;
554 }
555
556 public String getName() {
557 Person person = (Person) SpringContext.getBean(PersonService.class).getPersonByEmployeeId(getEmplid());
558 if (person == null) {
559 return LaborConstants.BalanceInquiries.UnknownPersonName;
560 }
561
562 return person.getName();
563 }
564
565 public void setName(String name) {
566 this.name = name;
567 }
568
569 /**
570 * Gets the financialSubObject attribute.
571 *
572 * @return Returns the financialSubObject.
573 */
574 public SubObjectCode getFinancialSubObject() {
575 return financialSubObject;
576 }
577
578 /**
579 * Sets the financialSubObject attribute value.
580 *
581 * @param financialSubObject The financialSubObject to set.
582 * @deprecated
583 */
584 public void setFinancialSubObject(SubObjectCode financialSubObject) {
585 this.financialSubObject = financialSubObject;
586 }
587
588 public CalculatedSalaryFoundationTrackerOverride getCalculatedSalaryFoundationTrackerOverride() {
589 return calculatedSalaryFoundationTrackerOverride;
590 }
591
592 public void setCalculatedSalaryFoundationTrackerOverride(CalculatedSalaryFoundationTrackerOverride calculatedSalaryFoundationTrackerOverride) {
593 this.calculatedSalaryFoundationTrackerOverride = calculatedSalaryFoundationTrackerOverride;
594 }
595
596 public boolean isOverride() {
597
598 return (getCalculatedSalaryFoundationTrackerOverride() != null);
599 }
600
601 public String getPositionLookupPositionNumber() {
602 if ( isOverride() ) return getCalculatedSalaryFoundationTrackerOverride().getPositionNumber();
603
604 return getPositionNumber();
605 }
606
607 public KualiDecimal getPositionLookupCsfAmount() {
608 if ( isOverride() ) return getCalculatedSalaryFoundationTrackerOverride().getCsfAmount();
609
610 return getCsfAmount();
611 }
612
613 public BigDecimal getPositionLookupCsfFullTimeEmploymentQuantity() {
614 if ( isOverride() ) return getCalculatedSalaryFoundationTrackerOverride().getCsfFullTimeEmploymentQuantity();
615
616 return getCsfFullTimeEmploymentQuantity();
617 }
618
619 public String getPositionLookupOverrideFlag() {
620
621 return isOverride() ? "Y" : "N";
622 }
623 }
624