Package de.hybris.platform.order
Interface EntryGroupService
- All Known Implementing Classes:
DefaultEntryGroupService
public interface EntryGroupService
Service that exposes methods to deal with
EntryGroup operations.-
Method Summary
Modifier and TypeMethodDescriptionintfindMaxGroupNumber(List<EntryGroup> roots) Searches for maximum value ofEntryGroup.getGroupNumber().voidAsEntryGroupis not a DB entity, changing it does not cause parent order to save.getGroup(AbstractOrderModel order, Integer groupNumber) ReturnsEntryGroupby groupNumbergetGroupOfType(AbstractOrderModel order, Collection<Integer> groupNumbers, GroupType type) Find entry group in the cart by number and type.getLeaves(EntryGroup entryGroup) Returns all leafEntryGroups of given one.getNestedGroups(EntryGroup entryGroup) Gets all nestedEntryGroups of given one, including the given one.getParent(AbstractOrderModel order, Integer groupNumber) Returns parent entry group of the tree within the order's entry group trees which has given group.getRoot(AbstractOrderModel order, Integer groupNumber) Returns root of the tree within the order's entry group trees which has given group.
-
Method Details
-
getNestedGroups
Gets all nestedEntryGroups of given one, including the given one.- Parameters:
entryGroup- rootEntryGroup- Returns:
- all
EntryGroups for subtree where the givenEntryGroupis root, including the root
-
getLeaves
Returns all leafEntryGroups of given one. If that one is already leaf it will return itself.- Parameters:
entryGroup- rootEntryGroup- Returns:
- all leaf
EntryGroups for subtree where the givenEntryGroupis root or givenEntryGroupif it is a leaf.
-
getGroup
ReturnsEntryGroupby groupNumber- Parameters:
groupNumber- number of the group to search fororder- order containing entry group trees- Returns:
EntryGroupwith given groupNumber from the order- Throws:
IllegalArgumentException- if no group with given groupNumber in the order
-
getRoot
Returns root of the tree within the order's entry group trees which has given group.- Parameters:
order- order to take trees fromgroupNumber- number of group to search for- Returns:
- root of the tree that contains
groupNumber - Throws:
IllegalArgumentException- if group is not found
-
getParent
Returns parent entry group of the tree within the order's entry group trees which has given group.- Parameters:
order- order to take trees fromgroupNumber- number of group to search for- Returns:
- parent of the
groupNumberor null if it is root - Throws:
IllegalArgumentException- if group is not found in the cart
-
forceOrderSaving
AsEntryGroupis 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.- Parameters:
order- order to save
-
findMaxGroupNumber
Searches for maximum value ofEntryGroup.getGroupNumber(). Is useful for assigning unique values to entry group numbers.- Parameters:
roots- list of root groups- Returns:
- maximum value of groupNumber field
-
getGroupOfType
EntryGroup getGroupOfType(@Nonnull AbstractOrderModel order, @Nonnull Collection<Integer> groupNumbers, @Nonnull GroupType type) Find entry group in the cart by number and type.- Parameters:
order- user's cartgroupNumbers- group numbers of the entrytype- group type- Returns:
EntryGroupobject or null if no groups of given type in collection- Throws:
AmbiguousIdentifierException- if more than oneEntryGroupwith provided group type was found
-