1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krms.impl.repository;
17
18 import org.kuali.rice.kns.inquiry.KualiInquirableImpl;
19 import org.kuali.rice.krad.data.DataObjectService;
20 import org.kuali.rice.krad.service.KRADServiceLocator;
21
22 import java.util.Map;
23
24
25
26
27
28
29 public class TermSpecificationInquiryHelperServiceImpl extends KualiInquirableImpl {
30
31 private DataObjectService dataObjectService;
32
33
34
35
36
37
38
39 @Override
40 public TermSpecificationBo retrieveDataObject(Map fieldValues) {
41 TermSpecificationBo termSpecification = getDataObjectService().find(TermSpecificationBo.class, fieldValues.get("id"));
42
43 if (termSpecification == null) { return null; }
44
45 for (ContextValidTermBo contextValidTerm : termSpecification.getContextValidTerms()) {
46 ContextBo context = getDataObjectService().find(ContextBo.class, contextValidTerm.getContextId());
47
48 if (context != null) {
49 termSpecification.getContextIds().add(context.getId());
50 termSpecification.getContexts().add(context);
51 }
52 }
53
54 return termSpecification;
55 }
56
57 public DataObjectService getDataObjectService() {
58 if (dataObjectService == null) {
59 return KRADServiceLocator.getDataObjectService();
60 }
61 return dataObjectService;
62 }
63
64 public void setDataObjectService(DataObjectService dataObjectService) {
65 this.dataObjectService = dataObjectService;
66 }
67 }