View Javadoc

1   /**
2    * Copyright 2004-2013 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.hr.job;
17  
18  import java.math.BigDecimal;
19  
20  import org.kuali.hr.core.KPMEConstants;
21  import org.kuali.hr.location.Location;
22  import org.kuali.hr.paygrade.PayGrade;
23  import org.kuali.hr.time.HrBusinessObject;
24  import org.kuali.hr.time.department.Department;
25  import org.kuali.hr.time.paytype.PayType;
26  import org.kuali.hr.time.position.Position;
27  import org.kuali.hr.time.salgroup.SalGroup;
28  import org.kuali.hr.time.util.TkConstants;
29  import org.kuali.rice.kim.api.identity.Person;
30  import org.kuali.rice.kim.api.identity.principal.EntityNamePrincipalName;
31  import org.kuali.rice.kim.api.identity.principal.Principal;
32  import org.kuali.rice.kim.api.services.KimApiServiceLocator;
33  
34  public class Job extends HrBusinessObject {
35  
36  	private static final long serialVersionUID = 1369595897637935064L;
37  
38  	public static final String CACHE_NAME = KPMEConstants.APPLICATION_NAMESPACE_CODE + "/" + "Job";
39  	
40  	private String location;
41  	private String hrPayType;
42  	private String payGrade;
43  	private BigDecimal standardHours;
44  	private String hrJobId;
45  	private String principalId;
46  	private String firstName;
47  	private String lastName;
48  	private String principalName;
49  	private Long jobNumber;
50  	private String dept;
51  	private String hrSalGroup;
52  	private Boolean primaryIndicator;
53  	private Boolean history;
54  	private BigDecimal compRate = new BigDecimal(0);
55  	private String positionNumber;
56  	
57  	private String hrDeptId;
58  	private String hrPayTypeId;
59  	private boolean eligibleForLeave;
60  	
61  	private transient Person principal;
62  	private transient Department deptObj;
63  	private PayType payTypeObj;
64  	private transient Location locationObj;
65      private transient PayGrade payGradeObj;
66      private transient SalGroup salGroupObj;
67      private transient Position positionObj;
68      
69      private BigDecimal fte = new BigDecimal(0); //kpme1465, chen
70      private String flsaStatus;
71      
72  	public String getFlsaStatus() {
73  		return flsaStatus;
74  	}
75  
76  	public void setFlsaStatus(String flsaStatus) {
77  		this.flsaStatus = flsaStatus;
78  	}
79  
80  	public BigDecimal getFte() {
81  		if ( this.standardHours != null ) {
82  			return this.standardHours.divide(new BigDecimal(40)).setScale(2);
83  		} else {
84  			return fte;
85  		}
86  	}
87  
88  	public void setFte() {
89  		if ( this.standardHours != null ) {
90  			this.fte = this.standardHours.divide(new BigDecimal(40)).setScale(2);
91  		} else {
92  			this.fte = new BigDecimal(0).setScale(2);
93  		}
94  	}
95  	
96  	public String getPayGrade() {
97  		return payGrade;
98  	}
99  
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 }