com.ibm.commerce.context.experimentimpl

Class ExperimentContextImpl

  • All Implemented Interfaces:
    Context, ContextSPI, ExperimentContext, java.io.Serializable


    public class ExperimentContextImpl
    extends AbstractContextImpl
    implements ExperimentContext
    This class implements the ExperimentContext interface to provide the implementation details of the context object that is used in Experimentation. This context contains user and store dependent experiment result information, which is a randomly generated number used to determine the experimental element that will be converted to the control activity.
    See Also:
    Serialized Form
    • Field Detail

      • COPYRIGHT

        public static final java.lang.String COPYRIGHT
        IBM copyright notice field.
        See Also:
        Constant Field Values
      • CONTEXT_NAME

        public static final java.lang.String CONTEXT_NAME
        This is the name of the context.
        See Also:
        Constant Field Values
    • Constructor Detail

      • ExperimentContextImpl

        public ExperimentContextImpl()
        The default constructor for this class, a new java.util.HashMap object is created to store user-specific experiment results.
    • Method Detail

      • clearContext

        public void clearContext()
        This method clears the experiment context, it is called when the ContextSPI object is returned to their respective object pool. The purpose of this object is to reset the instance variables to its uninitialized values.
        Specified by:
        clearContext in class AbstractContextImpl
        See Also:
        AbstractContextImpl.clear()
      • copyContext

        public void copyContext(Context ctx)
        This method copies the content of the specified context to this context.
        Specified by:
        copyContext in interface Context
        Parameters:
        ctx - The context to be copied from.
      • getContextName

        public java.lang.String getContextName()
        This method returns the name of this context.
        Specified by:
        getContextName in interface Context
        Returns:
        The name of this context.
      • getExperimentResult

        public java.lang.Short getExperimentResult(java.lang.Integer experimentId)
        This method returns the result of the given experiment for the user who owns this context. Experiment result is a randomly generated number used to determine the experimental element that will be converted to the control activity.
        Specified by:
        getExperimentResult in interface ExperimentContext
        Parameters:
        experimentId - The ID of the experiment.
        Returns:
        The result of the given experiment.
      • getSessionId

        public java.lang.String getSessionId()
        This method returns the current session ID for the user who is accessing this context.
        Specified by:
        getSessionId in interface ExperimentContext
        Returns:
        The current session ID used specifically in marketing experimentation.
      • initializeContext

        public void initializeContext(com.ibm.commerce.component.contextservice.ActivityData initData)
                               throws BusinessContextException
        This initializes the context when the session is created.
        Overrides:
        initializeContext in class AbstractContextImpl
        Parameters:
        initData - The initialization data.
        Throws:
        BusinessContextException
        See Also:
        com.ibm.commerce.context.baseimpl.AbstractContextImpl#initialize(com.ibm.commerce.component.contextservice.ActivityData)
      • setExperimentResult

        public void setExperimentResult(java.lang.Integer experimentId,
                                        java.lang.Short newExperimentResult)
        This method sets the result of the given experiment for the user who owns this context. Experiment result is a randomly generated number used to determine the experimental element that will be converted to the control activity.
        Specified by:
        setExperimentResult in interface ExperimentContext
        Parameters:
        experimentId - The ID of the experiment.
        newExperimentResult - The result of the given experiment.
      • setSessionId

        public void setSessionId(java.lang.String newSessionId)
        This method sets the current session ID for the user who is accessing this context.
        Specified by:
        setSessionId in interface ExperimentContext
        Parameters:
        newSessionId - The current session ID used specifically in marketing experimentation.
      • toString

        public java.lang.String toString()
        This method returns the string representation of the object.
        Overrides:
        toString in class AbstractContextImpl
        Returns:
        The string representation of the object.