001 /**
002 * Copyright 2004-2013 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 package org.kuali.hr.job;
017
018 import java.math.BigDecimal;
019
020 import org.kuali.hr.core.KPMEConstants;
021 import org.kuali.hr.location.Location;
022 import org.kuali.hr.paygrade.PayGrade;
023 import org.kuali.hr.time.HrBusinessObject;
024 import org.kuali.hr.time.department.Department;
025 import org.kuali.hr.time.paytype.PayType;
026 import org.kuali.hr.time.position.Position;
027 import org.kuali.hr.time.salgroup.SalGroup;
028 import org.kuali.hr.time.util.TkConstants;
029 import org.kuali.rice.kim.api.identity.Person;
030 import org.kuali.rice.kim.api.identity.principal.EntityNamePrincipalName;
031 import org.kuali.rice.kim.api.identity.principal.Principal;
032 import org.kuali.rice.kim.api.services.KimApiServiceLocator;
033
034 public class Job extends HrBusinessObject {
035
036 private static final long serialVersionUID = 1369595897637935064L;
037
038 public static final String CACHE_NAME = KPMEConstants.APPLICATION_NAMESPACE_CODE + "/" + "Job";
039
040 private String location;
041 private String hrPayType;
042 private String payGrade;
043 private BigDecimal standardHours;
044 private String hrJobId;
045 private String principalId;
046 private String firstName;
047 private String lastName;
048 private String principalName;
049 private Long jobNumber;
050 private String dept;
051 private String hrSalGroup;
052 private Boolean primaryIndicator;
053 private Boolean history;
054 private BigDecimal compRate = new BigDecimal(0);
055 private String positionNumber;
056
057 private String hrDeptId;
058 private String hrPayTypeId;
059 private boolean eligibleForLeave;
060
061 private transient Person principal;
062 private transient Department deptObj;
063 private PayType payTypeObj;
064 private transient Location locationObj;
065 private transient PayGrade payGradeObj;
066 private transient SalGroup salGroupObj;
067 private transient Position positionObj;
068
069 private BigDecimal fte = new BigDecimal(0); //kpme1465, chen
070 private String flsaStatus;
071
072 public String getFlsaStatus() {
073 return flsaStatus;
074 }
075
076 public void setFlsaStatus(String flsaStatus) {
077 this.flsaStatus = flsaStatus;
078 }
079
080 public BigDecimal getFte() {
081 if ( this.standardHours != null ) {
082 return this.standardHours.divide(new BigDecimal(40)).setScale(2);
083 } else {
084 return fte;
085 }
086 }
087
088 public void setFte() {
089 if ( this.standardHours != null ) {
090 this.fte = this.standardHours.divide(new BigDecimal(40)).setScale(2);
091 } else {
092 this.fte = new BigDecimal(0).setScale(2);
093 }
094 }
095
096 public String getPayGrade() {
097 return payGrade;
098 }
099
100 public void setPayGrade(String payGrade) {
101 this.payGrade = payGrade;
102 }
103
104 public BigDecimal getStandardHours() {
105 return standardHours;
106 }
107
108 public void setStandardHours(BigDecimal standardHours) {
109 this.standardHours = standardHours;
110 }
111
112 public String getPrincipalId() {
113 return principalId;
114 }
115
116 public void setPrincipalId(String principalId) {
117 this.principalId = principalId;
118 }
119
120 public String getFirstName() {
121 return firstName;
122 }
123
124 public void setFirstName(String firstName) {
125 this.firstName = firstName;
126 }
127
128 public String getLastName() {
129 return lastName;
130 }
131
132 public void setLastName(String lastName) {
133 this.lastName = lastName;
134 }
135
136 public String getName() {
137 if (principal == null) {
138 principal = KimApiServiceLocator.getPersonService().getPerson(this.principalId);
139 }
140 return (principal != null) ? principal.getName() : "";
141 }
142
143 public String getPrincipalName() {
144 if(principalName == null && !this.getPrincipalId().isEmpty()) {
145 EntityNamePrincipalName aPerson = KimApiServiceLocator.getIdentityService().getDefaultNamesForPrincipalId(getPrincipalId());
146 if (aPerson != null && aPerson.getDefaultName() != null) {
147 setPrincipalName(aPerson.getDefaultName().getCompositeName());
148 }
149 }
150 return principalName;
151 }
152
153 public void setPrincipalName(String principalName) {
154 this.principalName = principalName;
155 }
156
157 public Long getJobNumber() {
158 return jobNumber;
159 }
160
161 public void setJobNumber(Long jobNumber) {
162 this.jobNumber = jobNumber;
163 }
164
165 public Boolean getHistory() {
166 return history;
167 }
168
169 public void setHistory(Boolean history) {
170 this.history = history;
171 }
172
173 public void setLocation(String location) {
174 this.location = location;
175 }
176
177 public String getLocation() {
178 return location;
179 }
180
181 public String getHrPayType() {
182 return hrPayType;
183 }
184
185 public void setHrPayType(String hrPayType) {
186 this.hrPayType = hrPayType;
187 }
188
189 public String getHrJobId() {
190 return hrJobId;
191 }
192
193 public void setHrJobId(String hrJobId) {
194 this.hrJobId = hrJobId;
195 }
196
197 public String getDept() {
198 return dept;
199 }
200
201 public void setDept(String dept) {
202 this.dept = dept;
203 }
204
205 public String getHrSalGroup() {
206 return hrSalGroup;
207 }
208
209 public void setHrSalGroup(String hrSalGroup) {
210 this.hrSalGroup = hrSalGroup;
211 }
212
213
214 public BigDecimal getCompRate() {
215 return compRate;
216 }
217
218
219 public void setCompRate(BigDecimal compRate) {
220 if(compRate != null){
221 this.compRate = compRate.setScale(TkConstants.BIG_DECIMAL_SCALE);
222 } else {
223 this.compRate = compRate;
224 }
225 }
226
227 public Department getDeptObj() {
228 return deptObj;
229 }
230
231
232 public void setDeptObj(Department deptObj) {
233 this.deptObj = deptObj;
234 }
235
236
237 public PayType getPayTypeObj() {
238 return payTypeObj;
239 }
240
241
242 public void setPayTypeObj(PayType payTypeObj) {
243 this.payTypeObj = payTypeObj;
244 }
245
246
247 public Person getPrincipal() {
248 return principal;
249 }
250
251
252 public void setPrincipal(Person principal) {
253 this.principal = principal;
254 }
255
256
257 public void setPrimaryIndicator(Boolean primaryIndicator) {
258 this.primaryIndicator = primaryIndicator;
259 }
260
261
262 public Boolean getPrimaryIndicator() {
263 return primaryIndicator;
264 }
265
266 public Location getLocationObj() {
267 return locationObj;
268 }
269
270 public void setLocationObj(Location locationObj) {
271 this.locationObj = locationObj;
272 }
273
274 public PayGrade getPayGradeObj() {
275 return payGradeObj;
276 }
277
278 public void setPayGradeObj(PayGrade payGradeObj) {
279 this.payGradeObj = payGradeObj;
280 }
281
282 public SalGroup getSalGroupObj() {
283 return salGroupObj;
284 }
285
286 public void setSalGroupObj(SalGroup salGroupObj) {
287 this.salGroupObj = salGroupObj;
288 }
289
290 public void setPositionNumber(String positionNumber) {
291 this.positionNumber = positionNumber;
292 }
293
294 public String getPositionNumber() {
295 return positionNumber;
296 }
297
298 public void setPositionObj(Position positionObj) {
299 this.positionObj = positionObj;
300 }
301
302 public Position getPositionObj() {
303 return positionObj;
304 }
305
306 public String getHrDeptId() {
307 return hrDeptId;
308 }
309
310 public void setHrDeptId(String hrDeptId) {
311 this.hrDeptId = hrDeptId;
312 }
313
314 public String getHrPayTypeId() {
315 return hrPayTypeId;
316 }
317
318 public void setHrPayTypeId(String hrPayTypeId) {
319 this.hrPayTypeId = hrPayTypeId;
320 }
321
322 @Override
323 public String getUniqueKey() {
324 return getPrincipalId() + "_" + getJobNumber();
325 }
326
327 @Override
328 public String getId() {
329 return getHrJobId();
330 }
331
332 @Override
333 public void setId(String id) {
334 setHrJobId(id);
335 }
336 public boolean isEligibleForLeave() {
337 return eligibleForLeave;
338 }
339
340 public void setEligibleForLeave(boolean eligibleForLeave) {
341 this.eligibleForLeave = eligibleForLeave;
342 }
343
344 }