com.ibm.commerce.tools.campaigns

Class CampaignUtil

  • java.lang.Object
    • com.ibm.commerce.tools.campaigns.CampaignUtil


  • public class CampaignUtil
    extends java.lang.Object
    The CampaignUtil class provides some utility methods that are used by campaigns.
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static java.lang.String COPYRIGHT
      Copyright.
    • Constructor Summary

      Constructors 
      Constructor and Description
      CampaignUtil() 
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static java.lang.String[] getActivityViewByStoreType(java.lang.String storeType)
      This method returns all activity views that a store with the given store type is allowed to access.
      static java.lang.Integer getCalcodeIdByIdentifier(java.lang.String calcodeCode, java.lang.Integer calcodeUsage, java.lang.Integer storeId)
      This method returns the calculation code ID given the code, usage and store ID.
      static java.lang.Long[] getCatalogMemberIds(java.lang.Integer storeId)
      This method returns all the catalog member IDs in the store path given the current store ID.
      static java.lang.Long getCatentryIdByPartNumber(java.lang.String partNumber, java.lang.Integer storeId)
      This method returns the catalog entry ID given the catalog entry part number and the current store ID.
      static java.lang.Long getCatentryIdByPartNumber(java.lang.String partNumber, java.lang.String DN)
      This method returns the catalog entry ID given the catalog entry part number and the organization distinguish name.
      static java.lang.Long getCatgroupIdByIdentifier(java.lang.String identifier, java.lang.Integer storeId)
      This method returns the catalog group ID given the catalog group identifier and the current store ID.
      static java.lang.Long getCatgroupIdByIdentifier(java.lang.String identifier, java.lang.String DN)
      This method returns the catalog group ID given the catalog group identifier and the organization distinguish name.
      static java.lang.String getCatgroupIdentifierById(java.lang.Long catgroupId)
      This method returns the catalog group identifier given the catalog group ID.
      static java.util.Vector getChildCatgroupIdsByParentCatgroupId(java.lang.Long catgroupId, java.util.Vector currentList)
      This method returns all the child catalog groups in all levels of the given parent catalog group.
      static java.lang.Integer getLanguageIdFromLocaleName(java.lang.String localeName)
      The getLanguageIdFromLocaleName method takes the locale, and returns the relative language ID.
      static java.lang.String getLocaleNameFromLanguageId(java.lang.String languageId)
      The getLocaleNameFromLanguageId method takes the language ID, and returns the relative locale name.
      static java.lang.String[] getPromotionByInitiativeId(java.lang.Integer initiativeId, java.lang.Integer storeId)
      This method gets the promotion usage, name and code that is associated with the given initiative.
      static java.lang.String[] getPromotionByInitiativeRule(com.ibm.commerce.rule.Rule initiativeRule, java.lang.Integer storeId)
      This method gets the promotion usage, name and code that is associated with the given initiative rule.
      static java.lang.Integer getPromotionIdByInitiativeRule(com.ibm.commerce.rule.Rule initiativeRule, java.lang.Integer storeId)
      This method parses an initiative rule and gets the ID of promotion if the displaying content of the given initiative is a promotion.
      static java.lang.Integer getStoreIdByIdentifier(java.lang.String storeIdentifier, java.lang.String DN)
      This method returns the store entity ID given the store identifier and member distinguish name.
      static boolean isEmsEditable(java.lang.String storeType)
      This method determines whether e-Marketing Spot is editable or not, given the current store type.
      static boolean isItemsRelated(com.ibm.commerce.catalog.beans.CatalogEntryDataBean itemDataBean1, com.ibm.commerce.catalog.beans.CatalogEntryDataBean itemDataBean2)
      This method determines whether the two given items are related to the same product.
      static boolean isItemsRelated(com.ibm.commerce.catalog.beans.ItemDataBean itemDataBean1, com.ibm.commerce.catalog.beans.ItemDataBean itemDataBean2)
      This method determines whether the two given items are related to the same product.
      static boolean isProductItemRelated(com.ibm.commerce.catalog.beans.CatalogEntryDataBean productDataBean, com.ibm.commerce.catalog.beans.CatalogEntryDataBean itemDataBean)
      This method determines whether the given item belongs to the given product.
      static boolean isProductItemRelated(com.ibm.commerce.catalog.beans.ProductDataBean productDataBean, com.ibm.commerce.catalog.beans.ItemDataBean itemDataBean)
      This method determines whether the given item belongs to the given product.
      static boolean isPromotionAccessible(java.lang.String storeType)
      This method determines whether campaign can access promotion or not, given the current store type.
      static java.lang.String normalizeStringDate(java.lang.String stringDate)
      The normalizeStringDate method takes the date in string format, and normalize it.
      static java.lang.String stripBrackets(java.lang.String s)
      The stripBrackets method takes the string, and removes its bracket wrapped around it.
      static java.lang.String stripQuotes(java.lang.String s)
      The stripQuotes method takes the string, and removes its quotes wrapped around it.
      static java.lang.String stripSingleQuotes(java.lang.String s)
      The stripSingleQuotes method takes the string, and removes its single quotes wrapped around it.
      static java.lang.String substitute(java.lang.String message, int arg1)
      Substitutes message parameters with arguments.
      static java.lang.String substitute(java.lang.String message, int arg1, int arg2)
      Substitutes message parameters with arguments.
      static java.lang.String substitute(java.lang.String message, java.lang.Object[] arguments)
      Substitutes message parameters with arguments.
      static java.lang.String substitute(java.lang.String message, java.lang.String arg1)
      Substitutes message parameters with arguments.
      static java.lang.String substitute(java.lang.String message, java.lang.String arg1, java.lang.String arg2)
      Substitutes message parameters with arguments.
      static java.math.BigDecimal toBigDecimal(java.lang.String value)
      Converts a string value to BigDecimal.
      static boolean toBoolean(java.lang.String value)
      Converts a string value to boolean.
      static java.lang.Integer toInteger(java.lang.String value)
      Converts a string value to Ingeger.
      static java.lang.Long toLong(java.lang.String value)
      Converts a string value to Long.
      static java.util.Vector toVector(java.lang.Object value)
      Converts an object to a Vector.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

    • Constructor Detail

      • CampaignUtil

        public CampaignUtil()
    • Method Detail

      • getActivityViewByStoreType

        public static java.lang.String[] getActivityViewByStoreType(java.lang.String storeType)
        This method returns all activity views that a store with the given store type is allowed to access.
        Parameters:
        storeType - A constant value that indicates the type of the store.
        Returns:
        All activity views that a store with the given store type is allowed to access.
      • getCalcodeIdByIdentifier

        public static java.lang.Integer getCalcodeIdByIdentifier(java.lang.String calcodeCode,
                                                                 java.lang.Integer calcodeUsage,
                                                                 java.lang.Integer storeId)
        This method returns the calculation code ID given the code, usage and store ID.
        Parameters:
        calcodeCode - The string that identifies the calculation code.
        calcodeUsage - The usage of the calculation code.
        storeId - ID of the store which the calculation code belongs to.
        Returns:
        ID of the calculation code.
      • getCatalogMemberIds

        public static java.lang.Long[] getCatalogMemberIds(java.lang.Integer storeId)
        This method returns all the catalog member IDs in the store path given the current store ID.
        Parameters:
        storeId - ID of the current store.
        Returns:
        All the catalog member IDs in the store path.
      • getCatentryIdByPartNumber

        public static java.lang.Long getCatentryIdByPartNumber(java.lang.String partNumber,
                                                               java.lang.Integer storeId)
        This method returns the catalog entry ID given the catalog entry part number and the current store ID.
        Parameters:
        partNumber - The part number of the catalog entry.
        storeId - ID of the current store.
        Returns:
        ID of the catalog entry.
      • getCatentryIdByPartNumber

        public static java.lang.Long getCatentryIdByPartNumber(java.lang.String partNumber,
                                                               java.lang.String DN)
        This method returns the catalog entry ID given the catalog entry part number and the organization distinguish name.
        Parameters:
        partNumber - The part number of the catalog entry.
        DN - The distinguish name of the organization which owns the catalog entry.
        Returns:
        ID of the catalog entry.
      • getCatgroupIdByIdentifier

        public static java.lang.Long getCatgroupIdByIdentifier(java.lang.String identifier,
                                                               java.lang.Integer storeId)
        This method returns the catalog group ID given the catalog group identifier and the current store ID.
        Parameters:
        identifier - The identifier of the catalog group.
        storeId - ID of the current store.
        Returns:
        ID of the catalog group.
      • getCatgroupIdByIdentifier

        public static java.lang.Long getCatgroupIdByIdentifier(java.lang.String identifier,
                                                               java.lang.String DN)
        This method returns the catalog group ID given the catalog group identifier and the organization distinguish name.
        Parameters:
        identifier - The identifier of the catalog group.
        DN - The distinguish name of the organization which owns the catalog group.
        Returns:
        ID of the catalog group.
      • getCatgroupIdentifierById

        public static java.lang.String getCatgroupIdentifierById(java.lang.Long catgroupId)
        This method returns the catalog group identifier given the catalog group ID.
        Parameters:
        catgroupId - ID of the catalog group.
        Returns:
        The identifier of the catalog group.
      • getChildCatgroupIdsByParentCatgroupId

        public static java.util.Vector getChildCatgroupIdsByParentCatgroupId(java.lang.Long catgroupId,
                                                                             java.util.Vector currentList)
        This method returns all the child catalog groups in all levels of the given parent catalog group.
        Parameters:
        catgroupId - ID of the parent catalog group.
        currentList - List that holds the currently found child catalog groups.
        Returns:
        List of all the child catalog groups of the given parent catalog group.
      • getLanguageIdFromLocaleName

        public static java.lang.Integer getLanguageIdFromLocaleName(java.lang.String localeName)
        The getLanguageIdFromLocaleName method takes the locale, and returns the relative language ID.
        Parameters:
        localeName - The name of the locale.
        Returns:
        The language ID of the specified locale.
      • getLocaleNameFromLanguageId

        public static java.lang.String getLocaleNameFromLanguageId(java.lang.String languageId)
        The getLocaleNameFromLanguageId method takes the language ID, and returns the relative locale name.
        Parameters:
        languageId - The language ID.
        Returns:
        The name of the locale of the specified language ID.
      • getPromotionByInitiativeId

        public static java.lang.String[] getPromotionByInitiativeId(java.lang.Integer initiativeId,
                                                                    java.lang.Integer storeId)
        This method gets the promotion usage, name and code that is associated with the given initiative.
        Parameters:
        initiativeId - ID of the initiative.
        storeId - ID of the current store.
        Returns:
        The promotion data that is associated with the given initiative.
      • getPromotionByInitiativeRule

        public static java.lang.String[] getPromotionByInitiativeRule(com.ibm.commerce.rule.Rule initiativeRule,
                                                                      java.lang.Integer storeId)
        This method gets the promotion usage, name and code that is associated with the given initiative rule.
        Parameters:
        initiativeRule - Rule of the initiative.
        storeId - ID of the current store.
        Returns:
        The promotion data that is associated with the given initiative.
      • getPromotionIdByInitiativeRule

        public static java.lang.Integer getPromotionIdByInitiativeRule(com.ibm.commerce.rule.Rule initiativeRule,
                                                                       java.lang.Integer storeId)
        This method parses an initiative rule and gets the ID of promotion if the displaying content of the given initiative is a promotion.
        Parameters:
        initiativeRule - An instance of the initiative rule object.
        storeId - ID of the current store.
        Returns:
        Promotion ID.
      • getStoreIdByIdentifier

        public static java.lang.Integer getStoreIdByIdentifier(java.lang.String storeIdentifier,
                                                               java.lang.String DN)
        This method returns the store entity ID given the store identifier and member distinguish name.
        Parameters:
        storeIdentifier - Identifier of the store.
        DN - The distinguish name of the organization which owns the store.
        Returns:
        ID of the store.
      • isEmsEditable

        public static boolean isEmsEditable(java.lang.String storeType)
        This method determines whether e-Marketing Spot is editable or not, given the current store type.
        Parameters:
        storeType - A constant value that indicates the type of the store.
        Returns:
        True if e-Marketing Spot is editable in the stores of which the type is the same as the given store type; false otherwise.
      • isItemsRelated

        public static boolean isItemsRelated(com.ibm.commerce.catalog.beans.CatalogEntryDataBean itemDataBean1,
                                             com.ibm.commerce.catalog.beans.CatalogEntryDataBean itemDataBean2)
        This method determines whether the two given items are related to the same product.
        Parameters:
        itemDataBean1 - The first item to be evaluated, represented by CatalogEntryDataBean.
        itemDataBean2 - The second item to be evaluated, represented by CatalogEntryDataBean.
        Returns:
        True if the two given items are related to the same product; false otherwise.
      • isItemsRelated

        public static boolean isItemsRelated(com.ibm.commerce.catalog.beans.ItemDataBean itemDataBean1,
                                             com.ibm.commerce.catalog.beans.ItemDataBean itemDataBean2)
        This method determines whether the two given items are related to the same product.
        Parameters:
        itemDataBean1 - The first item to be evaluated, represented by ItemDataBean.
        itemDataBean2 - The second item to be evaluated, represented by ItemDataBean.
        Returns:
        True if the two given items are related to the same product; false otherwise.
      • isProductItemRelated

        public static boolean isProductItemRelated(com.ibm.commerce.catalog.beans.CatalogEntryDataBean productDataBean,
                                                   com.ibm.commerce.catalog.beans.CatalogEntryDataBean itemDataBean)
        This method determines whether the given item belongs to the given product.
        Parameters:
        productDataBean - The product to be evaluated, represented by CatalogEntryDataBean.
        itemDataBean - The item to be evaluated, represented by CatalogEntryDataBean.
        Returns:
        True if the the given item belongs to the given product; false otherwise.
      • isProductItemRelated

        public static boolean isProductItemRelated(com.ibm.commerce.catalog.beans.ProductDataBean productDataBean,
                                                   com.ibm.commerce.catalog.beans.ItemDataBean itemDataBean)
        This method determines whether the given item belongs to the given product.
        Parameters:
        productDataBean - The product to be evaluated, represented by ProductDataBean.
        itemDataBean - The item to be evaluated, represented by ItemDataBean.
        Returns:
        True if the the given item belongs to the given product; false otherwise.
      • isPromotionAccessible

        public static boolean isPromotionAccessible(java.lang.String storeType)
        This method determines whether campaign can access promotion or not, given the current store type.
        Parameters:
        storeType - A constant value that indicates the type of the store.
        Returns:
        True if promotion is accessible from campaign in the stores of which the type is the same as the given store type; false otherwise.
      • normalizeStringDate

        public static java.lang.String normalizeStringDate(java.lang.String stringDate)
        The normalizeStringDate method takes the date in string format, and normalize it.
        Parameters:
        stringDate - The date string.
        Returns:
        The normalize date string.
      • stripBrackets

        public static java.lang.String stripBrackets(java.lang.String s)
        The stripBrackets method takes the string, and removes its bracket wrapped around it.
        Parameters:
        s - The string with brackets.
        Returns:
        The string without brackets.
      • stripQuotes

        public static java.lang.String stripQuotes(java.lang.String s)
        The stripQuotes method takes the string, and removes its quotes wrapped around it.
        Parameters:
        s - The string with quotes.
        Returns:
        The string without quotes.
      • stripSingleQuotes

        public static java.lang.String stripSingleQuotes(java.lang.String s)
        The stripSingleQuotes method takes the string, and removes its single quotes wrapped around it.
        Parameters:
        s - The string with single quotes.
        Returns:
        The string without single quotes.
      • substitute

        public static java.lang.String substitute(java.lang.String message,
                                                  int arg1)
        Substitutes message parameters with arguments. Parameters are of the form {n}.
        Parameters:
        message - A text message with imbedded parameters.
        arg1 - An argument.
        Returns:
        The message after substitution.
      • substitute

        public static java.lang.String substitute(java.lang.String message,
                                                  int arg1,
                                                  int arg2)
        Substitutes message parameters with arguments. Parameters are of the form {n}.
        Parameters:
        message - A text message with imbedded parameters.
        arg1 - An argument.
        arg2 - An argument.
        Returns:
        The message after substitution.
      • substitute

        public static java.lang.String substitute(java.lang.String message,
                                                  java.lang.Object[] arguments)
        Substitutes message parameters with arguments. Parameters are of the form {n}.
        Parameters:
        message - A text message with imbedded parameters.
        arguments - An array of arguments.
        Returns:
        The message after substitution.
      • substitute

        public static java.lang.String substitute(java.lang.String message,
                                                  java.lang.String arg1)
        Substitutes message parameters with arguments. Parameters are of the form {n}.
        Parameters:
        message - A text message with imbedded parameters.
        arg1 - An argument.
        Returns:
        The message after substitution.
      • substitute

        public static java.lang.String substitute(java.lang.String message,
                                                  java.lang.String arg1,
                                                  java.lang.String arg2)
        Substitutes message parameters with arguments. Parameters are of the form {n}.
        Parameters:
        message - A text message with imbedded parameters.
        arg1 - An argument.
        arg2 - An argument.
        Returns:
        The message after substitution.
      • toBigDecimal

        public static java.math.BigDecimal toBigDecimal(java.lang.String value)
        Converts a string value to BigDecimal.
        Returns:
        A BigDecimal object or null.
      • toBoolean

        public static boolean toBoolean(java.lang.String value)
        Converts a string value to boolean.
        Returns:
        true if the string is "true".
      • toInteger

        public static java.lang.Integer toInteger(java.lang.String value)
        Converts a string value to Ingeger.
        Returns:
        An Integer object or null.
      • toLong

        public static java.lang.Long toLong(java.lang.String value)
        Converts a string value to Long.
        Returns:
        A Long object or null.
      • toVector

        public static java.util.Vector toVector(java.lang.Object value)
        Converts an object to a Vector.
        Returns:
        A Vector object or null.