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