java.lang.Object
com.broadleafcommerce.promotion.offer.domain.OfferCode
All Implemented Interfaces:
com.broadleafcommerce.data.tracking.core.ContextStateAware, ActiveDateEntity, Serializable

public class OfferCode extends Object implements Serializable, com.broadleafcommerce.data.tracking.core.ContextStateAware, ActiveDateEntity
See Also:
  • Constructor Details

    • OfferCode

      public OfferCode()
  • Method Details

    • getAttribute

      public <T> T getAttribute(String name)
    • isCampaignCode

      public boolean isCampaignCode()
    • isSharedCode

      public boolean isSharedCode()
    • getGeneralMaxUsageStatus

      public String getGeneralMaxUsageStatus()
    • getId

      public String getId()
    • getCode

      public String getCode()
      The string code that represents this record.
    • getExternalId

      public String 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
    • getOfferId

      public String getOfferId()
      Defines the id for the offer that originated the offer code.
    • getActiveStartDate

      public Instant getActiveStartDate()
      Defines the beginning time for which this offer code is active.
      Specified by:
      getActiveStartDate in interface ActiveDateEntity
      Returns:
      The time at which this entity becomes active for storefront consumption
    • getActiveEndDate

      public Instant getActiveEndDate()
      Defines the ending time for which this offer code is active.
      Specified by:
      getActiveEndDate in interface ActiveDateEntity
      Returns:
      The time at which this entity becomes inactive for storefront consumption
    • getMaxUses

      public int getMaxUses()
      Defines the number of max uses allowed for this offer code. By default, a code can be used only once.
    • getMaxUsesPerUser

      public int getMaxUsesPerUser()
      Determines the maximum number of times this offer code can be used by the same user. A value of 0 indicates unlimited usage. Default is 0.
    • getEmailRegEx

      public String getEmailRegEx()
      Defines a regex to be used for validating the offer code for customer updateUses.
    • getCampaignId

      public String getCampaignId()
      Defines the id for the campaign that originated the offer code.
    • getGeneratorId

      public String getGeneratorId()
      Defines the id for the code generator that originated the offer code.
    • isAssigned

      public boolean isAssigned()
      Defines whether this code has been assigned for use.
    • getSegment

      public String getSegment()
      The segment to which this offer can apply. A value of empty or "ANY" is the most common usage and means that this offer can apply to any qualifying part of the order. Typical uses of segments include using them to restrict an offer to a specific vendor or store (aka banner).
      Returns:
      The segment to which this offer can apply.
    • getAttributes

      public Map<String,Attribute> getAttributes()
      Dynamic attributes that are a part of the offer code.
      Returns:
      dynamic attributes that are a part of the offer code
    • getContextState

      public com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState getContextState()
      A subset of Tracking information to expose the context state for this object.
      Specified by:
      getContextState in interface com.broadleafcommerce.data.tracking.core.ContextStateAware
      Returns:
      a subset of Tracking information to expose the context state for this object
    • setId

      public void setId(String id)
    • setCode

      public void setCode(String code)
      The string code that represents this record.
    • setExternalId

      public void setExternalId(String externalId)
      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
    • setOfferId

      public void setOfferId(String offerId)
      Defines the id for the offer that originated the offer code.
    • setActiveStartDate

      public void setActiveStartDate(Instant activeStartDate)
      Defines the beginning time for which this offer code is active.
    • setActiveEndDate

      public void setActiveEndDate(Instant activeEndDate)
      Defines the ending time for which this offer code is active.
    • setMaxUses

      public void setMaxUses(int maxUses)
      Defines the number of max uses allowed for this offer code. By default, a code can be used only once.
    • setMaxUsesPerUser

      public void setMaxUsesPerUser(int maxUsesPerUser)
      Determines the maximum number of times this offer code can be used by the same user. A value of 0 indicates unlimited usage. Default is 0.
    • setGeneralMaxUsageStatus

      public void setGeneralMaxUsageStatus(String generalMaxUsageStatus)
      If an offercode has been deemed to have exceeded its max usage threshold, this field will be set with a reason MaxUsageStatusType.MAX_USES_EXCEEDED. This reason applies to general offercode usage as specified by getMaxUses(). Exceeding max thresholds for specific users scenarios is not tracked here. Status will be MaxUsageStatusType.VIABLE when the offercode has not exceeded thresholds yet, or is not bound by max usage thresholds.
    • setEmailRegEx

      public void setEmailRegEx(String emailRegEx)
      Defines a regex to be used for validating the offer code for customer updateUses.
    • setCampaignId

      public void setCampaignId(String campaignId)
      Defines the id for the campaign that originated the offer code.
    • setGeneratorId

      public void setGeneratorId(String generatorId)
      Defines the id for the code generator that originated the offer code.
    • setAssigned

      public void setAssigned(boolean assigned)
      Defines whether this code has been assigned for use.
    • setSegment

      public void setSegment(String segment)
      The segment to which this offer can apply. A value of empty or "ANY" is the most common usage and means that this offer can apply to any qualifying part of the order. Typical uses of segments include using them to restrict an offer to a specific vendor or store (aka banner).
    • setAttributes

      public void setAttributes(Map<String,Attribute> attributes)
      Dynamic attributes that are a part of the offer code.
      Parameters:
      attributes - dynamic attributes that are a part of the offer code
    • setContextState

      public void setContextState(com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState contextState)
      A subset of Tracking information to expose the context state for this object.
      Specified by:
      setContextState in interface com.broadleafcommerce.data.tracking.core.ContextStateAware
      Parameters:
      contextState - a subset of Tracking information to expose the context state for this object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

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

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object