com.ibm.commerce.bi.taglib

Class TagUtils

  • java.lang.Object
    • com.ibm.commerce.bi.taglib.TagUtils


  • public class TagUtils
    extends java.lang.Object
    This class provides static utility methods for use with the Business Intelligence tag library.
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static java.lang.String COPYRIGHT
      IBM copyright notice field.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static java.lang.String findCategoryId(java.lang.Long catEntryId, javax.servlet.http.HttpServletRequest request, CommandContext ctx)
      Returns the categoryId associated with a product.
      static java.lang.String generateDelimiters(int delimCount)
      Generate the Delimiter '-_-' for the extraParams in the cmCreateOrderTag and cmCreateShopAction9Tag
      static AddressAccessBean getAddressObject(java.lang.Long userId)
      Returns the AddressAccessBean that corresponds to the user
      static java.lang.String getCampaignNameForEmailPromotion(java.lang.String emailPromotionId)
      Returns the email campaign name using marketing services
      static java.util.LinkedList getCatalogHierarchy(CommandContext cc, java.lang.Long catEntryId)
      Given a catalog entry ID, this method traverses up the catalog tree searching for all of the entry's parent categories.
      static java.lang.Long getCategoryID(CommandContext cc, java.lang.Long catEntryId)
      Given a catalog entry ID, this method traverses up the catalog tree searching for the entry's parent category.
      static java.util.ArrayList<java.lang.Long> getCategoryIDs(CommandContext cc, java.lang.Long catEntryId)
      Returns a list of categoryIds to which the catentry is associated in a catalog
      static java.util.ArrayList getContentNameList(java.lang.String emsName, java.lang.String storeId, java.lang.String catalogId)
      Return the content name list of the activities scheduled in the eMarketingSpot
      static java.lang.String getEmailCampaignName(java.lang.String emailPromoId)
      This method returns the campaign name for the Email activity
      static java.lang.String getEmailPromoName(java.lang.String emailPromotionId)
      This method returns the emailPromo Name
      static java.lang.String getEmailPromotionName(java.lang.String emailPromotionId)
      Returns the email promotion name using marketing services
      static java.lang.String getEmailTemplateName(java.lang.String emailPromotionId)
      This method returns the email template name
      static MarketingSpotDataType getMarketingSpotData(java.lang.String emsName, java.lang.String storeId, java.lang.String catalogId)
      Returns the MarketingSpotDataType object from the emarketing spot name using the marketing runtime services
      static java.lang.Long getMasterCategoryId(CommandContext cc, java.lang.Long catEntryId)
      Return the master category id of the catalog entry based on the master catalog of the store A product could belong to a master catalog and different sales catalogs.
      static java.util.LinkedList getOrganizationHierarchy(CommandContext cc, java.lang.Long accountId)
      Given a organization member ID, this method traverses up the organization tree to produce a list of all of the entry's ancestors.
      static java.math.BigDecimal getTaxComponent(CatalogEntryDataBean catentryDB, CommandContext ctx)
      Retrieves the tax amount applicable for the input catalog entry
      static boolean isEmpty(java.lang.String string)
      Checks whether the input string is null or is blank
      static boolean isUncle(CommandContext cc, java.lang.Long catEntryId)
      Given a catalog entry ID, this method traverses up the catalog tree one level to see whether or not a product is an uncle.
      static java.lang.Long min(java.lang.Long x, java.lang.Long y)
      Given two numbers, return the smallest
      static java.lang.String[] parseParms(java.lang.String parms, java.lang.Object obj)
      Given a comma-separated list of parameters, this method splits it up and returns and array of parameters.
      static java.util.Vector processPackage(java.util.Map params, boolean fromCart)
      Iterates over the items in the kit and returns a vector that contain details about items in the kit.
      static java.lang.String runMethod(java.lang.Object obj, java.lang.String methodName)
      Convenience method to run any other method in a given object.
      static java.lang.String stringListToDelimitedString(java.util.List list, java.lang.String delimiter)
      Given a List of String objects, return a single String with all the elements separated by the delimiter.
      • Methods inherited from class java.lang.Object

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

      • COPYRIGHT

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

      • getCatalogHierarchy

        public static java.util.LinkedList getCatalogHierarchy(CommandContext cc,
                                                               java.lang.Long catEntryId)
        Given a catalog entry ID, this method traverses up the catalog tree searching for all of the entry's parent categories. If multiple parents are found at any particular node of the tree, the parent with the smallest catalog ID will be taken.
        Parameters:
        cc - CommandContext of the current request
        catEntryId - catalog entry ID of the product
        Returns:
        A linked list of String description names of the category hierarchy of the product. The list starts with the top category and ends with the subcategory that is the direct parent the product. For example, the list for a White, Comfy Couch would be Living Room->Furniture->Couches
      • getCategoryID

        public static java.lang.Long getCategoryID(CommandContext cc,
                                                   java.lang.Long catEntryId)
        Given a catalog entry ID, this method traverses up the catalog tree searching for the entry's parent category. If multiple parents are found at any particular node of the tree, the parent with the smallest catalog ID will be taken.
        Parameters:
        cc - CommandContext of the current request
        catEntryId - catalog entry ID of the product
        Returns:
        the ID of the parent category of the product. If none is found, 0 is returned.
      • getCategoryIDs

        public static java.util.ArrayList<java.lang.Long> getCategoryIDs(CommandContext cc,
                                                                         java.lang.Long catEntryId)
        Returns a list of categoryIds to which the catentry is associated in a catalog
        Parameters:
        cc - The command context object
        catEntryId - The catalog entry Id
        Returns:
        A list containing the category Ids
      • isUncle

        public static boolean isUncle(CommandContext cc,
                                      java.lang.Long catEntryId)
        Given a catalog entry ID, this method traverses up the catalog tree one level to see whether or not a product is an uncle. That is, has a sibling with children. For example, in the tree,
                a
               / \
              b   c
                 / \
                d   e
        product b is an uncle, but product d and e are not.
        Parameters:
        cc - CommandContext of the current request
        catEntryId - catalog entry ID of the product
        Returns:
        Whether or not a catalog entry is an uncle
      • getOrganizationHierarchy

        public static java.util.LinkedList getOrganizationHierarchy(CommandContext cc,
                                                                    java.lang.Long accountId)
        Given a organization member ID, this method traverses up the organization tree to produce a list of all of the entry's ancestors.
        Parameters:
        cc - CommandContext of the current request
        accountId - account ID of the contract
        Returns:
        A linked list of String description names of the organization hierarchy of the product. The list starts with the organization directly beneath "Root Organization" and ends with the organization given.
      • getMasterCategoryId

        public static java.lang.Long getMasterCategoryId(CommandContext cc,
                                                         java.lang.Long catEntryId)
        Return the master category id of the catalog entry based on the master catalog of the store A product could belong to a master catalog and different sales catalogs. When the customer views the product from a sales catalog, the sales catalog id will be by default send by the tag. Along with that the category id from the master catalog also needs to be send. e.g., "Brewmaster Deluxe Coffeemaker" belongs to different categories in master and sales catalogs as given below.
        Catalog Type(Catalog ID)Category Name(Category ID)
        Master Catalog(10101)Coffee Makers(10125)
        Sales Catalog(10151)Coffee and Espresso Makers(10128)
        In this case this method will return a value of 10125 which is the value of the master category in the master catalog
        Parameters:
        cc - CommandContext of the current request
        catEntryId - catalog entry ID of the product
        Returns:
        master category id of the catalog entry
      • min

        public static java.lang.Long min(java.lang.Long x,
                                         java.lang.Long y)
        Given two numbers, return the smallest
        Parameters:
        x - First number value
        y - Second number value
        Returns:
        The smallest of x or y
      • stringListToDelimitedString

        public static java.lang.String stringListToDelimitedString(java.util.List list,
                                                                   java.lang.String delimiter)
        Given a List of String objects, return a single String with all the elements separated by the delimiter. Useful in combination with getCatalogHierarchy.
        Parameters:
        list - ordered or unordered List of Strings
        delimiter - string used to split up elements in the list
        Returns:
        A String in the format "listElement1<delimiter>listElement2<delimiter>...<delimiter>listElementN"
      • runMethod

        public static java.lang.String runMethod(java.lang.Object obj,
                                                 java.lang.String methodName)
        Convenience method to run any other method in a given object.
        Parameters:
        obj - the object to execute the method on
        methodName - the method to execute. This method must take no arguments and the parentheses dropped. For example, use "getValue", not "getValue()".
        Returns:
        the value of toString() on the result of the method call
      • getEmailPromoName

        public static java.lang.String getEmailPromoName(java.lang.String emailPromotionId)
        This method returns the emailPromo Name
        Parameters:
        emailPromotionId - The email activity id of the Email Activity
        Returns:
        String - email promo name
      • getEmailTemplateName

        public static java.lang.String getEmailTemplateName(java.lang.String emailPromotionId)
        This method returns the email template name
        Parameters:
        emailPromotionId - The email activity id of the Email Activity
        Returns:
        String - emailTemplateName
      • getEmailCampaignName

        public static java.lang.String getEmailCampaignName(java.lang.String emailPromoId)
        This method returns the campaign name for the Email activity
        Parameters:
        emailPromoId - The email activity id of the Email Activity
        Returns:
        String - campaignName
      • parseParms

        public static java.lang.String[] parseParms(java.lang.String parms,
                                                    java.lang.Object obj)
        Given a comma-separated list of parameters, this method splits it up and returns and array of parameters. If a parameter is delimited by the $ symbol, it is assumed to be a method name and will be executed on obj. The toString() method will be called on this result and returned as part of the parameter list.
        Parameters:
        parms - comma-separated list of parameters
        obj - the object to execute methods delimited by $ on. If null, delimited $ strings will be ignored and returned without modification.
        Returns:
        an array of String with each literal and dynamic parameters
      • getMarketingSpotData

        public static MarketingSpotDataType getMarketingSpotData(java.lang.String emsName,
                                                                 java.lang.String storeId,
                                                                 java.lang.String catalogId)
                                                          throws java.lang.Exception
        Returns the MarketingSpotDataType object from the emarketing spot name using the marketing runtime services
        Parameters:
        emsName - The eMarketing spot name
        storeId - The store identifier
        catalogId - The catalog identifier
        Returns:
        The MarketingSpotDataType object
        Throws:
        java.lang.Exception
      • getEmailPromotionName

        public static java.lang.String getEmailPromotionName(java.lang.String emailPromotionId)
                                                      throws java.lang.Exception
        Returns the email promotion name using marketing services
        Parameters:
        emailPromotionId - The email promotion Id
        Returns:
        The email promotion name
        Throws:
        java.lang.Exception
      • getCampaignNameForEmailPromotion

        public static java.lang.String getCampaignNameForEmailPromotion(java.lang.String emailPromotionId)
                                                                 throws java.lang.Exception
        Returns the email campaign name using marketing services
        Parameters:
        emailPromotionId - The email promotion Id
        Returns:
        The campaign name
        Throws:
        java.lang.Exception
      • getContentNameList

        public static java.util.ArrayList getContentNameList(java.lang.String emsName,
                                                             java.lang.String storeId,
                                                             java.lang.String catalogId)
                                                      throws java.lang.Exception
        Return the content name list of the activities scheduled in the eMarketingSpot
        Parameters:
        emsName - The eMarketingSpotName
        storeId - The store identifier
        catalogId - The catalog identifier
        Returns:
        The content name list
        Throws:
        java.lang.Exception
      • findCategoryId

        public static java.lang.String findCategoryId(java.lang.Long catEntryId,
                                                      javax.servlet.http.HttpServletRequest request,
                                                      CommandContext ctx)
        Returns the categoryId associated with a product. CategoryId parameter is required to associate a product with its parent category. The categoryId is obtained using the following method: 1. The tag class will try to locate a request parameter named 'categoryId' and use that value of this parameter if present 2. If the categoryId request parameter is not found, the tag class will get all the categories to which the product is associated, in the current browsing catalog, from the data base. 3. If the product has only one category associated, the tag class will use that categoryId 4. If the product has multiple categories associated, the tag class will try to locate the categoryId from either the session or cookie based on the customer settings 5. If the value is not found in session/cookie, the tag class will use the categoryId which has the lowest numerical value found from the database
        Parameters:
        catEntryId - The catalog entry Id of the product
        request - The HttpServletRequest object associated with the request
        ctx - The CommandContext associated with the request
        Returns:
        The categoryId
      • getTaxComponent

        public static java.math.BigDecimal getTaxComponent(CatalogEntryDataBean catentryDB,
                                                           CommandContext ctx)
                                                    throws java.lang.Exception
        Retrieves the tax amount applicable for the input catalog entry
        Parameters:
        catentryDB - The catalog entry databean whose tax details need to be retrieved
        ctx - The command context instance
        Returns:
        The tax amount value
        Throws:
        java.lang.Exception - on any Exception
      • generateDelimiters

        public static java.lang.String generateDelimiters(int delimCount)
        Generate the Delimiter '-_-' for the extraParams in the cmCreateOrderTag and cmCreateShopAction9Tag
        Parameters:
        delimCount - number of delimiters to be added
        Returns:
        the string of delimiters.
      • isEmpty

        public static boolean isEmpty(java.lang.String string)
        Checks whether the input string is null or is blank
        Parameters:
        string - The input string
        Returns:
        A boolean value
      • processPackage

        public static java.util.Vector processPackage(java.util.Map params,
                                                      boolean fromCart)
                                               throws java.lang.Exception
        Iterates over the items in the kit and returns a vector that contain details about items in the kit.
        Parameters:
        params - A set of parameters used to process the kit
        fromCart - Whether the function has been invoked from the shopping cart page
        Returns:
        The vector containing details about the items in the kit
        Throws:
        java.lang.Exception
      • getAddressObject

        public static AddressAccessBean getAddressObject(java.lang.Long userId)
        Returns the AddressAccessBean that corresponds to the user
        Parameters:
        userId - The user identifier of the user whose address needs to be located
        Returns:
        The AddressAccessBean object