1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.kpme.core.institution.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.institution.InstitutionContract;
23 import org.kuali.kpme.core.institution.InstitutionBo;
24 import org.kuali.kpme.core.service.HrServiceLocator;
25 import org.kuali.kpme.core.util.TKUtils;
26 import org.kuali.kpme.core.util.ValidationUtils;
27 import org.kuali.rice.kns.inquiry.KualiInquirableImpl;
28 import org.kuali.rice.krad.bo.BusinessObject;
29
30 @SuppressWarnings("deprecation")
31 public class InstitutionInquirableImpl extends KualiInquirableImpl {
32
33 private static final long serialVersionUID = 7952001181052895833L;
34
35 @Override
36 @SuppressWarnings("rawtypes")
37 public BusinessObject getBusinessObject(Map fieldValues) {
38 InstitutionBo institutionObj = null;
39 if (StringUtils.isNotBlank((String) fieldValues.get("pmInstitutionId"))) {
40 institutionObj = InstitutionBo.from(HrServiceLocator.getInstitutionService().getInstitutionById((String) fieldValues.get("pmInstitutionId")));
41 } else if (fieldValues.containsKey("institutionCode") && fieldValues.containsKey("effectiveDate")) {
42 String effDate = (String) fieldValues.get("effectiveDate");
43 LocalDate effectiveDate = StringUtils.isBlank(effDate) ? LocalDate.now() : TKUtils.formatDateString(effDate);
44
45 institutionObj = InstitutionBo.from(HrServiceLocator.getInstitutionService().getInstitution((String)fieldValues.get("institutionCode"), effectiveDate));
46 } else {
47 if(fieldValues.get("institutionCode") != null && !ValidationUtils.isWildCard(fieldValues.get("institutionCode").toString())){
48 institutionObj = (InstitutionBo) super.getBusinessObject(fieldValues);
49 }
50 }
51 return institutionObj;
52 }
53
54 }