Interface OrgUnitHierarchyService
-
- All Known Implementing Classes:
DefaultOrgUnitHierarchyService
public interface OrgUnitHierarchyServiceService interface for generating and updating the value of thepathattribute ofOrgUnitModelobjects. Thepathattribute of anOrgUnitModelis a flatStringrepresentation 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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T extends OrgUnitModel>
voidgenerateUnitPaths(java.lang.Class<T> unitType)Generates thepathvalue of allOrgUnitModelobjects of the given unit type.voidsaveChangesAndUpdateUnitPath(OrgUnitModel unit)Saves all changes to the givenOrgUnitModeland updates itspathvalue as well as thepathvalues for all its descendants of the same type subsequently.
-
-
-
Method Detail
-
generateUnitPaths
<T extends OrgUnitModel> void generateUnitPaths(java.lang.Class<T> unitType)
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:
java.lang.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
void saveChangesAndUpdateUnitPath(OrgUnitModel unit)
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:
java.lang.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.
-
-