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