1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.kpme.core.salarygroup.web;
17
18 import java.util.Map;
19
20 import org.apache.commons.lang.StringUtils;
21 import org.joda.time.LocalDate;
22 import org.kuali.kpme.core.api.salarygroup.SalaryGroupContract;
23 import org.kuali.kpme.core.salarygroup.SalaryGroupBo;
24 import org.kuali.kpme.core.service.HrServiceLocator;
25 import org.kuali.kpme.core.util.TKUtils;
26 import org.kuali.rice.kns.inquiry.KualiInquirableImpl;
27 import org.kuali.rice.krad.bo.BusinessObject;
28
29 public class SalaryGroupInquirableImpl extends KualiInquirableImpl {
30
31 private static final long serialVersionUID = 6341884912342980800L;
32
33 @Override
34 @SuppressWarnings("rawtypes")
35 public BusinessObject getBusinessObject(Map fieldValues) {
36 SalaryGroupBo salaryGroup = null;
37
38 if (StringUtils.isNotBlank((String)fieldValues.get("hrSalGroupId"))) {
39 salaryGroup = SalaryGroupBo.from(HrServiceLocator.getSalaryGroupService().getSalaryGroup((String) fieldValues.get("hrSalGroupId")));
40 } else if (StringUtils.isNotBlank((String)fieldValues.get("hrSalGroup"))
41 && StringUtils.isNotBlank((String)fieldValues.get("effectiveDate"))) {
42 String hrSalGroup = (String) fieldValues.get("hrSalGroup");
43 String effDate = (String) fieldValues.get("effectiveDate");
44 LocalDate effectiveDate = StringUtils.isBlank(effDate) ? LocalDate.now() : TKUtils.formatDateString(effDate);
45
46 salaryGroup = SalaryGroupBo.from(HrServiceLocator.getSalaryGroupService().getSalaryGroup(hrSalGroup, effectiveDate));
47 } else {
48 salaryGroup = (SalaryGroupBo) super.getBusinessObject(fieldValues);
49 }
50
51 return salaryGroup;
52 }
53
54 }