Class DefaultOrgUnitHierarchyService

    • Field Detail

      • DELIMITER

        public static final char DELIMITER
        Character used as a delimiter between unit UIDs in the path.
        See Also:
        Constant Field Values
    • Constructor Detail

      • DefaultOrgUnitHierarchyService

        public DefaultOrgUnitHierarchyService()
    • Method Detail

      • generateUnitPaths

        public <T extends OrgUnitModel> void generateUnitPaths​(java.lang.Class<T> unitType)
        Generates the path value of all OrgUnitModel objects 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.

        Note: The default implementations of generateUnitPaths(Class) and saveChangesAndUpdateUnitPath(OrgUnitModel) are synchronized in order to avoid inconsistent path values in case two threads try to access one of the methods at the same time.
        Specified by:
        generateUnitPaths in interface OrgUnitHierarchyService
        Parameters:
        unitType - Determines the type to generate path values for. Sub-types will be ignored. May not be null.
      • saveChangesAndUpdateUnitPath

        public void saveChangesAndUpdateUnitPath​(OrgUnitModel unit)
        Saves all changes to the given OrgUnitModel and updates its path value as well as the path values 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.

        Note: The default implementations of generateUnitPaths(Class) and saveChangesAndUpdateUnitPath(OrgUnitModel) are synchronized in order to avoid inconsistent path values in case two threads try to access one of the methods at the same time.
        Specified by:
        saveChangesAndUpdateUnitPath in interface OrgUnitHierarchyService
        Parameters:
        unit - The OrgUnitModel to update. May not be null.
      • updateUnitPath

        protected void updateUnitPath​(OrgUnitModel unit)
      • validatePath

        protected void validatePath​(OrgUnitModel parentUnit)
      • handleTransactionException

        protected void handleTransactionException​(java.lang.Exception e)
      • getOrgUnitDao

        protected OrgUnitDao getOrgUnitDao()
      • setOrgUnitDao

        public void setOrgUnitDao​(OrgUnitDao orgUnitDao)
      • setSessionService

        public void setSessionService​(SessionService sessionService)
      • getModelService

        protected ModelService getModelService()
      • setModelService

        public void setModelService​(ModelService modelService)