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(readOnly=true,noRollbackFor={DoesNotExistException.class},rollbackFor={Throwable.class}) |
69 | 0 | public class OrganizationServiceImpl implements OrganizationService { |
70 | |
|
71 | 0 | 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 | 0 | checkForMissingParameter(orgId, "orgId"); |
90 | 0 | checkForMissingParameter(orgPersonRelationTypeKey, "orgPersonRelationTypeKey"); |
91 | 0 | checkForMissingParameter(orgPositionRestrictionInfo, "orgPositionRestrictionInfo"); |
92 | |
|
93 | |
|
94 | 0 | orgPositionRestrictionInfo.setOrgId(orgId); |
95 | 0 | orgPositionRestrictionInfo.setOrgPersonRelationTypeKey(orgPersonRelationTypeKey); |
96 | |
|
97 | 0 | OrgPositionRestriction orgPositionRestriction = null; |
98 | |
|
99 | |
|
100 | |
try { |
101 | 0 | orgPositionRestriction = OrganizationAssembler.toOrgPositionRestriction(false, orgPositionRestrictionInfo, organizationDao); |
102 | 0 | } catch (VersionMismatchException e) { |
103 | 0 | } |
104 | |
|
105 | |
|
106 | 0 | organizationDao.create(orgPositionRestriction); |
107 | |
|
108 | |
|
109 | 0 | OrgPositionRestrictionInfo createdOrgPositionRestrictionInfo = OrganizationAssembler.toOrgPositionRestrictionInfo(orgPositionRestriction); |
110 | 0 | 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 | 0 | checkForMissingParameter(orgId, "orgId"); |
125 | 0 | checkForMissingParameter(relatedOrgId, "relatedOrgId"); |
126 | 0 | checkForMissingParameter(orgOrgRelationTypeKey, "orgOrgRelationTypeKey"); |
127 | 0 | checkForMissingParameter(orgOrgRelationInfo, "orgOrgRelationInfo"); |
128 | |
|
129 | |
|
130 | 0 | orgOrgRelationInfo.setOrgId(orgId); |
131 | 0 | orgOrgRelationInfo.setRelatedOrgId(relatedOrgId); |
132 | 0 | orgOrgRelationInfo.setType(orgOrgRelationTypeKey); |
133 | |
|
134 | 0 | OrgOrgRelation orgOrgRelation = null; |
135 | |
|
136 | |
|
137 | |
try { |
138 | 0 | orgOrgRelation = OrganizationAssembler.toOrgOrgRelation(false, orgOrgRelationInfo, organizationDao); |
139 | 0 | } catch (VersionMismatchException e) { |
140 | 0 | } |
141 | |
|
142 | |
|
143 | 0 | organizationDao.create(orgOrgRelation); |
144 | |
|
145 | |
|
146 | 0 | OrgOrgRelationInfo createdOrgOrgRelationInfo = OrganizationAssembler.toOrgOrgRelationInfo(orgOrgRelation); |
147 | 0 | 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 | 0 | checkForMissingParameter(orgId, "orgId"); |
162 | 0 | checkForMissingParameter(personId, "personId"); |
163 | 0 | checkForMissingParameter(orgPersonRelationTypeKey, "orgPersonRelationTypeKey"); |
164 | 0 | checkForMissingParameter(orgPersonRelationTypeKey, "orgPersonRelationTypeKey"); |
165 | |
|
166 | |
|
167 | 0 | if(!organizationDao.validatePositionRestriction(orgId,orgPersonRelationTypeKey)){ |
168 | 0 | throw new InvalidParameterException("There is no Position for this relationship"); |
169 | |
} |
170 | |
|
171 | |
|
172 | 0 | orgPersonRelationInfo.setOrgId(orgId); |
173 | 0 | orgPersonRelationInfo.setPersonId(personId); |
174 | 0 | orgPersonRelationInfo.setType(orgPersonRelationTypeKey); |
175 | |
|
176 | 0 | OrgPersonRelation orgPersonRelation = null; |
177 | |
|
178 | |
|
179 | |
try { |
180 | 0 | orgPersonRelation = OrganizationAssembler.toOrgPersonRelation(false, orgPersonRelationInfo, organizationDao); |
181 | 0 | } catch (VersionMismatchException e) { |
182 | 0 | } |
183 | |
|
184 | |
|
185 | 0 | organizationDao.create(orgPersonRelation); |
186 | |
|
187 | |
|
188 | 0 | OrgPersonRelationInfo createdOrgPersonRelationInfo = OrganizationAssembler.toOrgPersonRelationInfo(orgPersonRelation); |
189 | 0 | 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 | 0 | checkForMissingParameter(orgTypeKey, "orgTypeKey"); |
201 | 0 | checkForMissingParameter(orgInfo, "orgInfo"); |
202 | |
|
203 | |
|
204 | 0 | orgInfo.setType(orgTypeKey); |
205 | |
|
206 | |
try { |
207 | 0 | List<ValidationResultInfo> validations = validateOrg("", orgInfo); |
208 | 0 | 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 | 0 | } |
215 | |
|
216 | 0 | Org org = null; |
217 | |
|
218 | |
|
219 | |
try { |
220 | 0 | 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 | 0 | } |
230 | |
|
231 | |
|
232 | 0 | organizationDao.create(org); |
233 | |
|
234 | |
|
235 | 0 | OrgInfo createdOrgInfo = OrganizationAssembler.toOrgInfo(org); |
236 | 0 | 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 | 0 | checkForMissingParameter(orgId, "orgId"); |
248 | |
|
249 | 0 | Org org = organizationDao.fetch(Org.class, orgId); |
250 | |
|
251 | 0 | if(org==null){ |
252 | 0 | throw new DoesNotExistException("Org does not exist for id: "+orgId); |
253 | |
} |
254 | |
|
255 | 0 | organizationDao.delete(org); |
256 | |
|
257 | 0 | StatusInfo statusInfo = new StatusInfo(); |
258 | 0 | statusInfo.setSuccess(true); |
259 | 0 | return statusInfo; |
260 | |
} |
261 | |
|
262 | |
@Override |
263 | |
public List<String> getAllDescendants(String orgId, String orgHierarchy) |
264 | |
throws InvalidParameterException, MissingParameterException, |
265 | |
OperationFailedException, PermissionDeniedException { |
266 | |
|
267 | 0 | checkForMissingParameter(orgId, "orgId"); |
268 | 0 | checkForMissingParameter(orgId, "orgHierarchy"); |
269 | |
|
270 | 0 | List<String> descendants = this.organizationDao.getAllDescendants(orgId, orgHierarchy); |
271 | 0 | return descendants; |
272 | |
} |
273 | |
|
274 | |
@Override |
275 | |
public List<OrgPersonRelationInfo> getAllOrgPersonRelationsByOrg( |
276 | |
String orgId) throws DoesNotExistException, |
277 | |
InvalidParameterException, MissingParameterException, |
278 | |
OperationFailedException, PermissionDeniedException { |
279 | 0 | checkForMissingParameter(orgId, "orgId"); |
280 | |
|
281 | 0 | 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 | 0 | checkForMissingParameter(personId, "personId"); |
290 | |
|
291 | 0 | List<OrgPersonRelation> orgPersonRelationInfo = organizationDao.getAllOrgPersonRelationsByPerson(personId); |
292 | 0 | 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 | 0 | checkForMissingParameter(orgId, "orgId"); |
300 | 0 | checkForMissingParameter(orgHierarchy, "orgHierarchy"); |
301 | |
|
302 | 0 | List<String> ancestors = this.organizationDao.getAllAncestors(orgId, orgHierarchy); |
303 | 0 | return ancestors; |
304 | |
} |
305 | |
|
306 | |
@Override |
307 | |
public List<OrgHierarchyInfo> getOrgHierarchies() |
308 | |
throws OperationFailedException { |
309 | 0 | 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 | 0 | checkForMissingParameter(orgHierarchyKey, "orgHierarchyKey"); |
318 | |
|
319 | 0 | 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 | 0 | checkForMissingParameter(orgOrgRelationId, "orgOrgRelationId"); |
328 | |
|
329 | 0 | 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 | 0 | checkForMissingParameter(orgOrgRelationTypeKey, "orgOrgRelationTypeKey"); |
339 | |
|
340 | 0 | return OrganizationAssembler.toOrgOrgRelationTypeInfo(organizationDao.fetch(OrgOrgRelationType.class, orgOrgRelationTypeKey)); |
341 | |
} |
342 | |
|
343 | |
@Override |
344 | |
public List<OrgOrgRelationTypeInfo> getOrgOrgRelationTypes() |
345 | |
throws OperationFailedException { |
346 | 0 | List<OrgOrgRelationType> orgOrgRelationTypes = organizationDao.find(OrgOrgRelationType.class); |
347 | 0 | return OrganizationAssembler.toOrgOrgRelationTypeInfos(orgOrgRelationTypes); |
348 | |
} |
349 | |
|
350 | |
@Override |
351 | |
public List<OrgOrgRelationTypeInfo> getOrgOrgRelationTypesForOrgHierarchy( |
352 | |
String orgHierarchyKey) throws DoesNotExistException, |
353 | |
InvalidParameterException, MissingParameterException, |
354 | |
OperationFailedException { |
355 | 0 | checkForMissingParameter(orgHierarchyKey, "orgHierarchyKey"); |
356 | |
|
357 | 0 | List<OrgOrgRelationType> orgOrgRelationTypes = organizationDao.getOrgOrgRelationTypesForOrgHierarchy(orgHierarchyKey); |
358 | 0 | return OrganizationAssembler.toOrgOrgRelationTypeInfos(orgOrgRelationTypes); |
359 | |
} |
360 | |
|
361 | |
@Override |
362 | |
public List<OrgOrgRelationTypeInfo> getOrgOrgRelationTypesForOrgType( |
363 | |
String orgTypeKey) throws DoesNotExistException, |
364 | |
InvalidParameterException, MissingParameterException, |
365 | |
OperationFailedException { |
366 | 0 | checkForMissingParameter(orgTypeKey, "orgTypeKey"); |
367 | |
|
368 | 0 | List<OrgOrgRelationType> orgOrgRelationTypes = organizationDao.getOrgOrgRelationTypesForOrgType(orgTypeKey); |
369 | 0 | 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 | 0 | checkForMissingParameter(orgOrgRelationIdList, "orgOrgRelationIdList"); |
378 | |
|
379 | 0 | List<OrgOrgRelation> orgOrgRelations = organizationDao.getOrgOrgRelationsByIdList(orgOrgRelationIdList); |
380 | 0 | 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 | 0 | checkForMissingParameter(orgId, "orgId"); |
390 | |
|
391 | 0 | List<OrgOrgRelation> orgOrgRelations = organizationDao.getOrgOrgRelationsByOrg(orgId); |
392 | 0 | 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 | 0 | checkForMissingParameter(relatedOrgId, "relatedOrgId"); |
401 | |
|
402 | 0 | List<OrgOrgRelation> orgOrgRelations = organizationDao.getOrgOrgRelationsByRelatedOrg(relatedOrgId); |
403 | 0 | 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 | 0 | checkForMissingParameter(orgTypeKey, "orgTypeKey"); |
441 | |
|
442 | 0 | List<OrgPersonRelationType> oprts = organizationDao.getOrgPersonRelationTypesForOrgType(orgTypeKey); |
443 | 0 | 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 | 0 | checkForMissingParameter(orgPersonRelationIdList, "orgPersonRelationIdList"); |
452 | |
|
453 | 0 | List<OrgPersonRelation> oprts = organizationDao.getOrgPersonRelationsByIdList(orgPersonRelationIdList); |
454 | 0 | 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 | 0 | checkForMissingParameter(personId, "personId"); |
474 | 0 | checkForMissingParameter(orgId, "orgId"); |
475 | |
|
476 | 0 | List<OrgPersonRelation> oprts = organizationDao.getOrgPersonRelationsByPerson(personId, orgId); |
477 | 0 | return OrganizationAssembler.toOrgPersonRelationInfos(oprts); |
478 | |
} |
479 | |
|
480 | |
@Override |
481 | |
public OrgTypeInfo getOrgType(String orgTypeKey) |
482 | |
throws DoesNotExistException, InvalidParameterException, |
483 | |
MissingParameterException, OperationFailedException { |
484 | 0 | checkForMissingParameter(orgTypeKey, "orgTypeKey"); |
485 | |
|
486 | 0 | return OrganizationAssembler.toOrgTypeInfo(organizationDao.fetch(OrgType.class, orgTypeKey)); |
487 | |
} |
488 | |
|
489 | |
@Override |
490 | |
public List<OrgTypeInfo> getOrgTypes() throws OperationFailedException { |
491 | 0 | 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 | 0 | checkForMissingParameter(orgId, "orgId"); |
499 | |
|
500 | 0 | 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 | 0 | checkForMissingParameter(orgId, "orgId"); |
520 | 0 | checkForMissingParameter(orgPersonRelationTypeKey, "orgPersonRelationTypeKey"); |
521 | |
|
522 | 0 | 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 | 0 | checkForMissingParameter(orgId, "orgId"); |
532 | |
|
533 | 0 | List<OrgPositionRestriction> restrictions = organizationDao.getPositionRestrictionsByOrg(orgId); |
534 | 0 | 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 | 0 | checkForMissingParameter(orgId, "orgId"); |
544 | 0 | checkForMissingParameter(comparisonOrgId, "comparisonOrgId"); |
545 | 0 | checkForMissingParameter(orgOrgRelationTypeKey, "orgOrgRelationTypeKey"); |
546 | |
|
547 | 0 | boolean result = organizationDao.hasOrgOrgRelation(orgId, comparisonOrgId, |
548 | |
orgOrgRelationTypeKey); |
549 | 0 | 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 | 0 | checkForMissingParameter(orgId, "orgId"); |
558 | 0 | checkForMissingParameter(personId, "personId"); |
559 | 0 | checkForMissingParameter(orgPersonRelationTypeKey, "orgPersonRelationTypeKey"); |
560 | |
|
561 | 0 | 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 | 0 | checkForMissingParameter(orgId, "orgId"); |
570 | 0 | checkForMissingParameter(descendantOrgId, "descendantOrgId"); |
571 | 0 | checkForMissingParameter(orgHierarchy, "orgHierarchy"); |
572 | |
|
573 | |
|
574 | 0 | List<String> ancestors = organizationDao.getAllAncestors(descendantOrgId, orgHierarchy); |
575 | 0 | boolean result = ancestors.contains(orgId); |
576 | 0 | 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 | 0 | checkForMissingParameter(orgOrgRelationId, "orgOrgRelationId"); |
586 | |
|
587 | 0 | organizationDao.delete(OrgOrgRelation.class, orgOrgRelationId); |
588 | 0 | 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 | 0 | checkForMissingParameter(orgPersonRelationId, "orgPersonRelationId"); |
598 | |
|
599 | 0 | organizationDao.delete(OrgPersonRelation.class, orgPersonRelationId); |
600 | 0 | 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 | 0 | checkForMissingParameter(orgId, "orgId"); |
611 | 0 | checkForMissingParameter(orgPersonRelationTypeKey, "orgPersonRelationTypeKey"); |
612 | 0 | OrgPositionRestriction opr = null; |
613 | |
try { |
614 | 0 | opr = organizationDao.getPositionRestrictionByOrgAndPersonRelationTypeKey(orgId, orgPersonRelationTypeKey); |
615 | 0 | if (opr == null) { |
616 | 0 | throw new DoesNotExistException(); |
617 | |
} |
618 | 0 | } catch (NoResultException e) { |
619 | 0 | throw new DoesNotExistException(); |
620 | 0 | } |
621 | 0 | organizationDao.delete(opr); |
622 | 0 | 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 | 0 | checkForMissingParameter(orgId, "orgId"); |
698 | 0 | checkForMissingParameter(orgInfo, "orgInfo"); |
699 | |
|
700 | |
|
701 | 0 | orgInfo.setId(orgId); |
702 | |
|
703 | 0 | Org org = null; |
704 | |
|
705 | |
|
706 | 0 | org = OrganizationAssembler.toOrg(true, orgInfo, organizationDao); |
707 | |
|
708 | |
|
709 | 0 | Org updatedOrg = organizationDao.update(org); |
710 | |
|
711 | |
|
712 | 0 | OrgInfo updatedOrgInfo = OrganizationAssembler.toOrgInfo(updatedOrg); |
713 | 0 | 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 | 0 | checkForMissingParameter(validationType, "validationType"); |
756 | 0 | checkForMissingParameter(orgInfo, "orgInfo"); |
757 | |
|
758 | |
|
759 | |
|
760 | |
|
761 | 0 | 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 | 0 | this.organizationDao = organizationDao; |
867 | 0 | } |
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 | 0 | checkForMissingParameter(rootOrgId, "rootOrgId"); |
885 | 0 | checkForMissingParameter(orgHierarchyId, "orgHierarchyId"); |
886 | |
|
887 | 0 | Set<OrgTreeInfo> results = new HashSet<OrgTreeInfo>(); |
888 | 0 | Org rootOrg = organizationDao.fetch(Org.class, rootOrgId); |
889 | 0 | OrgTreeInfo root = new OrgTreeInfo(rootOrgId,null,rootOrg.getLongName()); |
890 | 0 | root.setPositions(this.organizationDao.getOrgMemebershipCount(root.getOrgId())); |
891 | 0 | root.setOrgHierarchyId(orgHierarchyId); |
892 | 0 | results.add(root); |
893 | 0 | if(maxLevels>=0){ |
894 | 0 | results.addAll(parseOrgTree(rootOrgId, orgHierarchyId, maxLevels,0)); |
895 | |
} |
896 | 0 | return new ArrayList<OrgTreeInfo>(results); |
897 | |
} |
898 | |
|
899 | |
private List<OrgTreeInfo> parseOrgTree(String rootOrgId, |
900 | |
String orgHierarchyId, int maxLevels, int currentLevel) { |
901 | 0 | List<OrgTreeInfo> results = new ArrayList<OrgTreeInfo>(); |
902 | 0 | if(maxLevels==0||currentLevel<maxLevels){ |
903 | 0 | List<OrgTreeInfo> orgTreeInfos = this.organizationDao.getOrgTreeInfo(rootOrgId,orgHierarchyId); |
904 | 0 | for(OrgTreeInfo orgTreeInfo:orgTreeInfos){ |
905 | 0 | orgTreeInfo.setPositions(this.organizationDao.getOrgMemebershipCount(orgTreeInfo.getOrgId())); |
906 | 0 | results.addAll(parseOrgTree(orgTreeInfo.getOrgId(),orgHierarchyId, maxLevels, currentLevel+1)); |
907 | |
} |
908 | 0 | results.addAll(orgTreeInfos); |
909 | |
} |
910 | 0 | return results; |
911 | |
} |
912 | |
|
913 | |
|
914 | |
|
915 | |
|
916 | |
|
917 | |
|
918 | |
|
919 | |
|
920 | |
private void checkForMissingParameter(Object param, String paramName) |
921 | |
throws MissingParameterException { |
922 | 0 | if (param == null) { |
923 | 0 | throw new MissingParameterException(paramName + " can not be null"); |
924 | |
} |
925 | 0 | } |
926 | |
|
927 | |
public SearchManager getSearchManager() { |
928 | 0 | return searchManager; |
929 | |
} |
930 | |
|
931 | |
public void setSearchManager(SearchManager searchManager) { |
932 | 0 | this.searchManager = searchManager; |
933 | 0 | } |
934 | |
|
935 | |
public DictionaryService getDictionaryServiceDelegate() { |
936 | 0 | return dictionaryServiceDelegate; |
937 | |
} |
938 | |
|
939 | |
public void setDictionaryServiceDelegate( |
940 | |
DictionaryService dictionaryServiceDelegate) { |
941 | 0 | this.dictionaryServiceDelegate = dictionaryServiceDelegate; |
942 | 0 | } |
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 | 0 | checkForMissingParameter(searchRequest, "searchRequest"); |
955 | 0 | return searchManager.search(searchRequest, organizationDao); |
956 | |
} |
957 | |
} |