Class DefaultOrgUnitHierarchyService

java.lang.Object
de.hybris.platform.commerceservices.organization.services.impl.DefaultOrgUnitHierarchyService
All Implemented Interfaces:
OrgUnitHierarchyService

public class DefaultOrgUnitHierarchyService extends Object implements OrgUnitHierarchyService
Default implementation of the OrgUnitHierarchyService interface.
  • Field Details

    • DELIMITER

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

    • DefaultOrgUnitHierarchyService

      public DefaultOrgUnitHierarchyService()
  • Method Details

    • generateUnitPaths

      public <T extends OrgUnitModel> void generateUnitPaths(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)
    • generatePathForUnit

      protected Set<OrgUnitModel> generatePathForUnit(OrgUnitModel unit, OrgUnitModel parentUnit)
    • beforeUpdate

      protected void beforeUpdate(OrgUnitModel unit, OrgUnitModel parentUnit)
    • validatePath

      protected void validatePath(OrgUnitModel parentUnit)
    • getParentUnit

      protected OrgUnitModel getParentUnit(OrgUnitModel unit)
    • getChildrenOfSameType

      protected Set<OrgUnitModel> getChildrenOfSameType(OrgUnitModel unit)
    • handleTransactionException

      protected void handleTransactionException(Exception e)
    • getOrgUnitDao

      protected OrgUnitDao getOrgUnitDao()
    • setOrgUnitDao

      public void setOrgUnitDao(OrgUnitDao orgUnitDao)
    • getSessionService

      protected SessionService getSessionService()
    • setSessionService

      public void setSessionService(SessionService sessionService)
    • getModelService

      protected ModelService getModelService()
    • setModelService

      public void setModelService(ModelService modelService)