Class MarketingMessage

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

public class MarketingMessage extends Object implements Serializable, Comparable<MarketingMessage>, com.broadleafcommerce.data.tracking.core.ContextStateAware, ActiveDateEntity

A MarketingMessage encapsulates information necessary for displaying a marketing message related to an Offer next to items affected by the offer in different contexts.

This includes such info as:

  • the target type,
    • whether the message should appear with items targeted by its parent offer
    • with items that qualify orders or other items to receive its parent offer
    • or with either kind of item.
  • the location types,
    • whether the message should appear on product detail pages,
    • browse pages,
    • cart pages,
    • or everywhere.
  • start and end dates,
  • and the priority of each message relative to any others applicable to the same context—lower integer value means higher priority.

Author:
Nathan Moore (nathanmoore).
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected boolean
     
    int
    Orders by priority.
    boolean
     
    Defines the ending time for which this message is active
    Defines the beginning time for which this message is active
    com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState
    A subset of Tracking information to expose the context state for this object.
    Defines a hint to the client on how to display this message
     
    Deprecated.
    since 1.6 use translations for different locales
    Deprecated.
    since 1.6 functionality moved to locationTypes.
    Determines in what locations this message can appear, whether on product detail, browse, search, or cart pages or everywhere.
    javax.money.MonetaryAmount
    The maximum cart subtotal to display this message.
    javax.money.MonetaryAmount
    The minimum cart subtotal to display this message.
    Id of the parent Offer.
    When multiple messages match a context, the message with the higher priority wins out, where smaller integer values represent higher priorities.
    Determines whether this message should appear only next to its offer's targets or qualifiers or next to both.
    The actual text of the message to display.
    int
     
    boolean
    Determines whether the message should be show to the customer if the associated offer is already applied to the cart.
    boolean
    Determines whether the message should be show based on the current subtotal of the customer's cart.
    void
    setActiveEndDate(Instant activeEndDate)
    Defines the ending time for which this message is active
    void
    setActiveStartDate(Instant activeStartDate)
    Defines the beginning time for which this message is active
    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.
    void
    setDisplayHint(String displayHint)
    Defines a hint to the client on how to display this message
    void
     
    void
    setLocale(Locale locale)
    Deprecated.
    since 1.6 use translations for different locales
    void
    setLocationType(String locationType)
    Deprecated.
    since 1.6 functionality moved to locationTypes.
    void
    setLocationTypes(List<String> locationTypes)
    Determines in what locations this message can appear, whether on product detail, browse, search, or cart pages or everywhere.
    void
    setMaxCartSubtotal(javax.money.MonetaryAmount maxCartSubtotal)
    The maximum cart subtotal to display this message.
    void
    setMinCartSubtotal(javax.money.MonetaryAmount minCartSubtotal)
    The minimum cart subtotal to display this message.
    void
    setOfferId(String offerId)
    Id of the parent Offer.
    void
    setPriority(Integer priority)
    When multiple messages match a context, the message with the higher priority wins out, where smaller integer values represent higher priorities.
    void
    setShowIfOfferApplied(boolean showIfOfferApplied)
    Determines whether the message should be show to the customer if the associated offer is already applied to the cart.
    void
    setTargetType(String targetType)
    Determines whether this message should appear only next to its offer's targets or qualifiers or next to both.
    void
    The actual text of the message to display.
    void
    setUseCartSubtotal(boolean useCartSubtotal)
    Determines whether the message should be show based on the current subtotal of the customer's cart.
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface com.broadleafcommerce.promotion.offer.domain.ActiveDateEntity

    checkActiveDates, checkActiveDates
  • Constructor Details

    • MarketingMessage

      public MarketingMessage()
  • Method Details

    • compareTo

      public int compareTo(@NonNull MarketingMessage that)
      Orders by priority. Nulls are sorted last.
      Specified by:
      compareTo in interface Comparable<MarketingMessage>
      Parameters:
      that - another marketing message to whose display order this will be compared
      Returns:
      an integer representing whether this item has a greater, less, or equal priority than the other
    • getId

      public String getId()
    • getOfferId

      public String getOfferId()
      Id of the parent Offer.
      Returns:
      id of the parent offer
    • getText

      public String getText()
      The actual text of the message to display.
      Returns:
      The text of the message to display.
    • getPriority

      public Integer getPriority()
      When multiple messages match a context, the message 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.
      Returns:
      The priority of this message
      See Also:
    • getTargetType

      public String getTargetType()
      Determines whether this message should appear only next to its offer's targets or qualifiers or next to both.
      Returns:
      the target type of this message
      See Also:
    • getLocationType

      @Deprecated public String getLocationType()
      Deprecated.
      since 1.6 functionality moved to locationTypes.
      Determines in what locations this message can appear, whether on product detail, browse, search, or cart pages or everywhere.
      Returns:
      the location type in which this message can appear
      See Also:
    • getLocationTypes

      public List<String> getLocationTypes()
      Determines in what locations this message can appear, whether on product detail, browse, search, or cart pages or everywhere.
      Returns:
      the location types in which this message can appear
      See Also:
    • getLocale

      @Deprecated public Locale getLocale()
      Deprecated.
      since 1.6 use translations for different locales
      The Locale to which this message is applicable.
      Returns:
      the Locale to which this message is applicable.
    • getActiveStartDate

      public Instant getActiveStartDate()
      Defines the beginning time for which this message is active
      Specified by:
      getActiveStartDate in interface ActiveDateEntity
      Returns:
      the beginning time for which this message is active
    • getActiveEndDate

      public Instant getActiveEndDate()
      Defines the ending time for which this message is active
      Specified by:
      getActiveEndDate in interface ActiveDateEntity
      Returns:
      the ending time for which this message is active
    • getDisplayHint

      public String getDisplayHint()
      Defines a hint to the client on how to display this message
      Returns:
      the display hint for this message
    • isShowIfOfferApplied

      public boolean isShowIfOfferApplied()
      Determines whether the message should be show to the customer if the associated offer is already applied to the cart.
      Returns:
      whether to show the message if the offer is applied
    • isUseCartSubtotal

      public boolean isUseCartSubtotal()
      Determines whether the message should be show based on the current subtotal of the customer's cart.
      Returns:
      whether to use the cart's subtotal to determine display
    • getMinCartSubtotal

      public javax.money.MonetaryAmount getMinCartSubtotal()
      The minimum cart subtotal to display this message. If this value is specified, this message will only display if the cart subtotal is equal to or greater than this value.
      Returns:
      the minimum cart subtotal to display this message
    • getMaxCartSubtotal

      public javax.money.MonetaryAmount getMaxCartSubtotal()
      The maximum cart subtotal to display this message. If this value is specified, this message will only display if the cart subtotal is equal to or less than this value.
      Returns:
      the maximum cart subtotal to display this message
    • 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)
    • setOfferId

      public void setOfferId(String offerId)
      Id of the parent Offer.
      Parameters:
      offerId - Id of the parent offer
    • setText

      public void setText(String text)
      The actual text of the message to display.
      Parameters:
      text - The actual text of the message to display.
    • setPriority

      public void setPriority(Integer priority)
      When multiple messages match a context, the message 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.
      Parameters:
      priority - The priority of this message when compared to others
      See Also:
    • setTargetType

      public void setTargetType(String targetType)
      Determines whether this message should appear only next to its offer's targets or qualifiers or next to both.
      Parameters:
      targetType - the target type of this message
      See Also:
    • setLocationType

      @Deprecated public void setLocationType(String locationType)
      Deprecated.
      since 1.6 functionality moved to locationTypes.
      Determines in what locations this message can appear, whether on product detail, browse, search, or cart pages or everywhere.
      Parameters:
      locationType - the location type in which this message can appear
      See Also:
    • setLocationTypes

      public void setLocationTypes(List<String> locationTypes)
      Determines in what locations this message can appear, whether on product detail, browse, search, or cart pages or everywhere.
      Parameters:
      locationTypes - the location types in which this message can appear
      See Also:
    • setLocale

      @Deprecated public void setLocale(Locale locale)
      Deprecated.
      since 1.6 use translations for different locales
      The Locale to which this message is applicable.
      Parameters:
      locale - the Locale to which this message is applicable.
    • setActiveStartDate

      public void setActiveStartDate(Instant activeStartDate)
      Defines the beginning time for which this message is active
      Parameters:
      activeStartDate - the beginning time for which this message is active
    • setActiveEndDate

      public void setActiveEndDate(Instant activeEndDate)
      Defines the ending time for which this message is active
      Parameters:
      activeEndDate - the ending time for which this message is active
    • setDisplayHint

      public void setDisplayHint(String displayHint)
      Defines a hint to the client on how to display this message
      Parameters:
      displayHint - the display hint for this message
    • setShowIfOfferApplied

      public void setShowIfOfferApplied(boolean showIfOfferApplied)
      Determines whether the message should be show to the customer if the associated offer is already applied to the cart.
      Parameters:
      showIfOfferApplied - whether to show the message if the offer is applied
    • setUseCartSubtotal

      public void setUseCartSubtotal(boolean useCartSubtotal)
      Determines whether the message should be show based on the current subtotal of the customer's cart.
      Parameters:
      useCartSubtotal - whether to use the cart's subtotal to determine display
    • setMinCartSubtotal

      public void setMinCartSubtotal(javax.money.MonetaryAmount minCartSubtotal)
      The minimum cart subtotal to display this message. If this value is specified, this message will only display if the cart subtotal is equal to or greater than this value.
      Parameters:
      minCartSubtotal - the minimum cart subtotal to display this message
    • setMaxCartSubtotal

      public void setMaxCartSubtotal(javax.money.MonetaryAmount maxCartSubtotal)
      The maximum cart subtotal to display this message. If this value is specified, this message will only display if the cart subtotal is equal to or less than this value.
      Parameters:
      maxCartSubtotal - the maximum cart subtotal to display this message
    • 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
    • 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
    • toString

      public String toString()
      Overrides:
      toString in class Object