1 /**
2 * Copyright 2005-2014 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.krad.service;
17
18 import java.util.Collection;
19 import java.util.List;
20 import java.util.Map;
21
22 /**
23 * Provides search capabilities for the lookup framework. This service is primarily intended for internal use by the
24 * lookup framework. Client code should preferably invoke {@link org.kuali.rice.krad.data.DataObjectService#findMatching(Class, org.kuali.rice.core.api.criteria.QueryByCriteria)}
25 * passing the appropriate criteria.
26 *
27 * @author Kuali Rice Team (rice.collab@kuali.org)
28 */
29 public interface LookupService {
30
31 /**
32 * Returns a collection of objects based on the given search parameters.
33 * Will not limit results, so the returned Collection could be huge.
34 *
35 * @param type the type of the object for which to search
36 * @param formProps a map of attributes against which to query
37 *
38 * @return an unbounded collection of results from the search
39 * @deprecated please use {@link #findCollectionBySearchHelper(Class, java.util.Map, java.util.List, boolean, Integer)} instead
40 */
41 @Deprecated
42 <T> Collection<T> findCollectionBySearchUnbounded(Class<T> type, Map<String, String> formProps);
43
44 /**
45 * Returns a collection of objects based on the given search parameters.
46 *
47 * @return Collection returned from the search
48 * @deprecated please use {@link #findCollectionBySearchHelper(Class, java.util.Map, java.util.List, boolean, Integer)} instead
49 */
50 @Deprecated
51 <T> Collection<T> findCollectionBySearch(Class<T> type, Map<String, String> formProps);
52
53 /**
54 * This version of findCollectionBySearchHelper is needed for version compatibility. It allows executeSearch
55 * to behave the same way as it did prior to 2.3. In the LookupDao, the value for searchResultsLimit will be
56 * retrieved from the KNS version of LookupUtils in the LookupDao.
57 *
58 * @since 2.3
59 * @deprecated please use {@link #findCollectionBySearchHelper(Class, java.util.Map, java.util.List, boolean, Integer)} instead
60 */
61 @Deprecated
62 <T> Collection<T> findCollectionBySearchHelper(Class<T> type, Map<String, String> formProperties,
63 boolean unbounded);
64
65 /**
66 *
67 * @param type class name of the data object on which the lookup is performed
68 * @param formProperties Map of search criteria properties obtained from the lookup form
69 * @param unbounded determines if search limit used
70 * @param searchResultsLimit search limit value
71 * @return Collection of items found
72 * @deprecated please use {@link #findCollectionBySearchHelper(Class, java.util.Map, java.util.List, boolean, Integer)} instead
73 */
74 @Deprecated
75 <T> Collection<T> findCollectionBySearchHelper(Class<T> type, Map<String, String> formProperties,
76 boolean unbounded, Integer searchResultsLimit);
77
78 /**
79 * Returns a collection of objects based on the given search parameters.
80 *
81 * <p>
82 * This version of findCollectionBySearchHelper further isolates the UIFramework from the LookupService and
83 * should be used instead of the deprecated version.
84 * </p>
85 *
86 * @param type class name of the data object on which the lookup is performed
87 * @param formProperties Map of search criteria properties obtained from the lookup form
88 * @param wildcardAsLiteralPropertyNames List of property names with wildcards disabled
89 * @param unbounded determines if search limit used
90 * @param searchResultsLimit search limit value
91 * @return Collection of items found
92 */
93 <T> Collection<T> findCollectionBySearchHelper(Class<T> type, Map<String, String> formProperties,
94 List<String> wildcardAsLiteralPropertyNames, boolean unbounded, Integer searchResultsLimit);
95
96 /**
97 * Retrieves an Object based on the search criteria, which should uniquely
98 * identify a record.
99 *
100 * @return Object returned from the search
101 */
102 <T> T findObjectBySearch(Class<T> type, Map<String, String> formProps);
103
104 boolean allPrimaryKeyValuesPresentAndNotWildcard(Class<?> boClass, Map<String, String> formProps);
105 }