Class SpecificItemChoice
- All Implemented Interfaces:
Serializable
ItemChoice is determined to be a
DefaultItemChoiceTargetType.SPECIFIC_PRODUCTS or
DefaultItemChoiceTargetType.SPECIFIC_VARIANTS, this holds the relationship that the
customer should select from- Author:
- Phillip Verheyden (phillipuniverse)
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanbooleangetAsset()The asset for this selection.javax.money.MonetaryAmountjavax.money.MonetaryAmountReturns the default price for the underlying item of this choice.When displaying this choice to a customer, an optional override for the display the customer should see.javax.money.MonetaryAmountThe price of this explicit selection.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 fromReturns the defaultProductTermfor the underlying item of this choice.Returns the pricing key for underlying product of this choice if applicable.Returns the SKU for the underlying item of this choice.If thetypeisDefaultSpecificItemChoiceType.VARIANTthis holds the variant for this choiceThis field contains the id of the parent product of the specifiedvariantif thetypeisDefaultSpecificItemChoiceType.VARIANT.Pricing overrides if specific variants of the main product this item belongs to are added to the cart.inthashCode()booleanDictates whether or not discounts are allowed to be applied to this add-on.booleanWhether this item choice's price is overridden, via the directoverridePriceor a price data targeting itspricingKey.voidsetAsset(SpecificItemChoiceAsset asset) The asset for this selection.voidsetDiscountAllowed(boolean discountAllowed) Dictates whether or not discounts are allowed to be applied to this add-on.voidsetNameOverride(String nameOverride) When displaying this choice to a customer, an optional override for the display the customer should see.voidsetOverridePrice(javax.money.MonetaryAmount overridePrice) The price of this explicit selection.voidsetPriceOverridden(boolean priceOverridden) Whether this item choice's price is overridden, via the directoverridePriceor a price data targeting itspricingKey.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 fromvoidsetVariant(Variant variant) If thetypeisDefaultSpecificItemChoiceType.VARIANTthis holds the variant for this choicevoidsetVariantParentProductId(String variantParentProductId) This field contains the id of the parent product of the specifiedvariantif thetypeisDefaultSpecificItemChoiceType.VARIANT.voidsetVariantPricingOverrides(List<SpecificItemVariantPricing> variantPricingOverrides) 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
-
getUnderlyingSku
Returns the SKU for the underlying item of this choice. If thetypeisDefaultSpecificItemChoiceType.PRODUCTthis will be theProduct.getSku()of theproduct. If thetypeisDefaultSpecificItemChoiceType.VARIANTthis will be theVariant.getSku()of thevariant.- Returns:
- The SKU for the underlying item of this choice
- Since:
- Catalog Service 2.1.5, Release Train 2.1.5
-
getUnderlyingPricingKey
Returns the pricing key for underlying product of this choice if applicable. If thetypeisDefaultSpecificItemChoiceType.PRODUCTthis will be theProduct.getPricingKey()of theproduct. Otherwise, it is null.- Returns:
- The pricing key for underlying product of this choice if applicable
- Since:
- Catalog Service 2.1.5, Release Train 2.1.5
-
getUnderlyingDefaultTerm
Returns the defaultProductTermfor the underlying item of this choice. If thetypeisDefaultSpecificItemChoiceType.PRODUCTthis will be theProduct.getDefaultTerm()of theproduct. If thetypeisDefaultSpecificItemChoiceType.VARIANTthis will be theVariant.getDefaultTerm()of thevariant.- Returns:
- The default
ProductTermfor the underlying item of this choice - Since:
- Catalog Service 2.1.5, Release Train 2.1.5
-
getDefaultPrice
public javax.money.MonetaryAmount getDefaultPrice() -
getDefaultUnderlyingPrice
public javax.money.MonetaryAmount getDefaultUnderlyingPrice()Returns the default price for the underlying item of this choice.- Returns:
- The default price for the underlying item of this choice
- Since:
- Catalog Service 2.1.5, Release Train 2.1.5
-
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 - See Also:
-
variantParentProductId
-
getVariantParentProductId
This field contains the id of the parent product of the specifiedvariantif thetypeisDefaultSpecificItemChoiceType.VARIANT.This field is necessary because variants are a sub-resource of product and thus API callers cannot fetch them purely by variant id alone.
- Returns:
- the id of the parent product of the
variant - See Also:
-
variant
-
getNameOverride
When displaying this choice to a customer, an optional override for the display the customer should see. If {@link null}, the product or variant name is used for display- Returns:
- the override of the display of the name to the customer. If null, the variant or product name should be used
-
isDiscountAllowed
public boolean isDiscountAllowed()Dictates whether or not discounts are allowed to be applied to this add-on.- Returns:
- true if discounts are allowed to be applied to this add-on, false otherwise
-
isPriceOverridden
public boolean isPriceOverridden()Whether this item choice's price is overridden, via the directoverridePriceor a price data targeting itspricingKey. This serves validation and metadata purposes.- Since:
- Catalog Services 2.3.0, ReleaseTrain 2.3.0
-
getOverridePrice
public javax.money.MonetaryAmount getOverridePrice()The price of this explicit selection. If no pricing is specified here, the price of the target
product,variantwill be used.If the
ItemChoice.getOverridePrice()is set, that will override any price set here and this price should be ignored- Returns:
- the explicit price of this choice or null if the product/variant price should be
used, or if the override price exists on the
ItemChoice
-
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. Only relevant whenItemChoice.getOverridePrice()is null.- Returns:
- a unique key to identify this choice, null if there is no external system this should be linked to for pricing data
-
getAsset
The asset for this selection. Intended to override the asset normally shown for theproductorvariantspecifically in the context of this relationship.- Returns:
- asset information for this explicit selection
- See Also:
-
getVariantPricingOverrides
Pricing overrides if specific variants of the main product this item belongs to are added to the cart.- Returns:
- Pricing overrides if specific variants of the main product are added to the cart.
-
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- See Also:
-
variantParentProductId
-
setVariantParentProductId
This field contains the id of the parent product of the specifiedvariantif thetypeisDefaultSpecificItemChoiceType.VARIANT.This field is necessary because variants are a sub-resource of product and thus API callers cannot fetch them purely by variant id alone.
- Parameters:
variantParentProductId- the id of the parent product of thevariant- See Also:
-
variant
-
setNameOverride
When displaying this choice to a customer, an optional override for the display the customer should see. If {@link null}, the product or variant name is used for display- Parameters:
nameOverride- what the customer should see for this choice
-
setDiscountAllowed
public void setDiscountAllowed(boolean discountAllowed) Dictates whether or not discounts are allowed to be applied to this add-on.- Parameters:
discountAllowed- true if discounts are allowed to be applied to this add-on, false otherwise
-
setPriceOverridden
public void setPriceOverridden(boolean priceOverridden) Whether this item choice's price is overridden, via the directoverridePriceor a price data targeting itspricingKey. This serves validation and metadata purposes.- Since:
- Catalog Services 2.3.0, ReleaseTrain 2.3.0
-
setOverridePrice
public void setOverridePrice(javax.money.MonetaryAmount overridePrice) The price of this explicit selection. If no pricing is specified here, the price of the target
product,variantwill be used.If the
ItemChoice.getOverridePrice()is set, that will override any price set here and this price should be ignored- Parameters:
overridePrice- the price of this choice
-
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. Only relevant whenItemChoice.getOverridePrice()is null.- Parameters:
pricingKey- a unique key to identify this choice (usually a UUID)
-
setAsset
The asset for this selection. Intended to override the asset normally shown for theproductorvariantspecifically in the context of this relationship.- Parameters:
asset- asset information for this explicit selection- See Also:
-
setVariantPricingOverrides
Pricing overrides if specific variants of the main product this item belongs to are added to the cart.- Parameters:
variantPricingOverrides- Pricing overrides if specific variants of the main product are added to the cart.
-
equals
-
canEqual
-
hashCode
public int hashCode() -
toString
-