Class OfferImpl

java.lang.Object
org.broadleafcommerce.core.offer.domain.OfferImpl
All Implemented Interfaces:
Serializable, org.broadleafcommerce.common.admin.domain.AdminMainEntity, org.broadleafcommerce.common.copy.MultiTenantCloneable<Offer>, org.broadleafcommerce.common.persistence.Status, Offer, OfferAdminPresentation

@Entity public class OfferImpl extends Object implements Offer, org.broadleafcommerce.common.admin.domain.AdminMainEntity, OfferAdminPresentation
See Also:
  • Field Details

    • EXCLUDE_OFFERCODE_COPY_HINT

      public static final String EXCLUDE_OFFERCODE_COPY_HINT
      See Also:
    • id

      protected Long id
    • offerCodes

      protected List<OfferCode> offerCodes
    • name

      protected String name
    • description

      protected String description
    • marketingMessage

      protected String marketingMessage
    • type

      protected String type
    • discountType

      protected String discountType
    • value

      protected BigDecimal value
    • priority

      protected Integer priority
    • startDate

      protected Date startDate
    • endDate

      protected Date endDate
    • targetSystem

      protected String targetSystem
    • applyToSalePrice

      protected Boolean applyToSalePrice
    • applyToChildItems

      protected Boolean applyToChildItems
    • combinableWithOtherOffers

      protected Boolean combinableWithOtherOffers
      Determines if other offers of the same type can be combined with this offer.
    • automaticallyAdded

      protected Boolean automaticallyAdded
    • maxUsesPerOrder

      protected Integer maxUsesPerOrder
    • maxUsesPerCustomer

      protected Long maxUsesPerCustomer
    • maxUsesStrategy

      protected String maxUsesStrategy
    • minimumDaysPerUsage

      protected Long minimumDaysPerUsage
    • offerItemQualifierRuleType

      protected String offerItemQualifierRuleType
    • qualifyingItemSubTotal

      protected BigDecimal qualifyingItemSubTotal
    • orderMinSubTotal

      protected BigDecimal orderMinSubTotal
    • targetMinSubTotal

      protected BigDecimal targetMinSubTotal
    • offerItemTargetRuleType

      protected String offerItemTargetRuleType
    • qualifyingItemCriteria

      protected Set<OfferQualifyingCriteriaXref> qualifyingItemCriteria
    • legacyQualifyingItemCriteria

      protected Set<OfferItemCriteria> legacyQualifyingItemCriteria
    • targetItemCriteria

      protected Set<OfferTargetCriteriaXref> targetItemCriteria
    • legacyTargetItemCriteria

      protected Set<OfferItemCriteria> legacyTargetItemCriteria
    • totalitarianOffer

      protected Boolean totalitarianOffer
    • requiresRelatedTargetAndQualifiers

      protected Boolean requiresRelatedTargetAndQualifiers
    • adjustmentType

      protected String adjustmentType
    • useListForDiscounts

      protected Boolean useListForDiscounts
    • offerPriceData

      protected List<OfferPriceData> offerPriceData
    • archiveStatus

      protected org.broadleafcommerce.common.persistence.ArchiveStatus archiveStatus
  • Constructor Details

    • OfferImpl

      public OfferImpl()
  • Method Details

    • getId

      public Long getId()
      Specified by:
      getId in interface Offer
    • setId

      public void setId(Long id)
      Specified by:
      setId in interface Offer
    • getName

      public String getName()
      Specified by:
      getName in interface Offer
    • setName

      public void setName(String name)
      Specified by:
      setName in interface Offer
    • getDescription

      public String getDescription()
      Specified by:
      getDescription in interface Offer
    • setDescription

      public void setDescription(String description)
      Specified by:
      setDescription in interface Offer
    • getType

      public OfferType getType()
      Specified by:
      getType in interface Offer
    • setType

      public void setType(OfferType type)
      Specified by:
      setType in interface Offer
    • getDiscountType

      public OfferDiscountType getDiscountType()
      Specified by:
      getDiscountType in interface Offer
    • setDiscountType

      public void setDiscountType(OfferDiscountType discountType)
      Specified by:
      setDiscountType in interface Offer
    • getOfferItemQualifierRuleType

      public OfferItemRestrictionRuleType getOfferItemQualifierRuleType()
      Specified by:
      getOfferItemQualifierRuleType in interface Offer
    • setOfferItemQualifierRuleType

      public void setOfferItemQualifierRuleType(OfferItemRestrictionRuleType restrictionRuleType)
      Specified by:
      setOfferItemQualifierRuleType in interface Offer
    • getOfferItemTargetRuleType

      public OfferItemRestrictionRuleType getOfferItemTargetRuleType()
      Specified by:
      getOfferItemTargetRuleType in interface Offer
    • setOfferItemTargetRuleType

      public void setOfferItemTargetRuleType(OfferItemRestrictionRuleType restrictionRuleType)
      Specified by:
      setOfferItemTargetRuleType in interface Offer
    • getValue

      public BigDecimal getValue()
      Specified by:
      getValue in interface Offer
    • setValue

      public void setValue(BigDecimal value)
      Specified by:
      setValue in interface Offer
    • getPriority

      public int getPriority()
      Specified by:
      getPriority in interface Offer
    • setPriority

      public void setPriority(Integer priority)
      Specified by:
      setPriority in interface Offer
    • getStartDate

      public Date getStartDate()
      Specified by:
      getStartDate in interface Offer
    • setStartDate

      public void setStartDate(Date startDate)
      Specified by:
      setStartDate in interface Offer
    • getEndDate

      public Date getEndDate()
      Specified by:
      getEndDate in interface Offer
    • setEndDate

      public void setEndDate(Date endDate)
      Specified by:
      setEndDate in interface Offer
    • getTargetSystem

      public String getTargetSystem()
      Specified by:
      getTargetSystem in interface Offer
    • setTargetSystem

      public void setTargetSystem(String targetSystem)
      Specified by:
      setTargetSystem in interface Offer
    • getApplyDiscountToSalePrice

      public boolean getApplyDiscountToSalePrice()
      Specified by:
      getApplyDiscountToSalePrice in interface Offer
    • setApplyDiscountToSalePrice

      public void setApplyDiscountToSalePrice(boolean applyToSalePrice)
      Specified by:
      setApplyDiscountToSalePrice in interface Offer
    • getApplyToChildItems

      public Boolean getApplyToChildItems()
      Description copied from interface: Offer
      Returns whether or not this offer should apply to an OrderItems child order items
      Specified by:
      getApplyToChildItems in interface Offer
      Returns:
      applyToChildItems
    • setApplyToChildItems

      public void setApplyToChildItems(boolean applyToChildItems)
      Description copied from interface: Offer
      Sets whether or not this offer should apply to an OrderItems child order items
      Specified by:
      setApplyToChildItems in interface Offer
    • isCombinableWithOtherOffers

      public boolean isCombinableWithOtherOffers()
      Returns true if this offer can be combined with other offers in the order.
      Specified by:
      isCombinableWithOtherOffers in interface Offer
      Returns:
      true if combinableWithOtherOffers, otherwise false
    • getCombinableWithOtherOffers

      public boolean getCombinableWithOtherOffers()
    • setCombinableWithOtherOffers

      public void setCombinableWithOtherOffers(boolean combinableWithOtherOffers)
      Sets the combinableWithOtherOffers value for this offer.
      Specified by:
      setCombinableWithOtherOffers in interface Offer
      Parameters:
      combinableWithOtherOffers -
    • isAutomaticallyAdded

      public boolean isAutomaticallyAdded()
      Description copied from interface: Offer
      Returns true if the offer system should automatically add this offer for consideration (versus requiring a code or other delivery mechanism). This does not guarantee that the offer will qualify. All rules associated with this offer must still pass. A true value here just means that the offer will be considered.

      Returns null if false

      Specified by:
      isAutomaticallyAdded in interface Offer
      Returns:
    • setAutomaticallyAdded

      public void setAutomaticallyAdded(boolean automaticallyAdded)
      Description copied from interface: Offer
      Sets whether or not this offer should be automatically considered for consideration (versus requiring a code or other delivery mechanism).
      Specified by:
      setAutomaticallyAdded in interface Offer
      See Also:
    • getMaxUsesPerCustomer

      public Long getMaxUsesPerCustomer()
      Description copied from interface: Offer
      Returns the maximum number of times that this offer can be used by the same customer. This field tracks the number of times the offer can be used and not how many times it is applied.

      0 or null indicates unlimited usage per customer.

      Specified by:
      getMaxUsesPerCustomer in interface Offer
      Returns:
    • setMaxUsesPerCustomer

      public void setMaxUsesPerCustomer(Long maxUsesPerCustomer)
      Description copied from interface: Offer
      Sets the maximum number of times that this offer can be used by the same customer. Intended as a transient field that gets derived from the other persisted max uses fields including maxUsesPerOrder and maxUsesPerCustomer.

      0 or null indicates unlimited usage.

      Specified by:
      setMaxUsesPerCustomer in interface Offer
    • getMaxUsesStrategyType

      public CustomerMaxUsesStrategyType getMaxUsesStrategyType()
      Description copied from interface: Offer
      Enum that allows implementations to vary how customer max uses will be interpreted. If null, the strategy will be CustomerMaxUsesStrategyType.CUSTOMER.
      Specified by:
      getMaxUsesStrategyType in interface Offer
      Returns:
    • setMaxUsesStrategyType

      public void setMaxUsesStrategyType(CustomerMaxUsesStrategyType strategyType)
      Description copied from interface: Offer
      Sets the strategy for determining customer max uses.
      Specified by:
      setMaxUsesStrategyType in interface Offer
      See Also:
    • getMinimumDaysPerUsage

      public Long getMinimumDaysPerUsage()
      Description copied from interface: Offer
      Sets the minimum number of days that this offer can be used by the same customer before resetting the number of uses dictated by Offer.getMaxUsesPerCustomer().

      0 or null indicates that the offer will never reset usages.

      Specified by:
      getMinimumDaysPerUsage in interface Offer
      Returns:
    • setMinimumDaysPerUsage

      public void setMinimumDaysPerUsage(Long minimumDaysPerUsage)
      Description copied from interface: Offer
      Sets the minimum number of days that this offer can be used by the same customer before resetting the number of uses dictated by Offer.getMaxUsesPerCustomer().

      0 or null indicates that the offer will never reset usages.

      Specified by:
      setMinimumDaysPerUsage in interface Offer
    • isUnlimitedUsePerCustomer

      public boolean isUnlimitedUsePerCustomer()
      Description copied from interface: Offer
      Indicates that there is no limit to how many times a customer can use this offer. By default this is true if Offer.getMaxUsesPerCustomer() == 0
      Specified by:
      isUnlimitedUsePerCustomer in interface Offer
    • isLimitedUsePerCustomer

      public boolean isLimitedUsePerCustomer()
      Description copied from interface: Offer
      Whether or not this offer has limited use in an order. By default this is true if Offer.getMaxUsesPerCustomer() > 0
      Specified by:
      isLimitedUsePerCustomer in interface Offer
    • getMaxUsesPerOrder

      public int getMaxUsesPerOrder()
      Description copied from interface: Offer
      Returns the maximum number of times that this offer can be used in the current order.

      0 indicates unlimited usage.

      Specified by:
      getMaxUsesPerOrder in interface Offer
    • setMaxUsesPerOrder

      public void setMaxUsesPerOrder(int maxUsesPerOrder)
      Description copied from interface: Offer
      Sets the maximum number of times that this offer can be used in the current order.

      0 indicates unlimited usage.

      Specified by:
      setMaxUsesPerOrder in interface Offer
    • isUnlimitedUsePerOrder

      public boolean isUnlimitedUsePerOrder()
      Description copied from interface: Offer
      Indicates that there is no limit to how many times this offer can be applied to the order. By default this is true if Offer.getMaxUsesPerOrder() == 0
      Specified by:
      isUnlimitedUsePerOrder in interface Offer
    • isLimitedUsePerOrder

      public boolean isLimitedUsePerOrder()
      Description copied from interface: Offer
      Whether or not this offer has limited use in an order. By default this is true if Offer.getMaxUsesPerOrder() > 0
      Specified by:
      isLimitedUsePerOrder in interface Offer
    • getMarketingMessage

      public String getMarketingMessage()
      Specified by:
      getMarketingMessage in interface Offer
    • setMarketingMessage

      public void setMarketingMessage(String marketingMessage)
      Specified by:
      setMarketingMessage in interface Offer
    • getQualifyingItemCriteriaXref

      public Set<OfferQualifyingCriteriaXref> getQualifyingItemCriteriaXref()
      Specified by:
      getQualifyingItemCriteriaXref in interface Offer
    • setQualifyingItemCriteriaXref

      public void setQualifyingItemCriteriaXref(Set<OfferQualifyingCriteriaXref> qualifyingItemCriteriaXref)
      Specified by:
      setQualifyingItemCriteriaXref in interface Offer
    • getTargetItemCriteriaXref

      public Set<OfferTargetCriteriaXref> getTargetItemCriteriaXref()
      Specified by:
      getTargetItemCriteriaXref in interface Offer
    • setTargetItemCriteriaXref

      public void setTargetItemCriteriaXref(Set<OfferTargetCriteriaXref> targetItemCriteriaXref)
      Specified by:
      setTargetItemCriteriaXref in interface Offer
    • isTotalitarianOffer

      public Boolean isTotalitarianOffer()
      Specified by:
      isTotalitarianOffer in interface Offer
    • setTotalitarianOffer

      public void setTotalitarianOffer(Boolean totalitarianOffer)
      Specified by:
      setTotalitarianOffer in interface Offer
    • getOfferMatchRulesXref

      public Map<String,OfferOfferRuleXref> getOfferMatchRulesXref()
      Specified by:
      getOfferMatchRulesXref in interface Offer
    • setOfferMatchRulesXref

      public void setOfferMatchRulesXref(Map<String,OfferOfferRuleXref> offerMatchRulesXref)
      Specified by:
      setOfferMatchRulesXref in interface Offer
    • getUseListForDiscounts

      public Boolean getUseListForDiscounts()
      Specified by:
      getUseListForDiscounts in interface Offer
    • setUseListForDiscounts

      public void setUseListForDiscounts(Boolean useListForDiscounts)
      Specified by:
      setUseListForDiscounts in interface Offer
    • getOfferPriceData

      public List<OfferPriceData> getOfferPriceData()
      Specified by:
      getOfferPriceData in interface Offer
    • setOfferPriceData

      public void setOfferPriceData(List<OfferPriceData> offerPriceData)
      Specified by:
      setOfferPriceData in interface Offer
    • getArchived

      public Character getArchived()
      Specified by:
      getArchived in interface org.broadleafcommerce.common.persistence.Status
    • setArchived

      public void setArchived(Character archived)
      Specified by:
      setArchived in interface org.broadleafcommerce.common.persistence.Status
    • isActive

      public boolean isActive()
      Specified by:
      isActive in interface org.broadleafcommerce.common.persistence.Status
    • getQualifyingItemSubTotal

      public org.broadleafcommerce.common.money.Money getQualifyingItemSubTotal()
      Description copied from interface: Offer
      Indicates the amount of items that must be purchased for this offer to be considered for this order.

      The system will find all qualifying items for the given offer and sum their prices before any discounts are applied to make the determination.

      If the sum of the qualifying items is not greater than this value the offer is not considered by the offer processing algorithm.

      Specified by:
      getQualifyingItemSubTotal in interface Offer
      Returns:
    • setQualifyingItemSubTotal

      public void setQualifyingItemSubTotal(org.broadleafcommerce.common.money.Money qualifyingItemSubTotal)
      Specified by:
      setQualifyingItemSubTotal in interface Offer
    • getOrderMinSubTotal

      public org.broadleafcommerce.common.money.Money getOrderMinSubTotal()
      Specified by:
      getOrderMinSubTotal in interface Offer
    • setOrderMinSubTotal

      public void setOrderMinSubTotal(org.broadleafcommerce.common.money.Money orderMinSubTotal)
      Specified by:
      setOrderMinSubTotal in interface Offer
    • getTargetMinSubTotal

      public org.broadleafcommerce.common.money.Money getTargetMinSubTotal()
      Specified by:
      getTargetMinSubTotal in interface Offer
    • setTargetMinSubTotal

      public void setTargetMinSubTotal(org.broadleafcommerce.common.money.Money targetMinSubTotal)
      Specified by:
      setTargetMinSubTotal in interface Offer
    • getOfferCodes

      public List<OfferCode> getOfferCodes()
      Description copied from interface: Offer
      Returns the offer codes that can be used to retrieve this Offer. These codes would be used in situations where this Offer is not automatically considered (meaning Offer.isAutomaticallyAdded() is false}
      Specified by:
      getOfferCodes in interface Offer
    • setOfferCodes

      public void setOfferCodes(List<OfferCode> offerCodes)
      Description copied from interface: Offer
      Sets the offer codes that can be used to retrieve this Offer. These codes would be used in situations where this Offer is not automatically considered (meaning Offer.isAutomaticallyAdded() is false}
      Specified by:
      setOfferCodes in interface Offer
    • getRequiresRelatedTargetAndQualifiers

      public Boolean getRequiresRelatedTargetAndQualifiers()
      Specified by:
      getRequiresRelatedTargetAndQualifiers in interface Offer
    • setRequiresRelatedTargetAndQualifiers

      public void setRequiresRelatedTargetAndQualifiers(Boolean requiresRelatedTargetAndQualifiers)
      Specified by:
      setRequiresRelatedTargetAndQualifiers in interface Offer
    • getMainEntityName

      public String getMainEntityName()
      Specified by:
      getMainEntityName in interface org.broadleafcommerce.common.admin.domain.AdminMainEntity
    • getAdjustmentType

      public OfferAdjustmentType getAdjustmentType()
      Description copied from interface: Offer
      This indicates how an Offer should be fulfilled to the customer, defaulting to order time discount. Currently, this enumeration can be ORDER_DISCOUNT or FUTURE_CREDIT. "Future credit" means that the associated adjustment will be discounted at a later time to the customer via a credit. It is up to the implementor to decide how to achieve this. The adjustment entities have a new "isFutureCredit" field used to determine if an adjustment originated from an offer marked as FUTURE_CREDIT. Order, OrderItem and FulfillmentGroup have new accessor methods for retrieving the future credit values when they are needed to be fulfilled.

      Out-of-box, this field is disabled from admin and must be manually enabled to view, since it is not a typical requirement to most implementations. To enable, add the following to AdminConfig.java:

      Specified by:
      getAdjustmentType in interface Offer
      Returns:
    • setAdjustmentType

      public void setAdjustmentType(OfferAdjustmentType adjustmentType)
      Description copied from interface: Offer
      This indicates how an Offer should be fulfilled to the customer, defaulting to order time discount. Currently, this enumeration can be ORDER_DISCOUNT or FUTURE_CREDIT. "Future credit" means that the associated adjustment will be discounted at a later time to the customer via a credit. It is up to the implementor to decide how to achieve this. The adjustment entities have a new "isFutureCredit" field used to determine if an adjustment originated from an offer marked as FUTURE_CREDIT. Order, OrderItem and FulfillmentGroup have new accessor methods for retrieving the future credit values when they are needed to be fulfilled.

      Out-of-box, this field is disabled from admin and must be manually enabled to view, since it is not a typical requirement to most implementations. To enable, add the following to AdminConfig.java:

      Specified by:
      setAdjustmentType in interface Offer
    • isFutureCredit

      public boolean isFutureCredit()
      Description copied from interface: Offer
      Future credit means that the associated adjustment will be discounted at a later time to the customer via a credit. It is up to the implementor to decide how to achieve this. The adjustment entities have a new "isFutureCredit" field used to determine if an adjustment originated from an offer marked as FUTURE_CREDIT. Order, OrderItem and FulfillmentGroup have new accessor methods for retrieving the future credit values when they are needed to be fulfilled.

      See Offer.getAdjustmentType() for more info

      Specified by:
      isFutureCredit in interface Offer
      Returns:
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • createOrRetrieveCopyInstance

      public <G extends Offer> org.broadleafcommerce.common.copy.CreateResponse<G> createOrRetrieveCopyInstance(org.broadleafcommerce.common.copy.MultiTenantCopyContext context) throws CloneNotSupportedException
      Specified by:
      createOrRetrieveCopyInstance in interface org.broadleafcommerce.common.copy.MultiTenantCloneable<Offer>
      Throws:
      CloneNotSupportedException