Class SpecificItemChoice
- java.lang.Object
-
- com.broadleafcommerce.catalogbrowse.domain.SpecificItemChoice
-
- All Implemented Interfaces:
Priceable,Serializable
public class SpecificItemChoice extends Object implements Serializable, Priceable
When aItemChoiceis determined to be aDefaultItemChoiceTargetType.SPECIFIC_PRODUCTSorDefaultItemChoiceTargetType.SPECIFIC_VARIANTS, this holds the relationship that the customer should select from- Author:
- Nathan Moore (nathandmoore)
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description SpecificItemChoice()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAttribute(String name, Object value)Takes in any additional attributes passed in the request not matching any defined properties.protected booleancanEqual(Object other)booleanequals(Object o)Map<String,Object>getAttribute()Return any additional attributes passed in the request not matching any defined properties.Map<String,Object>getAttributes()Map holding any additional attributes passed in the request not matching any defined properties.javax.money.MonetaryAmountgetOverridePrice()com.broadleafcommerce.pricing.client.domain.PriceInfogetPriceInfo()Summary of thepricing informationrelated to the choice.StringgetPricingKey()System-wide unique identifier to configure specific pricing for the choice.ProductgetProduct()If thetypeisDefaultSpecificItemChoiceType.PRODUCTthis holds the product for this choiceStringgetType()Whether or not this item holds a product or a variant that the customer can select fromVariantgetVariant()If thetypeisDefaultSpecificItemChoiceType.VARIANTthis holds the variant for this choiceMap<String,SpecificItemChoiceVariantPricingOverride>getVariantPricing()Pricing overrides if specific variants of the main product this item belongs to are added to the cart.StringgetVendorRef()inthashCode()booleanisUsingParentPricing()Whether thepriceInfois inherited from the parentItemChoice.voidsetAttributes(Map<String,Object> attributes)Map holding any additional attributes passed in the request not matching any defined properties.voidsetOverridePrice(javax.money.MonetaryAmount overridePrice)voidsetPriceInfo(com.broadleafcommerce.pricing.client.domain.PriceInfo priceInfo)Summary of thepricing informationrelated to the choice.voidsetPricingKey(String pricingKey)System-wide unique identifier to configure specific pricing for the choice.voidsetProduct(Product product)If thetypeisDefaultSpecificItemChoiceType.PRODUCTthis holds the product for this choicevoidsetType(String type)Whether or not this item holds a product or a variant that the customer can select fromvoidsetUsingParentPricing(boolean usingParentPricing)Whether thepriceInfois inherited from the parentItemChoice.voidsetVariant(Variant variant)If thetypeisDefaultSpecificItemChoiceType.VARIANTthis holds the variant for this choicevoidsetVariantPricing(Map<String,SpecificItemChoiceVariantPricingOverride> variantPricing)Pricing overrides if specific variants of the main product this item belongs to are added to the cart.StringtoString()
-
-
-
Method Detail
-
getVendorRef
@Nullable public String getVendorRef()
-
addAttribute
public void addAttribute(String name, Object value)
Takes in any additional attributes passed in the request not matching any defined properties.- Parameters:
name- Name of the additional attributevalue- Value of the additional attribute
-
getAttribute
public Map<String,Object> getAttribute()
Return any additional attributes passed in the request not matching any defined properties.- Returns:
- any additional attributes passed in the request not matching any defined properties.
-
getPricingKey
public String getPricingKey()
System-wide unique identifier to configure specific pricing for the choice. Relevant if pricing data is managed in a separate system or data store, like the Broadleaf pricing services.- Returns:
- a unique key to identify this choice, null if there is no external system this should be linked to for pricing data
-
getType
public String getType()
Whether or not this item holds a product or a variant that the customer can select from- Returns:
- the type of this addon item
- See Also:
DefaultSpecificItemChoiceType
-
getProduct
public Product getProduct()
If thetypeisDefaultSpecificItemChoiceType.PRODUCTthis holds the product for this choice- Returns:
- the product representing this choice, or null if
typeis notDefaultSpecificItemChoiceType.PRODUCT
-
getVariant
public Variant getVariant()
If thetypeisDefaultSpecificItemChoiceType.VARIANTthis holds the variant for this choice- Returns:
- the variant representing this choice, or null if
typeis notDefaultSpecificItemChoiceType.VARIANT
-
getPriceInfo
public com.broadleafcommerce.pricing.client.domain.PriceInfo getPriceInfo()
Summary of thepricing informationrelated to the choice. The consumer of this service is expecting this to be the source of truth for the pricing of this specific choice, so this field should be calculated from its own override price if present or be a copy of the underlying product's or variant's pricing to simplify the consumer's logic.- Specified by:
getPriceInfoin interfacePriceable- Returns:
- The
PriceInfoon the entity. - See Also:
for special pricing considerations
-
getOverridePrice
public javax.money.MonetaryAmount getOverridePrice()
The specific price set for this choice that overrides the price of underlyingproductorvariant. This is primarily used for reference in determining whetherpriceInfoshould be disregarded in pricing calculations in this service: If there is anoverridePrice, then thepriceInforeceived from theCatalogProvidershould be used as the base for additional pricing calculations informed by thePricingProvider. Otherwise, it should be discarded since it is really a copy of the underlyingproductorvariantand cannot be used as a basis for additional pricing calculations for theSpecificItemChoiceitself.- Returns:
- the price of this choice
-
getVariantPricing
public Map<String,SpecificItemChoiceVariantPricingOverride> getVariantPricing()
Pricing overrides if specific variants of the main product this item belongs to are added to the cart. This can be used in a case like a Warranty where the price of the Warranty depends on the price of the item (Variant) selected.- Returns:
- Pricing overrides if specific variants of the main product are added to the cart.
-
isUsingParentPricing
public boolean isUsingParentPricing()
Whether thepriceInfois inherited from the parentItemChoice. This is usually determined after pricing is hydrated by thePricingProvider.- Returns:
- Whether the
priceInfois inherited from the parentItemChoice
-
getAttributes
public Map<String,Object> getAttributes()
Map holding any additional attributes passed in the request not matching any defined properties.
-
setPricingKey
public void setPricingKey(String pricingKey)
System-wide unique identifier to configure specific pricing for the choice. Relevant if pricing data is managed in a separate system or data store, like the Broadleaf pricing services.- Parameters:
pricingKey- a unique key to identify this choice (usually a UUID)
-
setType
public void setType(String type)
Whether or not this item holds a product or a variant that the customer can select from- Parameters:
type- the type of item this is, usually fromDefaultSpecificItemChoiceType- See Also:
DefaultSpecificItemChoiceType
-
setProduct
public void setProduct(Product product)
If thetypeisDefaultSpecificItemChoiceType.PRODUCTthis holds the product for this choice- Parameters:
product- the product representing this choice
-
setVariant
public void setVariant(Variant variant)
If thetypeisDefaultSpecificItemChoiceType.VARIANTthis holds the variant for this choice- Parameters:
variant- the variant representing this choice
-
setPriceInfo
public void setPriceInfo(com.broadleafcommerce.pricing.client.domain.PriceInfo priceInfo)
Summary of thepricing informationrelated to the choice. The consumer of this service is expecting this to be the source of truth for the pricing of this specific choice, so this field should be calculated from its own override price if present or be a copy of the underlying product's or variant's pricing to simplify the consumer's logic.- Specified by:
setPriceInfoin interfacePriceable- Parameters:
priceInfo- ThePriceInfoto set.- See Also:
for special pricing considerations
-
setOverridePrice
public void setOverridePrice(javax.money.MonetaryAmount overridePrice)
The specific price set for this choice that overrides the price of underlyingproductorvariant. This is primarily used for reference in determining whetherpriceInfoshould be disregarded in pricing calculations in this service: If there is anoverridePrice, then thepriceInforeceived from theCatalogProvidershould be used as the base for additional pricing calculations informed by thePricingProvider. Otherwise, it should be discarded since it is really a copy of the underlyingproductorvariantand cannot be used as a basis for additional pricing calculations for theSpecificItemChoiceitself.- Parameters:
overridePrice- the price of this choice
-
setVariantPricing
public void setVariantPricing(Map<String,SpecificItemChoiceVariantPricingOverride> variantPricing)
Pricing overrides if specific variants of the main product this item belongs to are added to the cart. This can be used in a case like a Warranty where the price of the Warranty depends on the price of the item (Variant) selected.- Parameters:
variantPricing- Pricing overrides if specific variants of the main product are added to the cart.
-
setUsingParentPricing
public void setUsingParentPricing(boolean usingParentPricing)
Whether thepriceInfois inherited from the parentItemChoice. This is usually determined after pricing is hydrated by thePricingProvider.- Parameters:
usingParentPricing- Whether thepriceInfois inherited from the parentItemChoice
-
setAttributes
public void setAttributes(Map<String,Object> attributes)
Map holding any additional attributes passed in the request not matching any defined properties.
-
canEqual
protected boolean canEqual(Object other)
-
-