java.lang.Object
com.broadleafcommerce.promotion.offer.domain.UserTarget
All Implemented Interfaces:
com.broadleafcommerce.data.tracking.core.EmbeddedContextStateAware, Serializable

public class UserTarget extends Object implements Serializable, com.broadleafcommerce.data.tracking.core.EmbeddedContextStateAware
Abstraction of a user that offers can target. Examples include customers and accounts.
Author:
Nathan Moore (nathanmoore).
See Also:
  • Field Summary

    Fields inherited from interface com.broadleafcommerce.data.tracking.core.EmbeddedContextStateAware

    DEFAULT_FIELD_NAME
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    UserTarget(String targetType, String targetValue)
     
    UserTarget(String targetValue, String targetType, String label, com.broadleafcommerce.data.tracking.core.EmbeddedContextState contextState)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected boolean
     
    boolean
     
    com.broadleafcommerce.data.tracking.core.EmbeddedContextState
    A subset of Tracking information to expose the context state for this object.
    Gets a friendly label for admin display, or, if null, just returns targetValue.
    The type of the user.
    An identifying value for the user.
    int
     
    boolean
    Indicates that this user target is for any guest (anonymous) customer not a specific user.
    boolean
    Indicates that this user target is for any registered customer not a specific user.
    void
    setContextState(com.broadleafcommerce.data.tracking.core.EmbeddedContextState contextState)
    A subset of Tracking information to expose the context state for this object.
    void
    A friendly label for admin display.
    void
    setTargetType(String targetType)
    The type of the user.
    void
    setTargetValue(String targetValue)
    An identifying value for the user.
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • UserTarget

      public UserTarget(String targetType, String targetValue)
    • UserTarget

      public UserTarget()
    • UserTarget

      public UserTarget(String targetValue, String targetType, String label, com.broadleafcommerce.data.tracking.core.EmbeddedContextState contextState)
  • Method Details

    • isTargetAnyRegistered

      public boolean isTargetAnyRegistered()
      Indicates that this user target is for any registered customer not a specific user.
      Returns:
      Whether this user target is for any registered customer not a specific user.
    • isTargetAnyGuest

      public boolean isTargetAnyGuest()
      Indicates that this user target is for any guest (anonymous) customer not a specific user.
      Returns:
      Whether this user target is for any guest (anonymous) customer not a specific user.
    • getLabel

      public String getLabel()
      Gets a friendly label for admin display, or, if null, just returns targetValue.
      Returns:
      A friendly label for admin display, or, if null, targetValue.
    • getTargetValue

      public String getTargetValue()
      An identifying value for the user. Could be an email, username, or some similarly identifying value.
      Returns:
      An identifying value for the user
      See Also:
    • getTargetType

      public String getTargetType()
      The type of the user. This could be "CUSTOMER", "ACCOUNT", etc.
      Returns:
      The type of the user.
    • getContextState

      public com.broadleafcommerce.data.tracking.core.EmbeddedContextState getContextState()
      A subset of Tracking information to expose the context state for this object. This value is not persisted, and instead it is dynamically calculated and populated when the ChangeDetails for the parent object's entire attributes map are compared.
      Specified by:
      getContextState in interface com.broadleafcommerce.data.tracking.core.EmbeddedContextStateAware
      Returns:
      a subset of Tracking information to expose the context state for this object
    • setTargetValue

      public void setTargetValue(String targetValue)
      An identifying value for the user. Could be an email, username, or some similarly identifying value.
      Parameters:
      targetValue - An identifying value for the user.
      See Also:
    • setTargetType

      public void setTargetType(String targetType)
      The type of the user. This could be "CUSTOMER", "ACCOUNT", etc.
      Parameters:
      targetType - The type of the user.
    • setLabel

      public void setLabel(String label)
      A friendly label for admin display. Typically only set on initial creation of the target and not kept in sync.
      Parameters:
      label - A friendly label for admin display.
    • setContextState

      public void setContextState(com.broadleafcommerce.data.tracking.core.EmbeddedContextState contextState)
      A subset of Tracking information to expose the context state for this object. This value is not persisted, and instead it is dynamically calculated and populated when the ChangeDetails for the parent object's entire attributes map are compared.
      Specified by:
      setContextState in interface com.broadleafcommerce.data.tracking.core.EmbeddedContextStateAware
      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