| 1 |  |   | 
  | 2 |  |   | 
  | 3 |  |   | 
  | 4 |  |   | 
  | 5 |  |   | 
  | 6 |  |   | 
  | 7 |  |   | 
  | 8 |  |   | 
  | 9 |  |   | 
  | 10 |  |   | 
  | 11 |  |   | 
  | 12 |  |   | 
  | 13 |  |   | 
  | 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 |  |   | 
  | 40 |  |   | 
  | 41 |  |   | 
  | 42 |  |   | 
  | 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 | 0 |      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 | 0 |      static final public Map<String,String> PERSON_CRITERIA = new HashMap<String,String>(); | 
  | 54 |  |   | 
  | 55 | 0 |      static final public Map<String, SearchOperation> searchOperations = new HashMap<String, SearchOperation>(); | 
  | 56 |  |       | 
  | 57 |  |      static { | 
  | 58 | 0 |          PERSON_CRITERIA.put("entityTypes.active", "Y"); | 
  | 59 | 0 |          PERSON_CRITERIA.put("principals.active", "Y"); | 
  | 60 | 0 |          PERSON_CRITERIA.put("active", "Y"); | 
  | 61 | 0 |          PERSON_CRITERIA.put("entityTypes.entityTypeCode", "PERSON|SYSTEM"); | 
  | 62 | 0 |          searchOperations.put(QuickViewByGivenName.SEARCH_TYPE, new QuickViewByGivenName()); | 
  | 63 | 0 |      } | 
  | 64 |  |   | 
  | 65 |  |   | 
  | 66 | 0 |      public PersonSearchServiceImpl() { | 
  | 67 | 0 |      } | 
  | 68 |  |   | 
  | 69 |  |       | 
  | 70 |  |   | 
  | 71 |  |   | 
  | 72 |  |   | 
  | 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 | 0 |          final SearchOperation search = searchOperations.get(searchRequest.getSearchKey()); | 
  | 88 | 0 |          if (search != null) { | 
  | 89 | 0 |              return search.search(identityService, searchRequest); | 
  | 90 |  |          } | 
  | 91 | 0 |          return new SearchResult(); | 
  | 92 |  |      } | 
  | 93 |  |   | 
  | 94 |  |   | 
  | 95 |  |       | 
  | 96 |  |   | 
  | 97 |  |   | 
  | 98 |  |   | 
  | 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 |  |   | 
  | 107 |  |   | 
  | 108 |  |   | 
  | 109 |  |   | 
  | 110 |  |      @Override | 
  | 111 |  |      public List<SearchCriteriaTypeInfo> getSearchCriteriaTypes() throws OperationFailedException { | 
  | 112 | 0 |          throw new RuntimeException("Not implemented yet"); | 
  | 113 |  |      } | 
  | 114 |  |   | 
  | 115 |  |       | 
  | 116 |  |   | 
  | 117 |  |   | 
  | 118 |  |   | 
  | 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 |  |   | 
  | 127 |  |   | 
  | 128 |  |   | 
  | 129 |  |   | 
  | 130 |  |      @Override | 
  | 131 |  |      public List<SearchResultTypeInfo> getSearchResultTypes() throws OperationFailedException { | 
  | 132 | 0 |          throw new RuntimeException("Not implemented yet"); | 
  | 133 |  |      } | 
  | 134 |  |   | 
  | 135 |  |       | 
  | 136 |  |   | 
  | 137 |  |   | 
  | 138 |  |   | 
  | 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 |  |   | 
  | 147 |  |   | 
  | 148 |  |   | 
  | 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 |  |  } |