com.ibm.commerce.bi.taglib

Class CartBaseTag

  • All Implemented Interfaces:
    java.io.Serializable, javax.servlet.jsp.tagext.IterationTag, javax.servlet.jsp.tagext.JspTag, javax.servlet.jsp.tagext.Tag


    public abstract class CartBaseTag
    extends BaseTag

    An abstract tag class which generates the data required for an analytics vendor to trigger a shopping cart view event. The generated data is placed in a Vector object named paramVector which the analytics vendor classes can consume. Each element in the paramVector will contain a HashMap object. Each HashMap object contains data about an item in the shopping cart. The value for all the keys in the HashMap, except for EXTRA_PARAMS, are String objects. The value for EXTRA_PARAMS will be an ArrayList object which inturn contain String objects

    Following is the structure of the HashMap object. The keys used in the map are defined in the TagConstants class.

    
     +--------------------------------------------------------------------------+
     | PART_NUMBER                  | The part number of the product            |
     +--------------------------------------------------------------------------+
     | PRODUCT_NAME                 | The part number of the viewed product     |
     +--------------------------------------------------------------------------+
     | QUANTITY                     | Quantity                                  |
     +--------------------------------------------------------------------------+
     | BASE_PRICE                   | The unit price                            |
     +--------------------------------------------------------------------------+
     | CATEGORY                     | The category to which the product belong  |
     |                              | in the current browsing catalog           |
     +--------------------------------------------------------------------------+
     | MASTER_CATALOG_CATEGORY      | The category to which the product belong  |
     |                              | in the master catalog                     |
     +--------------------------------------------------------------------------+ 
     | CURRENCY                     | Currency                                  |
     +--------------------------------------------------------------------------+
     | EXTRA_PARAMS                 | The extra parameters which the users      |
     |                              | want to send along with the shop cart     |
     |                              | tag. The value for this key will be an    |
     |                              | object of type 'java.util.ArrayList'      |
     |                              | which inturn contains String objects      |
     +--------------------------------------------------------------------------+
     | STORE_ID                     | The store identifier                      |
     +--------------------------------------------------------------------------+
     
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static java.lang.String COPYRIGHT
      IBM copyright notice field.
      • Fields inherited from interface javax.servlet.jsp.tagext.IterationTag

        EVAL_BODY_AGAIN
      • Fields inherited from interface javax.servlet.jsp.tagext.Tag

        EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
    • Constructor Summary

      Constructors 
      Constructor and Description
      CartBaseTag() 
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      int doStartTag()
      Gathers the data required for generating an analytics cart view event and places that in an attribute for the vendor specific classes to consume.
      java.lang.String getDataAsJSON(boolean useCatIdOverride)
      Returns the analytics data in a JSON format
      java.util.Vector<java.util.HashMap<java.lang.String,java.lang.Object>> getParamVector()
      Returns a vector object which contain one or more HashMap objects based on the databean or the SDO.
      boolean isReturnAsJSON()
      Checks whether the tag need to return the data as JSON
      void setDatabean(OrderDataBean databeanVar) 
      void setExtraparms(java.lang.String extraparmsVar)
      Sets the additional parameters that need to be passed in the HashMap object.
      void setExtraparmsMap(java.util.HashMap extraparmsMapVar)
      Sets the additional parameter that need to be passed with specific items in the cart.
      void setIncludeDiscountsInUnitPrice(boolean discounted)
      Sets the flag to pass discounted price in the Coremetrics cmCreateShopAction5() tag.
      void setIncludeTaxInUnitPrice(boolean includeTaxInUnitPriceVar)
      Sets the boolean parameter to conditionally include tax component in unit price
      void setOrderId(java.lang.String orderIdVar)
      Sets the order ID parameter.
      void setOrderJSON(java.util.HashMap orderJSON)
      Sets the orderJSON JSON object to be used to get the data for analysis
      void setOrderType(OrderType orderTypeVar)
      Sets the OrderType SDO object
      void setReturnAsJSON(boolean flag)
      Sets the boolean value whether to return the data as JSON
      void setUseKitItems(boolean flag)
      Whether the tags need to be generated for all the items in a pre-defined kit
      • Methods inherited from class javax.servlet.jsp.tagext.TagSupport

        doAfterBody, doEndTag, findAncestorWithClass, getId, getParent, getValue, getValues, release, removeValue, setId, setPageContext, setParent, setValue
      • 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
    • Constructor Detail

      • CartBaseTag

        public CartBaseTag()
    • Method Detail

      • doStartTag

        public int doStartTag()
                       throws javax.servlet.jsp.JspException
        Gathers the data required for generating an analytics cart view event and places that in an attribute for the vendor specific classes to consume.
        Specified by:
        doStartTag in interface javax.servlet.jsp.tagext.Tag
        Overrides:
        doStartTag in class BaseTag
        Returns:
        always EVAL_PAGE constant
        Throws:
        javax.servlet.jsp.JspException - on any Exception
      • setDatabean

        public void setDatabean(OrderDataBean databeanVar)
        Parameters:
        databeanVar -
      • setOrderId

        public void setOrderId(java.lang.String orderIdVar)
        Sets the order ID parameter. If the databean is not set, this value will be used to create a databean.
        Parameters:
        orderIdVar - the order ID parameter to set.
      • setOrderType

        public void setOrderType(OrderType orderTypeVar)
        Sets the OrderType SDO object
        Parameters:
        orderTypeVar -
      • setOrderJSON

        public void setOrderJSON(java.util.HashMap orderJSON)
        Sets the orderJSON JSON object to be used to get the data for analysis
        Parameters:
        orderJSON -
      • setExtraparms

        public void setExtraparms(java.lang.String extraparmsVar)
        Sets the additional parameters that need to be passed in the HashMap object. The value of this parameter will be used for all the items in the cart
        Parameters:
        extraparmsVar -
      • getParamVector

        public java.util.Vector<java.util.HashMap<java.lang.String,java.lang.Object>> getParamVector()
        Returns a vector object which contain one or more HashMap objects based on the databean or the SDO.
        Returns:
        A vector containing HashMap object corresponding to every item in the shop cart
      • setIncludeTaxInUnitPrice

        public void setIncludeTaxInUnitPrice(boolean includeTaxInUnitPriceVar)
        Sets the boolean parameter to conditionally include tax component in unit price
        Parameters:
        includeTaxInUnitPriceVar -
      • setExtraparmsMap

        public void setExtraparmsMap(java.util.HashMap extraparmsMapVar)
        Sets the additional parameter that need to be passed with specific items in the cart. The key for this parameter will be the orderItemId for each item in the shop cart and the value will be the additional parameters that need to be appended with the specific item data
        Parameters:
        extraparmsMapVar -
      • setUseKitItems

        public void setUseKitItems(boolean flag)
        Whether the tags need to be generated for all the items in a pre-defined kit
        Parameters:
        flag -
      • getDataAsJSON

        public java.lang.String getDataAsJSON(boolean useCatIdOverride)
        Returns the analytics data in a JSON format
        Parameters:
        useCatIdOverride - A flag which specifies whether to override the categoryId value with the one passed as the first extra parameter. This parameter is used by Coremetrics customers who use the hosted coremetrics libraries
        Returns:
        A JSON String
      • isReturnAsJSON

        public boolean isReturnAsJSON()
        Checks whether the tag need to return the data as JSON
        Returns:
        A boolean value whether the tag need to return the data as JSON
      • setReturnAsJSON

        public void setReturnAsJSON(boolean flag)
        Sets the boolean value whether to return the data as JSON
        Parameters:
        flag - The boolean value whether to return the data as JSON
      • setIncludeDiscountsInUnitPrice

        public void setIncludeDiscountsInUnitPrice(boolean discounted)
        Sets the flag to pass discounted price in the Coremetrics cmCreateShopAction5() tag. By default this flag is set to 'true'
        Parameters:
        discounted - The boolean value