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.api.identity.IdentityService; |
27 | |
import org.kuali.student.common.exceptions.DoesNotExistException; |
28 | |
import org.kuali.student.common.exceptions.InvalidParameterException; |
29 | |
import org.kuali.student.common.exceptions.MissingParameterException; |
30 | |
import org.kuali.student.common.exceptions.OperationFailedException; |
31 | |
import org.kuali.student.common.search.dto.SearchCriteriaTypeInfo; |
32 | |
import org.kuali.student.common.search.dto.SearchRequest; |
33 | |
import org.kuali.student.common.search.dto.SearchResult; |
34 | |
import org.kuali.student.common.search.dto.SearchResultTypeInfo; |
35 | |
import org.kuali.student.common.search.dto.SearchTypeInfo; |
36 | |
import org.kuali.student.common.search.service.SearchService; |
37 | |
|
38 | |
|
39 | |
|
40 | |
|
41 | |
|
42 | |
|
43 | |
|
44 | |
@WebService(endpointInterface = "org.kuali.student.common.search.service.SearchService", name = "PersonSearchService", serviceName = "PersonSearchService", portName = "PersonSearchService", targetNamespace = "http://student.kuali.org/wsdl/personsearch") |
45 | |
public class PersonSearchServiceImpl implements SearchService { |
46 | 0 | protected static final Logger LOG = Logger.getLogger(PersonSearchServiceImpl.class); |
47 | |
|
48 | |
private IdentityService identityService; |
49 | |
|
50 | |
public static final String PERSON_ENTITY_TYPE = "PERSON"; |
51 | |
|
52 | 0 | static final public Map<String,String> PERSON_CRITERIA = new HashMap<String,String>(); |
53 | |
|
54 | 0 | static final public Map<String, SearchOperation> searchOperations = new HashMap<String, SearchOperation>(); |
55 | |
|
56 | |
static { |
57 | 0 | PERSON_CRITERIA.put("entityTypes.active", "Y"); |
58 | 0 | PERSON_CRITERIA.put("principals.active", "Y"); |
59 | 0 | PERSON_CRITERIA.put("active", "Y"); |
60 | 0 | PERSON_CRITERIA.put("entityTypes.entityTypeCode", "PERSON|SYSTEM"); |
61 | 0 | searchOperations.put(QuickViewByGivenName.SEARCH_TYPE, new QuickViewByGivenName()); |
62 | 0 | } |
63 | |
|
64 | |
|
65 | 0 | public PersonSearchServiceImpl() { |
66 | 0 | } |
67 | |
|
68 | |
|
69 | |
|
70 | |
|
71 | |
|
72 | |
|
73 | |
@Override |
74 | |
public List<SearchTypeInfo> getSearchTypes() throws OperationFailedException { |
75 | 0 | final List<SearchTypeInfo> searchTypes = new ArrayList<SearchTypeInfo>(searchOperations.size()); |
76 | 0 | for (String searchKey : searchOperations.keySet()) { |
77 | 0 | SearchOperation so = searchOperations.get (searchKey); |
78 | 0 | searchTypes.add(so.getType ()); |
79 | 0 | } |
80 | 0 | return searchTypes; |
81 | |
} |
82 | |
|
83 | |
|
84 | |
@Override |
85 | |
public SearchResult search(SearchRequest searchRequest) { |
86 | 0 | final SearchOperation search = searchOperations.get(searchRequest.getSearchKey()); |
87 | 0 | if (search != null) { |
88 | 0 | return search.search(identityService, searchRequest); |
89 | |
} |
90 | 0 | return new SearchResult(); |
91 | |
} |
92 | |
|
93 | |
|
94 | |
|
95 | |
|
96 | |
|
97 | |
|
98 | |
|
99 | |
@Override |
100 | |
public SearchCriteriaTypeInfo getSearchCriteriaType(String searchCriteriaTypeKey) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException { |
101 | 0 | throw new RuntimeException("Not implemented yet"); |
102 | |
} |
103 | |
|
104 | |
|
105 | |
|
106 | |
|
107 | |
|
108 | |
|
109 | |
@Override |
110 | |
public List<SearchCriteriaTypeInfo> getSearchCriteriaTypes() throws OperationFailedException { |
111 | 0 | throw new RuntimeException("Not implemented yet"); |
112 | |
} |
113 | |
|
114 | |
|
115 | |
|
116 | |
|
117 | |
|
118 | |
|
119 | |
@Override |
120 | |
public SearchResultTypeInfo getSearchResultType(String searchResultTypeKey) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException { |
121 | 0 | throw new RuntimeException("Not implemented yet"); |
122 | |
} |
123 | |
|
124 | |
|
125 | |
|
126 | |
|
127 | |
|
128 | |
|
129 | |
@Override |
130 | |
public List<SearchResultTypeInfo> getSearchResultTypes() throws OperationFailedException { |
131 | 0 | throw new RuntimeException("Not implemented yet"); |
132 | |
} |
133 | |
|
134 | |
|
135 | |
|
136 | |
|
137 | |
|
138 | |
|
139 | |
@Override |
140 | |
public SearchTypeInfo getSearchType(String searchTypeKey) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException { |
141 | 0 | throw new RuntimeException("Not implemented yet"); |
142 | |
} |
143 | |
|
144 | |
|
145 | |
|
146 | |
|
147 | |
|
148 | |
|
149 | |
@Override |
150 | |
public List<SearchTypeInfo> getSearchTypesByCriteria(String searchCriteriaTypeKey) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException { |
151 | 0 | throw new RuntimeException("Not implemented yet"); |
152 | |
} |
153 | |
|
154 | |
@Override |
155 | |
public List<SearchTypeInfo> getSearchTypesByResult(String searchResultTypeKey) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException { |
156 | 0 | throw new RuntimeException("Not implemented yet"); |
157 | |
} |
158 | |
|
159 | |
|
160 | |
|
161 | |
public IdentityService getIdentityService() { |
162 | 0 | return identityService; |
163 | |
} |
164 | |
public void setIdentityService(IdentityService identityService) { |
165 | 0 | this.identityService = identityService; |
166 | 0 | } |
167 | |
|
168 | |
} |