View Javadoc
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.krad.service.impl;
17  
18  import org.kuali.rice.core.api.config.property.ConfigurationService;
19  import org.kuali.rice.krad.service.LegacyDataAdapter;
20  import org.kuali.rice.krad.service.LookupService;
21  
22  import java.util.Collection;
23  import java.util.List;
24  import java.util.Map;
25  
26  /**
27   * Service implementation for the Lookup structure. It Provides a generic search
28   * mechanism against Business Objects. This is the default implementation, that
29   * is delivered with Kuali.
30   * 
31   * @author Kuali Rice Team (rice.collab@kuali.org)
32   */
33  public class LookupServiceImpl implements LookupService {
34      private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(LookupServiceImpl.class);
35  
36      private ConfigurationService kualiConfigurationService;
37      private LegacyDataAdapter legacyDataAdapter;
38  
39      @Override
40      @Deprecated
41      public <T> Collection<T> findCollectionBySearchUnbounded(Class<T> example,
42              Map<String, String> formProps) {
43          return findCollectionBySearchHelper(example, formProps, true);
44      }
45  
46      @Override
47      @Deprecated
48      public <T> Collection<T> findCollectionBySearch(Class<T> type, Map<String, String> formProps) {
49          return findCollectionBySearchHelper(type, formProps, false);
50      }
51  
52      @Override
53      @Deprecated
54      public <T> Collection<T> findCollectionBySearchHelper(Class<T> type,
55              Map<String, String> formProps, boolean unbounded) {
56          return findCollectionBySearchHelper(type, formProps, unbounded, null);
57      }
58  
59      @Override
60      @Deprecated
61      public <T> Collection<T> findCollectionBySearchHelper(Class<T> type,
62              Map<String, String> formProps, boolean unbounded, Integer searchResultsLimit) {
63          return getLegacyDataAdapter().findCollectionBySearchHelper(type, formProps, unbounded,
64                  allPrimaryKeyValuesPresentAndNotWildcard(type, formProps), searchResultsLimit);
65      }
66  
67      @Override
68      public <T> Collection<T> findCollectionBySearchHelper(Class<T> type,Map<String, String> formProps,
69             List<String> wildcardAsLiteralPropertyNames, boolean unbounded, Integer searchResultsLimit) {
70          return getLegacyDataAdapter().findCollectionBySearchHelper(type, formProps, wildcardAsLiteralPropertyNames,
71                  unbounded, allPrimaryKeyValuesPresentAndNotWildcard(type, formProps), searchResultsLimit);
72      }
73  
74      @Override
75      public <T> T findObjectBySearch(Class<T> type, Map<String, String> formProps) {
76          if (type == null || formProps == null) {
77              throw new IllegalArgumentException("Object and Map must not be null");
78          }
79          return getLegacyDataAdapter().findObjectBySearch(type, formProps);
80      }
81  
82      @Override
83      public boolean allPrimaryKeyValuesPresentAndNotWildcard(Class<?> boClass, Map<String, String> formProps) {
84          return getLegacyDataAdapter().allPrimaryKeyValuesPresentAndNotWildcard(boClass, formProps);
85      }
86  
87      public ConfigurationService getKualiConfigurationService() {
88          return kualiConfigurationService;
89      }
90  
91      public void setKualiConfigurationService(ConfigurationService kualiConfigurationService) {
92          this.kualiConfigurationService = kualiConfigurationService;
93      }
94  
95      public LegacyDataAdapter getLegacyDataAdapter() {
96          return legacyDataAdapter;
97      }
98  
99      public void setLegacyDataAdapter(LegacyDataAdapter legacyDataAdapter) {
100         this.legacyDataAdapter = legacyDataAdapter;
101     }
102 
103 }