com.ibm.commerce.marketing.facade.server.commands

Class GetMarketingSpotDataCmdImpl

  • All Implemented Interfaces:
    BusinessObjectDocumentCmd, GetMarketingSpotDataCmd, 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 GetMarketingSpotDataCmdImpl
    extends AbstractGetBusinessObjectDocumentCmdImpl
    implements GetMarketingSpotDataCmd
    This command gets marketing spot data based on the search criteria and the access profile. The command will call the marketing runtime engine to get the resulting EMarketingSpotDataBeans, and call the appropriate web services to get the associated logical SDOs for the content. The method performExpression sets the response business object document.
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static java.lang.String DATA_TYPE_SEARCH_QUERY
      A constant representing the type of data returned by the search marketing activities in the e-Marketing spot.
      static java.lang.String FILTER_RESULTS
      The constant that the recommendation results should not be filtered.
      static java.lang.String NVP_KEY_DISPLAYSEQUENCE
      Constant for EMarketingSpotDataBean nvp for order of default content
      • Fields inherited from class com.ibm.websphere.command.TargetableCommandImpl

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

        serialVersionUID
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void addFilteredResult(EMarketingSpotDataBean emsDataBean)
      This method sets an EMarketingSpotDataBean object into the list that contains the information of results that were returned by the marketing engine to display in the e-Marketing Spot, but the result is not being returned because it was filtered out by the object's filter logic.
      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.util.List getEmsDataBeans()
      This method gets the List of EMarketingSpotDataBeans returned by the marketing runtime.
      java.lang.Integer getEmsId()
      This method gets the ID of the e-Marketing Spot.
      java.lang.String getEmsName()
      This method gets the name of the e-Marketing Spot.
      java.util.List getEmsTitleDataBeans()
      This method gets the List of EMarketingSpotDataBeans returned by the marketing runtime used for e-Marketing Spot title.
      CampaignInitiativeCache.CachedEMarketingSpot getESpot(java.lang.String emsName, java.lang.Integer storeId)
      This method gets the cached information of an e-Marketing Spot.
      CampaignInitiativeCache.CachedEMarketingSpot getESpot(java.lang.String emsName, java.lang.String usage, java.lang.Integer storeId)
      This method gets the cached information of an e-Marketing Spot.
      java.util.List getFilteredResults()
      This method gets the list of EMarketingSpotDataBean objects that contain the information of results that were returned by the marketing engine to display in the e-Marketing Spot, but the result is not being returned because it was filtered out by the object's filter logic.
      java.lang.String getMarketingSpotBehaviorFromServiceCall()
      This method gets the caching behavior for the associated e-Marketing Spot.
      MarketingSpotDataType getMarketingSpotDataType(java.lang.String emsName, java.lang.String usage, java.lang.Integer storeId, java.lang.String pznId)
      This method gets the MarketingSpotDataType object to return in the Get MarketingSpotData service call.
      java.util.List getPreviewReport()
      This method gets the list that will contain the information that can be used to understand the evaluation that occurred on an e-Marketing Spot.
      BusinessObjectDocumentType getResultBusinessObjectDocument()
      This method returns the response business object document.
      boolean getReturnDefaultContentOnly()
      This method gets the flag value to return default content only.
      ShowMarketingSpotDataType getShowMarketingSpotData()
      This method gets the ShowMarketingSpotDataType business object document result.
      java.lang.Integer getStoreId()
      This method gets the ID of the current store.
      java.lang.String getTriggerParameters()
      This method gets the trigger parameters passed in the service call.
      java.util.Map getTriggerParametersMap()
      This method gets the trigger parameters passed in the service call.
      java.util.List handleIdOnlyRequestForDefaultContent(java.util.List newEmsDataBeans)
      This method processes a List of EMarketingSpotDataBeans returned by the marketing runtime as the default content to display in the e-Marketing Spot.
      CampaignInitiativeCache.CachedEMarketingSpot handleNoExactMatchForSearchMarketingSpot(java.lang.String emsName, java.lang.String usage, java.lang.Integer storeId, java.lang.String pznId)
      This method returns the e-Marketing Spot object that corresponds to the e-Marketing Spot name used in the Get MarketingSpotData request.
      void setAdditionalParameter(java.lang.String paramName, java.lang.String paramValue)
      This method sets the value of an additional parameter used for evaluation of the e-Marketing Spot.
      void setEmsDataBeans(java.util.List newEmsDataBeans)
      This method sets the List of EMarketingSpotDataBeans returned by the marketing runtime.
      void setEmsId(java.lang.Integer newEmsId)
      This method sets the ID of the e-Marketing Spot.
      void setEmsName(java.lang.String newEmsName)
      This method sets the name of the e-Marketing Spot.
      void setEmsTitleDataBeans(java.util.List newEmsTitleDataBeans)
      This method sets the List of EMarketingSpotDataBeans returned by the marketing runtime used for e-Marketing Spot title.
      void setGetMarketingSpotData(GetMarketingSpotDataType getMarketingSpotData)
      This method sets the GetMarketingSpotDataType business object document that this command will process.
      void setMarketingSpotBehaviorFromServiceCall(java.lang.String behavior)
      This method sets the caching behavior for the associated e-Marketing Spot.
      void setPreviewReport(java.util.List newPreviewReport)
      This method sets the list that will contain the information that can be used to understand the evaluation that occurred on an e-Marketing Spot.
      void setRequestBusinessObjectDocument(BusinessObjectDocumentType businessObjectDocument)
      This method sets the business object document to process.
      void setReturnDefaultContentOnly(boolean newReturnDefaultContentOnly)
      This method sets the flag to return default content only
      void setStoreId(java.lang.Integer newStoreId)
      This method sets the ID of the current store.
      void setTriggerParameters(java.lang.String newTriggerParameters)
      This method sets the trigger parameters passed in the service call.
      • Methods inherited from class com.ibm.commerce.command.MeasuredCacheableCommandImpl

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

        executeFromCache, getCaller, getEntryInfo, getId, getObjectSize, getSharingPolicy, postExecute, preExecute, reset, 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.Command

        execute, isReadyToCallExecute, reset
      • Methods inherited from interface com.ibm.websphere.command.TargetableCommand

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

      • DATA_TYPE_SEARCH_QUERY

        public static final java.lang.String DATA_TYPE_SEARCH_QUERY
        A constant representing the type of data returned by the search marketing activities in the e-Marketing spot.
        See Also:
        Constant Field Values
      • FILTER_RESULTS

        public static final java.lang.String FILTER_RESULTS
        The constant that the recommendation results should not be filtered.
        See Also:
        Constant Field Values
      • NVP_KEY_DISPLAYSEQUENCE

        public static final java.lang.String NVP_KEY_DISPLAYSEQUENCE
        Constant for EMarketingSpotDataBean nvp for order of default content
        See Also:
        Constant Field Values
    • Constructor Detail

      • GetMarketingSpotDataCmdImpl

        public GetMarketingSpotDataCmdImpl()
        This method is the default constructor. It performs no actions.
    • Method Detail

      • getEmsDataBeans

        public java.util.List getEmsDataBeans()
        This method gets the List of EMarketingSpotDataBeans returned by the marketing runtime.
        Returns:
        This method returns the List of EMarketingSpotDataBeans returned by the marketing runtime.
      • setEmsDataBeans

        public void setEmsDataBeans(java.util.List newEmsDataBeans)
        This method sets the List of EMarketingSpotDataBeans returned by the marketing runtime.
        Parameters:
        newEmsDataBeans - The List of EMarketingSpotDataBeans returned by the marketing runtime.
      • getEmsTitleDataBeans

        public java.util.List getEmsTitleDataBeans()
        This method gets the List of EMarketingSpotDataBeans returned by the marketing runtime used for e-Marketing Spot title.
        Returns:
        This method returns the List of EMarketingSpotDataBeans returned by the marketing runtime used for e-Marketing Spot title.
      • setEmsTitleDataBeans

        public void setEmsTitleDataBeans(java.util.List newEmsTitleDataBeans)
        This method sets the List of EMarketingSpotDataBeans returned by the marketing runtime used for e-Marketing Spot title.
        Parameters:
        newEmsTitleDataBeans - The List of EMarketingSpotDataBeans returned by the marketing runtime used for e-Marketing Spot title.
      • handleIdOnlyRequestForDefaultContent

        public java.util.List handleIdOnlyRequestForDefaultContent(java.util.List newEmsDataBeans)
        This method processes a List of EMarketingSpotDataBeans returned by the marketing runtime as the default content to display in the e-Marketing Spot. If the e-Marketing Spot only wants the IDs of the data to be returned, then the EMarketingSpotDataBean is modified to specify that only the ID should be returned. This is done if DM_ReturnCatalogEntryId is true and there is CatalogEntry default content, when DM_ReturnCatalogGroupId is true and there is CatalogGroup default content, and when DM_ReturnMarketingContentId is true and there is MarketingContent default content.
        Parameters:
        newEmsDataBeans - The List of EMarketingSpotDataBeans returned by the marketing runtime.
        Returns:
        The list of EMarketingSpotDataBeans to display in the e-Marketing Spot. The types of the EMarketingSpotDataBeans may have been modified.
      • getTriggerParameters

        public java.lang.String getTriggerParameters()
        This method gets the trigger parameters passed in the service call. It is preferable to use the Map representation of the trigger parameters than the String representation.
        Returns:
        This method returns the trigger parameters passed in the service call.
      • getTriggerParametersMap

        public java.util.Map getTriggerParametersMap()
        This method gets the trigger parameters passed in the service call. It is preferable to use the Map representation of the trigger parameters than the String representation.
        Returns:
        This method returns the trigger parameters passed in the service call.
      • setTriggerParameters

        public void setTriggerParameters(java.lang.String newTriggerParameters)
        This method sets the trigger parameters passed in the service call. It is preferable to use the Map representation of the trigger parameters than the String representation. The parameters in the string will be decoded.
        Parameters:
        newTriggerParameters - The trigger parameters passed in the service call.
      • getStoreId

        public java.lang.Integer getStoreId()
        This method gets the ID of the current store.
        Returns:
        This method returns the ID of the current store.
      • setStoreId

        public void setStoreId(java.lang.Integer newStoreId)
        This method sets the ID of the current store.
        Parameters:
        newStoreId - The ID of the current store.
      • getEmsId

        public java.lang.Integer getEmsId()
        This method gets the ID of the e-Marketing Spot.
        Returns:
        This method returns the ID of the e-Marketing Spot.
      • setEmsId

        public void setEmsId(java.lang.Integer newEmsId)
        This method sets the ID of the e-Marketing Spot.
        Parameters:
        newEmsId - The ID of the e-Marketing Spot.
      • getEmsName

        public java.lang.String getEmsName()
        This method gets the name of the e-Marketing Spot.
        Returns:
        This method returns the ID of the e-Marketing Spot.
      • setEmsName

        public void setEmsName(java.lang.String newEmsName)
        This method sets the name of the e-Marketing Spot.
        Parameters:
        newEmsName - The name of the e-Marketing Spot.
      • getESpot

        public CampaignInitiativeCache.CachedEMarketingSpot getESpot(java.lang.String emsName,
                                                                     java.lang.Integer storeId)
        This method gets the cached information of an e-Marketing Spot.
        Parameters:
        emsName - The name of the e-Marketing Spot.
        storeId - The ID of the store.
        Returns:
        This method returns the cached information of an e-Marketing Spot.
      • getESpot

        public CampaignInitiativeCache.CachedEMarketingSpot getESpot(java.lang.String emsName,
                                                                     java.lang.String usage,
                                                                     java.lang.Integer storeId)
        This method gets the cached information of an e-Marketing Spot. There is special handling for extended sites. If the e-Marketing Spot exists in both an extended site and in an asset store with the same name, then the following ordering is used to determine the spot that is returned.
        • The extended site e-Marketing Spot has active activities.
        • The asset store e-Marketing Spot has active activities.
        • The extended site e-Marketing Spot has default content.
        • The asset store e-Marketing Spot has default content.
        Parameters:
        emsName - The name of the e-Marketing Spot.
        usage - The usage type of the e-Marketing Spot.
        storeId - The ID of the store.
        Returns:
        This method returns the cached information of an e-Marketing Spot.
      • handleNoExactMatchForSearchMarketingSpot

        public CampaignInitiativeCache.CachedEMarketingSpot handleNoExactMatchForSearchMarketingSpot(java.lang.String emsName,
                                                                                                     java.lang.String usage,
                                                                                                     java.lang.Integer storeId,
                                                                                                     java.lang.String pznId)
        This method returns the e-Marketing Spot object that corresponds to the e-Marketing Spot name used in the Get MarketingSpotData request. For search e-Marketing Spots, the e-Marketing Spot name is the search term entered by the customer. Before this method is called, the entire search term is checked for any defined search e-Marketing Spots. If no search e-Marketing Spot is found, then this method is called. This method has the following behavior: If the customer search term has multiple words, then iterate through each word, one at a time, starting with the first word. Check if the individual word has a defined search e-Marketing Spot. For each word that has a defined search e-Marketing Spot, then the associated search activities will be used. For example, there is a search activity defined for the keyword 'computer'. The customer is performing a search for 'laptop computer special'.
        • First check for search e-Marketing Spot for 'laptop computer special'.
        • If none found, first check for search e-Marketing Spot for 'laptop'.
        • Next check for search e-Marketing Spot for 'computer'.
        • A search e-Marketing Spot is found, so use the search activities associated with that e-Marketing Spot.
        • Next check for search e-Marketing Spot for 'special'.
        For a customization, you may want to change the behavior so that the match is not done on an individual keyword, but instead is on the entire search term. This method can be overridden to implement that behavior. In that scenario, the following three methods can be used:
        • MarketingEngineCache.singleton().getSearchEMarketingSpots(Integer storeId): Use this method to get the set of currently defined search e-Marketing Spots. You can go through the entire map and find the e-Marketing Spot that matches the customer search term according to the custom requirement.
        • MarketingEngineCache.singleton().getEmarketingSpot(String name, String usage, Integer storeId): Use this method to return the applicable e-Marketing Spot object.
        • foundMatchForMarketingSpot(eSpot, storeId, pznId): For each search e-Marketing Spot, call this method to call the search activities associated with this e-Marketing Spot.

        The following is an example of how to find matches where the desired search term (which is stored in the search e-Marketing Spot names) can be found anywhere in the customer's search term (which is the emsName parameter passed into this method).

                        CampaignInitiativeCache.CachedEMarketingSpot returnESpot = null;
                        Integer[] relatedStores = null;
                        try {
                                relatedStores = StoreUtil.getStorePath(storeId, MarketingMetadata.MARKETING_STORE_RELATIONSHIP);
                        } catch (Exception e) {
                                return null;
                        }
                        for (int i = 0; i < relatedStores.length; i++) {
                                Map storeSearchSpots = MarketingEngineCache.singleton().getSearchEMarketingSpots(relatedStores[i]);
                        Iterator storeSearchSpotsIterator = storeSearchSpots.keySet().iterator();
                        while (storeSearchSpotsIterator.hasNext()) {
                                String spotName = (String)storeSearchSpotsIterator.next();
                                if (emsName.contains(spotName)) {
                                        CampaignInitiativeCache.CachedEMarketingSpot eSpot = 
                                                MarketingEngineCache.singleton().getEmarketingSpot(spotName, usage, relatedStores[i]);
                                                if (eSpot != null) {
                                                        // found a partial match spot
                                                        foundMatchForMarketingSpot(eSpot, storeId, pznId);
                                                        returnESpot = eSpot;
                                                }
                                }
                        }
                        }
                        return returnESpot; 
         
        Parameters:
        emsName - The name of the e-Marketing Spot in the Get MarketingSpotData request.
        usage - The usage of the e-Marketing Spot in the Get MarketingSpotData request.
        storeId - The ID of the store.
        pznId - The customer's personalization ID.
        Returns:
        This method returns the e-Marketing Spot object for which to run the search activities. This method may use activities from several search e-Marketing, however, only one of the search e-Marketing Spots needs to be returned. If this method did not use activities from any search e-Marketing Spots, then null should be returned.
      • setGetMarketingSpotData

        public void setGetMarketingSpotData(GetMarketingSpotDataType getMarketingSpotData)
        This method sets the GetMarketingSpotDataType business object document that this command will process.
        Specified by:
        setGetMarketingSpotData in interface GetMarketingSpotDataCmd
        Parameters:
        getMarketingSpotData - The GetMarketingSpotDataType business object document.
      • setPreviewReport

        public void setPreviewReport(java.util.List newPreviewReport)
        This method sets the list that will contain the information that can be used to understand the evaluation that occurred on an e-Marketing Spot.
        Parameters:
        newPreviewReport - A list of strings. Each string has its own format of the data contained depending on the type of information being returned. See the constants defined in the class MarketingUtil that being with the text PREVIEW_REPORT_.
      • getFilteredResults

        public java.util.List getFilteredResults()
        This method gets the list of EMarketingSpotDataBean objects that contain the information of results that were returned by the marketing engine to display in the e-Marketing Spot, but the result is not being returned because it was filtered out by the object's filter logic.
        Returns:
        A list of EMarketingSpotDataBean objects.
      • addFilteredResult

        public void addFilteredResult(EMarketingSpotDataBean emsDataBean)
        This method sets an EMarketingSpotDataBean object into the list that contains the information of results that were returned by the marketing engine to display in the e-Marketing Spot, but the result is not being returned because it was filtered out by the object's filter logic.
        Parameters:
        emsDataBean - The EMarketingSpotDataBean object that is being filtered from display.
      • getPreviewReport

        public java.util.List getPreviewReport()
        This method gets the list that will contain the information that can be used to understand the evaluation that occurred on an e-Marketing Spot.
        Returns:
        A list of strings. Each string has its own format of the data contained depending on the type of information being returned. See the constants defined in the class MarketingUtil that being with the text PREVIEW_REPORT_.
      • 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.
      • setAdditionalParameter

        public void setAdditionalParameter(java.lang.String paramName,
                                           java.lang.String paramValue)
        This method sets the value of an additional parameter used for evaluation of the e-Marketing Spot.
        Parameters:
        paramName - The name of the parameter.
        paramValue - The value of the parameter.
      • setReturnDefaultContentOnly

        public void setReturnDefaultContentOnly(boolean newReturnDefaultContentOnly)
        This method sets the flag to return default content only
        Parameters:
        newReturnDefaultContentOnly - A boolean value.
      • getReturnDefaultContentOnly

        public boolean getReturnDefaultContentOnly()
        This method gets the flag value to return default content only.
        Returns:
        true or false
      • setMarketingSpotBehaviorFromServiceCall

        public void setMarketingSpotBehaviorFromServiceCall(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.
      • getMarketingSpotBehaviorFromServiceCall

        public java.lang.String getMarketingSpotBehaviorFromServiceCall()
        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.
      • getMarketingSpotDataType

        public MarketingSpotDataType getMarketingSpotDataType(java.lang.String emsName,
                                                              java.lang.String usage,
                                                              java.lang.Integer storeId,
                                                              java.lang.String pznId)
        This method gets the MarketingSpotDataType object to return in the Get MarketingSpotData service call. The following methods need to be called to process an e-Marketing Spot:
        1. getESpot - to get the e-Marketing Spot definition
        2. foundMatchForMarketingSpot - if the e-Marketing Spot exists, call the marketing engine to evaluate the web activities scheduled to the e-Marketing Spot
        3. getMarketingSpotDataObject - process the results returned from the marketing engine and create the SDOs to return
        Once valid results are found, return the result returned from getMarketingSpotDataObject. This method does the following:
        • Check if the e-Marketing Spot specified in the DM_EmsName parameter exists. If it exists, then see if it returns any results. If it returns results, then this method returns those results.
        • If the DM_EmsName spot did not exist, or did not return any results, check the e-Marketing Spot specified in the DM_EmsName1 parameter.
        • Continue this processing until results are found, incrementing the number appended to DM_EmsName, or until the DM_EmsNameX parameter is not specified.
        A customization can override this method to process one or more associated e-Marketing Spots.
        Parameters:
        emsName - The name of the e-Marketing Spot.
        usage - The usage type of the e-Marketing Spot.
        storeId - The ID of the store.
        pznId - The customer's personalization ID.
        Returns:
        This method returns the MarketingSpotDataType object returned from the getMarketingSpotDataObject method.