com.ibm.commerce.marketing.dialog.util

Class MarketingServicesTaskCmdImpl

  • All Implemented Interfaces:
    com.ibm.commerce.command.CacheableECCommand, ECCommand, ECTargetableCommand, TaskCommand, MarketingServicesTaskCmd, 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 MarketingServicesTaskCmdImpl
    extends TaskCommandImpl
    implements MarketingServicesTaskCmd
    The class is used to customize the behavior of the marketing services storefront functionality.
    See Also:
    Serialized Form
    • Field Detail

      • COPYRIGHT

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

        public static final java.lang.String CLASSNAME
        The name of this class.
        See Also:
        Constant Field Values
    • Constructor Detail

      • MarketingServicesTaskCmdImpl

        public MarketingServicesTaskCmdImpl()
    • Method Detail

      • adjustServerTime

        public java.sql.Timestamp adjustServerTime(java.sql.Timestamp time,
                                                   java.lang.Integer storeId)
        This method is called by the marketing services when it needs to check the current time against the start and end times of an activity to determine if the activity is currently applicable. The current server or preview time is passed to this method, and this method can adjust the time if necessary. For example, if you know that the server is in one time zone, and the web store is in a different time zone, this method could adjust the time based on the offset between the server's time zone and the store's time zone.
        Specified by:
        adjustServerTime in interface MarketingServicesTaskCmd
        Parameters:
        time - The current server or preview time.
        storeId - The identifier of the current store.
        Returns:
        The time to use when comparing to the activity start and end time. If the time does not need to be adjusted, then return the time passed to this method. The default implementation of this method returns the time passed into this method.
      • getTime

        public java.sql.Timestamp getTime(Activity activity,
                                          java.sql.Timestamp time)
        This method is called by the marketing services to get the time used to check if an activity is currently applicable on an e-Marketing Spot based on the activity start and end times. Return a different time if you do not want the check to be against the current time, for example, if you want the check to be against the order delivery date.
        Specified by:
        getTime in interface MarketingServicesTaskCmd
        Parameters:
        activity - The marketing activity.
        time - The current server or preview time.
        Returns:
        The time to use when comparing to the activity start and end time. If the time does not need to be adjusted, then return the time passed to this method. The default implementation of this method returns the time passed into this method.
      • getPersonalizationId

        public java.lang.String getPersonalizationId(java.lang.StringBuffer triggerParameters)
        This method is called by the marketing services when the Get MarketingSpotData or Process MarketingTrigger services are called. This method can be used by a customization to determine the correct personalization ID to use during the service call. If these services are called by an external system, the external system may not know the customer's personalization ID. However, other information is known that will allow the marketing services to identify the customer (for example, the customer's logon ID, member ID, home phone number, or mobile number). This method can use the information in the service call trigger parameters to determine the appropriate personalization ID.

        Example 1:
        The external system knows the customer's commerce logon ID. The following service is called, and the parameter wclogonid is added to the call.
        MarketingTriggerProcessServiceEvaluate?DM_ReqCmd=SocialCommerceInteraction?type=blog&wclogonid=customer1
        The implementation of this method could do the following:

                        String pznId = null;
                        try {
                                String logonId = MarketingUtil.getDataFromTriggerParametersString(triggerParameters.toString(), "wclogonid");
                                if (logonId != null) {
                                        UserAccessBean uab = UserCache.findByUniqueIdentifier(logonId);
                                        if (uab != null) {
                                                pznId = uab.getPersonalizationId();
                                        }
                                }
                        } catch (Exception e) {
                                // trace
                        }
                        return pznId; 
         

        Example 2:
        The external system knows the customer's commerce member ID. The following service is called, and the parameter wcmemberid is added to the call.
        MarketingTriggerProcessServiceEvaluate?DM_ReqCmd=SocialCommerceInteraction?type=blog&wcmemberid=12345
        The implementation of this method could do the following:

                        String pznId = null;
                        try {
                                String memberId = MarketingUtil.getDataFromTriggerParametersString(triggerParameters.toString(), "wcmemberid");
                                if (memberId != null) {
                                        UserAccessBean uab = UserCache.findByPrimaryKey(memberId);
                                        if (uab != null) {
                                                pznId = uab.getPersonalizationId();
                                        }
                                }
                        } catch (Exception e) {
                                // trace
                        }
                        return pznId;  
         
        Specified by:
        getPersonalizationId in interface MarketingServicesTaskCmd
        Parameters:
        triggerParameters - The trigger parameters passed in the service call. Custom information added to the trigger parameters can be used to determine the appropriate personalization ID.
        Returns:
        The personalization ID to use in the service call. If the personalization ID cannot be determined, then this method should return null. The default implementation of this method does nothing and returns null.
      • getParentCatalogEntryOfCatalogEntry

        public java.lang.String getParentCatalogEntryOfCatalogEntry(java.lang.String storeId,
                                                                    java.lang.String childCatalogEntryId)
                                                             throws CatalogEntryException
        This method gets the parent catalog entry of a child catalog entry. If the provided catalog entry is already a product, then the provided catalog entry is returned. This method uses the Catalog services to retrieve the required data.
        Specified by:
        getParentCatalogEntryOfCatalogEntry in interface MarketingServicesTaskCmd
        Parameters:
        storeId - The store ID.
        childCatalogEntryId - The ID of the catalog entry for which to get the parent catalog entry.
        Returns:
        This method returns the ID of the parent catalog entry for an item, or the provided catalog entry ID if it is a product.
        Throws:
        CatalogEntryException