Class ItemChoice
- All Implemented Interfaces:
Serializable
DefaultProductOptionType.ITEM_CHOICE.- Author:
- Phillip Verheyden (phillipuniverse)
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanboolean<T> TgetAttribute(String name) Miscellaneous attributes for this tag.TheCategorywhich the choice will be chosen from by the customer if thetargetTypeisDefaultItemChoiceTargetType.CATEGORY.The key used during the validation of cart item's configuration to relate thisItemChoiceto one of the cart item's dependent items.javax.money.MonetaryAmountGets the explicit override price of the defaultSpecificItemChoiceor null if none.javax.money.MonetaryAmountGets the pricing key of the defaultSpecificItemChoiceif applicable for thetargetType.Gets the underlying defaultProductTermof the defaultSpecificItemChoiceorProductas appropriate for thetargetType.Gets the underlying pricing key of the defaultSpecificItemChoiceorProductas appropriate for thetargetType.Gets the underlying SKU of the defaultSpecificItemChoiceorProductas appropriate for thetargetType.javax.money.MonetaryAmountGets the default price as appropriate for thetargetType.The default product that can be used when driving customer selections if thetargetTypeisDefaultItemChoiceTargetType.SPECIFIC_PRODUCTS.The default product that can be used when driving customer selections if thetargetTypeisDefaultItemChoiceTargetType.CATEGORY.The default variant that can be used when driving customer selections if thetargetTypeisDefaultItemChoiceTargetType.SPECIFIC_VARIANTS.protected javax.money.MonetaryAmountprotected javax.money.MonetaryAmountprotected Stringprotected ProductTermprotected Stringprotected StringThe maximum amount of this item that a customer can purchase at a time.The minimum amount of the item that a customer must purchase.javax.money.MonetaryAmountThe price of this choice.System-wide unique identifier to configure specific pricing for the choice.The number of days after which a quantity decrease is not allowed until the window re-opens at the next billing cycle.The number of days after which an item can't be removed from the subscription, until the window re-opens at the next billing cycle.Describes restrictions placed on the customer's ability to select items from the targeted set.If thetargetTypeisDefaultItemChoiceTargetType.SPECIFIC_PRODUCTSorDefaultItemChoiceTargetType.SPECIFIC_VARIANTSthis holds the manually-curated options that the customer can choose from.If thetargetTypeisDefaultItemChoiceTargetType.SPECIFIC_PRODUCTorDefaultItemChoiceTargetType.SPECIFIC_VARIANTthis holds the manually selected option that the customer can choose to add on.Identifies the type of items that a customer can choose from, whether specific products, specific variants, or products from a specific category.inthashCode()booleanWhether the customer is allowed to add an optional item after initial purchase.booleanWhether edit is allowed after initial purchase.booleanWhether quantity can be edited after initial purchase.booleanWhether the customer is allowed to remove an optional item after initial purchase.booleanbooleanWhether this has post purchase edit rules.booleanWhether this item choice's price is overridden, via the directoverridePriceor a price data targeting itspricingKey.booleanWhether this is a sub-item on the main subscription or a separate item.booleanWhether this addon is a subscription addon.protected booleanmatchesDefaultVariantOrProduct(@NonNull SpecificItemChoice choice) Whether the underlyingVariantorProductof theSpecificItemChoicematches the default of theItemChoice.voidsetAllowAddAfterInitialPurchase(boolean allowAddAfterInitialPurchase) Whether the customer is allowed to add an optional item after initial purchase.voidsetAllowEditAfterInitialPurchase(boolean allowEditAfterInitialPurchase) Whether edit is allowed after initial purchase.voidsetAllowQtyEditAfterInitialPurchase(boolean allowQtyEditAfterInitialPurchase) Whether quantity can be edited after initial purchase.voidsetAllowRemoveAfterInitialPurchase(boolean allowRemoveAfterInitialPurchase) Whether the customer is allowed to remove an optional item after initial purchase.voidsetAttributes(Map<String, Object> attributes) Miscellaneous attributes for this tag.voidsetCategory(Category category) TheCategorywhich the choice will be chosen from by the customer if thetargetTypeisDefaultItemChoiceTargetType.CATEGORY.voidsetChoiceKey(String choiceKey) The key used during the validation of cart item's configuration to relate thisItemChoiceto one of the cart item's dependent items.voidsetDefaultProduct(Product defaultProduct) The default product that can be used when driving customer selections if thetargetTypeisDefaultItemChoiceTargetType.SPECIFIC_PRODUCTS.voidsetDefaultProductInCategory(Product defaultProductInCategory) The default product that can be used when driving customer selections if thetargetTypeisDefaultItemChoiceTargetType.CATEGORY.voidsetDefaultVariant(Variant defaultVariant) The default variant that can be used when driving customer selections if thetargetTypeisDefaultItemChoiceTargetType.SPECIFIC_VARIANTS.voidsetDiscountAllowed(boolean discountAllowed) Dictates whether or not discounts are allowed to be applied to this choice.voidsetHasPostPurchaseEditRules(boolean hasPostPurchaseEditRules) Whether this has post purchase edit rules.voidsetMaximumQuantity(Integer maximumQuantity) The maximum amount of this item that a customer can purchase at a time.voidsetMinimumQuantity(Integer minimumQuantity) The minimum amount of the item that a customer must purchase.voidsetOverridePrice(javax.money.MonetaryAmount overridePrice) The price of this choice.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.voidsetRestrictQtyDecreaseAfterDays(Integer restrictQtyDecreaseAfterDays) The number of days after which a quantity decrease is not allowed until the window re-opens at the next billing cycle.voidsetRestrictRemovalAfterDays(Integer restrictRemovalAfterDays) The number of days after which an item can't be removed from the subscription, until the window re-opens at the next billing cycle.voidsetSelectionType(String selectionType) Describes restrictions placed on the customer's ability to select items from the targeted set.voidsetSeparateFromPrimaryItem(boolean isSeparateFromPrimaryItem) Whether this is a sub-item on the main subscription or a separate item.voidsetSpecificChoices(List<SpecificItemChoice> specificChoices) If thetargetTypeisDefaultItemChoiceTargetType.SPECIFIC_PRODUCTSorDefaultItemChoiceTargetType.SPECIFIC_VARIANTSthis holds the manually-curated options that the customer can choose from.voidsetSpecificItemChoice(SpecificItemChoice specificItemChoice) If thetargetTypeisDefaultItemChoiceTargetType.SPECIFIC_PRODUCTorDefaultItemChoiceTargetType.SPECIFIC_VARIANTthis holds the manually selected option that the customer can choose to add on.voidsetSubscription(boolean isSubscription) Whether this addon is a subscription addon.voidsetTargetType(String targetType) Identifies the type of items that a customer can choose from, whether specific products, specific variants, or products from a specific category.toString()
-
Constructor Details
-
ItemChoice
public ItemChoice()
-
-
Method Details
-
getAttribute
-
getDefaultPrice
public javax.money.MonetaryAmount getDefaultPrice()Gets the default price as appropriate for thetargetType.- Returns:
- The default price as appropriate for the
targetType.
-
getDefaultChoicePrice
public javax.money.MonetaryAmount getDefaultChoicePrice()- Returns:
- The price of the default
SpecificItemChoiceorProductas appropriate for thetargetType. - Since:
- Catalog Service 2.1.5, Release Train 2.1.5
-
getDefaultChoiceOverridePrice
@Nullable public javax.money.MonetaryAmount getDefaultChoiceOverridePrice()Gets the explicit override price of the defaultSpecificItemChoiceor null if none.- Returns:
- The explicit override price of the default
SpecificItemChoiceor null if none. - Since:
- Catalog Service 2.1.5, Release Train 2.1.5
-
getDefaultChoiceUnderlyingSku
Gets the underlying SKU of the defaultSpecificItemChoiceorProductas appropriate for thetargetType.- Returns:
- The underlying SKU of the default
SpecificItemChoiceorProductas appropriate for thetargetType. - Since:
- Catalog Service 2.1.5, Release Train 2.1.5
-
getDefaultChoiceUnderlyingPricingKey
Gets the underlying pricing key of the defaultSpecificItemChoiceorProductas appropriate for thetargetType.- Returns:
- The underlying pricing key of the default
SpecificItemChoiceorProductas appropriate for thetargetType. - Since:
- Catalog Service 2.1.5, Release Train 2.1.5
-
getDefaultChoiceUnderlyingDefaultTerm
Gets the underlying defaultProductTermof the defaultSpecificItemChoiceorProductas appropriate for thetargetType.- Returns:
- The underlying default
ProductTermof the defaultSpecificItemChoiceorProductas appropriate for thetargetType. - Since:
- Catalog Service 2.1.5, Release Train 2.1.5
-
getDefaultChoicePricingKey
Gets the pricing key of the defaultSpecificItemChoiceif applicable for thetargetType.- Returns:
- The pricing key of the default
SpecificItemChoiceif applicable for thetargetType. - Since:
- Catalog Service 2.1.5, Release Train 2.1.5
-
isDiscountAllowed
public boolean isDiscountAllowed() -
getFirstChoicesDefaultPrice
protected javax.money.MonetaryAmount getFirstChoicesDefaultPrice() -
getFirstChoicesDefaultOverridePrice
@Nullable protected javax.money.MonetaryAmount getFirstChoicesDefaultOverridePrice() -
getFirstChoicesUnderlyingSku
- Since:
- Catalog Service 2.1.5, Release Train 2.1.5
-
getFirstChoicesUnderlyingPricingKey
- Since:
- Catalog Service 2.1.5, Release Train 2.1.5
-
getFirstChoicesUnderlyingDefaultTerm
- Since:
- Catalog Service 2.1.5, Release Train 2.1.5
-
getFirstChoicesPricingKey
- Since:
- Catalog Service 2.1.5, Release Train 2.1.5
-
matchesDefaultVariantOrProduct
Whether the underlyingVariantorProductof theSpecificItemChoicematches the default of theItemChoice.- Parameters:
choice- TheSpecificItemChoiceto check- Returns:
- True if the
SpecificItemChoicematches the default of theItemChoice, - Since:
- Catalog Service 2.1.5, Release Train 2.1.5
-
getTargetType
Identifies the type of items that a customer can choose from, whether specific products, specific variants, or products from a specific category.- Returns:
- the
DefaultItemChoiceTargetTypeof this item choice - See Also:
-
getSelectionType
Describes restrictions placed on the customer's ability to select items from the targeted set. Generally, this is a restriction on how many choices can be selected for a single add-to-cart request and, potentially, how quantity is distributed among multiple selected choices.- Returns:
- the
DefaultItemChoiceSelectionTypeof this item choice - See Also:
-
getChoiceKey
The key used during the validation of cart item's configuration to relate thisItemChoiceto one of the cart item's dependent items.- Returns:
- The key used during the validation of cart item's configuration to relate this
ItemChoiceto one of the cart item's dependent items.
-
getMaximumQuantity
The maximum amount of this item that a customer can purchase at a time. If null, this would allow a customer to specify their own quantity for how many of these items they can add to the cart.- Returns:
- the maximum quantity of the choice's target product(s) that can be added
-
getMinimumQuantity
The minimum amount of the item that a customer must purchase.- Returns:
- the minimum quantity of the choice's target product(s)
-
getOverridePrice
public javax.money.MonetaryAmount getOverridePrice()The price of this choice. If no pricing is specified here, the price of the target
product,getDefaultVariant()() variant}, or selected product from thecategorywill be used.If this is a
DefaultItemChoiceTargetType.SPECIFIC_PRODUCTSorDefaultItemChoiceTargetType.SPECIFIC_VARIANTSthen any price set here will be overridden by the item pricing set on any of thespecificChoicesfor that choice.- Returns:
- the price of this choice
-
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
-
getCategory
TheCategorywhich the choice will be chosen from by the customer if thetargetTypeisDefaultItemChoiceTargetType.CATEGORY.- Returns:
- the category from which the choice will be chosen from or {@link null} if
targetTypeis notDefaultItemChoiceTargetType.CATEGORY
-
getDefaultProductInCategory
The default product that can be used when driving customer selections if thetargetTypeisDefaultItemChoiceTargetType.CATEGORY.- Returns:
- the defaulted selection for this choice if the
targetTypeisDefaultItemChoiceTargetType.CATEGORY, null otherwise or if there is no default selection
-
getDefaultProduct
The default product that can be used when driving customer selections if thetargetTypeisDefaultItemChoiceTargetType.SPECIFIC_PRODUCTS. Can be null.- Returns:
- the defaulted selection for this choice if the
targetTypeisDefaultItemChoiceTargetType.SPECIFIC_PRODUCTS, null otherwise or if there is no default selection
-
getDefaultVariant
The default variant that can be used when driving customer selections if thetargetTypeisDefaultItemChoiceTargetType.SPECIFIC_VARIANTS. Can be null.- Returns:
- the defaulted selection for this choice if the
targetTypeisDefaultItemChoiceTargetType.SPECIFIC_VARIANTS, null otherwise or if there is no default selection
-
getSpecificChoices
If thetargetTypeisDefaultItemChoiceTargetType.SPECIFIC_PRODUCTSorDefaultItemChoiceTargetType.SPECIFIC_VARIANTSthis holds the manually-curated options that the customer can choose from. This also allows for specific override pricing on an item-by-item basis- Returns:
- the explicit choices for
DefaultItemChoiceTargetType.SPECIFIC_PRODUCTSorDefaultItemChoiceTargetType.SPECIFIC_VARIANTSvalue of thetargetType
-
getSpecificItemChoice
If thetargetTypeisDefaultItemChoiceTargetType.SPECIFIC_PRODUCTorDefaultItemChoiceTargetType.SPECIFIC_VARIANTthis holds the manually selected option that the customer can choose to add on. This also allows for specific override pricing.- Returns:
- the explicit choice for
DefaultItemChoiceTargetType.SPECIFIC_PRODUCTorDefaultItemChoiceTargetType.SPECIFIC_VARIANTvalue of thetargetType
-
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
-
getAttributes
Miscellaneous attributes for this tag.- Returns:
- Miscellaneous attributes for this tag.
-
isSubscription
public boolean isSubscription()Whether this addon is a subscription addon.- Since:
- Catalog Services 2.3.0, Release Train 2.3.0
-
isHasPostPurchaseEditRules
public boolean isHasPostPurchaseEditRules()Whether this has post purchase edit rules.- Since:
- Catalog Services 2.3.0, Release Train 2.3.0
-
isAllowEditAfterInitialPurchase
public boolean isAllowEditAfterInitialPurchase()Whether edit is allowed after initial purchase.- Since:
- Catalog Services 2.3.0, Release Train 2.3.0
-
isAllowQtyEditAfterInitialPurchase
public boolean isAllowQtyEditAfterInitialPurchase()Whether quantity can be edited after initial purchase.- Since:
- Catalog Services 2.3.0, Release Train 2.3.0
-
isAllowAddAfterInitialPurchase
public boolean isAllowAddAfterInitialPurchase()Whether the customer is allowed to add an optional item after initial purchase.- Since:
- Catalog Services 2.3.0, Release Train 2.3.0
-
isAllowRemoveAfterInitialPurchase
public boolean isAllowRemoveAfterInitialPurchase()Whether the customer is allowed to remove an optional item after initial purchase.- Since:
- Catalog Services 2.3.0, Release Train 2.3.0
-
getRestrictQtyDecreaseAfterDays
The number of days after which a quantity decrease is not allowed until the window re-opens at the next billing cycle.nullmeans no restriction.- Since:
- Catalog Services 2.3.0, Release Train 2.3.0
-
getRestrictRemovalAfterDays
The number of days after which an item can't be removed from the subscription, until the window re-opens at the next billing cycle.nullmeans no restriction.- Since:
- Catalog Services 2.3.0, Release Train 2.3.0
-
isSeparateFromPrimaryItem
public boolean isSeparateFromPrimaryItem()Whether this is a sub-item on the main subscription or a separate item.- Since:
- Catalog Services 2.3.0, Release Train 2.3.0
-
setTargetType
Identifies the type of items that a customer can choose from, whether specific products, specific variants, or products from a specific category.- Parameters:
targetType- theDefaultItemChoiceTargetTypeof this item choice- See Also:
-
setSelectionType
Describes restrictions placed on the customer's ability to select items from the targeted set. Generally, this is a restriction on how many choices can be selected for a single add-to-cart request and, potentially, how quantity is distributed among multiple selected choices.- Parameters:
selectionType- theDefaultItemChoiceSelectionTypeof this item choice- See Also:
-
setChoiceKey
The key used during the validation of cart item's configuration to relate thisItemChoiceto one of the cart item's dependent items.- Parameters:
choiceKey- The key used during the validation of cart item's configuration to relate thisItemChoiceto one of the cart item's dependent items.
-
setMaximumQuantity
The maximum amount of this item that a customer can purchase at a time. If null, this would allow a customer to specify their own quantity for how many of these items they can add to the cart.- Parameters:
maximumQuantity- the maximum quantity of the choice's target product(s) that can be added
-
setMinimumQuantity
The minimum amount of the item that a customer must purchase.- Parameters:
minimumQuantity- the minimum quantity of the choice's target product(s)
-
setOverridePrice
public void setOverridePrice(javax.money.MonetaryAmount overridePrice) The price of this choice. If no pricing is specified here, the price of the target
product,getDefaultVariant()() variant}, or selected product from thecategorywill be used.If this is a
DefaultItemChoiceTargetType.SPECIFIC_PRODUCTSorDefaultItemChoiceTargetType.SPECIFIC_VARIANTSthen any price set here will be overridden by the item pricing set on any of thespecificChoicesfor that choice.- Parameters:
overridePrice- the price of this choice
-
setDiscountAllowed
public void setDiscountAllowed(boolean discountAllowed) Dictates whether or not discounts are allowed to be applied to this choice.- Parameters:
discountAllowed- true if discounts are allowed to be applied to this choice, false otherwise
-
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)
-
setCategory
TheCategorywhich the choice will be chosen from by the customer if thetargetTypeisDefaultItemChoiceTargetType.CATEGORY.- Parameters:
category- the category from which the choice will be chosen from
-
setDefaultProductInCategory
The default product that can be used when driving customer selections if thetargetTypeisDefaultItemChoiceTargetType.CATEGORY.- Parameters:
defaultProduct- the default product that is automatically selected when thetargetTypeisDefaultItemChoiceTargetType.CATEGORY. Should come from within thecategory
-
setDefaultProduct
The default product that can be used when driving customer selections if thetargetTypeisDefaultItemChoiceTargetType.SPECIFIC_PRODUCTS. Can be null.- Parameters:
defaultProduct- the default product that is automatically selected when thetargetTypeis {DefaultItemChoiceTargetType.SPECIFIC_PRODUCTS. Should come from the specific set of products inspecificChoices
-
setDefaultVariant
The default variant that can be used when driving customer selections if thetargetTypeisDefaultItemChoiceTargetType.SPECIFIC_VARIANTS. Can be null.- Parameters:
defaultVariant- the default variant that is automatically selected when thetargetTypeisDefaultItemChoiceTargetType.SPECIFIC_VARIANTS. Should come from the explicit set of variants inspecificChoices
-
setSpecificChoices
If thetargetTypeisDefaultItemChoiceTargetType.SPECIFIC_PRODUCTSorDefaultItemChoiceTargetType.SPECIFIC_VARIANTSthis holds the manually-curated options that the customer can choose from. This also allows for specific override pricing on an item-by-item basis- Parameters:
specificChoices- manually-curated options for the user to choose from for this choice
-
setSpecificItemChoice
If thetargetTypeisDefaultItemChoiceTargetType.SPECIFIC_PRODUCTorDefaultItemChoiceTargetType.SPECIFIC_VARIANTthis holds the manually selected option that the customer can choose to add on. This also allows for specific override pricing.- Parameters:
specificChoice- manually selected option for the user to choose to add on
-
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
-
setAttributes
Miscellaneous attributes for this tag.- Parameters:
attributes- Miscellaneous attributes for this tag.
-
setSubscription
public void setSubscription(boolean isSubscription) Whether this addon is a subscription addon.- Since:
- Catalog Services 2.3.0, Release Train 2.3.0
-
setHasPostPurchaseEditRules
public void setHasPostPurchaseEditRules(boolean hasPostPurchaseEditRules) Whether this has post purchase edit rules.- Since:
- Catalog Services 2.3.0, Release Train 2.3.0
-
setAllowEditAfterInitialPurchase
public void setAllowEditAfterInitialPurchase(boolean allowEditAfterInitialPurchase) Whether edit is allowed after initial purchase.- Since:
- Catalog Services 2.3.0, Release Train 2.3.0
-
setAllowQtyEditAfterInitialPurchase
public void setAllowQtyEditAfterInitialPurchase(boolean allowQtyEditAfterInitialPurchase) Whether quantity can be edited after initial purchase.- Since:
- Catalog Services 2.3.0, Release Train 2.3.0
-
setAllowAddAfterInitialPurchase
public void setAllowAddAfterInitialPurchase(boolean allowAddAfterInitialPurchase) Whether the customer is allowed to add an optional item after initial purchase.- Since:
- Catalog Services 2.3.0, Release Train 2.3.0
-
setAllowRemoveAfterInitialPurchase
public void setAllowRemoveAfterInitialPurchase(boolean allowRemoveAfterInitialPurchase) Whether the customer is allowed to remove an optional item after initial purchase.- Since:
- Catalog Services 2.3.0, Release Train 2.3.0
-
setRestrictQtyDecreaseAfterDays
The number of days after which a quantity decrease is not allowed until the window re-opens at the next billing cycle.nullmeans no restriction.- Since:
- Catalog Services 2.3.0, Release Train 2.3.0
-
setRestrictRemovalAfterDays
The number of days after which an item can't be removed from the subscription, until the window re-opens at the next billing cycle.nullmeans no restriction.- Since:
- Catalog Services 2.3.0, Release Train 2.3.0
-
setSeparateFromPrimaryItem
public void setSeparateFromPrimaryItem(boolean isSeparateFromPrimaryItem) Whether this is a sub-item on the main subscription or a separate item.- Since:
- Catalog Services 2.3.0, Release Train 2.3.0
-
equals
-
canEqual
-
hashCode
public int hashCode() -
toString
-