Class DefaultOrgUnitHierarchyService
java.lang.Object
de.hybris.platform.commerceservices.organization.services.impl.DefaultOrgUnitHierarchyService
- All Implemented Interfaces:
OrgUnitHierarchyService
Default implementation of the
OrgUnitHierarchyService interface.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final charCharacter used as a delimiter between unit UIDs in the path. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidbeforeUpdate(OrgUnitModel unit, OrgUnitModel parentUnit) protected Set<OrgUnitModel>generatePathForUnit(OrgUnitModel unit, OrgUnitModel parentUnit) <T extends OrgUnitModel>
voidgenerateUnitPaths(Class<T> unitType) Generates thepathvalue of allOrgUnitModelobjects of the given unit type.protected Set<OrgUnitModel>protected ModelServiceprotected OrgUnitDaoprotected OrgUnitModelgetParentUnit(OrgUnitModel unit) protected SessionServiceprotected voidvoidSaves all changes to the givenOrgUnitModeland updates itspathvalue as well as thepathvalues for all its descendants of the same type subsequently.voidsetModelService(ModelService modelService) voidsetOrgUnitDao(OrgUnitDao orgUnitDao) voidsetSessionService(SessionService sessionService) protected voidupdateUnitPath(OrgUnitModel unit) protected voidvalidatePath(OrgUnitModel parentUnit)
-
Field Details
-
DELIMITER
public static final char DELIMITERCharacter used as a delimiter between unit UIDs in the path.- See Also:
-
-
Constructor Details
-
DefaultOrgUnitHierarchyService
public DefaultOrgUnitHierarchyService()
-
-
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.
Note: The default implementations ofgenerateUnitPaths(Class)andsaveChangesAndUpdateUnitPath(OrgUnitModel)aresynchronizedin order to avoid inconsistent path values in case two threads try to access one of the methods at the same time.- Specified by:
generateUnitPathsin interfaceOrgUnitHierarchyService- Parameters:
unitType- Determines the type to generatepathvalues for. Sub-types will be ignored. May not be null.
-
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.
Note: The default implementations ofgenerateUnitPaths(Class)andsaveChangesAndUpdateUnitPath(OrgUnitModel)aresynchronizedin order to avoid inconsistent path values in case two threads try to access one of the methods at the same time.- Specified by:
saveChangesAndUpdateUnitPathin interfaceOrgUnitHierarchyService- Parameters:
unit- TheOrgUnitModelto update. May not be null.
-
updateUnitPath
-
generatePathForUnit
-
beforeUpdate
-
validatePath
-
getParentUnit
-
getChildrenOfSameType
-
handleTransactionException
-
getOrgUnitDao
-
setOrgUnitDao
-
getSessionService
-
setSessionService
-
getModelService
-
setModelService
-