public class DefaultBundleCommerceCartFacade extends java.lang.Object implements BundleCartFacade
BundleCartFacade| Modifier and Type | Field and Description |
|---|---|
protected static java.lang.String |
FACET_SEPARATOR |
| Constructor and Description |
|---|
DefaultBundleCommerceCartFacade() |
| Modifier and Type | Method and Description |
|---|---|
java.util.List<CartModificationData> |
addToCart(java.lang.String productCode1,
int bundleNo,
java.lang.String bundleTemplateId1,
java.lang.String productCode2,
java.lang.String bundleTemplateId2)
Method to add the
productCode1 |
CartModificationData |
addToCart(java.lang.String productCode,
long quantity,
int groupNumber)
Add a product to an existing bundle.
|
java.util.List<CartModificationData> |
addToCart(java.lang.String productCode,
long quantity,
int bundleNo,
java.lang.String bundleTemplateId,
boolean removeCurrentProducts)
Adds the product with the productId and with the given
quantity to the cart. |
protected void |
applyDisableRules(ProductData productData,
EntryGroup currentEntryGroup) |
protected EntryGroup |
createBundleStructure(AbstractOrderEntryModel entry) |
protected SearchStateData |
createSearchStateWithBundleComponentFilter(java.lang.String searchQuery,
java.lang.String componentId) |
void |
deleteCartBundle(int bundleNo)
Method to delete all cart entries of a particular bundle
|
protected ProductSearchPageData<SearchStateData,ProductData> |
encodeSearchPageData(java.lang.String urlPrefix,
ProductSearchPageData<SearchStateData,ProductData> searchPageData) |
protected java.lang.String |
encodeURL(java.lang.String url) |
protected void |
enrichProductData(java.util.List<ProductData> searchResult,
EntryGroup currentEntryGroup)
Populate some extra fields of product DTO restored from solr documents.
|
ProductSearchPageData<SearchStateData,ProductData> |
getAllowedProducts(java.lang.Integer groupNumber,
java.lang.String searchQuery,
PageableData pageableData)
Constructs pageable list of products available for entry group of type
GroupType.CONFIGURABLEBUNDLE |
protected BundleRuleService |
getBundleRuleService() |
protected BundleTemplateService |
getBundleTemplateService() |
protected Converter<CommerceCartModification,CartModificationData> |
getCartModificationConverter() |
protected CartService |
getCartService() |
protected CommerceCartService |
getCommerceCartService() |
protected java.lang.Integer |
getEntryGroupNumber(AbstractOrderModel cartModel,
int bundleNo,
java.lang.String bundleTemplateId) |
protected EntryGroupService |
getEntryGroupService() |
protected ModelService |
getModelService() |
protected ProductSearchFacade<ProductData> |
getProductSearchFacade() |
protected ProductService |
getProductService() |
boolean |
isCartValid()
Checks if the session cart is valid (= does not contain any invalid components)
|
protected void |
patchURLs(java.lang.String urlPrefix,
ProductSearchPageData<SearchStateData,ProductData> searchPageData) |
protected void |
processFacetData(java.util.List<FacetData<SearchStateData>> facets) |
protected void |
processFacetDatas(java.util.List<FacetValueData<SearchStateData>> facetValueDatas) |
protected void |
removeEntriesByGroupNumber(CartModel cart,
java.lang.Integer entryGroupNumber) |
void |
setBundleRuleService(BundleRuleService bundleRuleService) |
void |
setBundleTemplateService(BundleTemplateService bundleTemplateService) |
void |
setCartModificationConverter(Converter<CommerceCartModification,CartModificationData> cartModificationConverter) |
void |
setCartService(CartService cartService) |
void |
setCommerceCartService(CommerceCartService commerceCartService) |
protected void |
setEntryGroupNumber(java.util.Map<java.lang.String,java.lang.Integer> groupsByTemplateId,
AbstractOrderEntryModel entry) |
void |
setEntryGroupService(EntryGroupService entryGroupService) |
void |
setModelService(ModelService modelService) |
void |
setProductSearchFacade(ProductSearchFacade<ProductData> productSearchFacade) |
void |
setProductService(ProductService productService) |
CartModificationData |
startBundle(java.lang.String bundleTemplateId,
java.lang.String productCode,
long quantity)
Start new bundle in cart based on the given bundle template and add the product to it.
|
protected static final java.lang.String FACET_SEPARATOR
public CartModificationData startBundle(java.lang.String bundleTemplateId, java.lang.String productCode, long quantity) throws CommerceCartModificationException
BundleCartFacadestartBundle in interface BundleCartFacadebundleTemplateId - a component to add the product to. He whole bundle structure
- starting from the root of the component - will be added to cart groupsproductCode - a product which will be added to the componentquantity - quantity for the product. Is limited by selection criteria of the componentCommerceCartModificationException - if the operation is not possibleEntryGroup,
BundleSelectionCriteriapublic CartModificationData addToCart(java.lang.String productCode, long quantity, int groupNumber) throws CommerceCartModificationException
BundleCartFacadeaddToCart in interface BundleCartFacadeproductCode - product to addquantity - quantity of the productgroupNumber - entry group number, that defines the bundle and the component within the bundleCommerceCartModificationException - if the operation is not possibleEntryGrouppublic java.util.List<CartModificationData> addToCart(java.lang.String productCode, long quantity, int bundleNo, java.lang.String bundleTemplateId, boolean removeCurrentProducts) throws CommerceCartModificationException
BundleCartFacadequantity to the cart. If an entry with the
given product exists in the cart already, then the given quantity is added to the quantity of this
cart entry. Dependent on the parameter bundleNo the product is added to an existing or new bundle or
treated as a standalone product. In case a new bundle is created the method also adds auto-pick products to the
cart if there are any setup for the bundle template. After this the multi-cart is calculated.addToCart in interface BundleCartFacadeproductCode - the product id that will be added to the cartquantity - the quantity of the productbundleNo - indicates to which bundle the product shall be added (-1=create new bundle; 0=standalone product/no
bundle; >0=number of existing bundle)bundleTemplateId - The bundletemplate id to add the product toremoveCurrentProducts - whether to remove existing products in that componentCartModificationDataCommerceCartModificationExceptionpublic java.util.List<CartModificationData> addToCart(java.lang.String productCode1, int bundleNo, java.lang.String bundleTemplateId1, java.lang.String productCode2, java.lang.String bundleTemplateId2) throws CommerceCartModificationException
BundleCartFacadeproductCode1 and productcode2 to multi-cart as new cart entries. As
this method works for bundles only, both products must have a bundle template and must be part of an existing
bundle or a new bundle that is created during the addToCart. In case a new bundle is created the method also adds
auto-pick products to the cart if there are any setup for the bundle template. After this the multi-cart is
calculated.addToCart in interface BundleCartFacadeproductCode1 - the first product id that will be added to the cartbundleNo - indicates to which bundle the product model shall be added (-1=create new bundle; >0=number of existing
bundle; 0=standalone product/no bundle is not allowed here)bundleTemplateId1 - current version of the bundleTemplate id based on which the first product is added to the cart. It will
be stored on the cart entry.productCode2 - the second product id that will be added to the cartbundleTemplateId2 - current version of the bundleTemplate id based on which the second product is added to the cart. It will
be stored on the cart entry.CartModificationDataCommerceCartModificationExceptionpublic void deleteCartBundle(int bundleNo)
throws CommerceCartModificationException
BundleCartFacadedeleteCartBundle in interface BundleCartFacadebundleNo - bundleNo in cartCommerceCartModificationExceptionpublic boolean isCartValid()
BundleCartFacadeisCartValid in interface BundleCartFacadetrue if the session cart is valid, otherwise falsepublic ProductSearchPageData<SearchStateData,ProductData> getAllowedProducts(java.lang.Integer groupNumber, java.lang.String searchQuery, PageableData pageableData)
BundleCartFacadeGroupType.CONFIGURABLEBUNDLEgetAllowedProducts in interface BundleCartFacadegroupNumber - entry group number related to the componentsearchQuery - the search querypageableData - the page to returnprotected void enrichProductData(java.util.List<ProductData> searchResult, EntryGroup currentEntryGroup)
searchResult - products that could be added to a componentgroup - bundle component the products are being selected forprotected void applyDisableRules(ProductData productData, EntryGroup currentEntryGroup)
protected java.lang.Integer getEntryGroupNumber(AbstractOrderModel cartModel, int bundleNo, java.lang.String bundleTemplateId) throws CommerceCartModificationException
protected EntryGroup createBundleStructure(AbstractOrderEntryModel entry)
protected void setEntryGroupNumber(java.util.Map<java.lang.String,java.lang.Integer> groupsByTemplateId,
AbstractOrderEntryModel entry)
protected void removeEntriesByGroupNumber(CartModel cart, java.lang.Integer entryGroupNumber) throws CommerceCartModificationException
protected SearchStateData createSearchStateWithBundleComponentFilter(java.lang.String searchQuery, java.lang.String componentId)
protected ProductSearchPageData<SearchStateData,ProductData> encodeSearchPageData(java.lang.String urlPrefix, ProductSearchPageData<SearchStateData,ProductData> searchPageData)
protected void patchURLs(java.lang.String urlPrefix,
ProductSearchPageData<SearchStateData,ProductData> searchPageData)
protected java.lang.String encodeURL(java.lang.String url)
protected void processFacetData(java.util.List<FacetData<SearchStateData>> facets) throws java.io.UnsupportedEncodingException
java.io.UnsupportedEncodingExceptionprotected void processFacetDatas(java.util.List<FacetValueData<SearchStateData>> facetValueDatas) throws java.io.UnsupportedEncodingException
java.io.UnsupportedEncodingExceptionprotected BundleTemplateService getBundleTemplateService()
public void setBundleTemplateService(BundleTemplateService bundleTemplateService)
protected CartService getCartService()
public void setCartService(CartService cartService)
protected ProductService getProductService()
public void setProductService(ProductService productService)
protected Converter<CommerceCartModification,CartModificationData> getCartModificationConverter()
public void setCartModificationConverter(Converter<CommerceCartModification,CartModificationData> cartModificationConverter)
protected EntryGroupService getEntryGroupService()
public void setEntryGroupService(EntryGroupService entryGroupService)
protected CommerceCartService getCommerceCartService()
public void setCommerceCartService(CommerceCartService commerceCartService)
protected ProductSearchFacade<ProductData> getProductSearchFacade()
public void setProductSearchFacade(ProductSearchFacade<ProductData> productSearchFacade)
protected ModelService getModelService()
public void setModelService(ModelService modelService)
protected BundleRuleService getBundleRuleService()
public void setBundleRuleService(BundleRuleService bundleRuleService)
Copyright © 2018 SAP SE. All Rights Reserved.