Coverage Report - org.kuali.student.core.personsearch.service.impl.PersonSearchServiceImpl
 
Classes in this File Line Coverage Branch Coverage Complexity
PersonSearchServiceImpl
45%
14/31
25%
1/4
1.833
 
 1  
 /**
 2  
  * Copyright 2010 The Kuali Foundation Licensed under the
 3  
  * Educational Community License, Version 2.0 (the "License"); you may
 4  
  * not use this file except in compliance with the License. You may
 5  
  * obtain a copy of the License at
 6  
  *
 7  
  * http://www.osedu.org/licenses/ECL-2.0
 8  
  *
 9  
  * Unless required by applicable law or agreed to in writing,
 10  
  * software distributed under the License is distributed on an "AS IS"
 11  
  * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 12  
  * or implied. See the License for the specific language governing
 13  
  * permissions and limitations under the License.
 14  
  */
 15  
 
 16  
 package org.kuali.student.core.personsearch.service.impl;
 17  
 
 18  
 import java.util.ArrayList;
 19  
 import java.util.HashMap;
 20  
 import java.util.List;
 21  
 import java.util.Map;
 22  
 
 23  
 import javax.jws.WebService;
 24  
 
 25  
 import org.apache.log4j.Logger;
 26  
 import org.kuali.rice.kim.service.IdentityManagementService;
 27  
 import org.kuali.rice.kim.service.IdentityService;
 28  
 import org.kuali.student.core.exceptions.DoesNotExistException;
 29  
 import org.kuali.student.core.exceptions.InvalidParameterException;
 30  
 import org.kuali.student.core.exceptions.MissingParameterException;
 31  
 import org.kuali.student.core.exceptions.OperationFailedException;
 32  
 import org.kuali.student.core.search.dto.SearchCriteriaTypeInfo;
 33  
 import org.kuali.student.core.search.dto.SearchRequest;
 34  
 import org.kuali.student.core.search.dto.SearchResult;
 35  
 import org.kuali.student.core.search.dto.SearchResultTypeInfo;
 36  
 import org.kuali.student.core.search.dto.SearchTypeInfo;
 37  
 import org.kuali.student.core.search.service.SearchService;
 38  
 /**
 39  
  * Proxy Search service to the rice PersonService that adds primitive support for the search() and searchForResult()
 40  
  * search methods.
 41  
  *
 42  
  * @author Kuali Rice Team (kuali-rice@googlegroups.com)
 43  
  *
 44  
  */
 45  
 @WebService(endpointInterface = "org.kuali.student.core.search.service.SearchService", name = "PersonSearchService", serviceName = "PersonSearchService", portName = "PersonSearchService", targetNamespace = "http://student.kuali.org/wsdl/personsearch")
 46  
 public class PersonSearchServiceImpl implements SearchService {
 47  1
     protected static final Logger LOG = Logger.getLogger(PersonSearchServiceImpl.class);
 48  
 
 49  
     private IdentityManagementService identityService;
 50  
 
 51  
     public static final String PERSON_ENTITY_TYPE = "PERSON";
 52  
 
 53  1
     static final public Map<String,String> PERSON_CRITERIA = new HashMap<String,String>();
 54  
 
 55  1
     static final public Map<String, SearchOperation> searchOperations = new HashMap<String, SearchOperation>();
 56  
     
 57  
     static {
 58  1
         PERSON_CRITERIA.put("entityTypes.active", "Y");
 59  1
         PERSON_CRITERIA.put("principals.active", "Y");
 60  1
         PERSON_CRITERIA.put("active", "Y");
 61  1
         PERSON_CRITERIA.put("entityTypes.entityTypeCode", "PERSON|SYSTEM");
 62  1
         searchOperations.put(QuickViewByGivenName.SEARCH_TYPE, new QuickViewByGivenName());
 63  1
     }
 64  
 
 65  
 
 66  1
     public PersonSearchServiceImpl() {
 67  1
     }
 68  
 
 69  
     /**
 70  
      * Return the list of searches we recognize
 71  
      *
 72  
      * @see org.kuali.student.core.search.service.SearchService#getSearchTypes()
 73  
      */
 74  
     @Override
 75  
     public List<SearchTypeInfo> getSearchTypes() throws OperationFailedException {
 76  0
         final List<SearchTypeInfo> searchTypes =  new ArrayList<SearchTypeInfo>(searchOperations.size());
 77  0
         for (String searchKey : searchOperations.keySet()) {
 78  0
             SearchOperation so = searchOperations.get (searchKey);
 79  0
             searchTypes.add(so.getType ());
 80  0
         }
 81  0
         return searchTypes;
 82  
     }
 83  
 
 84  
 
 85  
     @Override
 86  
     public SearchResult search(SearchRequest searchRequest) {
 87  1
         final SearchOperation search = searchOperations.get(searchRequest.getSearchKey());
 88  1
         if (search != null) {
 89  0
             return search.search(identityService, searchRequest);
 90  
         }
 91  1
         return new SearchResult();
 92  
     }
 93  
 
 94  
 
 95  
     /**
 96  
      * This overridden method ...
 97  
      *
 98  
      * @see org.kuali.student.core.search.service.SearchService#getSearchCriteriaType(java.lang.String)
 99  
      */
 100  
     @Override
 101  
     public SearchCriteriaTypeInfo getSearchCriteriaType(String searchCriteriaTypeKey) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
 102  0
        throw new RuntimeException("Not implemented yet");
 103  
     }
 104  
 
 105  
     /**
 106  
      * This overridden method ...
 107  
      *
 108  
      * @see org.kuali.student.core.search.service.SearchService#getSearchCriteriaTypes()
 109  
      */
 110  
     @Override
 111  
     public List<SearchCriteriaTypeInfo> getSearchCriteriaTypes() throws OperationFailedException {
 112  0
         throw new RuntimeException("Not implemented yet");
 113  
     }
 114  
 
 115  
     /**
 116  
      * This overridden method ...
 117  
      *
 118  
      * @see org.kuali.student.core.search.service.SearchService#getSearchResultType(java.lang.String)
 119  
      */
 120  
     @Override
 121  
     public SearchResultTypeInfo getSearchResultType(String searchResultTypeKey) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
 122  0
         throw new RuntimeException("Not implemented yet");
 123  
     }
 124  
 
 125  
     /**
 126  
      * This overridden method ...
 127  
      *
 128  
      * @see org.kuali.student.core.search.service.SearchService#getSearchResultTypes()
 129  
      */
 130  
     @Override
 131  
     public List<SearchResultTypeInfo> getSearchResultTypes() throws OperationFailedException {
 132  0
         throw new RuntimeException("Not implemented yet");
 133  
     }
 134  
 
 135  
     /**
 136  
      * This overridden method ...
 137  
      *
 138  
      * @see org.kuali.student.core.search.service.SearchService#getSearchType(java.lang.String)
 139  
      */
 140  
     @Override
 141  
     public SearchTypeInfo getSearchType(String searchTypeKey) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
 142  0
         throw new RuntimeException("Not implemented yet");
 143  
     }
 144  
 
 145  
     /**
 146  
      * This overridden method ...
 147  
      *
 148  
      * @see org.kuali.student.core.search.service.SearchService#getSearchTypesByCriteria(java.lang.String)
 149  
      */
 150  
     @Override
 151  
     public List<SearchTypeInfo> getSearchTypesByCriteria(String searchCriteriaTypeKey) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
 152  0
         throw new RuntimeException("Not implemented yet");
 153  
     }
 154  
 
 155  
     @Override
 156  
     public List<SearchTypeInfo> getSearchTypesByResult(String searchResultTypeKey) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
 157  0
         throw new RuntimeException("Not implemented yet");
 158  
     }
 159  
 
 160  
     //
 161  
 
 162  
     public IdentityManagementService getIdentityService() {
 163  0
         return identityService;
 164  
     }
 165  
     public void setIdentityService(IdentityManagementService identityService) {
 166  0
         this.identityService = identityService;
 167  0
     }
 168  
 
 169  
 }