1 2 3 4 5 6 7 8 9 10 11
| UserService userService = UserServiceFactory.getUserService(session,transaction);
Organisation rootOrganisation = userService.getRootOrganisation(assessmentType.getId(), SelectionStrategy.SELECT_ALLCHILDREN);
Collection<?> organisations = CompositeUtils.getListFromTree(rootOrganisation);
for(Iterator<?>it = organisations.iterator() ; it.hasNext() ; ){
Organisation organisation =(Organisation) it.next();
SortedSet<Organisation> childrenOrganisations = organisation.getChildren();
for (Organisation organisation2 : childrenOrganisations) {
organisation = userService.getOrganisation(organisation2.getId(), SelectionStrategy.SELECT_TWOCHILDREN);
userService.deleteOrganisation(organisation.getId());
}
} |
Partager