Class DefaultBundleTemplateService
- java.lang.Object
-
- de.hybris.platform.configurablebundleservices.bundle.impl.DefaultBundleTemplateService
-
- All Implemented Interfaces:
BundleTemplateService
public class DefaultBundleTemplateService extends java.lang.Object implements BundleTemplateService
Default implementation of the BundleTemplate serviceBundleTemplateService
-
-
Constructor Summary
Constructors Constructor Description DefaultBundleTemplateService()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected voidaddGroupNumbers(java.util.List<EntryGroup> bundleEntryGroups, AbstractOrderModel order)protected voidaddTreeToOrder(AbstractOrderModel order, EntryGroup rootGroup)EntryGroupcreateBundleTree(BundleTemplateModel bundleTemplate, AbstractOrderModel order)Creates entry group tree reflecting the structure of a bundle template and add the tree to the given order.protected java.util.List<EntryGroup>createEntryGroupTree(BundleTemplateModel currentBundleTemplate, EntryGroup parentEntryGroup)java.util.List<BundleTemplateModel>getAllApprovedRootBundleTemplates(CatalogVersionModel catalogVersion)This methods returns all approved root bundle templates.java.util.List<BundleTemplateModel>getAllRootBundleTemplates(CatalogVersionModel catalogVersion)This methods returns all root bundle templates.protected AbstractBundleComponentEditableChecker<CartModel>getBundleComponentEditableChecker()EntryGroupgetBundleEntryGroup(AbstractOrderEntryModel entry)ReturnsEntryGroupof typeGroupType.CONFIGURABLEBUNDLEthe given entry belongs to.EntryGroupgetBundleEntryGroup(AbstractOrderModel order, java.util.Set<java.lang.Integer> entryGroupNumbers)For given Set of entry group numbers find the one which id is of typeCONFIGURABLEBUNDLEin given order.protected BundleTemplateDaogetBundleTemplateDao()BundleTemplateModelgetBundleTemplateForCode(java.lang.String bundleId)This method returns the bundle template by bundle idbundleIdBundleTemplateModelgetBundleTemplateForCode(java.lang.String bundleId, java.lang.String version)This method returns the bundle template by bundle idbundleIdjava.lang.StringgetBundleTemplateName(BundleTemplateModel bundleTemplate)Get well-formatted string with the name of the given component.java.util.List<BundleTemplateModel>getBundleTemplatesByProduct(ProductModel model)Get all components (child bundle templates) where the current device is included in the products listprotected EntryGroupServicegetEntryGroupService()java.util.List<BundleTemplateModel>getLeafComponents(BundleTemplateModel anyComponent)Collect all leaf components of bundle.protected ModelServicegetModelService()intgetPositionInParent(BundleTemplateModel bundleTemplate)Returns the givenbundleTemplate's absolute position in the list of child templates that are assigned to the parent templateBundleTemplateModelgetPreviousBundleTemplate(BundleTemplateModel bundleTemplate)Returns the previous child bundle template.BundleTemplateModelgetRelativeBundleTemplate(BundleTemplateModel bundleTemplate, int relativePosition)Returns a relative child bundle template.BundleTemplateModelgetRootBundleTemplate(BundleTemplateModel bundleTemplateModel)This method returns the root bundleTemplateBundleTemplateModelof the givenbundleTemplateModel.BundleTemplateModelgetSubsequentBundleTemplate(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)
-
-
-
Method Detail
-
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
@Nonnull public BundleTemplateModel getBundleTemplateForCode(@Nonnull java.lang.String bundleId)
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
@Nonnull public java.util.List<BundleTemplateModel> getBundleTemplatesByProduct(@Nonnull ProductModel model)
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 java.util.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
public int getPositionInParent(@Nonnull BundleTemplateModel bundleTemplate)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
public boolean isAutoPickComponent(@Nullable BundleTemplateModel bundleTemplate)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 java.lang.String bundleId, @Nonnull java.lang.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
@Nonnull public java.lang.String getBundleTemplateName(BundleTemplateModel bundleTemplate)
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
public EntryGroup getBundleEntryGroup(@Nonnull AbstractOrderEntryModel entry)
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
public EntryGroup getBundleEntryGroup(AbstractOrderModel order, java.util.Set<java.lang.Integer> entryGroupNumbers)
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 java.util.List<EntryGroup> createEntryGroupTree(@Nonnull BundleTemplateModel currentBundleTemplate, EntryGroup parentEntryGroup)
-
addGroupNumbers
protected void addGroupNumbers(@Nonnull java.util.List<EntryGroup> bundleEntryGroups, @Nonnull AbstractOrderModel order)
-
addTreeToOrder
protected void addTreeToOrder(@Nonnull AbstractOrderModel order, @Nonnull EntryGroup rootGroup)
-
getBundleTemplateDao
protected BundleTemplateDao getBundleTemplateDao()
-
setBundleTemplateDao
public void setBundleTemplateDao(BundleTemplateDao bundleTemplateDao)
-
getBundleComponentEditableChecker
protected AbstractBundleComponentEditableChecker<CartModel> getBundleComponentEditableChecker()
-
setBundleComponentEditableChecker
public void setBundleComponentEditableChecker(AbstractBundleComponentEditableChecker<CartModel> bundleComponentEditableChecker)
-
getAllRootBundleTemplates
@Nonnull public java.util.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 java.util.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
protected ModelService getModelService()
-
setModelService
public void setModelService(ModelService modelService)
-
getEntryGroupService
protected EntryGroupService getEntryGroupService()
-
setEntryGroupService
public void setEntryGroupService(EntryGroupService entryGroupService)
-
-