Interface OrgUnitHierarchyService
- All Known Implementing Classes:
DefaultOrgUnitHierarchyService
public interface OrgUnitHierarchyService
Service interface for generating and updating the value of the
path attribute of
OrgUnitModel objects. The path attribute of an OrgUnitModel is a flat
String representation of the path of traversal to reach the unit from the root of its organization and
contains the UIDs of all units on this path separated by a delimiter.-
Method Summary
Modifier and TypeMethodDescription<T extends OrgUnitModel>
voidgenerateUnitPaths(Class<T> unitType) Generates thepathvalue of allOrgUnitModelobjects of the given unit type.voidSaves all changes to the givenOrgUnitModeland updates itspathvalue as well as thepathvalues for all its descendants of the same type subsequently.
-
Method Details
-
generateUnitPaths
Generates thepathvalue of allOrgUnitModelobjects of the given unit type. The process starts with the root units, i.e. the ones that don't have a parent of the same type, and will traverse the hierarchy tree for each of them. All changes to affected items are persisted.- Parameters:
unitType- Determines the type to generatepathvalues for. Sub-types will be ignored. May not be null.- Throws:
IllegalArgumentException- In case the passed unitType is null.OrgUnitHierarchyException- In case inconsistencies are discovered during the path generation process or the process failed for other reasons.
-
saveChangesAndUpdateUnitPath
Saves all changes to the givenOrgUnitModeland updates itspathvalue as well as thepathvalues for all its descendants of the same type subsequently. All changes to affected items are persisted.
This method should be called whenever changes to the unit include a change of its parent unit. Implementations have to make sure that all changes are rolled back in case the creation of path values fails.- Parameters:
unit- TheOrgUnitModelto update. May not be null.- Throws:
IllegalArgumentException- In case the passed unit is null.OrgUnitHierarchyException- In case inconsistencies are discovered during the path generation process or the process failed for other reasons.
-