public class DefaultEntryGroupService extends java.lang.Object implements EntryGroupService
EntryGroupService| Constructor and Description |
|---|
DefaultEntryGroupService() |
| Modifier and Type | Method and Description |
|---|---|
int |
findMaxGroupNumber(java.util.List<EntryGroup> roots)
Searches for maximum value of
EntryGroup.getGroupNumber(). |
void |
forceOrderSaving(AbstractOrderModel order)
As
EntryGroup is not a DB entity, changing it does not cause parent order to save. |
EntryGroup |
getGroup(AbstractOrderModel order,
java.lang.Integer groupNumber)
Returns
EntryGroup by groupNumber |
EntryGroup |
getGroupOfType(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 leaf
EntryGroups of given one. |
protected ModelService |
getModelService() |
java.util.List<EntryGroup> |
getNestedGroups(EntryGroup entryGroup)
Gets all nested
EntryGroups of given one, including the given one. |
EntryGroup |
getParent(AbstractOrderModel order,
java.lang.Integer groupNumber)
Returns parent entry group of the tree within the order's entry group trees which has given group.
|
EntryGroup |
getRoot(AbstractOrderModel order,
java.lang.Integer groupNumber)
Returns root of the tree within the order's entry group trees which has given group.
|
void |
setModelService(ModelService modelService) |
public java.util.List<EntryGroup> getNestedGroups(EntryGroup entryGroup)
EntryGroupServiceEntryGroups of given one, including the given one.getNestedGroups in interface EntryGroupServiceentryGroup - root EntryGroupEntryGroups for subtree where the given EntryGroup is root, including the rootpublic java.util.List<EntryGroup> getLeaves(EntryGroup entryGroup)
EntryGroupServiceEntryGroups of given one. If that one is already leaf it will return itself.getLeaves in interface EntryGroupServiceentryGroup - root EntryGroupEntryGroups for subtree where the given EntryGroup is root or given
EntryGroup if it is a leaf.public EntryGroup getGroup(AbstractOrderModel order, java.lang.Integer groupNumber)
EntryGroupServiceEntryGroup by groupNumbergetGroup in interface EntryGroupServiceorder - order containing entry group treesgroupNumber - number of the group to search forEntryGroup with given groupNumber from the orderpublic EntryGroup getRoot(AbstractOrderModel order, java.lang.Integer groupNumber)
EntryGroupServicegetRoot in interface EntryGroupServiceorder - order to take trees fromgroupNumber - number of group to search forgroupNumberpublic EntryGroup getParent(AbstractOrderModel order, java.lang.Integer groupNumber)
EntryGroupServicegetParent in interface EntryGroupServiceorder - order to take trees fromgroupNumber - number of group to search forgroupNumber or null if it is rootpublic void forceOrderSaving(AbstractOrderModel order)
EntryGroupServiceEntryGroup is not a DB entity, changing it does not cause parent order to save. This method updates the
whole entryGroups field, so the order is marked as changes and correctly saved to DB.forceOrderSaving in interface EntryGroupServiceorder - order to savepublic int findMaxGroupNumber(java.util.List<EntryGroup> roots)
EntryGroupServiceEntryGroup.getGroupNumber().
Is useful for assigning unique values to entry group numbers.findMaxGroupNumber in interface EntryGroupServiceroots - list of root groupspublic EntryGroup getGroupOfType(AbstractOrderModel order, java.util.Collection<java.lang.Integer> groupNumbers, GroupType type)
EntryGroupServicegetGroupOfType in interface EntryGroupServiceorder - user's cartgroupNumbers - group numbers of the entrytype - group typeEntryGroup object or null if no groups of given type in collectionprotected ModelService getModelService()
public void setModelService(ModelService modelService)
Copyright © 2018 SAP SE. All Rights Reserved.