1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.kpme.tklm.leave.adjustment;
17
18 import java.math.BigDecimal;
19
20 import org.apache.commons.lang.StringUtils;
21 import org.kuali.kpme.core.accrualcategory.AccrualCategory;
22 import org.kuali.kpme.core.bo.HrBusinessObject;
23 import org.kuali.kpme.core.earncode.EarnCode;
24 import org.kuali.kpme.core.principal.PrincipalHRAttributes;
25 import org.kuali.kpme.core.service.HrServiceLocator;
26 import org.kuali.kpme.tklm.api.leave.adjustment.LeaveAdjustmentContract;
27 import org.kuali.rice.kim.api.identity.Person;
28 import org.kuali.rice.kim.api.services.KimApiServiceLocator;
29
30 import com.google.common.collect.ImmutableList;
31
32 public class LeaveAdjustment extends HrBusinessObject implements LeaveAdjustmentContract {
33 private static final long serialVersionUID = 1L;
34 public static final ImmutableList<String> EQUAL_TO_FIELDS = new ImmutableList.Builder<String>()
35 .add("principalId")
36 .add("jobNumber")
37 .add("accrualCategory")
38 .add("earnCode")
39 .build();
40 private String lmLeaveAdjustmentId;
41 private String principalId;
42 private String leavePlan;
43 private String accrualCategory;
44 private String earnCode;
45 private String description;
46 private BigDecimal adjustmentAmount = new BigDecimal("0.0");
47 private transient Person principal;
48 private transient AccrualCategory accrualCategoryObj;
49 private transient EarnCode earnCodeObj;
50 private transient PrincipalHRAttributes principalHRAttrObj;
51
52 public String getEarnCode() {
53 return earnCode;
54 }
55 public void setEarnCode(String earnCode) {
56 this.earnCode = earnCode;
57 }
58 public EarnCode getEarnCodeObj() {
59 return earnCodeObj;
60 }
61 public void setEarnCodeObj(EarnCode earnCodeObj) {
62 this.earnCodeObj = earnCodeObj;
63 }
64 public String getPrincipalId() {
65 return principalId;
66 }
67 public void setPrincipalId(String principalId) {
68 this.principalId = principalId;
69 }
70 public Person getPrincipal() {
71 return principal;
72 }
73 public void setPrincipal(Person principal) {
74 this.principal = principal;
75 }
76 public String getName() {
77 if (principal == null) {
78 principal = KimApiServiceLocator.getPersonService().getPerson(this.principalId);
79 }
80 return (principal != null) ? principal.getName() : "";
81 }
82
83 public String getLeavePlan() {
84 if (!StringUtils.isEmpty(this.principalId)) {
85 principalHRAttrObj = HrServiceLocator.getPrincipalHRAttributeService().getPrincipalCalendar(principalId, this.getEffectiveLocalDate());
86 }
87 return (principalHRAttrObj != null) ? principalHRAttrObj.getLeavePlan() : "";
88 }
89
90 public void setLeavePlan(String leavePlan) {
91 this.leavePlan = leavePlan;
92 }
93 public String getAccrualCategory() {
94 return accrualCategory;
95 }
96 public void setAccrualCategory(String accrualCategory) {
97 this.accrualCategory = accrualCategory;
98 }
99
100 public String getDescription() {
101 return description;
102 }
103 public void setDescription(String description) {
104 this.description = description;
105 }
106 public BigDecimal getAdjustmentAmount() {
107 return adjustmentAmount;
108 }
109 public void setAdjustmentAmount(BigDecimal adjustmentAmount) {
110 this.adjustmentAmount = adjustmentAmount;
111 }
112 public AccrualCategory getAccrualCategoryObj() {
113 return accrualCategoryObj;
114 }
115 public void setAccrualCategoryObj(AccrualCategory accrualCategoryObj) {
116 this.accrualCategoryObj = accrualCategoryObj;
117 }
118 public static long getSerialversionuid() {
119 return serialVersionUID;
120 }
121 public String getLmLeaveAdjustmentId() {
122 return lmLeaveAdjustmentId;
123 }
124 public void setLmLeaveAdjustmentId(String lmLeaveAdjustmentId) {
125 this.lmLeaveAdjustmentId = lmLeaveAdjustmentId;
126 }
127
128 @Override
129 protected String getUniqueKey() {
130 return getLmLeaveAdjustmentId();
131 }
132
133 @Override
134 public String getId() {
135 return getLmLeaveAdjustmentId();
136 }
137
138 @Override
139 public void setId(String id) {
140 setLmLeaveAdjustmentId(id);
141 }
142
143 public PrincipalHRAttributes getPrincipalHRAttrObj() {
144 return principalHRAttrObj;
145 }
146 public void setPrincipalHRAttrObj(PrincipalHRAttributes principalHRAttrObj) {
147 this.principalHRAttrObj = principalHRAttrObj;
148 }
149 }