Class SpecificItemChoice
java.lang.Object
com.broadleafcommerce.catalogbrowse.domain.SpecificItemChoice
- All Implemented Interfaces:
Priceable,Serializable
When a
ItemChoice is determined to be a
DefaultItemChoiceTargetType.SPECIFIC_PRODUCTS or
DefaultItemChoiceTargetType.SPECIFIC_VARIANTS, this holds the relationship that the
customer should select from- Author:
- Nathan Moore (nathandmoore)
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAttribute(String name, Object value) Takes in any additional attributes passed in the request not matching any defined properties.protected booleanbooleanReturn any additional attributes passed in the request not matching any defined properties.Map holding any additional attributes passed in the request not matching any defined properties.javax.money.MonetaryAmountThe specific price set for this choice that overrides the price of underlyingproductorvariant.com.broadleafcommerce.pricing.client.domain.PriceInfoSummary of thepricing informationrelated to the choice.System-wide unique identifier to configure specific pricing for the choice.If thetypeisDefaultSpecificItemChoiceType.PRODUCTthis holds the product for this choicegetType()Whether or not this item holds a product or a variant that the customer can select fromIf thetypeisDefaultSpecificItemChoiceType.VARIANTthis holds the variant for this choicePricing overrides if specific variants of the main product this item belongs to are added to the cart.inthashCode()booleanWhether 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) The specific price set for this choice that overrides the price of underlyingproductorvariant.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 choicevoidWhether 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.toString()
-
Constructor Details
-
SpecificItemChoice
public SpecificItemChoice()
-
-
Method Details
-
getVendorRef
-
addAttribute
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
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
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
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:
-
getProduct
If thetypeisDefaultSpecificItemChoiceType.PRODUCTthis holds the product for this choice- Returns:
- the product representing this choice, or null if
typeis notDefaultSpecificItemChoiceType.PRODUCT
-
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
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
Map holding any additional attributes passed in the request not matching any defined properties. -
setPricingKey
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
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:
-
setProduct
If thetypeisDefaultSpecificItemChoiceType.PRODUCTthis holds the product for this choice- Parameters:
product- the product representing this choice
-
setVariant
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
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
Map holding any additional attributes passed in the request not matching any defined properties. -
equals
-
canEqual
-
hashCode
public int hashCode() -
toString
-