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