1 /**
2 * Copyright 2005-2015 The Kuali Foundation
3 *
4 * Licensed under the Educational Community License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.opensource.org/licenses/ecl2.php
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
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 * Helper service to assist with fetching TermSpecificationBos that have all the properties needed for display
26 *
27 * @author Kuali Rice Team (rice.collab@kuali.org)
28 */
29 public class TermSpecificationInquiryHelperServiceImpl extends KualiInquirableImpl {
30
31 private DataObjectService dataObjectService;
32
33 /**
34 * Fetches the TermSpecificationBo for the given id, and manually adds ContextBos for display
35 *
36 * @param fieldValues the search fields
37 * @return the TermSpecificationBo with any contexts mapped by contextValidTerms added
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 return termSpecification;
46 }
47
48 public DataObjectService getDataObjectService() {
49 if (dataObjectService == null) {
50 return KRADServiceLocator.getDataObjectService();
51 }
52 return dataObjectService;
53 }
54
55 public void setDataObjectService(DataObjectService dataObjectService) {
56 this.dataObjectService = dataObjectService;
57 }
58 }