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