com.ibm.commerce.experimentation.commands

Class ExperimentBaseEvaluateCmdImpl

  • All Implemented Interfaces:
    com.ibm.commerce.command.CacheableECCommand, ECCommand, ECTargetableCommand, TaskCommand, ExperimentBaseEvaluateCmd, com.ibm.websphere.cache.Sizeable, com.ibm.websphere.command.CacheableCommand, com.ibm.websphere.command.Command, com.ibm.websphere.command.CommandCaller, com.ibm.websphere.command.TargetableCommand, java.io.Serializable


    public class ExperimentBaseEvaluateCmdImpl
    extends TaskCommandImpl
    implements ExperimentBaseEvaluateCmd
    This class implements the ExperimentBaseEvaluateCmd interface to provide the task command that contains common methods used in evaluation of experiments. This command is extended by a custom implementation for each type of store element, which is the object used to display content in the store front. An e-Marketing Spot is an example of a store element in which marketing content is delivered to customers.

    Functionalities provided by common methods implemented in this command include database operations on the EXPRESULT table, and result generation for experiments given their business rule definitions.

    See Also:
    Serialized Form
    • Field Detail

      • COPYRIGHT

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

        public static final int DEFAULT_FREQUENCY_SIZE
        Default size of display frequency in an experiment.
        See Also:
        Constant Field Values
    • Constructor Detail

      • ExperimentBaseEvaluateCmdImpl

        public ExperimentBaseEvaluateCmdImpl()
    • Method Detail

      • generateExperimentResult

        public java.lang.Short generateExperimentResult(ExperimentRuleDefinition ruleDefinition)
        This method returns the ID of a control or test element in the given rule definition object based on the comparison result between the element's display frequency and the randomly generated number.
        Specified by:
        generateExperimentResult in interface ExperimentBaseEvaluateCmd
        Parameters:
        ruleDefinition - An instance of com.ibm.commerce.tools.experimentation.ExperimentRuleDefinition object which contains the definition of experiment rule.
        Returns:
        The ID of the selected control or test element.
      • getExperimentResultFromDB

        public java.lang.Short getExperimentResultFromDB(java.lang.Integer experimentId,
                                                         java.lang.String sessionId)
        This method returns the ID of the control or test element to be returned as the result of the experiment evaluation from the database, based on the given experiment and session ID.
        Specified by:
        getExperimentResultFromDB in interface ExperimentBaseEvaluateCmd
        Parameters:
        experimentId - The ID of the experiment.
        sessionId - The ID of the current session.
        Returns:
        The ID of the control or test element to be returned as the result of the experiment evaluation.
      • getExperimentResultFromDB

        public java.lang.Short getExperimentResultFromDB(java.lang.Integer experimentId,
                                                         java.lang.Long userId,
                                                         java.lang.String sessionId,
                                                         boolean isUserFallBack)
        This method returns the ID of the control or test element to be returned as the result of the experiment evaluation from the database, based on the given experiment, and user or session, depending on the fallback flag.
        Specified by:
        getExperimentResultFromDB in interface ExperimentBaseEvaluateCmd
        Parameters:
        experimentId - The ID of the experiment.
        userId - The ID of the user.
        sessionId - The ID of the current session.
        isUserFallBack - True if the result will be found based on the session and use the user as fallback; false otherwise.
        Returns:
        The ID of the control or test element to be returned as the result of the experiment evaluation.
      • insertExperimentResultToDB

        public void insertExperimentResultToDB(java.lang.Integer experimentId,
                                               java.lang.Long userId,
                                               java.lang.String sessionId,
                                               java.lang.Short resultNumber)
        This method inserts a new record to the EXPRESULT table in the database which holds the experiment result uniquely identified by the experiment, session and user.
        Specified by:
        insertExperimentResultToDB in interface ExperimentBaseEvaluateCmd
        Parameters:
        experimentId - The ID of the experiment.
        userId - The ID of the user.
        sessionId - The ID of the current session.
        resultNumber - The ID of the selected control or test element.
      • performExecute

        public void performExecute()
                            throws ECException
        This method evaluates all of the currently active experiments that are scheduled to the given store element during the given time, and gathers all of the experiment results which can be accessed through parameters, by invoking the getPostInvokeParameters method in this command. By default, this method does not contain any logic, and command implementations for custom store element types should override this method to implement the logic accordingly.
        Specified by:
        performExecute in interface ECCommand
        Specified by:
        performExecute in interface com.ibm.websphere.command.TargetableCommand
        Overrides:
        performExecute in class AbstractECTargetableCommand
        Throws:
        ECException - Thrown whenever an exception occurs while parsing and evaluating the experiment rules.