1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.hr.time.workarea.web;
17
18 import java.util.Map;
19
20 import org.apache.commons.lang3.StringUtils;
21 import org.kuali.hr.time.service.base.TkServiceLocator;
22 import org.kuali.hr.time.util.TKUtils;
23 import org.kuali.hr.time.workarea.WorkArea;
24 import org.kuali.rice.kns.inquiry.KualiInquirableImpl;
25 import org.kuali.rice.krad.bo.BusinessObject;
26
27 public class WorkAreaInquirableImpl extends KualiInquirableImpl {
28
29 private static final long serialVersionUID = -4002061046745019065L;
30
31 @Override
32 public BusinessObject getBusinessObject(Map fieldValues) {
33 WorkArea workArea = null;
34 if (StringUtils.isNotBlank((String)fieldValues.get("tkWorkAreaId"))) {
35 workArea = TkServiceLocator.getWorkAreaService().getWorkArea((String)fieldValues.get("tkWorkAreaId"));
36 } else if (fieldValues.containsKey("workArea") && fieldValues.containsKey("effectiveDate")) {
37 String workAreaVal = (String)fieldValues.get("workArea");
38 Long wa = workAreaVal != null ? Long.parseLong(workAreaVal) : null;
39 workArea = TkServiceLocator.getWorkAreaService().getWorkArea(wa,
40 new java.sql.Date(TKUtils.convertDateStringToTimestampNoTimezone((String)fieldValues.get("effectiveDate")).getTime()));
41 } else {
42 workArea = (WorkArea) super.getBusinessObject(fieldValues);
43 }
44
45 if (workArea != null) {
46 TkServiceLocator.getWorkAreaService().populateWorkAreaTasks(workArea);
47 TkServiceLocator.getWorkAreaService().populateWorkAreaRoles(workArea);
48 }
49
50 return workArea;
51 }
52
53 }