Class DefaultTmaPoService
- java.lang.Object
-
- de.hybris.platform.b2ctelcoservices.services.impl.DefaultTmaPoService
-
- All Implemented Interfaces:
TmaPoService
public class DefaultTmaPoService extends java.lang.Object implements TmaPoService
Default implementation of theTmaPoService.- Since:
- 6.7
-
-
Constructor Summary
Constructors Constructor Description DefaultTmaPoService(TmaProductDao tmaProductDao)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddPoChildToParent(TmaBundledProductOfferingModel parent, TmaProductOfferingModel child)Adds a newTmaProductOfferingModelchild to aTmaBundledProductOfferingModelparent.java.util.Collection<TmaBundledProductOfferingModel>getAllParents(TmaProductOfferingModel poModel)Returns all parents for the given product offering.TmaBundledProductOfferingModelgetBpoForCode(java.lang.String code)Returns aTmaBundledProductOfferingModelfor the given code.protected TmaCommercePriceServicegetCommercePriceService()java.util.Set<TmaProductSpecCharacteristicModel>getConfigurableProductSpecCharacteristics(TmaProductOfferingModel productOffering)Computes and returns the configurableTmaProductSpecCharacteristicModelof a given product.protected de.hybris.platform.servicelayer.config.ConfigurationServicegetConfigurationService()java.util.Optional<TmaProductOfferingGroupModel>getGroupNextToProductGroup(TmaBundledProductOfferingModel bpo, TmaProductOfferingModel po)Searches for the the group next to the group which contains the PO given as parameter; It returns: the group with index 0, if PO given as parameter is in a group with index higher than 0 or, the group with index 1, if PO given as parameter is in a group with index 0 or, emptyOptionalif no group is found.protected de.hybris.platform.servicelayer.model.ModelServicegetModelService()java.util.Optional<TmaProductOfferingGroupModel>getOfferingGroupForPoAndBpo(TmaProductOfferingModel productOffering, TmaBundledProductOfferingModel parent)Retrieves theTmaProductOfferingGroupModelfor a given product inside the givenTmaBundledProductOfferingModelparent.java.util.Optional<TmaOperationalProductOfferingModel>getOperationalProductOffering(TmaSubscribedProductAction action)Returns the operational product corresponding to the specified action.TmaProductOfferingModelgetPoForCode(java.lang.String code)Returns aTmaProductOfferingModelfor the given code.TmaProductOfferingModelgetPoForCodeAndPriceContext(java.lang.String code, TmaPriceContext priceContext)Returns aTmaProductOfferingModelfor the given code and prices of theTmaProductOfferingModelbased on theTmaPriceContextDataProductModelgetProductOffering(java.lang.String productOfferingCode, TmaSubscribedProductAction cartAction)Returns a product offering for the given product code and cart action.java.util.Set<TmaProductOfferingGroupModel>getProductOfferingGroupsByProperties(java.util.Map<java.lang.String,java.lang.String> propertyPattern)Returns the set of @{link TmaProductOfferingGroupModel} based on key and value in map where key is the property name and the value is the pattern value of the propertyjava.util.List<TmaProductOfferingModel>getProductOfferings(CatalogVersionModel catalogVersion)Returns product offering list for corresponding catalog versionSearchPageData<TmaProductOfferingModel>getProductOfferings(java.util.Collection<CatalogVersionModel> catalogVersions, TmaProductOfferingSearchContext productOfferingSearchContext)Finds theTmaProductOfferingModelfor a given collectionCatalogVersionModelandTmaProductOfferingSearchContextjava.util.Set<TmaProductOfferingModel>getProductOfferingsByProperties(java.util.Map<java.lang.String,java.lang.String> propertyPattern)Returns the set ofTmaProductOfferingModelbased on key and value in map where key is the property name and the value is the pattern value of the propertyprotected de.hybris.platform.product.ProductServicegetProductService()java.util.List<TmaProductOfferingModel>getProductsForCode(java.lang.String code)Return the list ofTmaProductOfferingModelbased on product codejava.util.List<TmaSimpleProductOfferingModel>getSpoListForBpo(TmaBundledProductOfferingModel bundleProductOffering)This method will traverses down the hierarchy of a given bundle product offering to find out all the child spos.protected TmaProductDaogetTmaProductDao()protected TmaProductOfferingDaogetTmaProductOfferingDao()booleanisPoEligibleForProcessType(TmaProcessType processType, TmaProductOfferingModel product, TmaBundledProductOfferingModel bpo)Verifies if the given product is eligible for the given process type.booleanisServiceRequestAction(TmaSubscribedProductAction action)This method checks if the given cart action requires an operational product.booleanisValidParent(TmaProductOfferingModel product, TmaBundledProductOfferingModel parent)Verifies if the givenTmaBundledProductOfferingModelparent is a valid parent for the given product offering.voidremovePoChildFromParent(TmaBundledProductOfferingModel parent, TmaProductOfferingModel child)Removes the link betweenTmaProductOfferingModelchild andTmaBundledProductOfferingModelparent.voidsetCommercePriceService(TmaCommercePriceService commercePriceService)voidsetConfigurationService(de.hybris.platform.servicelayer.config.ConfigurationService configurationService)voidsetModelService(de.hybris.platform.servicelayer.model.ModelService modelService)voidsetProductService(de.hybris.platform.product.ProductService productService)voidsetTmaProductOfferingDao(TmaProductOfferingDao tmaProductOfferingDao)
-
-
-
Constructor Detail
-
DefaultTmaPoService
public DefaultTmaPoService(TmaProductDao tmaProductDao)
-
-
Method Detail
-
getPoForCode
public TmaProductOfferingModel getPoForCode(java.lang.String code)
Description copied from interface:TmaPoServiceReturns aTmaProductOfferingModelfor the given code.- Specified by:
getPoForCodein interfaceTmaPoService- Parameters:
code- identifier ofTmaProductOfferingModel- Returns:
TmaProductOfferingModel
-
getPoForCodeAndPriceContext
public TmaProductOfferingModel getPoForCodeAndPriceContext(java.lang.String code, TmaPriceContext priceContext)
Description copied from interface:TmaPoServiceReturns aTmaProductOfferingModelfor the given code and prices of theTmaProductOfferingModelbased on theTmaPriceContextData- Specified by:
getPoForCodeAndPriceContextin interfaceTmaPoService- Parameters:
code- identifier ofTmaProductOfferingModelpriceContext- priceContextTmaPriceContextto retrieve prices of theTmaProductOfferingModel- Returns:
TmaProductOfferingModel
-
addPoChildToParent
public void addPoChildToParent(TmaBundledProductOfferingModel parent, TmaProductOfferingModel child)
Description copied from interface:TmaPoServiceAdds a newTmaProductOfferingModelchild to aTmaBundledProductOfferingModelparent.- Specified by:
addPoChildToParentin interfaceTmaPoService- Parameters:
parent- bundled product offering under which the child is addedchild- child to be added
-
removePoChildFromParent
public void removePoChildFromParent(TmaBundledProductOfferingModel parent, TmaProductOfferingModel child)
Description copied from interface:TmaPoServiceRemoves the link betweenTmaProductOfferingModelchild andTmaBundledProductOfferingModelparent.- Specified by:
removePoChildFromParentin interfaceTmaPoService- Parameters:
parent- bundled product offering from which the child is removedchild- product offering child to be removed
-
getAllParents
public java.util.Collection<TmaBundledProductOfferingModel> getAllParents(TmaProductOfferingModel poModel)
Description copied from interface:TmaPoServiceReturns all parents for the given product offering.- Specified by:
getAllParentsin interfaceTmaPoService- Parameters:
poModel- product offering- Returns:
CollectionofTmaBundledProductOfferingModel
-
getGroupNextToProductGroup
public java.util.Optional<TmaProductOfferingGroupModel> getGroupNextToProductGroup(TmaBundledProductOfferingModel bpo, TmaProductOfferingModel po)
Description copied from interface:TmaPoServiceSearches for the the group next to the group which contains the PO given as parameter; It returns: the group with index 0, if PO given as parameter is in a group with index higher than 0 or, the group with index 1, if PO given as parameter is in a group with index 0 or, emptyOptionalif no group is found.- Specified by:
getGroupNextToProductGroupin interfaceTmaPoService- Parameters:
bpo- theTmaBundledProductOfferingModelpo- theTmaProductOfferingModel- Returns:
OptionalofTmaProductOfferingGroupModel
-
getBpoForCode
public TmaBundledProductOfferingModel getBpoForCode(java.lang.String code)
Description copied from interface:TmaPoServiceReturns aTmaBundledProductOfferingModelfor the given code.- Specified by:
getBpoForCodein interfaceTmaPoService- Parameters:
code- identifier ofTmaBundledProductOfferingModel- Returns:
TmaBundledProductOfferingModel
-
isPoEligibleForProcessType
public boolean isPoEligibleForProcessType(TmaProcessType processType, TmaProductOfferingModel product, TmaBundledProductOfferingModel bpo)
Description copied from interface:TmaPoServiceVerifies if the given product is eligible for the given process type. Eligibility is performed considering the process types defined on the subscription price plans of the given product. If the BPO is given then the checks are performed against price plan overrides of the BPO where the product is defined as affected product.- Specified by:
isPoEligibleForProcessTypein interfaceTmaPoService- Parameters:
processType- the process type that is going to be verifiedproduct- the product checked if eligible for given process typebpo- the BPO where product is part of- Returns:
- true/ false depending on the eligibility of the given product for the process type
-
isValidParent
public boolean isValidParent(TmaProductOfferingModel product, TmaBundledProductOfferingModel parent)
Description copied from interface:TmaPoServiceVerifies if the givenTmaBundledProductOfferingModelparent is a valid parent for the given product offering. A valid parent it not necessary a first direct parent, it can also be a parent of one of product parents.- Specified by:
isValidParentin interfaceTmaPoService- Parameters:
product- the given product offering against the checks are madeparent- the given parent to be check if is valid- Returns:
- true if all Set elements are valid product parents codes, false otherwise
-
getOfferingGroupForPoAndBpo
public java.util.Optional<TmaProductOfferingGroupModel> getOfferingGroupForPoAndBpo(TmaProductOfferingModel productOffering, TmaBundledProductOfferingModel parent)
Description copied from interface:TmaPoServiceRetrieves theTmaProductOfferingGroupModelfor a given product inside the givenTmaBundledProductOfferingModelparent.- Specified by:
getOfferingGroupForPoAndBpoin interfaceTmaPoService- Parameters:
productOffering- theTmaProductOfferingModelwhose product offering group will be identifiedparent- theTmaBundledProductOfferingModelused for filtering the product offering groups- Returns:
- the
TmaProductOfferingGroupModelconfigured for the given product if any
-
getProductOfferings
public SearchPageData<TmaProductOfferingModel> getProductOfferings(java.util.Collection<CatalogVersionModel> catalogVersions, TmaProductOfferingSearchContext productOfferingSearchContext)
Description copied from interface:TmaPoServiceFinds theTmaProductOfferingModelfor a given collectionCatalogVersionModelandTmaProductOfferingSearchContext- Specified by:
getProductOfferingsin interfaceTmaPoService- Parameters:
catalogVersions- catalog versions used to query for productsproductOfferingSearchContext- product search context object stores all attributes for search- Returns:
- page of
TmaProductOfferingModelwrapped onSearchResult
-
getConfigurableProductSpecCharacteristics
public java.util.Set<TmaProductSpecCharacteristicModel> getConfigurableProductSpecCharacteristics(TmaProductOfferingModel productOffering)
Description copied from interface:TmaPoServiceComputes and returns the configurableTmaProductSpecCharacteristicModelof a given product.- Specified by:
getConfigurableProductSpecCharacteristicsin interfaceTmaPoService- Parameters:
productOffering- the product offering- Returns:
- the configurable characteristics
-
getOperationalProductOffering
public java.util.Optional<TmaOperationalProductOfferingModel> getOperationalProductOffering(TmaSubscribedProductAction action)
Description copied from interface:TmaPoServiceReturns the operational product corresponding to the specified action.- Specified by:
getOperationalProductOfferingin interfaceTmaPoService- Parameters:
action- the action that should be supported by the operational product.- Returns:
- The first operational product found that supports the given action, if any.
-
getProductOffering
public ProductModel getProductOffering(java.lang.String productOfferingCode, TmaSubscribedProductAction cartAction)
Description copied from interface:TmaPoServiceReturns a product offering for the given product code and cart action.- Specified by:
getProductOfferingin interfaceTmaPoService- Parameters:
productOfferingCode- the code used for getting a PO if the action is keepcartAction- the cart action- Returns:
- the product offering for the product code and cart action.
-
isServiceRequestAction
public boolean isServiceRequestAction(TmaSubscribedProductAction action)
Description copied from interface:TmaPoServiceThis method checks if the given cart action requires an operational product.- Specified by:
isServiceRequestActionin interfaceTmaPoService- Parameters:
action- the input action to be checked.- Returns:
- true if an operational Po is used; false otherwise
-
getProductsForCode
public java.util.List<TmaProductOfferingModel> getProductsForCode(java.lang.String code)
Description copied from interface:TmaPoServiceReturn the list ofTmaProductOfferingModelbased on product code- Specified by:
getProductsForCodein interfaceTmaPoService- Parameters:
code- identifier ofTmaProductOfferingModel- Returns:
TmaProductOfferingModel
-
getProductOfferingsByProperties
public java.util.Set<TmaProductOfferingModel> getProductOfferingsByProperties(java.util.Map<java.lang.String,java.lang.String> propertyPattern)
Description copied from interface:TmaPoServiceReturns the set ofTmaProductOfferingModelbased on key and value in map where key is the property name and the value is the pattern value of the property- Specified by:
getProductOfferingsByPropertiesin interfaceTmaPoService- Parameters:
propertyPattern- map which has property as key and pattern as value- Returns:
- Set of
TmaProductOfferingModel
-
getProductOfferingGroupsByProperties
public java.util.Set<TmaProductOfferingGroupModel> getProductOfferingGroupsByProperties(java.util.Map<java.lang.String,java.lang.String> propertyPattern)
Description copied from interface:TmaPoServiceReturns the set of @{link TmaProductOfferingGroupModel} based on key and value in map where key is the property name and the value is the pattern value of the property- Specified by:
getProductOfferingGroupsByPropertiesin interfaceTmaPoService- Parameters:
propertyPattern- map which has propertyPattern as key and pattern as value- Returns:
- Set of
TmaProductOfferingGroupModel
-
getProductOfferings
public java.util.List<TmaProductOfferingModel> getProductOfferings(CatalogVersionModel catalogVersion)
Returns product offering list for corresponding catalog version- Specified by:
getProductOfferingsin interfaceTmaPoService- Parameters:
catalogVersion- for which product offerings will be retrieved- Returns:
- List of
TmaProductOfferingModel
-
getSpoListForBpo
public java.util.List<TmaSimpleProductOfferingModel> getSpoListForBpo(TmaBundledProductOfferingModel bundleProductOffering)
This method will traverses down the hierarchy of a given bundle product offering to find out all the child spos. There might be a case when a given bpo has a child bpo and further this child bpo have many child spos. Returns the list of all child simple product offerings of a given bundle product offering.- Specified by:
getSpoListForBpoin interfaceTmaPoService- Parameters:
bundleProductOffering- the bundle product offering- Returns:
- the child spos of the bundle product offering
-
getModelService
protected de.hybris.platform.servicelayer.model.ModelService getModelService()
-
getProductService
protected de.hybris.platform.product.ProductService getProductService()
-
getCommercePriceService
protected TmaCommercePriceService getCommercePriceService()
-
getTmaProductOfferingDao
protected TmaProductOfferingDao getTmaProductOfferingDao()
-
getConfigurationService
protected de.hybris.platform.servicelayer.config.ConfigurationService getConfigurationService()
-
setModelService
public void setModelService(de.hybris.platform.servicelayer.model.ModelService modelService)
-
setProductService
public void setProductService(de.hybris.platform.product.ProductService productService)
-
setCommercePriceService
public void setCommercePriceService(TmaCommercePriceService commercePriceService)
-
setTmaProductOfferingDao
public void setTmaProductOfferingDao(TmaProductOfferingDao tmaProductOfferingDao)
-
setConfigurationService
public void setConfigurationService(de.hybris.platform.servicelayer.config.ConfigurationService configurationService)
-
getTmaProductDao
protected TmaProductDao getTmaProductDao()
-
-