Class DefaultBundleTemplateService
java.lang.Object
de.hybris.platform.configurablebundleservices.bundle.impl.DefaultBundleTemplateService
- All Implemented Interfaces:
BundleTemplateService
Default implementation of the BundleTemplate service
BundleTemplateService-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddGroupNumbers(List<EntryGroup> bundleEntryGroups, AbstractOrderModel order) protected voidaddTreeToOrder(AbstractOrderModel order, EntryGroup rootGroup) createBundleTree(BundleTemplateModel bundleTemplate, AbstractOrderModel order) Creates entry group tree reflecting the structure of a bundle template and add the tree to the given order.protected List<EntryGroup>createEntryGroupTree(BundleTemplateModel currentBundleTemplate, EntryGroup parentEntryGroup) getAllApprovedRootBundleTemplates(CatalogVersionModel catalogVersion) This methods returns all approved root bundle templates.getAllRootBundleTemplates(CatalogVersionModel catalogVersion) This methods returns all root bundle templates.protected AbstractBundleComponentEditableChecker<CartModel>ReturnsEntryGroupof typeGroupType.CONFIGURABLEBUNDLEthe given entry belongs to.getBundleEntryGroup(AbstractOrderModel order, Set<Integer> entryGroupNumbers) For given Set of entry group numbers find the one which id is of typeCONFIGURABLEBUNDLEin given order.protected BundleTemplateDaogetBundleTemplateForCode(String bundleId) This method returns the bundle template by bundle idbundleIdgetBundleTemplateForCode(String bundleId, String version) This method returns the bundle template by bundle idbundleIdgetBundleTemplateName(BundleTemplateModel bundleTemplate) Get well-formatted string with the name of the given component.Get all components (child bundle templates) where the current device is included in the products listprotected EntryGroupServicegetLeafComponents(BundleTemplateModel anyComponent) Collect all leaf components of bundle.protected ModelServiceintgetPositionInParent(BundleTemplateModel bundleTemplate) Returns the givenbundleTemplate's absolute position in the list of child templates that are assigned to the parent templategetPreviousBundleTemplate(BundleTemplateModel bundleTemplate) Returns the previous child bundle template.getRelativeBundleTemplate(BundleTemplateModel bundleTemplate, int relativePosition) Returns a relative child bundle template.getRootBundleTemplate(BundleTemplateModel bundleTemplateModel) This method returns the root bundleTemplateBundleTemplateModelof the givenbundleTemplateModel.getSubsequentBundleTemplate(BundleTemplateModel bundleTemplate) Returns the next child bundle template.booleanisAutoPickComponent(BundleTemplateModel bundleTemplate) Checks ifBundleTemplateModelhas a selection criteria of auto pick type.booleanisBundleTemplateUsed(BundleTemplateModel bundleTemplate) Deprecated, for removal: This API element is subject to removal in a future version.voidsetBundleComponentEditableChecker(AbstractBundleComponentEditableChecker<CartModel> bundleComponentEditableChecker) voidsetBundleTemplateDao(BundleTemplateDao bundleTemplateDao) voidsetEntryGroupService(EntryGroupService entryGroupService) voidsetModelService(ModelService modelService)
-
Constructor Details
-
DefaultBundleTemplateService
public DefaultBundleTemplateService()
-
-
Method Details
-
getRootBundleTemplate
@Nonnull public BundleTemplateModel getRootBundleTemplate(@Nonnull BundleTemplateModel bundleTemplateModel) Description copied from interface:BundleTemplateServiceThis method returns the root bundleTemplateBundleTemplateModelof the givenbundleTemplateModel. In case the givenbundleTemplateModelis the root template the givenbundleTemplateModelis returned as root template.- Specified by:
getRootBundleTemplatein interfaceBundleTemplateService- Parameters:
bundleTemplateModel- Bundle Template Model- Returns:
BundleTemplateModel
-
getBundleTemplateForCode
Description copied from interface:BundleTemplateServiceThis method returns the bundle template by bundle idbundleId- Specified by:
getBundleTemplateForCodein interfaceBundleTemplateService- Parameters:
bundleId- Bundle Id- Returns:
- BundleTemplateModel
BundleTemplateModel
-
getBundleTemplatesByProduct
Description copied from interface:BundleTemplateServiceGet all components (child bundle templates) where the current device is included in the products list- Specified by:
getBundleTemplatesByProductin interfaceBundleTemplateService- Parameters:
model- Product Model- Returns:
- List -
BundleTemplateModel
-
getSubsequentBundleTemplate
@Nullable public BundleTemplateModel getSubsequentBundleTemplate(@Nonnull BundleTemplateModel bundleTemplate) Description copied from interface:BundleTemplateServiceReturns the next child bundle template. The logic retrieves the parent of the givenbundleTemplateand selects the parents next child template, e.g. SMAR_Handset (givenbundleTemplate) -> SMAR (parent template) -> SMAR_Plan (next child template of parent), SMAR_Plan is returned.- Specified by:
getSubsequentBundleTemplatein interfaceBundleTemplateService- Parameters:
bundleTemplate- Bundle Template Model- Returns:
BundleTemplateModel
-
getPreviousBundleTemplate
@Nullable public BundleTemplateModel getPreviousBundleTemplate(@Nonnull BundleTemplateModel bundleTemplate) Description copied from interface:BundleTemplateServiceReturns the previous child bundle template. The logic retrieves the parent of the givenbundleTemplateand selects the parents next child template, e.g. SMAR_Plan (givenbundleTemplate) -> SMAR (parent template) -> SMAR_Handset (previous child template of parent), SMAR_Handset is returned.- Specified by:
getPreviousBundleTemplatein interfaceBundleTemplateService- Parameters:
bundleTemplate- Bundle Template Model- Returns:
BundleTemplateModel
-
getRelativeBundleTemplate
@Nullable public BundleTemplateModel getRelativeBundleTemplate(@Nonnull BundleTemplateModel bundleTemplate, int relativePosition) Description copied from interface:BundleTemplateServiceReturns a relative child bundle template. The logic retrieves the parent of the givenbundleTemplateand selects the parents relative child template- Specified by:
getRelativeBundleTemplatein interfaceBundleTemplateService- Parameters:
bundleTemplate- Bundle Template ModelrelativePosition- the relative position of the child template to be returned- Returns:
BundleTemplateModel
-
getLeafComponents
@Nonnull public List<BundleTemplateModel> getLeafComponents(@Nonnull BundleTemplateModel anyComponent) Description copied from interface:BundleTemplateServiceCollect all leaf components of bundle.- Specified by:
getLeafComponentsin interfaceBundleTemplateService- Parameters:
anyComponent- any component in bundle hierarchy- Returns:
- list of leaf components in correct order
-
getPositionInParent
Description copied from interface:BundleTemplateServiceReturns the givenbundleTemplate's absolute position in the list of child templates that are assigned to the parent template- Specified by:
getPositionInParentin interfaceBundleTemplateService- Parameters:
bundleTemplate- the child template whose position shall be returned- Returns:
- absolute position as int
-
isAutoPickComponent
Description copied from interface:BundleTemplateServiceChecks ifBundleTemplateModelhas a selection criteria of auto pick type.- Specified by:
isAutoPickComponentin interfaceBundleTemplateService- Parameters:
bundleTemplate- Bundle Template Model- Returns:
trueif selection criteria has auto pick type, otherwisefalse
-
getBundleTemplateForCode
@Nonnull public BundleTemplateModel getBundleTemplateForCode(@Nonnull String bundleId, @Nonnull String version) Description copied from interface:BundleTemplateServiceThis method returns the bundle template by bundle idbundleId- Specified by:
getBundleTemplateForCodein interfaceBundleTemplateService- Parameters:
bundleId- Bundle Idversion- bundle version- Returns:
- BundleTemplateModel
BundleTemplateModel
-
isBundleTemplateUsed
@Deprecated(since="1905", forRemoval=true) public boolean isBundleTemplateUsed(@Nonnull BundleTemplateModel bundleTemplate) Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:BundleTemplateServiceChecks if the givenBundleTemplateModelwas used in any cart or order entry- Specified by:
isBundleTemplateUsedin interfaceBundleTemplateService- Parameters:
bundleTemplate- Bundle Template Model- Returns:
- true if given bundleTemplate is used in any cart/order entry, otherwise false
- Since:
- 1905
-
getBundleTemplateName
Description copied from interface:BundleTemplateServiceGet well-formatted string with the name of the given component.- Specified by:
getBundleTemplateNamein interfaceBundleTemplateService- Parameters:
bundleTemplate- a bundle component- Returns:
- the name of the component of component id (if the name is null)
-
getBundleEntryGroup
Description copied from interface:BundleTemplateServiceReturnsEntryGroupof typeGroupType.CONFIGURABLEBUNDLEthe given entry belongs to.- Specified by:
getBundleEntryGroupin interfaceBundleTemplateService- Parameters:
entry- entry to get group for- Returns:
- entry group or null if the entry does not belong to any bundle groups
-
getBundleEntryGroup
Description copied from interface:BundleTemplateServiceFor given Set of entry group numbers find the one which id is of typeCONFIGURABLEBUNDLEin given order.- Specified by:
getBundleEntryGroupin interfaceBundleTemplateService- Parameters:
order- Order to get bundle group forentryGroupNumbers- List of Integers representing numbers of EntryGroups- Returns:
- EntryGroup of type CONFIGURABLEBUNDLE in given order, referenced in entryGroupNumbers
-
createBundleTree
@Nonnull public EntryGroup createBundleTree(@Nonnull BundleTemplateModel bundleTemplate, @Nonnull AbstractOrderModel order) Description copied from interface:BundleTemplateServiceCreates entry group tree reflecting the structure of a bundle template and add the tree to the given order.- Specified by:
createBundleTreein interfaceBundleTemplateService- Parameters:
bundleTemplate- any component of a bundle templateorder- order to add the bundle to- Returns:
- root
EntryGroupof the structure created
-
createEntryGroupTree
protected List<EntryGroup> createEntryGroupTree(@Nonnull BundleTemplateModel currentBundleTemplate, EntryGroup parentEntryGroup) -
addGroupNumbers
protected void addGroupNumbers(@Nonnull List<EntryGroup> bundleEntryGroups, @Nonnull AbstractOrderModel order) -
addTreeToOrder
-
getBundleTemplateDao
-
setBundleTemplateDao
-
getBundleComponentEditableChecker
-
setBundleComponentEditableChecker
public void setBundleComponentEditableChecker(AbstractBundleComponentEditableChecker<CartModel> bundleComponentEditableChecker) -
getAllRootBundleTemplates
@Nonnull public List<BundleTemplateModel> getAllRootBundleTemplates(CatalogVersionModel catalogVersion) Description copied from interface:BundleTemplateServiceThis methods returns all root bundle templates.- Specified by:
getAllRootBundleTemplatesin interfaceBundleTemplateService- Parameters:
catalogVersion- catalog version where bundle templates will be searched in- Returns:
ListofBundleTemplateModels
-
getAllApprovedRootBundleTemplates
@Nonnull public List<BundleTemplateModel> getAllApprovedRootBundleTemplates(CatalogVersionModel catalogVersion) Description copied from interface:BundleTemplateServiceThis methods returns all approved root bundle templates.- Specified by:
getAllApprovedRootBundleTemplatesin interfaceBundleTemplateService- Parameters:
catalogVersion- catalog version where bundle templates will be searched in- Returns:
ListofBundleTemplateModels
-
getModelService
-
setModelService
-
getEntryGroupService
-
setEntryGroupService
-