1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.student.core.organization.service.impl; |
17 | |
|
18 | |
import java.util.ArrayList; |
19 | |
import java.util.HashSet; |
20 | |
import java.util.List; |
21 | |
import java.util.Set; |
22 | |
|
23 | |
import javax.jws.WebService; |
24 | |
import javax.persistence.NoResultException; |
25 | |
|
26 | |
import org.apache.log4j.Logger; |
27 | |
import org.kuali.student.common.validator.old.Validator; |
28 | |
import org.kuali.student.core.dictionary.old.dto.ObjectStructure; |
29 | |
import org.kuali.student.core.dictionary.service.old.DictionaryService; |
30 | |
import org.kuali.student.core.dto.StatusInfo; |
31 | |
import org.kuali.student.core.exceptions.AlreadyExistsException; |
32 | |
import org.kuali.student.core.exceptions.DataValidationErrorException; |
33 | |
import org.kuali.student.core.exceptions.DoesNotExistException; |
34 | |
import org.kuali.student.core.exceptions.InvalidParameterException; |
35 | |
import org.kuali.student.core.exceptions.MissingParameterException; |
36 | |
import org.kuali.student.core.exceptions.OperationFailedException; |
37 | |
import org.kuali.student.core.exceptions.PermissionDeniedException; |
38 | |
import org.kuali.student.core.exceptions.VersionMismatchException; |
39 | |
import org.kuali.student.core.organization.dao.OrganizationDao; |
40 | |
import org.kuali.student.core.organization.dto.OrgHierarchyInfo; |
41 | |
import org.kuali.student.core.organization.dto.OrgInfo; |
42 | |
import org.kuali.student.core.organization.dto.OrgOrgRelationInfo; |
43 | |
import org.kuali.student.core.organization.dto.OrgOrgRelationTypeInfo; |
44 | |
import org.kuali.student.core.organization.dto.OrgPersonRelationInfo; |
45 | |
import org.kuali.student.core.organization.dto.OrgPersonRelationTypeInfo; |
46 | |
import org.kuali.student.core.organization.dto.OrgPositionRestrictionInfo; |
47 | |
import org.kuali.student.core.organization.dto.OrgTreeInfo; |
48 | |
import org.kuali.student.core.organization.dto.OrgTypeInfo; |
49 | |
import org.kuali.student.core.organization.entity.Org; |
50 | |
import org.kuali.student.core.organization.entity.OrgHierarchy; |
51 | |
import org.kuali.student.core.organization.entity.OrgOrgRelation; |
52 | |
import org.kuali.student.core.organization.entity.OrgOrgRelationType; |
53 | |
import org.kuali.student.core.organization.entity.OrgPersonRelation; |
54 | |
import org.kuali.student.core.organization.entity.OrgPersonRelationType; |
55 | |
import org.kuali.student.core.organization.entity.OrgPositionRestriction; |
56 | |
import org.kuali.student.core.organization.entity.OrgType; |
57 | |
import org.kuali.student.core.organization.service.OrganizationService; |
58 | |
import org.kuali.student.core.search.dto.SearchCriteriaTypeInfo; |
59 | |
import org.kuali.student.core.search.dto.SearchRequest; |
60 | |
import org.kuali.student.core.search.dto.SearchResult; |
61 | |
import org.kuali.student.core.search.dto.SearchResultTypeInfo; |
62 | |
import org.kuali.student.core.search.dto.SearchTypeInfo; |
63 | |
import org.kuali.student.core.search.service.SearchManager; |
64 | |
import org.kuali.student.core.validation.dto.ValidationResultInfo; |
65 | |
import org.springframework.transaction.annotation.Transactional; |
66 | |
|
67 | |
@WebService(endpointInterface = "org.kuali.student.core.organization.service.OrganizationService", serviceName = "OrganizationService", portName = "OrganizationService", targetNamespace = "http://student.kuali.org/wsdl/organization") |
68 | |
@Transactional(noRollbackFor={DoesNotExistException.class},rollbackFor={Throwable.class}) |
69 | 2 | public class OrganizationServiceImpl implements OrganizationService { |
70 | |
|
71 | 2 | final Logger logger = Logger.getLogger(OrganizationServiceImpl.class); |
72 | |
|
73 | |
private OrganizationDao organizationDao; |
74 | |
private DictionaryService dictionaryServiceDelegate; |
75 | |
private SearchManager searchManager; |
76 | |
private Validator validator; |
77 | |
|
78 | |
@Override |
79 | |
public OrgPositionRestrictionInfo addPositionRestrictionToOrg(String orgId, |
80 | |
String orgPersonRelationTypeKey, |
81 | |
OrgPositionRestrictionInfo orgPositionRestrictionInfo) |
82 | |
throws AlreadyExistsException, DataValidationErrorException, |
83 | |
DoesNotExistException, InvalidParameterException, |
84 | |
MissingParameterException, OperationFailedException, |
85 | |
PermissionDeniedException { |
86 | |
|
87 | |
|
88 | 2 | checkForMissingParameter(orgId, "orgId"); |
89 | 2 | checkForMissingParameter(orgPersonRelationTypeKey, "orgPersonRelationTypeKey"); |
90 | 2 | checkForMissingParameter(orgPositionRestrictionInfo, "orgPositionRestrictionInfo"); |
91 | |
|
92 | |
|
93 | 2 | orgPositionRestrictionInfo.setOrgId(orgId); |
94 | 2 | orgPositionRestrictionInfo.setOrgPersonRelationTypeKey(orgPersonRelationTypeKey); |
95 | |
|
96 | 2 | OrgPositionRestriction orgPositionRestriction = null; |
97 | |
|
98 | |
|
99 | |
try { |
100 | 2 | orgPositionRestriction = OrganizationAssembler.toOrgPositionRestriction(false, orgPositionRestrictionInfo, organizationDao); |
101 | 0 | } catch (VersionMismatchException e) { |
102 | 2 | } |
103 | |
|
104 | |
|
105 | 2 | organizationDao.create(orgPositionRestriction); |
106 | |
|
107 | |
|
108 | 2 | OrgPositionRestrictionInfo createdOrgPositionRestrictionInfo = OrganizationAssembler.toOrgPositionRestrictionInfo(orgPositionRestriction); |
109 | 2 | return createdOrgPositionRestrictionInfo; |
110 | |
} |
111 | |
|
112 | |
@Override |
113 | |
public OrgOrgRelationInfo createOrgOrgRelation(String orgId, |
114 | |
String relatedOrgId, String orgOrgRelationTypeKey, |
115 | |
OrgOrgRelationInfo orgOrgRelationInfo) |
116 | |
throws AlreadyExistsException, DataValidationErrorException, |
117 | |
DoesNotExistException, InvalidParameterException, |
118 | |
MissingParameterException, PermissionDeniedException, |
119 | |
OperationFailedException { |
120 | |
|
121 | |
|
122 | 1 | checkForMissingParameter(orgId, "orgId"); |
123 | 1 | checkForMissingParameter(relatedOrgId, "relatedOrgId"); |
124 | 1 | checkForMissingParameter(orgOrgRelationTypeKey, "orgOrgRelationTypeKey"); |
125 | 1 | checkForMissingParameter(orgOrgRelationInfo, "orgOrgRelationInfo"); |
126 | |
|
127 | |
|
128 | 1 | orgOrgRelationInfo.setOrgId(orgId); |
129 | 1 | orgOrgRelationInfo.setRelatedOrgId(relatedOrgId); |
130 | 1 | orgOrgRelationInfo.setType(orgOrgRelationTypeKey); |
131 | |
|
132 | 1 | OrgOrgRelation orgOrgRelation = null; |
133 | |
|
134 | |
|
135 | |
try { |
136 | 1 | orgOrgRelation = OrganizationAssembler.toOrgOrgRelation(false, orgOrgRelationInfo, organizationDao); |
137 | 0 | } catch (VersionMismatchException e) { |
138 | 1 | } |
139 | |
|
140 | |
|
141 | 1 | organizationDao.create(orgOrgRelation); |
142 | |
|
143 | |
|
144 | 1 | OrgOrgRelationInfo createdOrgOrgRelationInfo = OrganizationAssembler.toOrgOrgRelationInfo(orgOrgRelation); |
145 | 1 | return createdOrgOrgRelationInfo; |
146 | |
} |
147 | |
|
148 | |
@Override |
149 | |
public OrgPersonRelationInfo createOrgPersonRelation(String orgId, |
150 | |
String personId, String orgPersonRelationTypeKey, |
151 | |
OrgPersonRelationInfo orgPersonRelationInfo) |
152 | |
throws AlreadyExistsException, DataValidationErrorException, |
153 | |
DoesNotExistException, InvalidParameterException, |
154 | |
MissingParameterException, PermissionDeniedException, |
155 | |
OperationFailedException { |
156 | |
|
157 | |
|
158 | 1 | checkForMissingParameter(orgId, "orgId"); |
159 | 1 | checkForMissingParameter(personId, "personId"); |
160 | 1 | checkForMissingParameter(orgPersonRelationTypeKey, "orgPersonRelationTypeKey"); |
161 | 1 | checkForMissingParameter(orgPersonRelationTypeKey, "orgPersonRelationTypeKey"); |
162 | |
|
163 | |
|
164 | 1 | if(!organizationDao.validatePositionRestriction(orgId,orgPersonRelationTypeKey)){ |
165 | 0 | throw new InvalidParameterException("There is no Position for this relationship"); |
166 | |
} |
167 | |
|
168 | |
|
169 | 1 | orgPersonRelationInfo.setOrgId(orgId); |
170 | 1 | orgPersonRelationInfo.setPersonId(personId); |
171 | 1 | orgPersonRelationInfo.setType(orgPersonRelationTypeKey); |
172 | |
|
173 | 1 | OrgPersonRelation orgPersonRelation = null; |
174 | |
|
175 | |
|
176 | |
try { |
177 | 1 | orgPersonRelation = OrganizationAssembler.toOrgPersonRelation(false, orgPersonRelationInfo, organizationDao); |
178 | 0 | } catch (VersionMismatchException e) { |
179 | 1 | } |
180 | |
|
181 | |
|
182 | 1 | organizationDao.create(orgPersonRelation); |
183 | |
|
184 | |
|
185 | 1 | OrgPersonRelationInfo createdOrgPersonRelationInfo = OrganizationAssembler.toOrgPersonRelationInfo(orgPersonRelation); |
186 | 1 | return createdOrgPersonRelationInfo; |
187 | |
} |
188 | |
|
189 | |
@Override |
190 | |
public OrgInfo createOrganization(String orgTypeKey, OrgInfo orgInfo) |
191 | |
throws AlreadyExistsException, DataValidationErrorException, |
192 | |
InvalidParameterException, MissingParameterException, |
193 | |
OperationFailedException, PermissionDeniedException { |
194 | |
|
195 | |
|
196 | 1 | checkForMissingParameter(orgTypeKey, "orgTypeKey"); |
197 | 1 | checkForMissingParameter(orgInfo, "orgInfo"); |
198 | |
|
199 | |
|
200 | 1 | orgInfo.setType(orgTypeKey); |
201 | |
|
202 | |
try { |
203 | 1 | List<ValidationResultInfo> validations = validateOrg("", orgInfo); |
204 | 1 | for (ValidationResultInfo validationResult : validations) { |
205 | 0 | if(validationResult.isError()) |
206 | 0 | throw new DataValidationErrorException(validationResult.toString()); |
207 | |
} |
208 | 0 | } catch (DoesNotExistException e1) { |
209 | 0 | logger.error("Exception occured: ", e1); |
210 | 1 | } |
211 | |
|
212 | 1 | Org org = null; |
213 | |
|
214 | |
|
215 | |
try { |
216 | 1 | org = OrganizationAssembler.toOrg(false, orgInfo, organizationDao); |
217 | 0 | } catch (DoesNotExistException e) { |
218 | |
|
219 | 0 | logger.info(e.getMessage(), e); |
220 | 0 | throw new OperationFailedException(e.getMessage(), e); |
221 | 0 | } catch (VersionMismatchException e) { |
222 | |
|
223 | 0 | logger.info(e.getMessage(), e); |
224 | 0 | throw new OperationFailedException(e.getMessage(), e); |
225 | 1 | } |
226 | |
|
227 | |
|
228 | 1 | organizationDao.create(org); |
229 | |
|
230 | |
|
231 | 1 | OrgInfo createdOrgInfo = OrganizationAssembler.toOrgInfo(org); |
232 | 1 | return createdOrgInfo; |
233 | |
|
234 | |
} |
235 | |
|
236 | |
@Override |
237 | |
public StatusInfo deleteOrganization(String orgId) |
238 | |
throws DoesNotExistException, InvalidParameterException, |
239 | |
MissingParameterException, OperationFailedException, |
240 | |
PermissionDeniedException { |
241 | |
|
242 | 1 | checkForMissingParameter(orgId, "orgId"); |
243 | |
|
244 | 1 | Org org = organizationDao.fetch(Org.class, orgId); |
245 | |
|
246 | 1 | if(org==null){ |
247 | 0 | throw new DoesNotExistException("Org does not exist for id: "+orgId); |
248 | |
} |
249 | |
|
250 | 1 | organizationDao.delete(org); |
251 | |
|
252 | 1 | StatusInfo statusInfo = new StatusInfo(); |
253 | 1 | statusInfo.setSuccess(true); |
254 | 1 | return statusInfo; |
255 | |
} |
256 | |
|
257 | |
@Override |
258 | |
public List<String> getAllDescendants(String orgId, String orgHierarchy) |
259 | |
throws InvalidParameterException, MissingParameterException, |
260 | |
OperationFailedException, PermissionDeniedException { |
261 | |
|
262 | 4 | checkForMissingParameter(orgId, "orgId"); |
263 | 4 | checkForMissingParameter(orgId, "orgHierarchy"); |
264 | |
|
265 | 4 | List<String> descendants = this.organizationDao.getAllDescendants(orgId, orgHierarchy); |
266 | 4 | return descendants; |
267 | |
} |
268 | |
|
269 | |
@Override |
270 | |
public List<OrgPersonRelationInfo> getAllOrgPersonRelationsByOrg( |
271 | |
String orgId) throws DoesNotExistException, |
272 | |
InvalidParameterException, MissingParameterException, |
273 | |
OperationFailedException, PermissionDeniedException { |
274 | 2 | checkForMissingParameter(orgId, "orgId"); |
275 | |
|
276 | 2 | return OrganizationAssembler.toOrgPersonRelationInfos(organizationDao.getAllOrgPersonRelationsByOrg(orgId)); |
277 | |
} |
278 | |
|
279 | |
@Override |
280 | |
public List<OrgPersonRelationInfo> getAllOrgPersonRelationsByPerson( |
281 | |
String personId) throws DoesNotExistException, |
282 | |
InvalidParameterException, MissingParameterException, |
283 | |
OperationFailedException, PermissionDeniedException { |
284 | 2 | checkForMissingParameter(personId, "personId"); |
285 | |
|
286 | 2 | List<OrgPersonRelation> orgPersonRelationInfo = organizationDao.getAllOrgPersonRelationsByPerson(personId); |
287 | 2 | return OrganizationAssembler.toOrgPersonRelationInfos(orgPersonRelationInfo); |
288 | |
} |
289 | |
|
290 | |
@Override |
291 | |
public List<String> getAllAncestors(String orgId, String orgHierarchy) |
292 | |
throws InvalidParameterException, MissingParameterException, |
293 | |
OperationFailedException, PermissionDeniedException { |
294 | 4 | checkForMissingParameter(orgId, "orgId"); |
295 | 4 | checkForMissingParameter(orgHierarchy, "orgHierarchy"); |
296 | |
|
297 | 4 | List<String> ancestors = this.organizationDao.getAllAncestors(orgId, orgHierarchy); |
298 | 4 | return ancestors; |
299 | |
} |
300 | |
|
301 | |
@Override |
302 | |
public List<OrgHierarchyInfo> getOrgHierarchies() |
303 | |
throws OperationFailedException { |
304 | 1 | return OrganizationAssembler.toOrgHierarchyInfos(organizationDao.find(OrgHierarchy.class)); |
305 | |
|
306 | |
} |
307 | |
|
308 | |
@Override |
309 | |
public OrgHierarchyInfo getOrgHierarchy(String orgHierarchyKey) |
310 | |
throws DoesNotExistException, InvalidParameterException, |
311 | |
MissingParameterException, OperationFailedException { |
312 | 2 | checkForMissingParameter(orgHierarchyKey, "orgHierarchyKey"); |
313 | |
|
314 | 2 | return OrganizationAssembler.toOrgHierarchyInfo(organizationDao.fetch(OrgHierarchy.class, orgHierarchyKey)); |
315 | |
} |
316 | |
|
317 | |
@Override |
318 | |
public OrgOrgRelationInfo getOrgOrgRelation(String orgOrgRelationId) |
319 | |
throws DoesNotExistException, InvalidParameterException, |
320 | |
MissingParameterException, OperationFailedException, |
321 | |
PermissionDeniedException { |
322 | 3 | checkForMissingParameter(orgOrgRelationId, "orgOrgRelationId"); |
323 | |
|
324 | 2 | return OrganizationAssembler.toOrgOrgRelationInfo(organizationDao.fetch(OrgOrgRelation.class, orgOrgRelationId)); |
325 | |
|
326 | |
} |
327 | |
|
328 | |
@Override |
329 | |
public OrgOrgRelationTypeInfo getOrgOrgRelationType( |
330 | |
String orgOrgRelationTypeKey) throws DoesNotExistException, |
331 | |
InvalidParameterException, MissingParameterException, |
332 | |
OperationFailedException { |
333 | 2 | checkForMissingParameter(orgOrgRelationTypeKey, "orgOrgRelationTypeKey"); |
334 | |
|
335 | 2 | return OrganizationAssembler.toOrgOrgRelationTypeInfo(organizationDao.fetch(OrgOrgRelationType.class, orgOrgRelationTypeKey)); |
336 | |
} |
337 | |
|
338 | |
@Override |
339 | |
public List<OrgOrgRelationTypeInfo> getOrgOrgRelationTypes() |
340 | |
throws OperationFailedException { |
341 | 1 | List<OrgOrgRelationType> orgOrgRelationTypes = organizationDao.find(OrgOrgRelationType.class); |
342 | 1 | return OrganizationAssembler.toOrgOrgRelationTypeInfos(orgOrgRelationTypes); |
343 | |
} |
344 | |
|
345 | |
@Override |
346 | |
public List<OrgOrgRelationTypeInfo> getOrgOrgRelationTypesForOrgHierarchy( |
347 | |
String orgHierarchyKey) throws DoesNotExistException, |
348 | |
InvalidParameterException, MissingParameterException, |
349 | |
OperationFailedException { |
350 | 2 | checkForMissingParameter(orgHierarchyKey, "orgHierarchyKey"); |
351 | |
|
352 | 2 | List<OrgOrgRelationType> orgOrgRelationTypes = organizationDao.getOrgOrgRelationTypesForOrgHierarchy(orgHierarchyKey); |
353 | 2 | return OrganizationAssembler.toOrgOrgRelationTypeInfos(orgOrgRelationTypes); |
354 | |
} |
355 | |
|
356 | |
@Override |
357 | |
public List<OrgOrgRelationTypeInfo> getOrgOrgRelationTypesForOrgType( |
358 | |
String orgTypeKey) throws DoesNotExistException, |
359 | |
InvalidParameterException, MissingParameterException, |
360 | |
OperationFailedException { |
361 | 2 | checkForMissingParameter(orgTypeKey, "orgTypeKey"); |
362 | |
|
363 | 2 | List<OrgOrgRelationType> orgOrgRelationTypes = organizationDao.getOrgOrgRelationTypesForOrgType(orgTypeKey); |
364 | 2 | return OrganizationAssembler.toOrgOrgRelationTypeInfos(orgOrgRelationTypes); |
365 | |
} |
366 | |
|
367 | |
@Override |
368 | |
public List<OrgOrgRelationInfo> getOrgOrgRelationsByIdList( |
369 | |
List<String> orgOrgRelationIdList) throws DoesNotExistException, |
370 | |
InvalidParameterException, MissingParameterException, |
371 | |
OperationFailedException, PermissionDeniedException { |
372 | 3 | checkForMissingParameter(orgOrgRelationIdList, "orgOrgRelationIdList"); |
373 | |
|
374 | 3 | List<OrgOrgRelation> orgOrgRelations = organizationDao.getOrgOrgRelationsByIdList(orgOrgRelationIdList); |
375 | 3 | return OrganizationAssembler.toOrgOrgRelationInfos(orgOrgRelations); |
376 | |
} |
377 | |
|
378 | |
@Override |
379 | |
public List<OrgOrgRelationInfo> getOrgOrgRelationsByOrg(String orgId) |
380 | |
throws DoesNotExistException, InvalidParameterException, |
381 | |
MissingParameterException, OperationFailedException, |
382 | |
PermissionDeniedException { |
383 | |
|
384 | 2 | checkForMissingParameter(orgId, "orgId"); |
385 | |
|
386 | 2 | List<OrgOrgRelation> orgOrgRelations = organizationDao.getOrgOrgRelationsByOrg(orgId); |
387 | 2 | return OrganizationAssembler.toOrgOrgRelationInfos(orgOrgRelations); |
388 | |
} |
389 | |
|
390 | |
@Override |
391 | |
public List<OrgOrgRelationInfo> getOrgOrgRelationsByRelatedOrg( |
392 | |
String relatedOrgId) throws DoesNotExistException, |
393 | |
InvalidParameterException, MissingParameterException, |
394 | |
OperationFailedException, PermissionDeniedException { |
395 | 2 | checkForMissingParameter(relatedOrgId, "relatedOrgId"); |
396 | |
|
397 | 2 | List<OrgOrgRelation> orgOrgRelations = organizationDao.getOrgOrgRelationsByRelatedOrg(relatedOrgId); |
398 | 2 | return OrganizationAssembler.toOrgOrgRelationInfos(orgOrgRelations); |
399 | |
} |
400 | |
|
401 | |
@Override |
402 | |
public OrgPersonRelationInfo getOrgPersonRelation(String orgPersonRelationId) |
403 | |
throws DoesNotExistException, InvalidParameterException, |
404 | |
MissingParameterException, OperationFailedException, |
405 | |
PermissionDeniedException { |
406 | 0 | checkForMissingParameter(orgPersonRelationId, "orgPersonRelationId"); |
407 | |
|
408 | 0 | OrgPersonRelation opr = organizationDao.fetch(OrgPersonRelation.class, orgPersonRelationId); |
409 | 0 | return OrganizationAssembler.toOrgPersonRelationInfo(opr); |
410 | |
} |
411 | |
|
412 | |
@Override |
413 | |
public OrgPersonRelationTypeInfo getOrgPersonRelationType( |
414 | |
String orgPersonRelationTypeKey) throws DoesNotExistException, |
415 | |
InvalidParameterException, MissingParameterException, |
416 | |
OperationFailedException { |
417 | 0 | checkForMissingParameter(orgPersonRelationTypeKey, "orgPersonRelationTypeKey"); |
418 | |
|
419 | 0 | OrgPersonRelationType oprt = organizationDao.fetch(OrgPersonRelationType.class, orgPersonRelationTypeKey); |
420 | 0 | return OrganizationAssembler.toOrgPersonRelationTypeInfo(oprt); |
421 | |
} |
422 | |
|
423 | |
@Override |
424 | |
public List<OrgPersonRelationTypeInfo> getOrgPersonRelationTypes() |
425 | |
throws OperationFailedException { |
426 | 0 | List<OrgPersonRelationType> oprts = organizationDao.find(OrgPersonRelationType.class); |
427 | 0 | return OrganizationAssembler.toOrgPersonRelationTypeInfos(oprts); |
428 | |
} |
429 | |
|
430 | |
@Override |
431 | |
public List<OrgPersonRelationTypeInfo> getOrgPersonRelationTypesForOrgType( |
432 | |
String orgTypeKey) throws DoesNotExistException, |
433 | |
InvalidParameterException, MissingParameterException, |
434 | |
OperationFailedException { |
435 | 2 | checkForMissingParameter(orgTypeKey, "orgTypeKey"); |
436 | |
|
437 | 2 | List<OrgPersonRelationType> oprts = organizationDao.getOrgPersonRelationTypesForOrgType(orgTypeKey); |
438 | 2 | return OrganizationAssembler.toOrgPersonRelationTypeInfos(oprts); |
439 | |
} |
440 | |
|
441 | |
@Override |
442 | |
public List<OrgPersonRelationInfo> getOrgPersonRelationsByIdList( |
443 | |
List<String> orgPersonRelationIdList) throws DoesNotExistException, |
444 | |
InvalidParameterException, MissingParameterException, |
445 | |
OperationFailedException, PermissionDeniedException { |
446 | 3 | checkForMissingParameter(orgPersonRelationIdList, "orgPersonRelationIdList"); |
447 | |
|
448 | 3 | List<OrgPersonRelation> oprts = organizationDao.getOrgPersonRelationsByIdList(orgPersonRelationIdList); |
449 | 3 | return OrganizationAssembler.toOrgPersonRelationInfos(oprts); |
450 | |
} |
451 | |
|
452 | |
@Override |
453 | |
public List<OrgPersonRelationInfo> getOrgPersonRelationsByOrg(String orgId) |
454 | |
throws DoesNotExistException, InvalidParameterException, |
455 | |
MissingParameterException, OperationFailedException, |
456 | |
PermissionDeniedException { |
457 | 0 | checkForMissingParameter(orgId, "orgId"); |
458 | |
|
459 | 0 | List<OrgPersonRelation> relations = organizationDao.getAllOrgPersonRelationsByOrg(orgId); |
460 | 0 | return OrganizationAssembler.toOrgPersonRelationInfos(relations); |
461 | |
} |
462 | |
|
463 | |
@Override |
464 | |
public List<OrgPersonRelationInfo> getOrgPersonRelationsByPerson( |
465 | |
String personId, String orgId) throws DoesNotExistException, |
466 | |
InvalidParameterException, MissingParameterException, |
467 | |
OperationFailedException, PermissionDeniedException { |
468 | 4 | checkForMissingParameter(personId, "personId"); |
469 | 4 | checkForMissingParameter(orgId, "orgId"); |
470 | |
|
471 | 4 | List<OrgPersonRelation> oprts = organizationDao.getOrgPersonRelationsByPerson(personId, orgId); |
472 | 4 | return OrganizationAssembler.toOrgPersonRelationInfos(oprts); |
473 | |
} |
474 | |
|
475 | |
@Override |
476 | |
public OrgTypeInfo getOrgType(String orgTypeKey) |
477 | |
throws DoesNotExistException, InvalidParameterException, |
478 | |
MissingParameterException, OperationFailedException { |
479 | 2 | checkForMissingParameter(orgTypeKey, "orgTypeKey"); |
480 | |
|
481 | 2 | return OrganizationAssembler.toOrgTypeInfo(organizationDao.fetch(OrgType.class, orgTypeKey)); |
482 | |
} |
483 | |
|
484 | |
@Override |
485 | |
public List<OrgTypeInfo> getOrgTypes() throws OperationFailedException { |
486 | 1 | return OrganizationAssembler.toOrgTypeInfos(organizationDao.find(OrgType.class)); |
487 | |
} |
488 | |
|
489 | |
@Override |
490 | |
public OrgInfo getOrganization(String orgId) throws DoesNotExistException, |
491 | |
InvalidParameterException, MissingParameterException, |
492 | |
OperationFailedException, PermissionDeniedException { |
493 | 4 | checkForMissingParameter(orgId, "orgId"); |
494 | |
|
495 | 4 | return OrganizationAssembler.toOrgInfo(organizationDao.fetch(Org.class, orgId)); |
496 | |
} |
497 | |
|
498 | |
@Override |
499 | |
public List<OrgInfo> getOrganizationsByIdList(List<String> orgIdList) |
500 | |
throws DoesNotExistException, InvalidParameterException, |
501 | |
MissingParameterException, OperationFailedException, |
502 | |
PermissionDeniedException { |
503 | 0 | checkForMissingParameter(orgIdList, "orgIdList"); |
504 | |
|
505 | 0 | List<Org> orgs = this.organizationDao.getOrganizationsByIdList(orgIdList); |
506 | 0 | return OrganizationAssembler.toOrgInfos(orgs); |
507 | |
} |
508 | |
|
509 | |
@Override |
510 | |
public List<String> getPersonIdsForOrgByRelationType(String orgId, |
511 | |
String orgPersonRelationTypeKey) throws DoesNotExistException, |
512 | |
InvalidParameterException, MissingParameterException, |
513 | |
OperationFailedException, PermissionDeniedException { |
514 | 2 | checkForMissingParameter(orgId, "orgId"); |
515 | 2 | checkForMissingParameter(orgPersonRelationTypeKey, "orgPersonRelationTypeKey"); |
516 | |
|
517 | 2 | return organizationDao.getPersonIdsForOrgByRelationType(orgId, orgPersonRelationTypeKey); |
518 | |
} |
519 | |
|
520 | |
@Override |
521 | |
public List<OrgPositionRestrictionInfo> getPositionRestrictionsByOrg( |
522 | |
String orgId) throws DataValidationErrorException, |
523 | |
DoesNotExistException, InvalidParameterException, |
524 | |
MissingParameterException, PermissionDeniedException, |
525 | |
OperationFailedException { |
526 | 2 | checkForMissingParameter(orgId, "orgId"); |
527 | |
|
528 | 2 | List<OrgPositionRestriction> restrictions = organizationDao.getPositionRestrictionsByOrg(orgId); |
529 | 2 | return OrganizationAssembler.toOrgPositionRestrictionInfos(restrictions); |
530 | |
} |
531 | |
|
532 | |
@Override |
533 | |
public Boolean hasOrgOrgRelation(String orgId, String comparisonOrgId, |
534 | |
String orgOrgRelationTypeKey) throws InvalidParameterException, |
535 | |
MissingParameterException, OperationFailedException, |
536 | |
PermissionDeniedException { |
537 | |
|
538 | 2 | checkForMissingParameter(orgId, "orgId"); |
539 | 2 | checkForMissingParameter(comparisonOrgId, "comparisonOrgId"); |
540 | 2 | checkForMissingParameter(orgOrgRelationTypeKey, "orgOrgRelationTypeKey"); |
541 | |
|
542 | 2 | boolean result = organizationDao.hasOrgOrgRelation(orgId, comparisonOrgId, |
543 | |
orgOrgRelationTypeKey); |
544 | 2 | return Boolean.valueOf(result); |
545 | |
} |
546 | |
|
547 | |
@Override |
548 | |
public Boolean hasOrgPersonRelation(String orgId, String personId, |
549 | |
String orgPersonRelationTypeKey) throws InvalidParameterException, |
550 | |
MissingParameterException, OperationFailedException, |
551 | |
PermissionDeniedException { |
552 | 7 | checkForMissingParameter(orgId, "orgId"); |
553 | 6 | checkForMissingParameter(personId, "personId"); |
554 | 5 | checkForMissingParameter(orgPersonRelationTypeKey, "orgPersonRelationTypeKey"); |
555 | |
|
556 | 4 | return organizationDao.hasOrgPersonRelation(orgId, personId, orgPersonRelationTypeKey); |
557 | |
} |
558 | |
|
559 | |
@Override |
560 | |
public Boolean isDescendant(String orgId, String descendantOrgId, |
561 | |
String orgHierarchy) throws InvalidParameterException, |
562 | |
MissingParameterException, OperationFailedException, |
563 | |
PermissionDeniedException { |
564 | 3 | checkForMissingParameter(orgId, "orgId"); |
565 | 3 | checkForMissingParameter(descendantOrgId, "descendantOrgId"); |
566 | 3 | checkForMissingParameter(orgHierarchy, "orgHierarchy"); |
567 | |
|
568 | |
|
569 | 3 | List<String> ancestors = organizationDao.getAllAncestors(descendantOrgId, orgHierarchy); |
570 | 3 | boolean result = ancestors.contains(orgId); |
571 | 3 | return Boolean.valueOf(result); |
572 | |
} |
573 | |
|
574 | |
@Override |
575 | |
public StatusInfo removeOrgOrgRelation(String orgOrgRelationId) |
576 | |
throws DoesNotExistException, InvalidParameterException, |
577 | |
MissingParameterException, OperationFailedException, |
578 | |
PermissionDeniedException { |
579 | 3 | checkForMissingParameter(orgOrgRelationId, "orgOrgRelationId"); |
580 | |
|
581 | 2 | organizationDao.delete(OrgOrgRelation.class, orgOrgRelationId); |
582 | 1 | return new StatusInfo(); |
583 | |
} |
584 | |
|
585 | |
@Override |
586 | |
public StatusInfo removeOrgPersonRelation(String orgPersonRelationId) |
587 | |
throws DoesNotExistException, InvalidParameterException, |
588 | |
MissingParameterException, OperationFailedException, |
589 | |
PermissionDeniedException { |
590 | 5 | checkForMissingParameter(orgPersonRelationId, "orgPersonRelationId"); |
591 | |
|
592 | 3 | organizationDao.delete(OrgPersonRelation.class, orgPersonRelationId); |
593 | 1 | return new StatusInfo(); |
594 | |
} |
595 | |
|
596 | |
@Override |
597 | |
public StatusInfo removePositionRestrictionFromOrg(String orgId, |
598 | |
String orgPersonRelationTypeKey) throws DoesNotExistException, |
599 | |
InvalidParameterException, MissingParameterException, |
600 | |
OperationFailedException, PermissionDeniedException { |
601 | |
|
602 | 5 | checkForMissingParameter(orgId, "orgId"); |
603 | 4 | checkForMissingParameter(orgPersonRelationTypeKey, "orgPersonRelationTypeKey"); |
604 | 3 | OrgPositionRestriction opr = null; |
605 | |
try { |
606 | 3 | opr = organizationDao.getPositionRestrictionByOrgAndPersonRelationTypeKey(orgId, orgPersonRelationTypeKey); |
607 | 1 | if (opr == null) { |
608 | 0 | throw new DoesNotExistException(); |
609 | |
} |
610 | 2 | } catch (NoResultException e) { |
611 | 2 | throw new DoesNotExistException(); |
612 | 1 | } |
613 | 1 | organizationDao.delete(opr); |
614 | 1 | return new StatusInfo(); |
615 | |
} |
616 | |
|
617 | |
@Override |
618 | |
public OrgOrgRelationInfo updateOrgOrgRelation(String orgOrgRelationId, |
619 | |
OrgOrgRelationInfo orgOrgRelationInfo) |
620 | |
throws DataValidationErrorException, DoesNotExistException, |
621 | |
InvalidParameterException, MissingParameterException, |
622 | |
OperationFailedException, PermissionDeniedException, |
623 | |
VersionMismatchException { |
624 | |
|
625 | 0 | checkForMissingParameter(orgOrgRelationId, "orgOrgRelationId"); |
626 | 0 | checkForMissingParameter(orgOrgRelationId, "orgOrgRelationId"); |
627 | |
|
628 | |
|
629 | 0 | orgOrgRelationInfo.setId(orgOrgRelationId); |
630 | |
|
631 | 0 | OrgOrgRelation orgOrgRelation = null; |
632 | |
|
633 | |
|
634 | 0 | orgOrgRelation = OrganizationAssembler.toOrgOrgRelation(true, orgOrgRelationInfo, organizationDao); |
635 | |
|
636 | |
|
637 | 0 | OrgOrgRelation updatedOrgOrgRelation = organizationDao.update(orgOrgRelation); |
638 | |
|
639 | |
|
640 | 0 | OrgOrgRelationInfo updatedOrgOrgRelationInfo = OrganizationAssembler.toOrgOrgRelationInfo(updatedOrgOrgRelation); |
641 | 0 | return updatedOrgOrgRelationInfo; |
642 | |
|
643 | |
} |
644 | |
|
645 | |
@Override |
646 | |
public OrgPersonRelationInfo updateOrgPersonRelation( |
647 | |
String orgPersonRelationId, |
648 | |
OrgPersonRelationInfo orgPersonRelationInfo) |
649 | |
throws DataValidationErrorException, DoesNotExistException, |
650 | |
InvalidParameterException, MissingParameterException, |
651 | |
OperationFailedException, PermissionDeniedException, |
652 | |
VersionMismatchException { |
653 | |
|
654 | 0 | checkForMissingParameter(orgPersonRelationId, "orgPersonRelationId"); |
655 | 0 | checkForMissingParameter(orgPersonRelationInfo, "orgPersonRelationInfo"); |
656 | |
|
657 | |
|
658 | 0 | if(!organizationDao.validatePositionRestriction(orgPersonRelationInfo.getOrgId(),orgPersonRelationInfo.getType())){ |
659 | 0 | throw new InvalidParameterException("There is no Position for this relationship"); |
660 | |
} |
661 | |
|
662 | |
|
663 | 0 | orgPersonRelationInfo.setId(orgPersonRelationId); |
664 | |
|
665 | 0 | OrgPersonRelation orgPersonRelation = null; |
666 | |
|
667 | |
|
668 | 0 | orgPersonRelation = OrganizationAssembler.toOrgPersonRelation(true, orgPersonRelationInfo, organizationDao); |
669 | |
|
670 | |
|
671 | 0 | orgPersonRelation = organizationDao.update(orgPersonRelation); |
672 | |
|
673 | |
|
674 | 0 | OrgPersonRelationInfo createdOrgPersonRelationInfo = OrganizationAssembler.toOrgPersonRelationInfo(orgPersonRelation); |
675 | 0 | return createdOrgPersonRelationInfo; |
676 | |
} |
677 | |
|
678 | |
@Override |
679 | |
public OrgInfo updateOrganization(String orgId, OrgInfo orgInfo) |
680 | |
throws DataValidationErrorException, DoesNotExistException, |
681 | |
InvalidParameterException, MissingParameterException, |
682 | |
OperationFailedException, PermissionDeniedException, |
683 | |
VersionMismatchException { |
684 | |
|
685 | |
|
686 | 2 | checkForMissingParameter(orgId, "orgId"); |
687 | 2 | checkForMissingParameter(orgInfo, "orgInfo"); |
688 | |
|
689 | |
|
690 | 2 | orgInfo.setId(orgId); |
691 | |
|
692 | 2 | Org org = null; |
693 | |
|
694 | |
|
695 | 2 | org = OrganizationAssembler.toOrg(true, orgInfo, organizationDao); |
696 | |
|
697 | |
|
698 | 1 | Org updatedOrg = organizationDao.update(org); |
699 | |
|
700 | |
|
701 | 1 | OrgInfo updatedOrgInfo = OrganizationAssembler.toOrgInfo(updatedOrg); |
702 | 1 | return updatedOrgInfo; |
703 | |
|
704 | |
} |
705 | |
|
706 | |
@Override |
707 | |
public OrgPositionRestrictionInfo updatePositionRestrictionForOrg( |
708 | |
String orgId, String orgPersonRelationTypeKey, |
709 | |
OrgPositionRestrictionInfo orgPositionRestrictionInfo) |
710 | |
throws DataValidationErrorException, DoesNotExistException, |
711 | |
InvalidParameterException, MissingParameterException, |
712 | |
OperationFailedException, PermissionDeniedException, |
713 | |
VersionMismatchException { |
714 | |
|
715 | |
|
716 | 0 | checkForMissingParameter(orgId, "orgId"); |
717 | 0 | checkForMissingParameter(orgPersonRelationTypeKey, "orgPersonRelationTypeKey"); |
718 | 0 | checkForMissingParameter(orgPositionRestrictionInfo, "orgPositionRestrictionInfo"); |
719 | |
|
720 | |
|
721 | 0 | orgPositionRestrictionInfo.setOrgId(orgId); |
722 | 0 | orgPositionRestrictionInfo.setOrgPersonRelationTypeKey(orgPersonRelationTypeKey); |
723 | |
|
724 | 0 | OrgPositionRestriction orgPositionRestriction = null; |
725 | |
|
726 | |
|
727 | 0 | orgPositionRestriction = OrganizationAssembler.toOrgPositionRestriction(true, orgPositionRestrictionInfo, organizationDao); |
728 | |
|
729 | |
|
730 | 0 | OrgPositionRestriction updated = organizationDao.update(orgPositionRestriction); |
731 | |
|
732 | |
|
733 | 0 | OrgPositionRestrictionInfo updatedOrgPositionRestrictionInfo = OrganizationAssembler.toOrgPositionRestrictionInfo(updated); |
734 | 0 | return updatedOrgPositionRestrictionInfo; |
735 | |
} |
736 | |
|
737 | |
@Override |
738 | |
public List<ValidationResultInfo> validateOrg(String validationType, |
739 | |
OrgInfo orgInfo) throws DoesNotExistException, |
740 | |
InvalidParameterException, MissingParameterException, |
741 | |
OperationFailedException { |
742 | |
|
743 | 1 | checkForMissingParameter(validationType, "validationType"); |
744 | 1 | checkForMissingParameter(orgInfo, "orgInfo"); |
745 | |
|
746 | |
|
747 | |
|
748 | |
|
749 | 1 | return new ArrayList<ValidationResultInfo>(0); |
750 | |
} |
751 | |
|
752 | |
@Override |
753 | |
public List<ValidationResultInfo> validateOrgOrgRelation(String validationType, |
754 | |
OrgOrgRelationInfo orgOrgRelationInfo) |
755 | |
throws DoesNotExistException, InvalidParameterException, |
756 | |
MissingParameterException, OperationFailedException { |
757 | 0 | checkForMissingParameter(validationType, "validationType"); |
758 | 0 | checkForMissingParameter(orgOrgRelationInfo, "orgOrgRelationInfo"); |
759 | |
|
760 | 0 | List<ValidationResultInfo> valResults = validator.validateTypeStateObject(orgOrgRelationInfo, getObjectStructure("orgOrgRelationInfo")); |
761 | 0 | return valResults; |
762 | |
} |
763 | |
|
764 | |
@Override |
765 | |
public List<ValidationResultInfo> validateOrgPersonRelation( |
766 | |
String validationType, OrgPersonRelationInfo orgPersonRelationInfo) |
767 | |
throws DoesNotExistException, InvalidParameterException, |
768 | |
MissingParameterException, OperationFailedException { |
769 | 0 | checkForMissingParameter(validationType, "validationType"); |
770 | |
|
771 | 0 | List<ValidationResultInfo> valResults = validator.validateTypeStateObject(orgPersonRelationInfo, getObjectStructure("orgPersonRelationInfo")); |
772 | 0 | return valResults; |
773 | |
|
774 | |
} |
775 | |
|
776 | |
@Override |
777 | |
public List<ValidationResultInfo> validateOrgPositionRestriction( |
778 | |
String validationType, |
779 | |
OrgPositionRestrictionInfo orgPositionRestrictionInfo) |
780 | |
throws DoesNotExistException, InvalidParameterException, |
781 | |
MissingParameterException, OperationFailedException { |
782 | 0 | checkForMissingParameter(validationType, "validationType"); |
783 | 0 | checkForMissingParameter(orgPositionRestrictionInfo, "orgPositionRestrictionInfo"); |
784 | |
|
785 | 0 | return null; |
786 | |
} |
787 | |
|
788 | |
@Override |
789 | |
public SearchCriteriaTypeInfo getSearchCriteriaType( |
790 | |
String searchCriteriaTypeKey) throws DoesNotExistException, |
791 | |
InvalidParameterException, MissingParameterException, |
792 | |
OperationFailedException { |
793 | |
|
794 | 0 | return searchManager.getSearchCriteriaType(searchCriteriaTypeKey); |
795 | |
} |
796 | |
|
797 | |
@Override |
798 | |
public List<SearchCriteriaTypeInfo> getSearchCriteriaTypes() |
799 | |
throws OperationFailedException { |
800 | 0 | return searchManager.getSearchCriteriaTypes(); |
801 | |
} |
802 | |
|
803 | |
@Override |
804 | |
public SearchResultTypeInfo getSearchResultType(String searchResultTypeKey) |
805 | |
throws DoesNotExistException, InvalidParameterException, |
806 | |
MissingParameterException, OperationFailedException { |
807 | 0 | checkForMissingParameter(searchResultTypeKey, "searchResultTypeKey"); |
808 | 0 | return searchManager.getSearchResultType(searchResultTypeKey); |
809 | |
} |
810 | |
|
811 | |
@Override |
812 | |
public List<SearchResultTypeInfo> getSearchResultTypes() |
813 | |
throws OperationFailedException { |
814 | 0 | return searchManager.getSearchResultTypes(); |
815 | |
} |
816 | |
|
817 | |
@Override |
818 | |
public SearchTypeInfo getSearchType(String searchTypeKey) |
819 | |
throws DoesNotExistException, InvalidParameterException, |
820 | |
MissingParameterException, OperationFailedException { |
821 | 0 | checkForMissingParameter(searchTypeKey, "searchTypeKey"); |
822 | 0 | return searchManager.getSearchType(searchTypeKey); |
823 | |
} |
824 | |
|
825 | |
@Override |
826 | |
public List<SearchTypeInfo> getSearchTypes() |
827 | |
throws OperationFailedException { |
828 | 0 | return searchManager.getSearchTypes(); |
829 | |
} |
830 | |
|
831 | |
@Override |
832 | |
public List<SearchTypeInfo> getSearchTypesByCriteria( |
833 | |
String searchCriteriaTypeKey) throws DoesNotExistException, |
834 | |
InvalidParameterException, MissingParameterException, |
835 | |
OperationFailedException { |
836 | 0 | checkForMissingParameter(searchCriteriaTypeKey, "searchCriteriaTypeKey"); |
837 | 0 | return searchManager.getSearchTypesByCriteria(searchCriteriaTypeKey); |
838 | |
} |
839 | |
|
840 | |
@Override |
841 | |
public List<SearchTypeInfo> getSearchTypesByResult( |
842 | |
String searchResultTypeKey) throws DoesNotExistException, |
843 | |
InvalidParameterException, MissingParameterException, |
844 | |
OperationFailedException { |
845 | 0 | checkForMissingParameter(searchResultTypeKey, "searchResultTypeKey"); |
846 | 0 | return searchManager.getSearchTypesByResult(searchResultTypeKey); |
847 | |
} |
848 | |
|
849 | |
public OrganizationDao getOrganizationDao() { |
850 | 0 | return organizationDao; |
851 | |
} |
852 | |
|
853 | |
public void setOrganizationDao(OrganizationDao organizationDao) { |
854 | 1 | this.organizationDao = organizationDao; |
855 | 1 | } |
856 | |
|
857 | |
@Override |
858 | |
public ObjectStructure getObjectStructure(String objectTypeKey) { |
859 | 0 | return dictionaryServiceDelegate.getObjectStructure(objectTypeKey); |
860 | |
} |
861 | |
|
862 | |
@Override |
863 | |
public List<String> getObjectTypes() { |
864 | 0 | return dictionaryServiceDelegate.getObjectTypes(); |
865 | |
} |
866 | |
|
867 | |
@Override |
868 | |
public List<OrgTreeInfo> getOrgTree(String rootOrgId, |
869 | |
String orgHierarchyId, int maxLevels) throws DoesNotExistException, |
870 | |
InvalidParameterException, MissingParameterException, |
871 | |
OperationFailedException, PermissionDeniedException { |
872 | 2 | checkForMissingParameter(rootOrgId, "rootOrgId"); |
873 | 2 | checkForMissingParameter(orgHierarchyId, "orgHierarchyId"); |
874 | |
|
875 | 2 | Set<OrgTreeInfo> results = new HashSet<OrgTreeInfo>(); |
876 | 2 | Org rootOrg = organizationDao.fetch(Org.class, rootOrgId); |
877 | 2 | OrgTreeInfo root = new OrgTreeInfo(rootOrgId,null,rootOrg.getLongName()); |
878 | 2 | root.setPositions(this.organizationDao.getOrgMemebershipCount(root.getOrgId())); |
879 | 2 | root.setOrgHierarchyId(orgHierarchyId); |
880 | 2 | results.add(root); |
881 | 2 | if(maxLevels>=0){ |
882 | 2 | results.addAll(parseOrgTree(rootOrgId, orgHierarchyId, maxLevels,0)); |
883 | |
} |
884 | 2 | return new ArrayList<OrgTreeInfo>(results); |
885 | |
} |
886 | |
|
887 | |
private List<OrgTreeInfo> parseOrgTree(String rootOrgId, |
888 | |
String orgHierarchyId, int maxLevels, int currentLevel) { |
889 | 169 | List<OrgTreeInfo> results = new ArrayList<OrgTreeInfo>(); |
890 | 169 | if(maxLevels==0||currentLevel<maxLevels){ |
891 | 161 | List<OrgTreeInfo> orgTreeInfos = this.organizationDao.getOrgTreeInfo(rootOrgId,orgHierarchyId); |
892 | 161 | for(OrgTreeInfo orgTreeInfo:orgTreeInfos){ |
893 | 167 | orgTreeInfo.setPositions(this.organizationDao.getOrgMemebershipCount(orgTreeInfo.getOrgId())); |
894 | 167 | results.addAll(parseOrgTree(orgTreeInfo.getOrgId(),orgHierarchyId, maxLevels, currentLevel+1)); |
895 | |
} |
896 | 161 | results.addAll(orgTreeInfos); |
897 | |
} |
898 | 169 | return results; |
899 | |
} |
900 | |
|
901 | |
|
902 | |
|
903 | |
|
904 | |
|
905 | |
|
906 | |
|
907 | |
|
908 | |
private void checkForMissingParameter(Object param, String paramName) |
909 | |
throws MissingParameterException { |
910 | 145 | if (param == null) { |
911 | 9 | throw new MissingParameterException(paramName + " can not be null"); |
912 | |
} |
913 | 136 | } |
914 | |
|
915 | |
public SearchManager getSearchManager() { |
916 | 0 | return searchManager; |
917 | |
} |
918 | |
|
919 | |
public void setSearchManager(SearchManager searchManager) { |
920 | 1 | this.searchManager = searchManager; |
921 | 1 | } |
922 | |
|
923 | |
public DictionaryService getDictionaryServiceDelegate() { |
924 | 0 | return dictionaryServiceDelegate; |
925 | |
} |
926 | |
|
927 | |
public void setDictionaryServiceDelegate( |
928 | |
DictionaryService dictionaryServiceDelegate) { |
929 | 1 | this.dictionaryServiceDelegate = dictionaryServiceDelegate; |
930 | 1 | } |
931 | |
|
932 | |
public Validator getValidator() { |
933 | 0 | return validator; |
934 | |
} |
935 | |
|
936 | |
public void setValidator(Validator validator) { |
937 | 0 | this.validator = validator; |
938 | 0 | } |
939 | |
|
940 | |
@Override |
941 | |
public SearchResult search(SearchRequest searchRequest) throws MissingParameterException { |
942 | 5 | checkForMissingParameter(searchRequest, "searchRequest"); |
943 | 5 | return searchManager.search(searchRequest, organizationDao); |
944 | |
} |
945 | |
} |