1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.kpme.core.location.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.api.location.LocationContract;
24 import org.kuali.kpme.core.location.LocationBo;
25 import org.kuali.kpme.core.service.HrServiceLocator;
26 import org.kuali.kpme.core.service.HrServiceLocatorInternal;
27 import org.kuali.kpme.core.util.TKUtils;
28 import org.kuali.kpme.core.util.ValidationUtils;
29 import org.kuali.rice.kns.inquiry.KualiInquirableImpl;
30 import org.kuali.rice.krad.inquiry.InquirableImpl;
31
32 public class LocationInquirableImpl extends KualiInquirableImpl {
33
34 private static final long serialVersionUID = -828163766114475072L;
35
36 @Override
37 @SuppressWarnings("rawtypes")
38 public LocationContract retrieveDataObject(Map fieldValues) {
39 LocationBo locationObj = null;
40
41 if (StringUtils.isNotBlank((String) fieldValues.get("hrLocationId"))) {
42 locationObj = HrServiceLocatorInternal.getLocationInternalService().getLocationWithRoleData((String) fieldValues.get("hrLocationId"));
43 } else if (fieldValues.containsKey("location")) {
44 String location = (String) fieldValues.get("location");
45 String effDate = (String) fieldValues.get("effectiveDate");
46 LocalDate effectiveDate = StringUtils.isBlank(effDate) ? LocalDate.now() : TKUtils.formatDateString(effDate);
47
48 locationObj = HrServiceLocatorInternal.getLocationInternalService().getLocationWithRoleData(location, effectiveDate);
49 } else {
50 if(fieldValues.get("location") != null && !ValidationUtils.isWildCard(fieldValues.get("location").toString())){
51 locationObj = (LocationBo) super.retrieveDataObject(fieldValues);
52 }
53 }
54
55 return locationObj;
56
57 }
58
59 }