Package de.hybris.platform.order.impl
Class DefaultEntryGroupService
- java.lang.Object
-
- de.hybris.platform.order.impl.DefaultEntryGroupService
-
- All Implemented Interfaces:
EntryGroupService
public class DefaultEntryGroupService extends java.lang.Object implements EntryGroupService
Default implementation ofEntryGroupService
-
-
Constructor Summary
Constructors Constructor Description DefaultEntryGroupService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intfindMaxGroupNumber(java.util.List<EntryGroup> roots)Searches for maximum value ofEntryGroup.getGroupNumber().voidforceOrderSaving(AbstractOrderModel order)AsEntryGroupis not a DB entity, changing it does not cause parent order to save.EntryGroupgetGroup(AbstractOrderModel order, java.lang.Integer groupNumber)ReturnsEntryGroupby groupNumberEntryGroupgetGroupOfType(AbstractOrderModel order, java.util.Collection<java.lang.Integer> groupNumbers, GroupType type)Find entry group in the cart by number and type.java.util.List<EntryGroup>getLeaves(EntryGroup entryGroup)Returns all leafEntryGroups of given one.protected ModelServicegetModelService()java.util.List<EntryGroup>getNestedGroups(EntryGroup entryGroup)Gets all nestedEntryGroups of given one, including the given one.EntryGroupgetParent(AbstractOrderModel order, java.lang.Integer groupNumber)Returns parent entry group of the tree within the order's entry group trees which has given group.EntryGroupgetRoot(AbstractOrderModel order, java.lang.Integer groupNumber)Returns root of the tree within the order's entry group trees which has given group.voidsetModelService(ModelService modelService)
-
-
-
Method Detail
-
getNestedGroups
@Nonnull public java.util.List<EntryGroup> getNestedGroups(@Nonnull EntryGroup entryGroup)
Description copied from interface:EntryGroupServiceGets all nestedEntryGroups of given one, including the given one.- Specified by:
getNestedGroupsin interfaceEntryGroupService- Parameters:
entryGroup- rootEntryGroup- Returns:
- all
EntryGroups for subtree where the givenEntryGroupis root, including the root
-
getLeaves
@Nonnull public java.util.List<EntryGroup> getLeaves(@Nonnull EntryGroup entryGroup)
Description copied from interface:EntryGroupServiceReturns all leafEntryGroups of given one. If that one is already leaf it will return itself.- Specified by:
getLeavesin interfaceEntryGroupService- Parameters:
entryGroup- rootEntryGroup- Returns:
- all leaf
EntryGroups for subtree where the givenEntryGroupis root or givenEntryGroupif it is a leaf.
-
getGroup
@Nonnull public EntryGroup getGroup(@Nonnull AbstractOrderModel order, @Nonnull java.lang.Integer groupNumber)
Description copied from interface:EntryGroupServiceReturnsEntryGroupby groupNumber- Specified by:
getGroupin interfaceEntryGroupService- Parameters:
order- order containing entry group treesgroupNumber- number of the group to search for- Returns:
EntryGroupwith given groupNumber from the order
-
getRoot
@Nonnull public EntryGroup getRoot(@Nonnull AbstractOrderModel order, @Nonnull java.lang.Integer groupNumber)
Description copied from interface:EntryGroupServiceReturns root of the tree within the order's entry group trees which has given group.- Specified by:
getRootin interfaceEntryGroupService- Parameters:
order- order to take trees fromgroupNumber- number of group to search for- Returns:
- root of the tree that contains
groupNumber
-
getParent
public EntryGroup getParent(@Nonnull AbstractOrderModel order, @Nonnull java.lang.Integer groupNumber)
Description copied from interface:EntryGroupServiceReturns parent entry group of the tree within the order's entry group trees which has given group.- Specified by:
getParentin interfaceEntryGroupService- Parameters:
order- order to take trees fromgroupNumber- number of group to search for- Returns:
- parent of the
groupNumberor null if it is root
-
forceOrderSaving
public void forceOrderSaving(@Nonnull AbstractOrderModel order)Description copied from interface:EntryGroupServiceAsEntryGroupis not a DB entity, changing it does not cause parent order to save. This method updates the wholeentryGroupsfield, so the order is marked as changes and correctly saved to DB.- Specified by:
forceOrderSavingin interfaceEntryGroupService- Parameters:
order- order to save
-
findMaxGroupNumber
public int findMaxGroupNumber(java.util.List<EntryGroup> roots)
Description copied from interface:EntryGroupServiceSearches for maximum value ofEntryGroup.getGroupNumber(). Is useful for assigning unique values to entry group numbers.- Specified by:
findMaxGroupNumberin interfaceEntryGroupService- Parameters:
roots- list of root groups- Returns:
- maximum value of groupNumber field
-
getGroupOfType
public EntryGroup getGroupOfType(@Nonnull AbstractOrderModel order, @Nonnull java.util.Collection<java.lang.Integer> groupNumbers, @Nonnull GroupType type)
Description copied from interface:EntryGroupServiceFind entry group in the cart by number and type.- Specified by:
getGroupOfTypein interfaceEntryGroupService- Parameters:
order- user's cartgroupNumbers- group numbers of the entrytype- group type- Returns:
EntryGroupobject or null if no groups of given type in collection
-
getModelService
protected ModelService getModelService()
-
setModelService
public void setModelService(ModelService modelService)
-
-