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