Class Product
- All Implemented Interfaces:
com.broadleafcommerce.data.tracking.core.ContextStateAware,com.broadleafcommerce.money.CurrencyConsumer,Serializable,javax.money.CurrencySupplier
- Author:
- Phillip Verheyden (phillipuniverse)
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionProduct()Product(String id, String name, String uri, String description, String sku, String upc, String externalId, javax.money.CurrencyUnit currency, String pricingKey, javax.money.MonetaryAmount msrp, javax.money.MonetaryAmount defaultPrice, javax.money.MonetaryAmount salePrice, javax.money.MonetaryAmount cost, String metaTitle, String metaDescription, String displayTemplate, boolean online, boolean discountable, Boolean autoRenewalEnabled, Boolean allowAutoRenewalModification, String inventoryType, String mergingType, boolean availableOnline, String inventoryCheckStrategy, String inventoryReservationStrategy, boolean eligibleForPickup, Map<String, FulfillmentFlatRate> fulfillmentFlatRates, Instant activeStartDate, Instant activeEndDate, Dimensions dimension, Weight weight, boolean searchable, boolean individuallySold, boolean merchandisingProduct, String productType, String businessType, List<String> keywords, List<Set<ProductOptionValueCombination>> variantsToGenerate, ProductRecurringFrequency defaultFrequency, List<ProductTerm> terms, String paymentStrategy, Map<String, Attribute> attributes, Map<String, ProductCharacteristic> characteristics, List<IncludedProduct> includedProducts, List<ProductOption> options, ReviewsSummary reviewsSummary, ProductAsset primaryAsset, Category primaryCategory, List<String> tags, DataDrivenEnum brand, DataDrivenEnum merchandisingType, DataDrivenEnum targetDemographic, com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState contextState, String taxCode, Integer minimumThreshold, Integer maximumThreshold, Variant defaultVariant, boolean hasVariants, boolean isSubscription, boolean allowQtyEditAfterInitialPurchase, boolean allowChangingBillingFrequency, List<String> upgradeProductIds, List<String> downgradeProductIds, Integer restrictDowngradeAfterDays, Integer maxNumberOfActiveSubscriptions, DataDrivenEnum fulfillmentWorkflow, String cancellationPolicyRef, String pricingCategory, String variantPricingStrategy, Boolean characteristicsOverriddenHint) -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanbooleanEnd when this product is not longer active.Start of when this product should be active.For subscription products only, this flag indicates whether this product's subscription's auto-renewability can be modified after declaration on the subscription.<T> TgetAttribute(String name) Dynamic attributes that are a part of the product.For subscription products only, this flag indicates whether this product's subscription would be auto-renewed.getBrand()If thebusinessTypeisnull, then this will return theproductType.A reference (typically the Id) of the CancellationPolicy for this product that governs how this product's subscription would be cancelled.Fields and associated Characteristics that define a specific product.This field is not honored in API requests or persisted in the system.com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextStateA subset ofTrackinginformation to expose the context state for this object.javax.money.MonetaryAmountgetCost()Can be used in display or as a part of more complex pricing algorithms.javax.money.CurrencyUnitCurrency for all of the prices on this productSimilar todefault term, the default frequency is used for the initial display price for the product.javax.money.MonetaryAmountThe default price that should be used if there is not asalePriceset.Returns the defaultProductTermfor this product if it exists.When the `productType` is `VARIANT_BASED` this represents the default.Description of the product that can include HTML in implementations where a WYSIWYG editor manages this field.Defines the display template.The list of product ids describing the products that can be downgraded to.This is an arbitrary ID, typically assigned by or used by 1st or 3rd party systems that are not Broadleaf.A map of flat rates for fulfilling (e.g., shipping) this product for a particular fulfillment option type (e.g., standard shipping).The fulfillment workflow that this product will go through after checkout.getId()Additional products that are always included with the product, no matter what.Describes when the product's inventory should be checked for availability.Describes when the product's inventory should be reserved.Describes the product's type of fulfillment - ie is it a physical or virtual item?Generally additional search terms that should be used when customers search for this product.The maximum count of this product that must be added in a cart.The max number of active subscriptions that can be created for this product.Determines how this Product should merge with other similar items when it gets added to a cart.Used for SEO data in<meta description="">in a product detail page.Used for SEO data in<title>tag in a product detail page.The minimum count of this product that must be added in a cart.javax.money.MonetaryAmountgetMsrp()Suggested retail price for the product.getName()Customer-facing name of this product.Drives additional information that the customer should enter when purchasing this product.Specifies a payment strategy to use for this product.javax.money.MonetaryAmountCalculates the total with theincludedProductsandDefaultProductOptionType.ITEM_CHOICEtypeoptionsthat haveItemChoice.getMinimumQuantity()greater than 0.Optional.System-wide unique identifier to configure specific pricing for the product.TheProductAssetassociated with this product marked asProductAsset.isPrimary().TheCategoryassociated with this product where theCategoryProductrelationship is marked asCategoryProduct.isPrimary().Defines the type of the product.The number of days after which a downgrade is not allowed, until the window re-opens at the next billing cycle.Thesummary of reviewsfor this product.javax.money.MonetaryAmountIndicates that this product is on sale.getSku()This uniquely identifies this product in the catalog when it is sold and is used for other contexts like inventory and pricing.getTags()A list of simple labels used to categorize the productThe tax code for this product.getTerms()The list ofProductTermsthat are associated with this product.getUpc()Universal product code that identifies this product.The list of product ids describing the products that can be upgraded to.getUri()SEO-friendly URI to identify this product.The pricing strategy for this product's variants, only relevant forDefaultProductType.VARIANT_BASEDproducts.The list ofProductOptionValueCombinationsthat should be generated as part of the product creation flow.inthashCode()booleanisActive()Inactive products are by default NOT searchable, NOT browseable, and NOT purchaseable.booleanWhether the billing frequency can be changed after initial purchase.booleanWhether quantity can be edited after initial purchase.booleanWhether or not this product is available online - ie inventory is available somewhere to fulfill this product.booleanWhether or not this product be applied to any offers or promotions.booleanWhether or not this Product can be picked up at a store rather than just be shippedbooleanConvenience flag indicating to the caller if variants were found for this product.booleanIf this product or any of its variants can be sold individually in the store, or if they must be apart of another product as an add-on.booleanDeprecated.booleanisOnline()Whether or not this product should be visible at all in the store.booleanisOnSale()An item is on sale if bothgetDefaultPrice()andgetSalePrice()are both set andgetSalePrice()is less than thedefaultPricebooleanWhether or not this product shows up in search.booleanWhether this product is a subscription.voidsetActiveEndDate(Instant activeEndDate) End when this product is not longer active.voidsetActiveStartDate(Instant activeStartDate) Start of when this product should be active.voidsetAllowAutoRenewalModification(Boolean allowAutoRenewalModification) For subscription products only, this flag indicates whether this product's subscription's auto-renewability can be modified after declaration on the subscription.voidsetAllowChangingBillingFrequency(boolean allowChangingBillingFrequency) Whether the billing frequency can be changed after initial purchase.voidsetAllowQtyEditAfterInitialPurchase(boolean allowQtyEditAfterInitialPurchase) Whether quantity can be edited after initial purchase.voidsetAttributes(Map<String, Attribute> attributes) Dynamic attributes that are a part of the product.voidsetAutoRenewalEnabled(Boolean autoRenewalEnabled) For subscription products only, this flag indicates whether this product's subscription would be auto-renewed.voidsetAvailableOnline(boolean availableOnline) Whether or not this product is available online - ie inventory is available somewhere to fulfill this product.voidsetBrand(DataDrivenEnum brand) voidsetBusinessType(String businessType) Defines the type of the product for business purposes.voidsetCancellationPolicyRef(String cancellationPolicyRef) A reference (typically the Id) of the CancellationPolicy for this product that governs how this product's subscription would be cancelled.voidsetCharacteristics(Map<String, ProductCharacteristic> characteristics) Fields and associated Characteristics that define a specific product.voidsetCharacteristicsFromList(List<ProductCharacteristic> characteristics) voidsetCharacteristicsOverriddenHint(Boolean characteristicsOverriddenHint) This field is not honored in API requests or persisted in the system.voidsetContextState(com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState contextState) A subset ofTrackinginformation to expose the context state for this object.voidsetCost(javax.money.MonetaryAmount cost) Can be used in display or as a part of more complex pricing algorithms.voidsetCurrency(javax.money.CurrencyUnit currency) Currency for all of the prices on this productvoidsetDefaultFrequency(ProductRecurringFrequency defaultFrequency) Similar todefault term, the default frequency is used for the initial display price for the product.voidsetDefaultPrice(javax.money.MonetaryAmount defaultPrice) The default price that should be used if there is not asalePriceset.voidsetDefaultVariant(Variant defaultVariant) When the `productType` is `VARIANT_BASED` this represents the default.voidsetDescription(String description) Description of the product that can include HTML in implementations where a WYSIWYG editor manages this field.voidsetDimension(Dimensions dimension) voidsetDiscountable(boolean discountable) Whether or not this product be applied to any offers or promotions.voidsetDisplayTemplate(String displayTemplate) Defines the display template.voidsetDowngradeProductIds(List<String> downgradeProductIds) The list of product ids describing the products that can be downgraded to.voidsetEligibleForPickup(boolean eligibleForPickup) Whether or not this Product can be picked up at a store rather than just be shippedvoidsetExternalId(String externalId) This is an arbitrary ID, typically assigned by or used by 1st or 3rd party systems that are not Broadleaf.voidsetFulfillmentFlatRates(Map<String, FulfillmentFlatRate> fulfillmentFlatRates) A map of flat rates for fulfilling (e.g., shipping) this product for a particular fulfillment option type (e.g., standard shipping).voidsetFulfillmentWorkflow(DataDrivenEnum fulfillmentWorkflow) The fulfillment workflow that this product will go through after checkout.voidsetHasVariants(boolean hasVariants) Convenience flag indicating to the caller if variants were found for this product.voidvoidsetIncludedProducts(List<IncludedProduct> includedProducts) Additional products that are always included with the product, no matter what.voidsetIndividuallySold(boolean individuallySold) If this product or any of its variants can be sold individually in the store, or if they must be apart of another product as an add-on.voidsetInventoryCheckStrategy(String inventoryCheckStrategy) Describes when the product's inventory should be checked for availability.voidsetInventoryReservationStrategy(String inventoryReservationStrategy) Describes when the product's inventory should be reserved.voidsetInventoryType(String inventoryType) Describes the product's type of fulfillment - ie is it a physical or virtual item?voidsetKeywords(List<String> keywords) Generally additional search terms that should be used when customers search for this product.voidsetMaximumThreshold(Integer maximumThreshold) The maximum count of this product that must be added in a cart.voidsetMaxNumberOfActiveSubscriptions(Integer maxNumberOfActiveSubscriptions) The max number of active subscriptions that can be created for this product.voidsetMerchandisingProduct(boolean merchandisingProduct) Deprecated.please useproductTypeinstead.voidsetMerchandisingType(DataDrivenEnum merchandisingType) voidsetMergingType(String mergingType) Determines how this Product should merge with other similar items when it gets added to a cart.voidsetMetaDescription(String metaDescription) Used for SEO data in<meta description="">in a product detail page.voidsetMetaTitle(String metaTitle) Used for SEO data in<title>tag in a product detail page.voidsetMinimumThreshold(Integer minimumThreshold) The minimum count of this product that must be added in a cart.voidsetMsrp(javax.money.MonetaryAmount msrp) Suggested retail price for the product.voidCustomer-facing name of this product.voidsetOnline(boolean online) Whether or not this product should be visible at all in the store.voidsetOptions(List<ProductOption> options) Drives additional information that the customer should enter when purchasing this product.voidsetPaymentStrategy(String paymentStrategy) Specifies a payment strategy to use for this product.voidsetPricingCategory(String pricingCategory) Optional.voidsetPricingKey(String pricingKey) System-wide unique identifier to configure specific pricing for the product.voidsetPrimaryAsset(ProductAsset primaryAsset) TheProductAssetassociated with this product marked asProductAsset.isPrimary().voidsetPrimaryCategory(Category primaryCategory) TheCategoryassociated with this product where theCategoryProductrelationship is marked asCategoryProduct.isPrimary().voidsetProductType(String productType) Defines the type of the product.voidsetRestrictDowngradeAfterDays(Integer restrictDowngradeAfterDays) The number of days after which a downgrade is not allowed, until the window re-opens at the next billing cycle.voidsetReviewsSummary(ReviewsSummary reviewsSummary) Thesummary of reviewsfor this product.voidsetSalePrice(javax.money.MonetaryAmount salePrice) Indicates that this product is on sale.voidsetSearchable(boolean searchable) Whether or not this product shows up in search.voidThis uniquely identifies this product in the catalog when it is sold and is used for other contexts like inventory and pricing.voidsetSubscription(boolean isSubscription) Whether this product is a subscription.voidA list of simple labels used to categorize the productvoidsetTargetDemographic(DataDrivenEnum targetDemographic) voidsetTaxCode(String taxCode) The tax code for this product.voidsetTerms(List<ProductTerm> terms) The list ofProductTermsthat are associated with this product.voidUniversal product code that identifies this product.voidsetUpgradeProductIds(List<String> upgradeProductIds) The list of product ids describing the products that can be upgraded to.voidSEO-friendly URI to identify this product.voidsetVariantPricingStrategy(String variantPricingStrategy) The pricing strategy for this product's variants, only relevant forDefaultProductType.VARIANT_BASEDproducts.voidsetVariantsToGenerate(List<Set<ProductOptionValueCombination>> variantsToGenerate) The list ofProductOptionValueCombinationsthat should be generated as part of the product creation flow.voidtoString()
-
Constructor Details
-
Product
public Product() -
Product
public Product(String id, String name, String uri, String description, String sku, String upc, String externalId, javax.money.CurrencyUnit currency, String pricingKey, javax.money.MonetaryAmount msrp, javax.money.MonetaryAmount defaultPrice, javax.money.MonetaryAmount salePrice, javax.money.MonetaryAmount cost, String metaTitle, String metaDescription, String displayTemplate, boolean online, boolean discountable, Boolean autoRenewalEnabled, Boolean allowAutoRenewalModification, String inventoryType, String mergingType, boolean availableOnline, String inventoryCheckStrategy, String inventoryReservationStrategy, boolean eligibleForPickup, Map<String, FulfillmentFlatRate> fulfillmentFlatRates, Instant activeStartDate, Instant activeEndDate, Dimensions dimension, Weight weight, boolean searchable, boolean individuallySold, boolean merchandisingProduct, String productType, String businessType, List<String> keywords, List<Set<ProductOptionValueCombination>> variantsToGenerate, ProductRecurringFrequency defaultFrequency, List<ProductTerm> terms, String paymentStrategy, Map<String, Attribute> attributes, Map<String, ProductCharacteristic> characteristics, List<IncludedProduct> includedProducts, List<ProductOption> options, ReviewsSummary reviewsSummary, ProductAsset primaryAsset, @Nullable Category primaryCategory, List<String> tags, @Nullable DataDrivenEnum brand, @Nullable DataDrivenEnum merchandisingType, @Nullable DataDrivenEnum targetDemographic, com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState contextState, String taxCode, Integer minimumThreshold, Integer maximumThreshold, Variant defaultVariant, boolean hasVariants, boolean isSubscription, boolean allowQtyEditAfterInitialPurchase, boolean allowChangingBillingFrequency, List<String> upgradeProductIds, List<String> downgradeProductIds, Integer restrictDowngradeAfterDays, Integer maxNumberOfActiveSubscriptions, @Nullable DataDrivenEnum fulfillmentWorkflow, String cancellationPolicyRef, String pricingCategory, @Nullable String variantPricingStrategy, @Nullable Boolean characteristicsOverriddenHint)
-
-
Method Details
-
getAttribute
-
isActive
public boolean isActive()Inactive products are by default NOT searchable, NOT browseable, and NOT purchaseable.- Returns:
- the active state of this current product
- See Also:
-
isOnSale
public boolean isOnSale()An item is on sale if bothgetDefaultPrice()andgetSalePrice()are both set andgetSalePrice()is less than thedefaultPrice- Returns:
- whether or not the item is on sale
-
getBusinessType
If thebusinessTypeisnull, then this will return theproductType.- Returns:
- The
businessTypeunlessnull, then this will return theproductType.
-
setCharacteristicsFromList
-
getCharacteristicsValues
-
getPriceWithDependentItems
public javax.money.MonetaryAmount getPriceWithDependentItems()Calculates the total with theincludedProductsandDefaultProductOptionType.ITEM_CHOICEtypeoptionsthat haveItemChoice.getMinimumQuantity()greater than 0.- Returns:
- sum of IncludedProducts' and ItemChoices' prices.
-
getDefaultTerm
Returns the defaultProductTermfor this product if it exists.- Returns:
- the default
ProductTermfor this product if it exists - Since:
- Catalog Service 2.1.5, Release Train 2.1.5
-
getId
- Returns:
- the context ID of the product
-
getName
Customer-facing name of this product. This can also be overridden at theVariantlevel- Returns:
- the display name of this product
-
getUri
SEO-friendly URI to identify this product. This is usually generated with some URL-safe version of the main category name along with a url-friendly version ofname- Returns:
- the URI used to refer to this Product
-
getDescription
Description of the product that can include HTML in implementations where a WYSIWYG editor manages this field.- Returns:
- the description of this Product, can contain HTML
-
getSku
This uniquely identifies this product in the catalog when it is sold and is used for other contexts like inventory and pricing.- Returns:
- the Stock Keeping Unit identifier which means that this Product is sold in the store
-
getUpc
Universal product code that identifies this product. This is usually only relevant when this product is sold individually without any variants- Returns:
- the the Universal Product Code associated with this Product
-
getExternalId
This is an arbitrary ID, typically assigned by or used by 1st or 3rd party systems that are not Broadleaf.- Returns:
- an external ID
-
getCurrency
public javax.money.CurrencyUnit getCurrency()Currency for all of the prices on this product- Specified by:
getCurrencyin interfacejavax.money.CurrencySupplier- Returns:
- the currency to use for all of the prices on this product
-
getPricingKey
System-wide unique identifier to configure specific pricing for the product. 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 product
-
getMsrp
public javax.money.MonetaryAmount getMsrp()Suggested retail price for the product. This is generally only used for display and should not have any true pricing logic tied to it.- Returns:
- the suggested retail price
- See Also:
-
currency
-
getDefaultPrice
public javax.money.MonetaryAmount getDefaultPrice()The default price that should be used if there is not a
salePriceset. This price can also be used as the default price for all of the Variants as well.For more advance pricing calculations, consider hiding this field in the API and removing support for it in lieu of managing prices outside of this service.
Always included in the API even if set to null to indicate whether or not this was explicitly set
- Returns:
- the default price of the Product, non-null only in scenarios where this Product is
intended to be sold in the store. Set to
nullif managing prices at the Variant level
-
getSalePrice
public javax.money.MonetaryAmount getSalePrice()Indicates that this product is on sale. This should take priority over the default price if this salePrice is lower than the defaultPrice.- Returns:
- the sale price, indicating that the product is on sale
-
getCost
public javax.money.MonetaryAmount getCost()Can be used in display or as a part of more complex pricing algorithms.- Returns:
- the cost of this product
-
getMetaTitle
Used for SEO data in<title>tag in a product detail page. If this is unset, thenameshould be used.- Returns:
- the meta title used for SEO data in product details page title
-
getMetaDescription
Used for SEO data in<meta description="">in a product detail page. If this is unset, thedescriptionshould be used- Returns:
- the meta description used for SEO data in product details page description
-
getDisplayTemplate
Defines the display template. The display template can be used to help create a unique key that drives the presentation layer destination for this category. For example, if using Spring MVC with Thymeleaf, this could be a path to a Thymeleaf template. If using a frontend view technology like React, this could point to a specific React component.- Returns:
- the display template to use for this product
-
isOnline
public boolean isOnline()Whether or not this product should be visible at all in the store. A product that is offline is not searchable, visible, or purchasable. A product that is offline behaves as if it falls outside the active date range. It is not returned from storefront requests by default.
Defaults to
true- Returns:
- whether or not this product is visible in the store
-
isDiscountable
public boolean isDiscountable()Whether or not this product be applied to any offers or promotions.
Defaults to
true- Returns:
- whether or not this product can be applied to any offers or promotions
-
getAutoRenewalEnabled
For subscription products only, this flag indicates whether this product's subscription would be auto-renewed.- Since:
- Catalog Services 2.3.0, Release Train 2.3.0
-
getAllowAutoRenewalModification
For subscription products only, this flag indicates whether this product's subscription's auto-renewability can be modified after declaration on the subscription.- Since:
- Catalog Services 2.3.0, Release Train 2.3.0
-
getInventoryType
Describes the product's type of fulfillment - ie is it a physical or virtual item?Defaults to
InventoryType.PHYSICAL- Returns:
- the product's type of inventory
- See Also:
-
getMergingType
Determines how this Product should merge with other similar items when it gets added to a cart. This will override the global setting on item merging. Out of box supported values are those inDefaultMergingType.- Returns:
- the merging type to use for this Product
-
isAvailableOnline
public boolean isAvailableOnline()Whether or not this product is available online - ie inventory is available somewhere to fulfill this product.Defaults to
true- Returns:
- Whether or not this product is available online.
-
getInventoryCheckStrategy
Describes when the product's inventory should be checked for availability.- Returns:
- the product's inventory check strategy
- See Also:
-
getInventoryReservationStrategy
Describes when the product's inventory should be reserved.- Returns:
- the product's inventory reservation strategy
- See Also:
-
isEligibleForPickup
public boolean isEligibleForPickup()Whether or not this Product can be picked up at a store rather than just be shipped- Returns:
- if this Product can be picked up at a store
-
getFulfillmentFlatRates
A map of flat rates for fulfilling (e.g., shipping) this product for a particular fulfillment option type (e.g., standard shipping). Depending on if the option is configured to use flat rates, this flat rate will be used in calculating the cost of fulfilling this product.The key of the map is the type of the fulfillment option such as
FIXED_STANDARDorBANDED_PRICE_EXPRESS.- Returns:
- Map of Fulfillment option types to flat rates for this product.
- See Also:
-
getActiveStartDate
Start of when this product should be active.- Returns:
- the date when this product should start being active
-
getActiveEndDate
End when this product is not longer active. Unset indicates that it is always active.- Returns:
- the date when this product should no longer be active
- See Also:
-
getDimension
- Returns:
- the dimensions of this product
-
getWeight
- Returns:
- the weight of this product
-
isSearchable
public boolean isSearchable()Whether or not this product shows up in search. Usually this matches whether or not the product is
individuallySoldThis defaults to
true- Returns:
- whether or not this product shows up in search
-
isIndividuallySold
public boolean isIndividuallySold()If this product or any of its variants can be sold individually in the store, or if they must be apart of another product as an add-on. Usually if a product is not individually sold then it should also not show up in search.
This defaults to
true.- Returns:
- whether or not this product or any of its variants can be sold individually
- See Also:
-
searchable
-
isMerchandisingProduct
Deprecated.please useproductTypeinstead.This product is not sold itself, but is a sort of container for subordinate items. This allows for configurable products with different user choices throughProductOption- Returns:
- true if this product is a shell container or false otherwise
-
getProductType
Defines the type of the product. This affects how the product is displayed and managed in the admin UI, how it is handled by cart and order operations, and how it gets indexed by Search Services. The default types are defined byDefaultProductType.- Returns:
- The type of the product
- See Also:
-
getKeywords
Generally additional search terms that should be used when customers search for this product.- Returns:
- additional search terms that should be used when customers search for this product
-
getVariantsToGenerate
The list ofProductOptionValueCombinationsthat should be generated as part of the product creation flow.- Returns:
- the list of variants to generate
-
getDefaultFrequency
Similar todefault term, the default frequency is used for the initial display price for the product.Only relevant for products with recurring pricing.
- Returns:
- the default frequency to use for the initial display price
- Since:
- Catalog Services 2.3.0, Release Train 2.3.0
-
getTerms
The list ofProductTermsthat are associated with this product.- Returns:
- the list of terms associated with this product
- Since:
- Catalog Service 2.2.0, Release Train 2.2.0
-
getPaymentStrategy
Specifies a payment strategy to use for this product.Typically, this is determined by information from a pricing service rather than by the catalog service. However, in the case of
merchandising products, this needs to be set directly on the product since the Product's price is the sum of its add-ons. That is to say that the payment strategy to use can't be derived from an external pricing service since the merchandising product cannot be targeted directly for pricing. The merchandising product's payment strategy (and terms) will override the add-ons' defaults.Currently, this is only used for
merchandising products.- Since:
- Catalog Services 2.3.0, Release Train 2.3.0
- See Also:
-
getAttributes
Dynamic attributes that are a part of the product. This is an admin-centered concept- Returns:
- dynamic attributes that are a part of the product
-
getCharacteristics
Fields and associated Characteristics that define a specific product. These are typically manifested upon creation of a Product via aBusinessType.- Returns:
- fields and associated characteristics that define this Product
- Since:
- Catalog Service 2.2.0, Release Train 2.2.0
-
getIncludedProducts
Additional products that are always included with the product, no matter what. Used to configure "bundles" or "kits".
If some of these items should be optional or the user should decide which additional items are added to their cart, use
optionsinstead.- Returns:
- additional products that bundle with this product as their parent
- See Also:
-
getOptions
Drives additional information that the customer should enter when purchasing this product. This can be in the form of additionalvariations, additional items that can be bundled with this product or simply more information that the customer needs to enter about what they are purchasing (like a personalized message).- Returns:
- different options that the user can configure to further refine their purchase.
-
getReviewsSummary
Thesummary of reviewsfor this product.- Returns:
- The
summary of reviewsfor this product.
-
getPrimaryAsset
TheProductAssetassociated with this product marked asProductAsset.isPrimary(). By default, this is only hydrated for API callers.- Returns:
- The primary
ProductAssetfor this product.
-
getPrimaryCategory
TheCategoryassociated with this product where theCategoryProductrelationship is marked asCategoryProduct.isPrimary().This field is not persisted on the product - instead, this is a dynamically set/hydrated value for API callers to conveniently manage the primary
CategoryProductrelationship as part ofProductAPI create/replace calls.It is not necessarily respected or hydrated in all scenarios.
- Returns:
- the category that is associated with this product as the primary category
- See Also:
-
getTags
A list of simple labels used to categorize the product- Returns:
- a list of simple labels used to categorize the product
-
getBrand
- Returns:
- the brand of this product
-
getMerchandisingType
- Returns:
- the merchandising type of this product
-
getTargetDemographic
- Returns:
- the target demographic of this product
-
getContextState
public com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState getContextState()A subset ofTrackinginformation to expose the context state for this object.- Specified by:
getContextStatein interfacecom.broadleafcommerce.data.tracking.core.ContextStateAware- Returns:
- a subset of
Trackinginformation to expose the context state for this object
-
getTaxCode
The tax code for this product.- Returns:
- The tax code for this product.
-
getMinimumThreshold
The minimum count of this product that must be added in a cart.- Returns:
- the minimum count of this product that must be added in a cart
-
getMaximumThreshold
The maximum count of this product that must be added in a cart.- Returns:
- the maximum count of this product that must be added in a cart
-
getDefaultVariant
When the `productType` is `VARIANT_BASED` this represents the default. -
isHasVariants
public boolean isHasVariants()Convenience flag indicating to the caller if variants were found for this product. This is typically only set for admin-facing calls after hydration.- Since:
- Catalog Service 2.2.0, Release Train 2.2.0
-
isSubscription
public boolean isSubscription()Whether this product is a subscription.- 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
-
isAllowChangingBillingFrequency
public boolean isAllowChangingBillingFrequency()Whether the billing frequency can be changed after initial purchase.- Since:
- Catalog Services 2.3.0, Release Train 2.3.0
-
getUpgradeProductIds
The list of product ids describing the products that can be upgraded to. This is typically used for subscription upgrade scenarios.- Since:
- Catalog Services 2.3.0, Release Train 2.3.0
-
getDowngradeProductIds
The list of product ids describing the products that can be downgraded to. This is typically used for subscription downgrade scenarios.- Since:
- Catalog Services 2.3.0, Release Train 2.3.0
-
getRestrictDowngradeAfterDays
The number of days after which a downgrade 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
-
getMaxNumberOfActiveSubscriptions
The max number of active subscriptions that can be created for this product.nullmeans no restriction.- Since:
- Catalog Services 2.3.0, Release Train 2.3.0
-
getFulfillmentWorkflow
The fulfillment workflow that this product will go through after checkout.- Since:
- Catalog Services 2.3.0, Release Train 2.3.0
-
getCancellationPolicyRef
A reference (typically the Id) of the CancellationPolicy for this product that governs how this product's subscription would be cancelled.- Since:
- Catalog Services 2.3.0, Release Train 2.3.0
-
getPricingCategory
Optional. Specify a category designation that can be targeted in a pricing modifier formula to transform pricing for products. -
getVariantPricingStrategy
The pricing strategy for this product's variants, only relevant forDefaultProductType.VARIANT_BASEDproducts.- Since:
- Catalog Services 2.3.0, Release Train 2.3.0
- See Also:
-
getCharacteristicsOverriddenHint
This field is not honored in API requests or persisted in the system. It is dynamically computed and returned in select API responses (after characteristics are hydrated) to report whether any of the
getCharacteristics()can be considered overrides in the currentContextRequestthe API caller is requesting in.getCharacteristics(), despite technically being a separate domain, are managed as part of theProductlifecycle. Thus, operations such asclear-override requestsare not individually directed towardProductCharacteristicsand instead happen as part of the 'clear overrides' request against their parentProduct.API consumers like the Broadleaf admin frontend typically rely on
ContextState.getFieldChanges(),ContextState.getCatalog(), andContextState.getOverrideCatalogId()to determine whether an entity should be interpreted as an override in the caller's currentContextRequest. This drives whether 'undo overrides' is even shown as an action available to the end-user for that entity.However, because
getContextState()only knows about the catalog/field-change state of theProductitself and not any of itsgetCharacteristics(), the API consumer would also need to check eachProductCharacteristic.getContextState()to determine if any of the contained characteristics are overrides in the current context. For example, consider a scenario where ProductA is defined in parentCatalog and has characteristics overridden in childCatalog. If the user is in the 'childCatalog' context and only looked atgetContextState()to determine if there were any overrides, they would incorrectly conclude that there were none.Ultimately, this field is provided as a convenient hint to such API callers to spare them the effort of checking each
ProductCharacteristic.getContextState()in determining whether any of them are overrides in the currentContextRequest. The default implementation is 'best effort' to compute this value, so it should continue to be treated as a soft hint rather than a flag upon which any concrete backend business logic should be gated.- Since:
- Catalog Services 2.3.0, Release Train 2.3.0
-
setId
- Parameters:
id- the context ID of the product
-
setName
Customer-facing name of this product. This can also be overridden at theVariantlevel- Parameters:
name- the name of this product suitable for display
-
setUri
SEO-friendly URI to identify this product. This is usually generated with some URL-safe version of the main category name along with a url-friendly version ofname- Parameters:
uri- the uniquely identifiable URI of this Product
-
setDescription
Description of the product that can include HTML in implementations where a WYSIWYG editor manages this field.- Parameters:
description- of this Product with HTML if necessary
-
setSku
This uniquely identifies this product in the catalog when it is sold and is used for other contexts like inventory and pricing.- Parameters:
sku- the Stock Keeping Unit identifier for this Product. Typically only set this if intending to sell this single Product in the store, but can also be set to the same value as a relatedvariant'ssku to declare a default variant/default sku for the product
-
setUpc
Universal product code that identifies this product. This is usually only relevant when this product is sold individually without any variants- Parameters:
upc- a Universal Product Code to describe this Product
-
setExternalId
This is an arbitrary ID, typically assigned by or used by 1st or 3rd party systems that are not Broadleaf.- Parameters:
externalId- an external ID, often a DB or business ID, from a system outside of Broadleaf
-
setCurrency
public void setCurrency(javax.money.CurrencyUnit currency) Currency for all of the prices on this product- Specified by:
setCurrencyin interfacecom.broadleafcommerce.money.CurrencyConsumer- Parameters:
currency- the currency to use for all of the prices on this product
-
setPricingKey
System-wide unique identifier to configure specific pricing for the product. 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 product (usually a UUID)
-
setMsrp
public void setMsrp(javax.money.MonetaryAmount msrp) Suggested retail price for the product. This is generally only used for display and should not have any true pricing logic tied to it.- Parameters:
msrp- what to display as the suggested retail price- See Also:
-
currency
-
setDefaultPrice
public void setDefaultPrice(javax.money.MonetaryAmount defaultPrice) The default price that should be used if there is not a
salePriceset. This price can also be used as the default price for all of the Variants as well.For more advance pricing calculations, consider hiding this field in the API and removing support for it in lieu of managing prices outside of this service.
Always included in the API even if set to null to indicate whether or not this was explicitly set
- Parameters:
defaultPrice- the main price used for this particular Product, only applicable if sellable in the store
-
setSalePrice
public void setSalePrice(javax.money.MonetaryAmount salePrice) Indicates that this product is on sale. This should take priority over the default price if this salePrice is lower than the defaultPrice.- Parameters:
salePrice- the sale price, indicating that the product is on sale
-
setCost
public void setCost(javax.money.MonetaryAmount cost) Can be used in display or as a part of more complex pricing algorithms.- Parameters:
cost- the cost of this product
-
setMetaTitle
Used for SEO data in<title>tag in a product detail page. If this is unset, thenameshould be used.- Parameters:
metaTitle- the meta title used for SEO data in product details page title
-
setMetaDescription
Used for SEO data in<meta description="">in a product detail page. If this is unset, thedescriptionshould be used- Parameters:
metaDescription- the meta description used for SEO data in product details page description
-
setDisplayTemplate
Defines the display template. The display template can be used to help create a unique key that drives the presentation layer destination for this category. For example, if using Spring MVC with Thymeleaf, this could be a path to a Thymeleaf template. If using a frontend view technology like React, this could point to a specific React component.- Parameters:
displayTemplate- the display template to use for this product
-
setOnline
public void setOnline(boolean online) Whether or not this product should be visible at all in the store. A product that is offline is not searchable, visible, or purchasable. A product that is offline behaves as if it falls outside the active date range. It is not returned from storefront requests by default.
Defaults to
true- Parameters:
online- whether or not this product is visible in the store
-
setDiscountable
public void setDiscountable(boolean discountable) Whether or not this product be applied to any offers or promotions.
Defaults to
true- Parameters:
discountable- whether or not this product can be applied to any offers or promotions
-
setAutoRenewalEnabled
For subscription products only, this flag indicates whether this product's subscription would be auto-renewed.- Since:
- Catalog Services 2.3.0, Release Train 2.3.0
-
setAllowAutoRenewalModification
For subscription products only, this flag indicates whether this product's subscription's auto-renewability can be modified after declaration on the subscription.- Since:
- Catalog Services 2.3.0, Release Train 2.3.0
-
setInventoryType
Describes the product's type of fulfillment - ie is it a physical or virtual item?Defaults to
InventoryType.PHYSICAL- Parameters:
inventoryType- a String representation ofInventoryType- See Also:
-
setMergingType
Determines how this Product should merge with other similar items when it gets added to a cart. This will override the global setting on item merging. Out of box supported values are those inDefaultMergingType.- Parameters:
mergingType- the merging type to use for this Product
-
setAvailableOnline
public void setAvailableOnline(boolean availableOnline) Whether or not this product is available online - ie inventory is available somewhere to fulfill this product.Defaults to
true- Parameters:
availableOnline- Whether or not this product is available online.
-
setInventoryCheckStrategy
Describes when the product's inventory should be checked for availability.- Parameters:
inventoryCheckStrategy- a String representation ofInventoryCheckStrategy- See Also:
-
setInventoryReservationStrategy
Describes when the product's inventory should be reserved.- Parameters:
inventoryReservationStrategy- a String representation ofInventoryReservationStrategy- See Also:
-
setEligibleForPickup
public void setEligibleForPickup(boolean eligibleForPickup) Whether or not this Product can be picked up at a store rather than just be shipped- Parameters:
eligibleForPickup- flag that denotes whether or not this product can be picked up, only applicable forInventoryType.PHYSICALitems
-
setFulfillmentFlatRates
A map of flat rates for fulfilling (e.g., shipping) this product for a particular fulfillment option type (e.g., standard shipping). Depending on if the option is configured to use flat rates, this flat rate will be used in calculating the cost of fulfilling this product.The key of the map is the type of the fulfillment option such as
FIXED_STANDARDorBANDED_PRICE_EXPRESS.- Parameters:
fulfillmentFlatRates- Map of Fulfillment option types to flat rates for this product.- See Also:
-
setActiveStartDate
Start of when this product should be active.- Parameters:
activeStartDate- the date when this product should start being active
-
setActiveEndDate
End when this product is not longer active. Unset indicates that it is always active.- Parameters:
activeEndDate- the date when this product should no longer be active- See Also:
-
setDimension
- Parameters:
dimension- the dimensions of this product
-
setWeight
- Parameters:
weight- the weight of this product
-
setSearchable
public void setSearchable(boolean searchable) Whether or not this product shows up in search. Usually this matches whether or not the product is
individuallySoldThis defaults to
true- Parameters:
searchable- whether or not this product shows up in search
-
setIndividuallySold
public void setIndividuallySold(boolean individuallySold) If this product or any of its variants can be sold individually in the store, or if they must be apart of another product as an add-on. Usually if a product is not individually sold then it should also not show up in search.
This defaults to
true.- Parameters:
individuallySold- whether or not this product or any of its variants can be sold individually- See Also:
-
searchable
-
setMerchandisingProduct
Deprecated.please useproductTypeinstead.This product is not sold itself, but is a sort of container for subordinate items. This allows for configurable products with different user choices throughProductOption- Parameters:
merchandisingProduct- whether or not this is a container, merchandised-only product
-
setProductType
Defines the type of the product. This affects how the product is displayed and managed in the admin UI, how it is handled by cart and order operations, and how it gets indexed by Search Services. The default types are defined byDefaultProductType.- Parameters:
productType- The type of the product- See Also:
-
setBusinessType
Defines the type of the product for business purposes. This affects how the product is displayed and managed in the admin UI.- Parameters:
businessType- The type of the product for business purposes
-
setKeywords
Generally additional search terms that should be used when customers search for this product.- Parameters:
keywords- additional search terms that should be used when customers search for this product
-
setVariantsToGenerate
The list ofProductOptionValueCombinationsthat should be generated as part of the product creation flow.- Parameters:
variantsToGenerate- the list of variants to generate
-
setDefaultFrequency
Similar todefault term, the default frequency is used for the initial display price for the product.Only relevant for products with recurring pricing.
- Parameters:
defaultFrequency- the default frequency to use for the initial display price- Since:
- Catalog Services 2.3.0, Release Train 2.3.0
-
setTerms
The list ofProductTermsthat are associated with this product.- Parameters:
terms- the list of terms associated with this product- Since:
- Catalog Service 2.2.0, Release Train 2.2.0
-
setPaymentStrategy
Specifies a payment strategy to use for this product.Typically, this is determined by information from a pricing service rather than by the catalog service. However, in the case of
merchandising products, this needs to be set directly on the product since the Product's price is the sum of its add-ons. That is to say that the payment strategy to use can't be derived from an external pricing service since the merchandising product cannot be targeted directly for pricing. The merchandising product's payment strategy (and terms) will override the add-ons' defaults.Currently, this is only used for
merchandising products.- Since:
- Catalog Services 2.3.0, Release Train 2.3.0
- See Also:
-
setAttributes
Dynamic attributes that are a part of the product. This is an admin-centered concept- Parameters:
attributes- dynamic attributes that are a part of the product
-
setCharacteristics
Fields and associated Characteristics that define a specific product. These are typically manifested upon creation of a Product via aBusinessType.- Parameters:
characteristics- fields and associated characteristics that define this Product- Since:
- Catalog Service 2.2.0, Release Train 2.2.0
-
setIncludedProducts
Additional products that are always included with the product, no matter what. Used to configure "bundles" or "kits".
If some of these items should be optional or the user should decide which additional items are added to their cart, use
optionsinstead.- Parameters:
includedProducts- that bundle with this product as their parent- See Also:
-
setOptions
Drives additional information that the customer should enter when purchasing this product. This can be in the form of additionalvariations, additional items that can be bundled with this product or simply more information that the customer needs to enter about what they are purchasing (like a personalized message).- Parameters:
options- the options for this product
-
setReviewsSummary
Thesummary of reviewsfor this product.- Parameters:
reviewsSummary- Thesummary of reviewsfor this product.
-
setPrimaryAsset
TheProductAssetassociated with this product marked asProductAsset.isPrimary(). By default, this is only hydrated for API callers.- Parameters:
primaryAsset- The primaryProductAssetfor this product.
-
setPrimaryCategory
TheCategoryassociated with this product where theCategoryProductrelationship is marked asCategoryProduct.isPrimary().This field is not persisted on the product - instead, this is a dynamically set/hydrated value for API callers to conveniently manage the primary
CategoryProductrelationship as part ofProductAPI create/replace calls.It is not necessarily respected or hydrated in all scenarios.
- Parameters:
primaryCategory- the category that should be associated with this product as the primary category- See Also:
-
setTags
A list of simple labels used to categorize the product- Parameters:
tags- a list of simple labels used to categorize the product
-
setBrand
- Parameters:
brand- the brand of this product
-
setMerchandisingType
- Parameters:
merchandisingType- the merchandising type of this product
-
setTargetDemographic
- Parameters:
targetDemographic- the target demographic of this product
-
setContextState
public void setContextState(com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState contextState) A subset ofTrackinginformation to expose the context state for this object.- Specified by:
setContextStatein interfacecom.broadleafcommerce.data.tracking.core.ContextStateAware- Parameters:
contextState- a subset ofTrackinginformation to expose the context state for this object
-
setTaxCode
The tax code for this product.- Parameters:
taxCode- The tax code for this product.
-
setMinimumThreshold
The minimum count of this product that must be added in a cart.- Parameters:
minimumThreshold- the minimum count of this product that must be added in a cart
-
setMaximumThreshold
The maximum count of this product that must be added in a cart.- Parameters:
maximumThreshold- the maximum count of this product that must be added in a cart
-
setDefaultVariant
When the `productType` is `VARIANT_BASED` this represents the default. -
setHasVariants
public void setHasVariants(boolean hasVariants) Convenience flag indicating to the caller if variants were found for this product. This is typically only set for admin-facing calls after hydration.- Since:
- Catalog Service 2.2.0, Release Train 2.2.0
-
setSubscription
public void setSubscription(boolean isSubscription) Whether this product is a subscription.- 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
-
setAllowChangingBillingFrequency
public void setAllowChangingBillingFrequency(boolean allowChangingBillingFrequency) Whether the billing frequency can be changed after initial purchase.- Since:
- Catalog Services 2.3.0, Release Train 2.3.0
-
setUpgradeProductIds
The list of product ids describing the products that can be upgraded to. This is typically used for subscription upgrade scenarios.- Since:
- Catalog Services 2.3.0, Release Train 2.3.0
-
setDowngradeProductIds
The list of product ids describing the products that can be downgraded to. This is typically used for subscription downgrade scenarios.- Since:
- Catalog Services 2.3.0, Release Train 2.3.0
-
setRestrictDowngradeAfterDays
The number of days after which a downgrade 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
-
setMaxNumberOfActiveSubscriptions
The max number of active subscriptions that can be created for this product.nullmeans no restriction.- Since:
- Catalog Services 2.3.0, Release Train 2.3.0
-
setFulfillmentWorkflow
The fulfillment workflow that this product will go through after checkout.- Since:
- Catalog Services 2.3.0, Release Train 2.3.0
-
setCancellationPolicyRef
A reference (typically the Id) of the CancellationPolicy for this product that governs how this product's subscription would be cancelled.- Since:
- Catalog Services 2.3.0, Release Train 2.3.0
-
setPricingCategory
Optional. Specify a category designation that can be targeted in a pricing modifier formula to transform pricing for products. -
setVariantPricingStrategy
The pricing strategy for this product's variants, only relevant forDefaultProductType.VARIANT_BASEDproducts.- Since:
- Catalog Services 2.3.0, Release Train 2.3.0
- See Also:
-
setCharacteristicsOverriddenHint
This field is not honored in API requests or persisted in the system. It is dynamically computed and returned in select API responses (after characteristics are hydrated) to report whether any of the
getCharacteristics()can be considered overrides in the currentContextRequestthe API caller is requesting in.getCharacteristics(), despite technically being a separate domain, are managed as part of theProductlifecycle. Thus, operations such asclear-override requestsare not individually directed towardProductCharacteristicsand instead happen as part of the 'clear overrides' request against their parentProduct.API consumers like the Broadleaf admin frontend typically rely on
ContextState.getFieldChanges(),ContextState.getCatalog(), andContextState.getOverrideCatalogId()to determine whether an entity should be interpreted as an override in the caller's currentContextRequest. This drives whether 'undo overrides' is even shown as an action available to the end-user for that entity.However, because
getContextState()only knows about the catalog/field-change state of theProductitself and not any of itsgetCharacteristics(), the API consumer would also need to check eachProductCharacteristic.getContextState()to determine if any of the contained characteristics are overrides in the current context. For example, consider a scenario where ProductA is defined in parentCatalog and has characteristics overridden in childCatalog. If the user is in the 'childCatalog' context and only looked atgetContextState()to determine if there were any overrides, they would incorrectly conclude that there were none.Ultimately, this field is provided as a convenient hint to such API callers to spare them the effort of checking each
ProductCharacteristic.getContextState()in determining whether any of them are overrides in the currentContextRequest. The default implementation is 'best effort' to compute this value, so it should continue to be treated as a soft hint rather than a flag upon which any concrete backend business logic should be gated.- Since:
- Catalog Services 2.3.0, Release Train 2.3.0
-
equals
-
canEqual
-
hashCode
public int hashCode() -
toString
-
productTypeinstead.