Class CustomerSegment

java.lang.Object
com.broadleafcommerce.customer.domain.CustomerSegment
All Implemented Interfaces:
com.broadleafcommerce.data.tracking.core.ContextStateAware, Serializable

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

    • CustomerSegment

      public CustomerSegment()
    • CustomerSegment

      public CustomerSegment(String id, String name, String description, CustomerSegmentType customerSegmentType, Integer priority, String identifierType, String externalRef, String segmentMatchRule, String realtimeMatchRule, String ruleEvaluationType, boolean internalEvaluationRequired, boolean active, String processingState, com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState contextState)
  • Method Details

    • getId

      public String getId()
    • getName

      public String getName()
      The name of this customer segment.
      Returns:
      The customer segment name.
    • getDescription

      public String getDescription()
      The description of this customer segment.
      Returns:
      The customer segment's description.
    • getCustomerSegmentType

      public CustomerSegmentType getCustomerSegmentType()
      The type of this customer segment. This could be a customer set, rule-based, or external.
      Returns:
      The customer segment type
      See Also:
      • segmentMatchRule
      • realtimeMatchRule
      • ruleEvaluationType
    • getPriority

      public Integer getPriority()
      The priority of this customer segment. This is to enforce ordering when a customer may belong to multiple segments. A lower value indicates higher priority.
      Returns:
      The customer segment priority.
    • getIdentifierType

      @Deprecated public String getIdentifierType()
      Deprecated.
      This field is unused.
      For CustomerSegmentType.CUSTOMER_SET segment types, this represents the method used to associate a customer with this segment.

      Examples include email, customer ID, login username, etc.

      Returns:
      The segment identifier type
    • getExternalRef

      public String getExternalRef()
      If the customerSegmentType is CustomerSegmentType.EXTERNAL, then this stores the identifier for the external segment.
    • getSegmentMatchRule

      public String getSegmentMatchRule()
      The rule(s) for this customer segment if rule based and using offline evaluation. The default behavior is an RSQL filter.
      Returns:
      The rule(s) that must be fulfilled for a customer to match this segment.
      See Also:
      • ruleEvaluationType
    • getRealtimeMatchRule

      public String getRealtimeMatchRule()
      The rule(s) for this customer segment if rule based and using real-time evaluation. The default behavior is an SpEL filter. This is separate from segmentMatchRule so that it can be validating using RuleValidate.
      Returns:
      The rule(s) that must be fulfilled for a customer to match this segment.
      See Also:
      • ruleEvaluationType
    • getRuleEvaluationType

      public String getRuleEvaluationType()
      Indicates whether the segmentMatchRule is evaluated or realtimeMatchRule. This also determines the format of the rule such as RSQL for offline or SpEL for real-time.
      See Also:
    • isInternalEvaluationRequired

      public boolean isInternalEvaluationRequired()
      When ruleEvaluationType is DefaultCustomerSegmentRuleEvaluationType.REAL_TIME, indicates whether evaluation of the rule should be done in Customer Services specifically because it requires information that is only available in that service and not in the authorization token claims or a request attribute. This is typically something to avoid.
    • isActive

      public boolean isActive()
      Returns:
      Is this customer segment active?
    • getProcessingState

      public String getProcessingState()
      The current processing state of this segment.

      While this value is set on every segment for simplicity, the default behavior is that this value is only used of on rule based customer segments. This field not applicable for static segments, such as customer sets.

      The following describes the default processing states, and how these states are determined:

      Returns:
      The current processing state of this segment.
      See Also:
    • 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)
    • setName

      public void setName(String name)
      The name of this customer segment.
    • setDescription

      public void setDescription(String description)
      The description of this customer segment.
    • setCustomerSegmentType

      public void setCustomerSegmentType(CustomerSegmentType customerSegmentType)
      The type of this customer segment. This could be a customer set, rule-based, or external.
      See Also:
      • segmentMatchRule
      • realtimeMatchRule
      • ruleEvaluationType
    • setPriority

      public void setPriority(Integer priority)
      The priority of this customer segment. This is to enforce ordering when a customer may belong to multiple segments. A lower value indicates higher priority.
    • setIdentifierType

      @Deprecated public void setIdentifierType(String identifierType)
      Deprecated.
      This field is unused.
      For CustomerSegmentType.CUSTOMER_SET segment types, this represents the method used to associate a customer with this segment.

      Examples include email, customer ID, login username, etc.

    • setExternalRef

      public void setExternalRef(String externalRef)
      If the customerSegmentType is CustomerSegmentType.EXTERNAL, then this stores the identifier for the external segment.
    • setSegmentMatchRule

      public void setSegmentMatchRule(String segmentMatchRule)
      The rule(s) for this customer segment if rule based and using offline evaluation. The default behavior is an RSQL filter.
      See Also:
      • ruleEvaluationType
    • setRealtimeMatchRule

      public void setRealtimeMatchRule(String realtimeMatchRule)
      The rule(s) for this customer segment if rule based and using real-time evaluation. The default behavior is an SpEL filter. This is separate from segmentMatchRule so that it can be validating using RuleValidate.
      See Also:
      • ruleEvaluationType
    • setRuleEvaluationType

      public void setRuleEvaluationType(String ruleEvaluationType)
      Indicates whether the segmentMatchRule is evaluated or realtimeMatchRule. This also determines the format of the rule such as RSQL for offline or SpEL for real-time.
      See Also:
    • setInternalEvaluationRequired

      public void setInternalEvaluationRequired(boolean internalEvaluationRequired)
      When ruleEvaluationType is DefaultCustomerSegmentRuleEvaluationType.REAL_TIME, indicates whether evaluation of the rule should be done in Customer Services specifically because it requires information that is only available in that service and not in the authorization token claims or a request attribute. This is typically something to avoid.
    • setActive

      public void setActive(boolean active)
    • setProcessingState

      public void setProcessingState(String processingState)
      The current processing state of this segment.

      While this value is set on every segment for simplicity, the default behavior is that this value is only used of on rule based customer segments. This field not applicable for static segments, such as customer sets.

      The following describes the default processing states, and how these states are determined:

      See Also:
    • 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