com.ibm.commerce.marketing.commands.marketingspot

Class MarketingSpotCommandBaseTaskCmdImpl

  • java.lang.Object
    • com.ibm.websphere.command.TargetableCommandImpl
      • com.ibm.websphere.command.CacheableCommandImpl
        • com.ibm.commerce.command.MeasuredCacheableCommandImpl
          • com.ibm.commerce.marketing.commands.marketingspot.MarketingSpotCommandBaseTaskCmdImpl
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static java.lang.String COPYRIGHT
      IBM copyright notice field.
      • Fields inherited from class com.ibm.websphere.command.TargetableCommandImpl

        LOCAL
      • Fields inherited from interface com.ibm.websphere.command.Command

        serialVersionUID
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      java.lang.String getActiveOrg()
      This method gets the active organization in the session.
      java.lang.String[] getActivityId()
      This method returns the IDs of the activities associated with the loaded data.
      java.lang.String getAdditionalParameter(java.lang.String paramName)
      This method gets the value of an additional parameter used for evaluation of the e-Marketing Spot.
      java.util.Map<java.lang.String,java.lang.String> getAdditionalParameters()
      This method gets the map of additional parameters used for evaluation of the e-Marketing Spot.
      java.lang.String getCacheId()
      Returns the Dynamic Cache cache identifier or null if this command was not cached.
      java.lang.String getCatalogId()
      This method gets the current catalog set in the session.
      java.lang.String getContracts()
      This method gets the current contracts in the session.
      java.lang.String[] getDataType()
      This method returns the data types associated with the loaded data.
      java.lang.String[] getExperimentId()
      This method returns the IDs of the experiments associated with the loaded data.
      java.lang.String getLanguageId()
      This method gets the language ID in which the data should be retrieved.
      java.lang.String getMarketingSpotBehavior()
      This method gets the caching behavior for the associated e-Marketing Spot.
      java.lang.String[] getMemberGroups()
      This method gets the member groups to which the user explicitly belongs.
      java.lang.Long[] getMemberIdsForPersonalizationId()
      This method returns the set of member IDs associated with the customer.
      long getObjectSize()
      Returns the estimated footprint size in bytes of this object and the objects it contains.
      java.util.List getPreviewReport()
      This method gets the list of information about the activity evaluation on the e-Marketing Spot.
      java.lang.Integer getSpecificLanguageId()
      This method gets the language ID in which the data should be retrieved.
      java.lang.Integer getSpecificStoreeId()
      This method gets the store ID in which the data should be retrieved.
      java.lang.String[] getSpotCacheKey(EMarketingSpotDataBean[] spotDataBeans)
      This method generates a key to enable command caching.
      java.lang.String getStoreId()
      This method gets the store for which the data should be retrieved.
      java.lang.String[] getTestElementId()
      This method returns the IDs of the experiment test elements associated with the loaded data.
      boolean isCacheHit()
      Returns true if the setOutputProperties method was called.
      boolean isReadyToCallExecute()
      This method returns true.
      void performExecute()
      The business logic for the command.
      static void populateActivityData(BaseMarketingSpotActivityDataType marketingSpotObject, EMarketingSpotDataBean resultDataBean, MarketingFactory marketingFactory, CommerceFoundationFactory commerceFoundationFactory)
      This method populates the BaseMarketingSpotActivityDataType with the common activity, campaign, and experiment data.
      void populateUserData(BaseMarketingSpotActivityDataType marketingSpotObject, EMarketingSpotDataBean resultDataBean, MarketingFactory marketingFactory, CommerceFoundationFactory commerceFoundationFactory)
      This method should be implemented by customizations to add custom information to the BaseMarketingSpotActivityDataType SDO.
      void postExecute()
      This method is called by the Dynamic Cache when the execute method is called, and a cache miss occurs, after the performExecute method is called.
      boolean preExecute()
      This method is called by the Dynamic Cache when the execute method is called, and a cache miss occurs, before the performExecute method is called.
      java.util.ArrayList randomize(java.util.ArrayList arrayToRandomize, java.util.List priorityList, int totalPriority)
      Returns an array containing a randomized ordering of the items in the passed in array.
      void reset()
      Re-initializes the command for re-execution.
      void setAdditionalParameters(java.util.Map<java.lang.String,java.lang.String> newAdditionalParameters)
      This method sets any additional parameters used for evaluation of the e-Marketing Spot.
      void setMarketingSpotBehavior(java.lang.String behavior)
      This method sets the caching behavior for the associated e-Marketing Spot.
      void setOutputProperties(com.ibm.websphere.command.TargetableCommand fromCommand)
      Sets the output properties by copying them from another instance of this command.
      void setPreviewReport(java.util.List newPreviewReport)
      This method sets the list of information about the activity evaluation on the e-Marketing Spot.
      void setSpecificLanguageId(java.lang.Integer langId)
      This method sets the language ID in which the data should be retrieved.
      void setSpecificStoreId(java.lang.Integer storeId)
      This method sets the store ID in which the data should be retrieved.
      • Methods inherited from class com.ibm.commerce.command.MeasuredCacheableCommandImpl

        execute
      • Methods inherited from class com.ibm.websphere.command.CacheableCommandImpl

        executeFromCache, getCaller, getEntryInfo, getId, getSharingPolicy, setCaller, setObjectSize, unionDependencies, updateCache
      • Methods inherited from class com.ibm.websphere.command.TargetableCommandImpl

        getCommandTarget, getCommandTargetName, getTargetPolicy, hasOutputProperties, setCommandTarget, setCommandTargetName, setHasOutputProperties, setTargetPolicy
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface com.ibm.websphere.command.TargetableCommand

        getCommandTarget, getCommandTargetName, hasOutputProperties, setCommandTarget, setCommandTargetName
    • Field Detail

      • COPYRIGHT

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

      • MarketingSpotCommandBaseTaskCmdImpl

        public MarketingSpotCommandBaseTaskCmdImpl()
    • Method Detail

      • isReadyToCallExecute

        public boolean isReadyToCallExecute()
        This method returns true.
        Specified by:
        isReadyToCallExecute in interface com.ibm.websphere.command.Command
        Specified by:
        isReadyToCallExecute in class com.ibm.websphere.command.TargetableCommandImpl
        Returns:
        This method returns true.
      • getObjectSize

        public long getObjectSize()
        Returns the estimated footprint size in bytes of this object and the objects it contains.
        Specified by:
        getObjectSize in interface com.ibm.websphere.cache.Sizeable
        Overrides:
        getObjectSize in class com.ibm.websphere.command.CacheableCommandImpl
        Returns:
        the estimated footprint size in bytes or -1 if a size cannot be determined.
      • setPreviewReport

        public void setPreviewReport(java.util.List newPreviewReport)
        This method sets the list of information about the activity evaluation on the e-Marketing Spot.
        Parameters:
        newPreviewReport - A list of information about the activity evaluation on the e-Marketing Spot.
      • getPreviewReport

        public java.util.List getPreviewReport()
        This method gets the list of information about the activity evaluation on the e-Marketing Spot.
        Returns:
        A list of information about the activity evaluation on the e-Marketing Spot..
      • setAdditionalParameters

        public void setAdditionalParameters(java.util.Map<java.lang.String,java.lang.String> newAdditionalParameters)
        This method sets any additional parameters used for evaluation of the e-Marketing Spot.
        Parameters:
        newAdditionalParameters - A map of additional parameters used for evaluation of the e-Marketing Spot.
      • getAdditionalParameters

        public java.util.Map<java.lang.String,java.lang.String> getAdditionalParameters()
        This method gets the map of additional parameters used for evaluation of the e-Marketing Spot.
        Returns:
        A map of additional parameters used for evaluation of the e-Marketing Spot.
      • getAdditionalParameter

        public java.lang.String getAdditionalParameter(java.lang.String paramName)
        This method gets the value of an additional parameter used for evaluation of the e-Marketing Spot.
        Parameters:
        paramName - The name of the parameter.
        Returns:
        The value of an additional parameter used for evaluation of the e-Marketing Spot.
      • reset

        public void reset()
        Re-initializes the command for re-execution. Call this method before preparing it for re-execution (for example, by setting its properties).
        Specified by:
        reset in interface com.ibm.websphere.command.Command
        Overrides:
        reset in class com.ibm.websphere.command.CacheableCommandImpl
        See Also:
        Command.reset()
      • preExecute

        public boolean preExecute()

        This method is called by the Dynamic Cache when the execute method is called, and a cache miss occurs, before the performExecute method is called.

        Specified by:
        preExecute in interface com.ibm.websphere.command.CacheableCommand
        Overrides:
        preExecute in class com.ibm.websphere.command.CacheableCommandImpl
        Returns:
        true implies that the command's execution should be terminated, so the performExecute, postExecute and setCommand will not happen.
        See Also:
        CacheableCommand.preExecute()
      • performExecute

        public void performExecute()
                            throws java.lang.Exception

        The business logic for the command.

        This method is intended to be called by the cacheable command framework. Do not call this method directly.

        Specified by:
        performExecute in interface com.ibm.websphere.command.TargetableCommand
        Specified by:
        performExecute in class com.ibm.websphere.command.TargetableCommandImpl
        Throws:
        java.lang.Exception
        See Also:
        TargetableCommand.performExecute()
      • postExecute

        public void postExecute()

        This method is called by the Dynamic Cache when the execute method is called, and a cache miss occurs, after the performExecute method is called.

        Specified by:
        postExecute in interface com.ibm.websphere.command.CacheableCommand
        Overrides:
        postExecute in class com.ibm.websphere.command.CacheableCommandImpl
        See Also:
        CacheableCommand.postExecute()
      • isCacheHit

        public final boolean isCacheHit()
        Returns true if the setOutputProperties method was called.
        Returns:
        true if the setOutputProperties method was called.
      • getCacheId

        public final java.lang.String getCacheId()
        Returns the Dynamic Cache cache identifier or null if this command was not cached.
        Returns:
        the Dynamic Cache identifier, or null.
      • setOutputProperties

        public void setOutputProperties(com.ibm.websphere.command.TargetableCommand fromCommand)

        Sets the output properties by copying them from another instance of this command.

        This method is intended to be called by the cacheable command framework. Do not call this method directly.

        Specified by:
        setOutputProperties in interface com.ibm.websphere.command.TargetableCommand
        Overrides:
        setOutputProperties in class com.ibm.websphere.command.TargetableCommandImpl
        See Also:
        TargetableCommand.setOutputProperties(com.ibm.websphere.command.TargetableCommand)
      • getSpotCacheKey

        public java.lang.String[] getSpotCacheKey(EMarketingSpotDataBean[] spotDataBeans)
        This method generates a key to enable command caching.
        Parameters:
        spotDataBeans - The data beans from which to create the cache key.
        Returns:
        This method returns a key to enable command caching.
      • getActivityId

        public java.lang.String[] getActivityId()
        This method returns the IDs of the activities associated with the loaded data.
        Returns:
        This method returns a string array of activity IDs.
      • getDataType

        public java.lang.String[] getDataType()
        This method returns the data types associated with the loaded data.
        Returns:
        This method returns a string array of data types. This is one of the defined types in EMarketingSpotDataBean.
      • getExperimentId

        public java.lang.String[] getExperimentId()
        This method returns the IDs of the experiments associated with the loaded data.
        Returns:
        This method returns a string array of experiment IDs.
      • getTestElementId

        public java.lang.String[] getTestElementId()
        This method returns the IDs of the experiment test elements associated with the loaded data.
        Returns:
        This method returns a string array of test element IDs.
      • getContracts

        public java.lang.String getContracts()
        This method gets the current contracts in the session. This method is used for generating the appropriate cache key for the marketing spot commands.
        Returns:
        This method returns a string representing the current contracts in the session.
      • getStoreId

        public java.lang.String getStoreId()
        This method gets the store for which the data should be retrieved. If the specific store was set, then that store ID is returned. If the specific store was not set, then this method will return the current store set in the session. This method is used for generating the appropriate cache key for the marketing spot commands.
        Returns:
        This method returns a string representing the current store set in the session.
      • setSpecificLanguageId

        public void setSpecificLanguageId(java.lang.Integer langId)
        This method sets the language ID in which the data should be retrieved. This is currently only supported by the RetrieveContentTaskCmd. If the specific language is not set, then the language in the current context is used.
        Parameters:
        langId - The language ID of the language in which to retrieve the data.
      • getSpecificLanguageId

        public java.lang.Integer getSpecificLanguageId()
        This method gets the language ID in which the data should be retrieved. This is currently only supported by the RetrieveContentTaskCmd. If the specific language is not set, then the language in the current context is used.
        Returns:
        The language ID of the specific language in which to retrieve the data.
      • setSpecificStoreId

        public void setSpecificStoreId(java.lang.Integer storeId)
        This method sets the store ID in which the data should be retrieved. This is currently only supported by the RetrieveContentTaskCmd. If the specific store is not set, then the store in the current context is used.
        Parameters:
        storeId - The store ID of the store in which to retrieve the data.
      • getSpecificStoreeId

        public java.lang.Integer getSpecificStoreeId()
        This method gets the store ID in which the data should be retrieved. This is currently only supported by the RetrieveContentTaskCmd. If the specific store is not set, then the store in the current context is used.
        Returns:
        The store ID of the specific store in which to retrieve the data.
      • setMarketingSpotBehavior

        public void setMarketingSpotBehavior(java.lang.String behavior)
        This method sets the caching behavior for the associated e-Marketing Spot.
        Parameters:
        behavior - Set a value of 1 if the e-Marketing Spot is dynamic, and a value of 0 if it is static.
      • getMarketingSpotBehavior

        public java.lang.String getMarketingSpotBehavior()
        This method gets the caching behavior for the associated e-Marketing Spot.
        Returns:
        This method returns a value of 1 if the e-Marketing Spot is dynamic, and a value of 0 if it is static.
      • getLanguageId

        public java.lang.String getLanguageId()
        This method gets the language ID in which the data should be retrieved. If the specific language was set, then that language ID is returned. If the specific language was not set, then this method will return the current language set in the session. This method is used for generating the appropriate cache key for the marketing spot commands.
        Returns:
        This method returns a string representing the language in which the data should be retrieved.
      • getCatalogId

        public java.lang.String getCatalogId()
        This method gets the current catalog set in the session. This method is used for generating the appropriate cache key for the marketing spot commands.
        Returns:
        This method returns a string representing the current catalog set in the session.
      • getActiveOrg

        public java.lang.String getActiveOrg()
        This method gets the active organization in the session. This method is used for generating the appropriate cache key for the marketing spot commands.
        Returns:
        This method returns a string representing the active organization in the session.
      • getMemberGroups

        public java.lang.String[] getMemberGroups()
        This method gets the member groups to which the user explicitly belongs. This method is used for generating the appropriate cache key for the marketing spot commands.
        Returns:
        This method returns a string array representing the member groups to which the user explicitly belongs.
      • randomize

        public java.util.ArrayList randomize(java.util.ArrayList arrayToRandomize,
                                             java.util.List priorityList,
                                             int totalPriority)
        Returns an array containing a randomized ordering of the items in the passed in array.
        Parameters:
        arrayToRandomize - the array containing the items to randomize.
        priorityList - a list of priorities that represent the weight each item has when being ordered. The higher the weight the greater the chance of the item being selected over those items with lower weight.
        totalPriority - the sum of all priority weightings in priorityVector.
        Returns:
        The new array containing all of the original array's items in a weighted random order.
      • populateUserData

        public void populateUserData(BaseMarketingSpotActivityDataType marketingSpotObject,
                                     EMarketingSpotDataBean resultDataBean,
                                     MarketingFactory marketingFactory,
                                     CommerceFoundationFactory commerceFoundationFactory)
        This method should be implemented by customizations to add custom information to the BaseMarketingSpotActivityDataType SDO. This method is called by RetrieveCatalogEntryCmdImpl, RetrieveCategoryCmdImpl, and RetrieveContentCmdImpl. The default implementation does nothing. As an example of a customization, the following code illustrates how to add the activity description to the data returned to the e-Marketing Spot for a catalog entry. In an extension to the RetrieveCatalogEntryCmdImpl command, the following method is implemented.
                        public void populateUserData(BaseMarketingSpotActivityDataType marketingSpotObject, 
                                EMarketingSpotDataBean resultDataBean,
                                MarketingFactory marketingFactory, CommerceFoundationFactory commerceFoundationFactory) {
        
                        if (marketingSpotObject.getUserData() == null) {
                                marketingSpotObject.setUserData(commerceFoundationFactory.createUserDataType());
                        }
                        marketingSpotObject.getUserData().getUserDataField().put("ActivityDescription", 
                                        MarketingEngineCache.singleton().getActivity(resultDataBean.getActivityId()).getDescription());
        
                }
         
        In the store e-Marketing Spot JSP snippet, the activity description can be retrieved as follows: ${marketingSpotData.userData.userDataField['ActivityDescription']}
        Parameters:
        marketingSpotObject - The BaseMarketingSpotActivityDataType object to return to the e-Marketing Spot.
        resultDataBean - The EMarketingSpotDataBean returned from the marketing runtime.
        marketingFactory - The factory used to create objects defined by Marketing.
        commerceFoundationFactory - The factory used to create objects defined by the Commerce Foundation.
      • populateActivityData

        public static void populateActivityData(BaseMarketingSpotActivityDataType marketingSpotObject,
                                                EMarketingSpotDataBean resultDataBean,
                                                MarketingFactory marketingFactory,
                                                CommerceFoundationFactory commerceFoundationFactory)
        This method populates the BaseMarketingSpotActivityDataType with the common activity, campaign, and experiment data.
        Parameters:
        marketingSpotObject - The BaseMarketingSpotActivityDataType object to return to the eMarketing Spot.
        resultDataBean - The EMarketingSpotDataBean returned from the marketing runtime.
        marketingFactory - The factory used to create objects defined by Marketing.
        commerceFoundationFactory - The factory used to create objects defined by the Commerce Foundation.
      • getMemberIdsForPersonalizationId

        public java.lang.Long[] getMemberIdsForPersonalizationId()
        This method returns the set of member IDs associated with the customer. The member IDs are retrieved from the member ID in the customer's trigger parameters along with the member IDs associated with the customer's personalization ID.
        Returns:
        This method returns an array of member IDs associated with the a customer.