Class AddItemRequest
java.lang.Object
com.broadleafcommerce.cartoperation.web.endpoint.domain.CartModifyingRequest
com.broadleafcommerce.cartoperation.web.endpoint.domain.AddItemRequest
- All Implemented Interfaces:
CartVersionedRequest,Serializable
A request DTO for adding an item to a cart. This is passed through
CartOperationService.addItemToCart(Cart, AddItemRequest, boolean, ContextInfo) and is
used to inform the creation of a CartItem.- Author:
- Chad Harchar (charchar)
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanbooleanMiscellaneous attributes that can be set to this request in order to inform business logic for adding aCartItem.Attributes that should be copied to theCart.getAttributes()for this request.javax.money.CurrencyUnitDeprecated.A list of additionalAddItemRequeststhat should be processed as dependent items of the resulting parent item of this currentAddItemRequest.Attribute choices that should be copied toCartItem.getAttributeChoices()for this request.Miscellaneous attributes that should be copied to theCartItem.getAttributes()for this request.If thisAddItemRequestis one withingetDependentCartItems(), this is the key to use to relate to thisCartItemto a configured product item choice.Miscellaneous internal attributes that should be copied to theCartItem.getInternalAttributes()for this request.Thetypeof this item (e.g.Deprecated.in favor of usingPriceCartRequestfor creating or pricing a cart.The value that should be mapped toCartItem.getMerchandisingContext().Additional request information for adding a non-catalog item to the cart.The id of the product for this add item request.intThe amount of this item to be added to theCart.getSku()The SKU code for the item (e.g., Product or Variant).The id of the variant for this add item request.inthashCode()voidsetAdditionalAttributes(Map<String, Object> additionalAttributes) Miscellaneous attributes that can be set to this request in order to inform business logic for adding aCartItem.voidsetCartAttributes(Map<String, Object> cartAttributes) Attributes that should be copied to theCart.getAttributes()for this request.voidsetCurrency(javax.money.CurrencyUnit currency) Deprecated.in favor of usingPriceCartRequestfor creating or pricing a cart.voidsetDependentCartItems(List<AddItemRequest> dependentCartItems) A list of additionalAddItemRequeststhat should be processed as dependent items of the resulting parent item of this currentAddItemRequest.voidsetItemAttributeChoices(Map<String, String> itemAttributeChoices) Attribute choices that should be copied toCartItem.getAttributeChoices()for this request.voidsetItemAttributes(Map<String, Object> itemAttributes) Miscellaneous attributes that should be copied to theCartItem.getAttributes()for this request.voidsetItemChoiceKey(String itemChoiceKey) If thisAddItemRequestis one withingetDependentCartItems(), this is the key to use to relate to thisCartItemto a configured product item choice.voidsetItemInternalAttributes(Map<String, Object> itemInternalAttributes) Miscellaneous internal attributes that should be copied to theCartItem.getInternalAttributes()for this request.voidsetItemType(String itemType) Thetypeof this item (e.g.voidDeprecated.in favor of usingPriceCartRequestfor creating or pricing a cart.voidsetMerchandisingContext(String merchandisingContext) The value that should be mapped toCartItem.getMerchandisingContext().voidsetNonCatalogItemDetails(NonCatalogItemDetails nonCatalogItemDetails) Additional request information for adding a non-catalog item to the cart.voidsetProductId(String productId) The id of the product for this add item request.voidsetQuantity(int quantity) The amount of this item to be added to theCart.voidThe SKU code for the item (e.g., Product or Variant).voidsetVariantId(String variantId) The id of the variant for this add item request.toString()Methods inherited from class com.broadleafcommerce.cartoperation.web.endpoint.domain.CartModifyingRequest
getCartVersion, getVersion, setCartVersion, setVersion
-
Constructor Details
-
AddItemRequest
public AddItemRequest()
-
-
Method Details
-
getVariantId
The id of the variant for this add item request. Used to retrieve variant information for the cart item.- Returns:
- The id of the variant for this add item request. Used to retrieve variant information for the cart item.
-
getProductId
The id of the product for this add item request. Used to retrieve product information for the cart item.- Returns:
- The id of the product for this add item request. Used to retrieve product information for the cart item.
-
getSku
The SKU code for the item (e.g., Product or Variant).- Returns:
- SKU code for the item
-
getItemType
Thetypeof this item (e.g. Standard or Custom Quote Item). Defaults toDefaultCartItemTypes.STANDARD.- Returns:
- type of this item
- See Also:
-
getNonCatalogItemDetails
Additional request information for adding a non-catalog item to the cart. For example, this can be useful for adding aDefaultCartItemTypes.CUSTOM_QUOTE_ITEMthat doesn't exist in the catalog. -
getQuantity
public int getQuantity()The amount of this item to be added to theCart.- Returns:
- The amount of this item to be added to the
Cart.
-
getCurrency
Deprecated.in favor of usingPriceCartRequestfor creating or pricing a cart. -
getLocale
Deprecated.in favor of usingPriceCartRequestfor creating or pricing a cart. -
getItemAttributes
Miscellaneous attributes that should be copied to theCartItem.getAttributes()for this request.- Returns:
- Miscellaneous attributes that should be copied to the
CartItem.getAttributes()for this request.
-
getItemInternalAttributes
Miscellaneous internal attributes that should be copied to theCartItem.getInternalAttributes()for this request.- Returns:
- Miscellaneous internal attributes that should be copied to the
CartItem.getInternalAttributes()for this request.
-
getItemAttributeChoices
Attribute choices that should be copied toCartItem.getAttributeChoices()for this request.- Returns:
- Attribute choices that should be copied to
CartItem.getAttributeChoices()for this request.
-
getCartAttributes
Attributes that should be copied to theCart.getAttributes()for this request.- Returns:
- Attributes that should be copied to the
Cart.getAttributes()for this request.
-
getDependentCartItems
A list of additionalAddItemRequeststhat should be processed as dependent items of the resulting parent item of this currentAddItemRequest.- Returns:
- A list of additional
AddItemRequeststhat should be processed as dependent items of the resulting parent item of this currentAddItemRequest.
-
getItemChoiceKey
If thisAddItemRequestis one withingetDependentCartItems(), this is the key to use to relate to thisCartItemto a configured product item choice.- Returns:
- The key to use to relate to this
CartItemto a configured product item choice.
-
getMerchandisingContext
The value that should be mapped toCartItem.getMerchandisingContext(). This holds the selector or merchandising product's id.- Returns:
- The context of the item signifying where it's added from
-
getAdditionalAttributes
Miscellaneous attributes that can be set to this request in order to inform business logic for adding aCartItem.- Returns:
- Miscellaneous attributes that can be set to this request in order to inform business
logic for adding a
CartItem.
-
setVariantId
The id of the variant for this add item request. Used to retrieve variant information for the cart item.- Parameters:
variantId- The id of the variant for this add item request. Used to retrieve variant information for the cart item.
-
setProductId
The id of the product for this add item request. Used to retrieve product information for the cart item.- Parameters:
productId- The id of the product for this add item request. Used to retrieve product information for the cart item.
-
setSku
The SKU code for the item (e.g., Product or Variant).- Parameters:
sku- SKU code for the item
-
setItemType
Thetypeof this item (e.g. Standard or Custom Quote Item). Defaults toDefaultCartItemTypes.STANDARD.- Parameters:
type- type of this item- See Also:
-
setNonCatalogItemDetails
Additional request information for adding a non-catalog item to the cart. For example, this can be useful for adding aDefaultCartItemTypes.CUSTOM_QUOTE_ITEMthat doesn't exist in the catalog. -
setQuantity
public void setQuantity(int quantity) The amount of this item to be added to theCart.- Parameters:
quantity- The amount of this item to be added to theCart.
-
setCurrency
Deprecated.in favor of usingPriceCartRequestfor creating or pricing a cart. -
setLocale
Deprecated.in favor of usingPriceCartRequestfor creating or pricing a cart. -
setItemAttributes
Miscellaneous attributes that should be copied to theCartItem.getAttributes()for this request.- Parameters:
itemAttributes- Miscellaneous attributes that should be copied to theCartItem.getAttributes()for this request.
-
setItemInternalAttributes
Miscellaneous internal attributes that should be copied to theCartItem.getInternalAttributes()for this request.- Parameters:
itemAttributes- Miscellaneous internal attributes that should be copied to theCartItem.getInternalAttributes()for this request.
-
setItemAttributeChoices
Attribute choices that should be copied toCartItem.getAttributeChoices()for this request.- Parameters:
itemAttributeChoices- Attribute choices that should be copied toCartItem.getAttributeChoices()for this request.
-
setCartAttributes
Attributes that should be copied to theCart.getAttributes()for this request.- Parameters:
cartAttributes- Attributes that should be copied to theCart.getAttributes()for this request.
-
setDependentCartItems
A list of additionalAddItemRequeststhat should be processed as dependent items of the resulting parent item of this currentAddItemRequest.- Parameters:
dependentCartItems- A list of additionalAddItemRequeststhat should be processed as dependent items of the resulting parent item of this currentAddItemRequest.
-
setItemChoiceKey
If thisAddItemRequestis one withingetDependentCartItems(), this is the key to use to relate to thisCartItemto a configured product item choice.- Parameters:
itemChoiceKey- The key to use to relate to thisCartItemto a configured product item choice.
-
setMerchandisingContext
The value that should be mapped toCartItem.getMerchandisingContext(). This holds the selector or merchandising product's id.- Parameters:
merchandisingContext- The context of the item signifying where it's added from
-
setAdditionalAttributes
Miscellaneous attributes that can be set to this request in order to inform business logic for adding aCartItem.- Parameters:
additionalAttributes- Miscellaneous attributes that can be set to this request in order to inform business logic for adding aCartItem.
-
equals
- Overrides:
equalsin classCartModifyingRequest
-
canEqual
- Overrides:
canEqualin classCartModifyingRequest
-
hashCode
public int hashCode()- Overrides:
hashCodein classCartModifyingRequest
-
toString
- Overrides:
toStringin classCartModifyingRequest
-
PriceCartRequestfor creating or pricing a cart.