Class PriceList
- All Implemented Interfaces:
com.broadleafcommerce.data.tracking.core.ContextStateAware
,Serializable
,Comparable<PriceList>
Abstraction of an aggregation of prices for PriceableTargets
the applicability of
which is determined by a set of criteria targeting information provided in a PriceContext
.
These criteria include:
- a date range for when this price list should be active,
- a currency code
- a set of specific
UserTarget
s - Expressions targeting the web request
- Expressions targeting general user (e.g., customer or account) attributes
- Generic expression targeting
PriceContext
fields
Price lists can either aggregate PriceData
for individual PriceableTarget
s or
use a broader, generalized PriceModifier
that operates on base priceable fields or prices
provided by other price lists. (For example, a PriceListType.SALE
price list
can modify the price provided by a PriceListType.STANDARD
price list.)
Some price lists can also be given priority over others of the same price list type.
This allows ties to be broken when more than one price list applies to a given price context,
primarily used with PriceListType.STANDARD
price lists.
- Author:
- Nathan Moore (nathanmoore)
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
int
Compares first by priority then by id if equal.boolean
Defines the ending time for which this price list is activeDefines the beginning time for which this price list is active.com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState
A subset ofTracking
information to expose the context state for this object.javax.money.CurrencyUnit
The currency to which this price list applies.getId()
Fields that modifiers can modify for this price list.getName()
String expression used to determine whether a price list applies to aPriceContext
.Optionally describes how this price list will modify existing prices.When multiple price lists match aPriceContext
, the price list with the higher priority wins out, where smaller integer values represent higher priorities.Key to external system indicating that this PriceList is specific to a store.getType()
Specific users that this price list targets.Key to external system indicating that this PriceList is specific to a vendor.int
hashCode()
boolean
A flag determining whether vendors are allowed to view this price list or add vendor price data to it.boolean
Whether this price list uses a price modifier instead of price datavoid
setActiveEndDate
(Instant activeEndDate) Defines the ending time for which this price list is activevoid
setActiveStartDate
(Instant activeStartDate) Defines the beginning time for which this price list is active.void
setAllowVendorsToAddPriceData
(boolean allowVendorsToAddPriceData) A flag determining whether vendors are allowed to view this price list or add vendor price data to it.void
setContextState
(com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState contextState) A subset ofTracking
information to expose the context state for this object.void
setCurrency
(javax.money.CurrencyUnit currency) The currency to which this price list applies.void
void
setModifiableFields
(Set<String> modifiableFields) Fields that modifiers can modify for this price list.void
void
setPriceContextCriteria
(String priceContextCriteria) String expression used to determine whether a price list applies to aPriceContext
.void
setPriceModifier
(PriceModifier priceModifier) Optionally describes how this price list will modify existing prices.void
setPriority
(Integer priority) When multiple price lists match aPriceContext
, the price list with the higher priority wins out, where smaller integer values represent higher priorities.void
setStoreRef
(String storeRef) Key to external system indicating that this PriceList is specific to a store.void
void
setUseModifier
(boolean useModifier) Whether this price list uses a price modifier instead of price datavoid
setUserTargets
(Set<UserTarget> userTargets) Specific users that this price list targets.void
setVendorRef
(String vendorRef) Key to external system indicating that this PriceList is specific to a vendor.toString()
-
Constructor Details
-
PriceList
public PriceList()
-
-
Method Details
-
compareTo
Compares first by priority then by id if equal. Null is greater than not null.- Specified by:
compareTo
in interfaceComparable<PriceList>
-
getId
-
getName
-
getActiveStartDate
Defines the beginning time for which this price list is active. -
getActiveEndDate
Defines the ending time for which this price list is active -
getCurrency
public javax.money.CurrencyUnit getCurrency()The currency to which this price list applies. -
getType
- See Also:
-
getPriority
When multiple price lists match aPriceContext
, the price list with the higher priority wins out, where smaller integer values represent higher priorities. Nulls are implicitly given lower precedence than any other value - they will appear last. -
getPriceContextCriteria
String expression used to determine whether a price list applies to aPriceContext
. This could be a string representation of aSpelExpression
, e.g.,name == 'some-name' || id == '1'
, or that of some other expression language. -
getUserTargets
Specific users that this price list targets. Expects an ID and a type of user. This could include such types as "customer" or "account". -
isUseModifier
public boolean isUseModifier()Whether this price list uses a price modifier instead of price data -
getPriceModifier
Optionally describes how this price list will modify existing prices. -
getModifiableFields
Fields that modifiers can modify for this price list.
Modifiable fields for each type:
- Standard Price Lists:
-
Sale Price Lists:
PriceableFieldProperties.basePrice
PriceableFieldProperties.baseCost
- Standard Price List price (standardPrice)
-
Contract Price Lists:
PriceableFieldProperties.basePrice
PriceableFieldProperties.baseCost
- Standard Price List price (standardPrice)
- Sale Price List price (salePrice)
-
getContextState
public com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState getContextState()A subset ofTracking
information to expose the context state for this object.- Specified by:
getContextState
in interfacecom.broadleafcommerce.data.tracking.core.ContextStateAware
- Returns:
- a subset of
Tracking
information to expose the context state for this object
-
getVendorRef
Key to external system indicating that this PriceList is specific to a vendor. This can be populated to support security controls based on a vendor based claim.- Returns:
- the vendor reference
-
getStoreRef
Key to external system indicating that this PriceList is specific to a store. This can be populated to support security controls based on a store based claim.- Returns:
- the store reference
-
isAllowVendorsToAddPriceData
public boolean isAllowVendorsToAddPriceData()A flag determining whether vendors are allowed to view this price list or add vendor price data to it. This is most relevant to price lists which are themselves not in a vendor but want to control whether vendors can contribute to them. -
setId
-
setName
-
setActiveStartDate
Defines the beginning time for which this price list is active. -
setActiveEndDate
Defines the ending time for which this price list is active -
setCurrency
public void setCurrency(javax.money.CurrencyUnit currency) The currency to which this price list applies. -
setType
- See Also:
-
setPriority
When multiple price lists match aPriceContext
, the price list with the higher priority wins out, where smaller integer values represent higher priorities. Nulls are implicitly given lower precedence than any other value - they will appear last. -
setPriceContextCriteria
String expression used to determine whether a price list applies to aPriceContext
. This could be a string representation of aSpelExpression
, e.g.,name == 'some-name' || id == '1'
, or that of some other expression language. -
setUserTargets
Specific users that this price list targets. Expects an ID and a type of user. This could include such types as "customer" or "account". -
setUseModifier
public void setUseModifier(boolean useModifier) Whether this price list uses a price modifier instead of price data -
setPriceModifier
Optionally describes how this price list will modify existing prices. -
setModifiableFields
Fields that modifiers can modify for this price list.
Modifiable fields for each type:
- Standard Price Lists:
-
Sale Price Lists:
PriceableFieldProperties.basePrice
PriceableFieldProperties.baseCost
- Standard Price List price (standardPrice)
-
Contract Price Lists:
PriceableFieldProperties.basePrice
PriceableFieldProperties.baseCost
- Standard Price List price (standardPrice)
- Sale Price List price (salePrice)
-
setContextState
public void setContextState(com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState contextState) A subset ofTracking
information to expose the context state for this object.- Specified by:
setContextState
in interfacecom.broadleafcommerce.data.tracking.core.ContextStateAware
- Parameters:
contextState
- a subset ofTracking
information to expose the context state for this object
-
setVendorRef
Key to external system indicating that this PriceList is specific to a vendor. This can be populated to support security controls based on a vendor based claim.- Parameters:
vendorRef
- a reference to a vendor (e.g. vendorId or vendorCode)
-
setStoreRef
Key to external system indicating that this PriceList is specific to a store. This can be populated to support security controls based on a store based claim.- Parameters:
storeRef
- a reference to a store (e.g. storeId or storeCode)
-
setAllowVendorsToAddPriceData
public void setAllowVendorsToAddPriceData(boolean allowVendorsToAddPriceData) A flag determining whether vendors are allowed to view this price list or add vendor price data to it. This is most relevant to price lists which are themselves not in a vendor but want to control whether vendors can contribute to them. -
equals
-
canEqual
-
hashCode
public int hashCode() -
toString
-