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
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
boolean
Miscellaneous 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.CurrencyUnit
Deprecated.A list of additionalAddItemRequests
that 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 thisAddItemRequest
is one withingetDependentCartItems()
, this is the key to use to relate to thisCartItem
to a configured product item choice.Miscellaneous internal attributes that should be copied to theCartItem.getInternalAttributes()
for this request.Deprecated.in favor of usingPriceCartRequest
for creating or pricing a cart.The value that should be mapped toCartItem.getMerchandisingContext()
.The id of the product for this add item request.int
The 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.int
hashCode()
void
setAdditionalAttributes
(Map<String, Object> additionalAttributes) Miscellaneous attributes that can be set to this request in order to inform business logic for adding aCartItem
.void
setCartAttributes
(Map<String, Object> cartAttributes) Attributes that should be copied to theCart.getAttributes()
for this request.void
setCurrency
(javax.money.CurrencyUnit currency) Deprecated.in favor of usingPriceCartRequest
for creating or pricing a cart.void
setDependentCartItems
(List<AddItemRequest> dependentCartItems) A list of additionalAddItemRequests
that should be processed as dependent items of the resulting parent item of this currentAddItemRequest
.void
setItemAttributeChoices
(Map<String, String> itemAttributeChoices) Attribute choices that should be copied toCartItem.getAttributeChoices()
for this request.void
setItemAttributes
(Map<String, Object> itemAttributes) Miscellaneous attributes that should be copied to theCartItem.getAttributes()
for this request.void
setItemChoiceKey
(String itemChoiceKey) If thisAddItemRequest
is one withingetDependentCartItems()
, this is the key to use to relate to thisCartItem
to a configured product item choice.void
setItemInternalAttributes
(Map<String, Object> itemInternalAttributes) Miscellaneous internal attributes that should be copied to theCartItem.getInternalAttributes()
for this request.void
Deprecated.in favor of usingPriceCartRequest
for creating or pricing a cart.void
setMerchandisingContext
(String merchandisingContext) The value that should be mapped toCartItem.getMerchandisingContext()
.void
setProductId
(String productId) The id of the product for this add item request.void
setQuantity
(int quantity) The amount of this item to be added to theCart
.void
The SKU code for the item (e.g., Product or Variant).void
setVariantId
(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
-
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 usingPriceCartRequest
for creating or pricing a cart. -
getLocale
Deprecated.in favor of usingPriceCartRequest
for 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 additionalAddItemRequests
that should be processed as dependent items of the resulting parent item of this currentAddItemRequest
.- Returns:
- A list of additional
AddItemRequests
that should be processed as dependent items of the resulting parent item of this currentAddItemRequest
.
-
getItemChoiceKey
If thisAddItemRequest
is one withingetDependentCartItems()
, this is the key to use to relate to thisCartItem
to a configured product item choice.- Returns:
- The key to use to relate to this
CartItem
to 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
-
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 usingPriceCartRequest
for creating or pricing a cart. -
setLocale
Deprecated.in favor of usingPriceCartRequest
for 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 additionalAddItemRequests
that should be processed as dependent items of the resulting parent item of this currentAddItemRequest
.- Parameters:
dependentCartItems
- A list of additionalAddItemRequests
that should be processed as dependent items of the resulting parent item of this currentAddItemRequest
.
-
setItemChoiceKey
If thisAddItemRequest
is one withingetDependentCartItems()
, this is the key to use to relate to thisCartItem
to a configured product item choice.- Parameters:
itemChoiceKey
- The key to use to relate to thisCartItem
to 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:
equals
in classCartModifyingRequest
-
canEqual
- Overrides:
canEqual
in classCartModifyingRequest
-
hashCode
public int hashCode()- Overrides:
hashCode
in classCartModifyingRequest
-
toString
- Overrides:
toString
in classCartModifyingRequest
-
PriceCartRequest
for creating or pricing a cart.