Class DefaultCommerceEntryGroupUtils
- java.lang.Object
-
- de.hybris.platform.commercefacades.order.impl.DefaultCommerceEntryGroupUtils
-
- All Implemented Interfaces:
CommerceEntryGroupUtils
public class DefaultCommerceEntryGroupUtils extends java.lang.Object implements CommerceEntryGroupUtils
Default implementation ofCommerceEntryGroupUtils.
-
-
Constructor Summary
Constructors Constructor Description DefaultCommerceEntryGroupUtils()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intfindMaxGroupNumber(java.util.List<EntryGroupData> roots)Returns max value ofEntryGroupData#groupNumber.EntryGroupDatagetGroup(AbstractOrderData order, java.lang.Integer groupNumber)ReturnsEntryGroupDataby groupNumber from given orderEntryGroupDatagetGroup(AbstractOrderData order, java.util.Collection<java.lang.Integer> groupNumbers, GroupType groupType)Searches for entry group which is a type ofgroupTypeand which number belongs to thegroupNumbers.java.util.List<EntryGroupData>getLeaves(EntryGroupData root)Returns all leaf nodes of group tree, preventing their natural order.java.util.List<EntryGroupData>getNestedGroups(EntryGroupData root)Flatten group tree and return it as a plain list of groups.
-
-
-
Method Detail
-
getNestedGroups
@Nonnull public java.util.List<EntryGroupData> getNestedGroups(@Nonnull EntryGroupData root)
Description copied from interface:CommerceEntryGroupUtilsFlatten group tree and return it as a plain list of groups.The method keeps item order unchanged: first goes root item, then its first child, then the children of that child and so forth.
- Specified by:
getNestedGroupsin interfaceCommerceEntryGroupUtils- Parameters:
root- node to start collecting from- Returns:
- list, that includes the node and all its descendants
-
getLeaves
@Nonnull public java.util.List<EntryGroupData> getLeaves(@Nonnull EntryGroupData root)
Description copied from interface:CommerceEntryGroupUtilsReturns all leaf nodes of group tree, preventing their natural order.- Specified by:
getLeavesin interfaceCommerceEntryGroupUtils- Parameters:
root- root node of group tree- Returns:
- leaf nodes
-
getGroup
@Nonnull public EntryGroupData getGroup(@Nonnull AbstractOrderData order, @Nonnull java.lang.Integer groupNumber)
Description copied from interface:CommerceEntryGroupUtilsReturnsEntryGroupDataby groupNumber from given order- Specified by:
getGroupin interfaceCommerceEntryGroupUtils- Parameters:
order- order containing entry group treesgroupNumber- number of the group to search for- Returns:
EntryGroupDatawith given groupNumber from the order
-
getGroup
@Nonnull public EntryGroupData getGroup(@Nonnull AbstractOrderData order, @Nonnull java.util.Collection<java.lang.Integer> groupNumbers, @Nonnull GroupType groupType)
Description copied from interface:CommerceEntryGroupUtilsSearches for entry group which is a type ofgroupTypeand which number belongs to thegroupNumbers.- Specified by:
getGroupin interfaceCommerceEntryGroupUtils- Parameters:
order- order what is expected to contain the desired groupgroupNumbers- possible group numbers. Usually are taken fromOrderEntryData.getEntryGroupNumbers()groupType- desired group type- Returns:
- group
-
findMaxGroupNumber
public int findMaxGroupNumber(java.util.List<EntryGroupData> roots)
Description copied from interface:CommerceEntryGroupUtilsReturns max value ofEntryGroupData#groupNumber.- Specified by:
findMaxGroupNumberin interfaceCommerceEntryGroupUtils- Parameters:
roots- root groups- Returns:
- maximum group number among the whole forest
-
-