1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.kpme.core.department.web;
17
18
19 import java.util.Map;
20
21 import org.apache.commons.lang.StringUtils;
22 import org.joda.time.LocalDate;
23 import org.kuali.kpme.core.department.DepartmentBo;
24 import org.kuali.kpme.core.service.HrServiceLocatorInternal;
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 DepartmentInquirableImpl extends KualiInquirableImpl {
30
31 private static final long serialVersionUID = 8809785231041208573L;
32
33
34 @Override
35 @SuppressWarnings("rawtypes")
36 public BusinessObject getBusinessObject(Map fieldValues) {
37 DepartmentBo departmentObj = null;
38
39 if (StringUtils.isNotBlank((String) fieldValues.get("hrDeptId"))) {
40 departmentObj = HrServiceLocatorInternal.getDepartmentInternalService().getDepartmentWithRoleData((String) fieldValues.get("hrDeptId"));
41 } else if (fieldValues.containsKey("dept") && fieldValues.containsKey("groupKeyCode") && fieldValues.containsKey("effectiveDate")) {
42 String department = (String) fieldValues.get("dept");
43 String groupKeyCode = (String) fieldValues.get("groupKeyCode");
44 String effDate = (String) fieldValues.get("effectiveDate");
45 LocalDate effectiveDate = StringUtils.isBlank(effDate) ? LocalDate.now() : TKUtils.formatDateString(effDate);
46 departmentObj = HrServiceLocatorInternal.getDepartmentInternalService().getDepartmentWithRoleData(department, groupKeyCode, effectiveDate);
47 } else {
48 departmentObj = (DepartmentBo) super.getBusinessObject(fieldValues);
49 }
50
51 return departmentObj;
52 }
53 }