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