1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.hr.job;
17
18 import java.math.BigDecimal;
19 import java.math.RoundingMode;
20 import java.util.Arrays;
21 import java.util.Collections;
22 import java.util.List;
23
24 import org.kuali.hr.core.KPMEConstants;
25 import org.kuali.hr.lm.earncodesec.EarnCodeSecurity;
26 import org.kuali.hr.location.Location;
27 import org.kuali.hr.paygrade.PayGrade;
28 import org.kuali.hr.time.HrBusinessObject;
29 import org.kuali.hr.time.assignment.Assignment;
30 import org.kuali.hr.time.department.Department;
31 import org.kuali.hr.time.paytype.PayType;
32 import org.kuali.hr.time.position.Position;
33 import org.kuali.hr.time.salgroup.SalGroup;
34 import org.kuali.hr.time.util.TkConstants;
35 import org.kuali.rice.kim.api.identity.Person;
36 import org.kuali.rice.kim.api.identity.principal.EntityNamePrincipalName;
37 import org.kuali.rice.kim.api.services.KimApiServiceLocator;
38
39 public class Job extends HrBusinessObject {
40
41 private static final long serialVersionUID = 1369595897637935064L;
42
43 public static final String CACHE_NAME = KPMEConstants.APPLICATION_NAMESPACE_CODE + "/" + "Job";
44 private static final String[] PRIVATE_CACHES_FOR_FLUSH = {Job.CACHE_NAME, Assignment.CACHE_NAME};
45 public static final List<String> CACHE_FLUSH = Collections.unmodifiableList(Arrays.asList(PRIVATE_CACHES_FOR_FLUSH));
46
47 private String location;
48 private String hrPayType;
49 private String payGrade;
50 private BigDecimal standardHours;
51 private String hrJobId;
52 private String principalId;
53 private String firstName;
54 private String lastName;
55 private String principalName;
56 private Long jobNumber;
57 private String dept;
58 private String hrSalGroup;
59 private Boolean primaryIndicator;
60 private Boolean history;
61 private BigDecimal compRate = new BigDecimal(0);
62 private String positionNumber;
63
64 private String hrDeptId;
65 private String hrPayTypeId;
66 private boolean eligibleForLeave;
67
68 private transient Person principal;
69 private transient Department deptObj;
70 private PayType payTypeObj;
71 private transient Location locationObj;
72 private transient PayGrade payGradeObj;
73 private transient SalGroup salGroupObj;
74 private transient Position positionObj;
75
76 private BigDecimal fte = new BigDecimal(0);
77 private String flsaStatus;
78
79 public String getFlsaStatus() {
80 return flsaStatus;
81 }
82
83 public void setFlsaStatus(String flsaStatus) {
84 this.flsaStatus = flsaStatus;
85 }
86
87 public BigDecimal getFte() {
88 if ( this.standardHours != null ) {
89 return this.standardHours.divide(new BigDecimal(40)).setScale(2, RoundingMode.HALF_EVEN);
90 } else {
91 return fte;
92 }
93 }
94
95 public void setFte() {
96 if ( this.standardHours != null ) {
97 this.fte = this.standardHours.divide(new BigDecimal(40)).setScale(2, RoundingMode.HALF_EVEN);
98 } else {
99 this.fte = new BigDecimal(0).setScale(2);
100 }
101 }
102
103 public String getPayGrade() {
104 return payGrade;
105 }
106
107 public void setPayGrade(String payGrade) {
108 this.payGrade = payGrade;
109 }
110
111 public BigDecimal getStandardHours() {
112 return standardHours;
113 }
114
115 public void setStandardHours(BigDecimal standardHours) {
116 this.standardHours = standardHours;
117 }
118
119 public String getPrincipalId() {
120 return principalId;
121 }
122
123 public void setPrincipalId(String principalId) {
124 this.principalId = principalId;
125 }
126
127 public String getFirstName() {
128 return firstName;
129 }
130
131 public void setFirstName(String firstName) {
132 this.firstName = firstName;
133 }
134
135 public String getLastName() {
136 return lastName;
137 }
138
139 public void setLastName(String lastName) {
140 this.lastName = lastName;
141 }
142
143 public String getName() {
144 if (principal == null) {
145 principal = KimApiServiceLocator.getPersonService().getPerson(this.principalId);
146 }
147 return (principal != null) ? principal.getName() : "";
148 }
149
150 public String getPrincipalName() {
151 if(principalName == null && !this.getPrincipalId().isEmpty()) {
152 EntityNamePrincipalName aPerson = KimApiServiceLocator.getIdentityService().getDefaultNamesForPrincipalId(getPrincipalId());
153 if (aPerson != null && aPerson.getDefaultName() != null) {
154 setPrincipalName(aPerson.getDefaultName().getCompositeName());
155 }
156 }
157 return principalName;
158 }
159
160 public void setPrincipalName(String principalName) {
161 this.principalName = principalName;
162 }
163
164 public Long getJobNumber() {
165 return jobNumber;
166 }
167
168 public void setJobNumber(Long jobNumber) {
169 this.jobNumber = jobNumber;
170 }
171
172 public Boolean getHistory() {
173 return history;
174 }
175
176 public void setHistory(Boolean history) {
177 this.history = history;
178 }
179
180 public void setLocation(String location) {
181 this.location = location;
182 }
183
184 public String getLocation() {
185 return location;
186 }
187
188 public String getHrPayType() {
189 return hrPayType;
190 }
191
192 public void setHrPayType(String hrPayType) {
193 this.hrPayType = hrPayType;
194 }
195
196 public String getHrJobId() {
197 return hrJobId;
198 }
199
200 public void setHrJobId(String hrJobId) {
201 this.hrJobId = hrJobId;
202 }
203
204 public String getDept() {
205 return dept;
206 }
207
208 public void setDept(String dept) {
209 this.dept = dept;
210 }
211
212 public String getHrSalGroup() {
213 return hrSalGroup;
214 }
215
216 public void setHrSalGroup(String hrSalGroup) {
217 this.hrSalGroup = hrSalGroup;
218 }
219
220
221 public BigDecimal getCompRate() {
222 return compRate;
223 }
224
225
226 public void setCompRate(BigDecimal compRate) {
227 if(compRate != null){
228 this.compRate = compRate.setScale(TkConstants.BIG_DECIMAL_SCALE);
229 } else {
230 this.compRate = compRate;
231 }
232 }
233
234 public Department getDeptObj() {
235 return deptObj;
236 }
237
238
239 public void setDeptObj(Department deptObj) {
240 this.deptObj = deptObj;
241 }
242
243
244 public PayType getPayTypeObj() {
245 return payTypeObj;
246 }
247
248
249 public void setPayTypeObj(PayType payTypeObj) {
250 this.payTypeObj = payTypeObj;
251 }
252
253
254 public Person getPrincipal() {
255 return principal;
256 }
257
258
259 public void setPrincipal(Person principal) {
260 this.principal = principal;
261 }
262
263
264 public void setPrimaryIndicator(Boolean primaryIndicator) {
265 this.primaryIndicator = primaryIndicator;
266 }
267
268
269 public Boolean getPrimaryIndicator() {
270 return primaryIndicator;
271 }
272
273 public Location getLocationObj() {
274 return locationObj;
275 }
276
277 public void setLocationObj(Location locationObj) {
278 this.locationObj = locationObj;
279 }
280
281 public PayGrade getPayGradeObj() {
282 return payGradeObj;
283 }
284
285 public void setPayGradeObj(PayGrade payGradeObj) {
286 this.payGradeObj = payGradeObj;
287 }
288
289 public SalGroup getSalGroupObj() {
290 return salGroupObj;
291 }
292
293 public void setSalGroupObj(SalGroup salGroupObj) {
294 this.salGroupObj = salGroupObj;
295 }
296
297 public void setPositionNumber(String positionNumber) {
298 this.positionNumber = positionNumber;
299 }
300
301 public String getPositionNumber() {
302 return positionNumber;
303 }
304
305 public void setPositionObj(Position positionObj) {
306 this.positionObj = positionObj;
307 }
308
309 public Position getPositionObj() {
310 return positionObj;
311 }
312
313 public String getHrDeptId() {
314 return hrDeptId;
315 }
316
317 public void setHrDeptId(String hrDeptId) {
318 this.hrDeptId = hrDeptId;
319 }
320
321 public String getHrPayTypeId() {
322 return hrPayTypeId;
323 }
324
325 public void setHrPayTypeId(String hrPayTypeId) {
326 this.hrPayTypeId = hrPayTypeId;
327 }
328
329 @Override
330 public String getUniqueKey() {
331 return getPrincipalId() + "_" + getJobNumber();
332 }
333
334 @Override
335 public String getId() {
336 return getHrJobId();
337 }
338
339 @Override
340 public void setId(String id) {
341 setHrJobId(id);
342 }
343 public boolean isEligibleForLeave() {
344 return eligibleForLeave;
345 }
346
347 public void setEligibleForLeave(boolean eligibleForLeave) {
348 this.eligibleForLeave = eligibleForLeave;
349 }
350
351 }