com.ibm.commerce.tools.campaigns

Class CatalogSearchListDataBean

  • java.lang.Object
    • com.ibm.commerce.beans.InputDataBeanImpl
      • com.ibm.commerce.beans.SmartDataBeanImpl
        • com.ibm.commerce.tools.util.CommonSearchHelperBean
          • com.ibm.commerce.tools.campaigns.CatalogSearchListDataBean
  • All Implemented Interfaces:
    com.ibm.commerce.beans.DataBean, com.ibm.commerce.beans.InputDataBean, com.ibm.commerce.beans.SmartDataBean, java.io.Serializable


    public class CatalogSearchListDataBean
    extends com.ibm.commerce.tools.util.CommonSearchHelperBean
    This data bean finds catalog entries or categories in a store. It accepts parameters to be used as the search criteria, generates and executes an SQL query to find the result set from the database, and returns the result to the view. In order to use the abstract class (com.ibm.commerce.tools.util.CommonSearchHelperBean) to support the DB side execution, the most important methods that would be necessary are the ones to contruct the database query and the list of data beans. You would also need to be able to get a list of entries that have been found and get a specific entry that has been found.
    To make use of the com.ibm.commerce.tools.util.CommonSearchHelperBean class you must first create a query that will return the desired results from the database. Some hints as to how to do this can be taken from looking at the current Entity's and discovering what tables and contraints they currently use to retrieve the desired data. Any parameters that are to be passed to the query such as ordering information or search criteria must be received before the execution of the query. Some of these parameters will have been set throught the search or list data bean's constructor. They can also be set through calling set methods in the JSP. The com.ibm.commerce.tools.util.CommonSearchHelperBean provides a method to exectue the SQL statement. It sets up a cursor and a com.ibm.commerce.base.objects.ServerJDBCHelperBean and passes the cursor and the returned SQL string (that you have built in the buildQuery method you have implemented) to the com.ibm.commerce.base.objects.ServerJDBCHelperBean. The result size is then set, taken from the cursor. Using the cursor we can account for high volumes of returned results by dividing the results onto an appropriate number of pages. Next you would have to implement the buildResultDataBean method. This method would need to get the results from the returned vector and parse each row into the set methods of a data bean. One would need to either create or augment an existing data bean to allow parameters to be set in the data bean.
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static java.lang.String CATENTRY_TYPE_BUNDLE
      Values of the catalog entry type, for example: Product, Item, Package, and so on.
      static java.lang.String CATENTRY_TYPE_DYNAMIC_KIT
      Values of the catalog entry type, for example: Product, Item, Package, and so on.
      static java.lang.String CATENTRY_TYPE_ITEM
      Values of the catalog entry type, for example: Product, Item, Package, and so on.
      static java.lang.String CATENTRY_TYPE_PACKAGE
      Values of the catalog entry type, for example: Product, Item, Package, and so on.
      static java.lang.String CATENTRY_TYPE_PRODUCT
      Values of the catalog entry type, for example: Product, Item, Package, and so on.
      static java.lang.String COPYRIGHT
      IBM copyright notice field.
      static java.lang.String ORDER_BY_CATEGORY_NAME
      Database column on the category tables used in the order by clause of the SQL query to do sorting.
      static java.lang.String ORDER_BY_CATEGORY_PARENT
      Database column on the category tables used in the order by clause of the SQL query to do sorting.
      static java.lang.String ORDER_BY_CATEGORY_SHORTDESC
      Database column on the category tables used in the order by clause of the SQL query to do sorting.
      static java.lang.String ORDER_BY_PRODUCT_CODE
      Database column on the catalog entry tables used in the order by clause of the SQL query to do sorting.
      static java.lang.String ORDER_BY_PRODUCT_NAME
      Database column on the catalog entry tables used in the order by clause of the SQL query to do sorting.
      static java.lang.String ORDER_BY_PRODUCT_SHORTDESC
      Database column on the catalog entry tables used in the order by clause of the SQL query to do sorting.
      static java.lang.String ORDER_BY_PRODUCT_TYPE
      Database column on the catalog entry tables used in the order by clause of the SQL query to do sorting.
      static java.lang.String SEARCH_TYPE_CATENTRY
      Values used to determine the kind of search it's performing, either catalog entry or category.
      static java.lang.String SEARCH_TYPE_CATGROUP
      Values used to determine the kind of search it's performing, either catalog entry or category.
      static java.lang.String TYPE_LIKE_CASE_SENSITIVE
      Values of the search type for each criteria.
      static java.lang.String TYPE_LIKE_IGNORE_CASE
      Values of the search type for each criteria.
      static java.lang.String TYPE_MATCH_CASE_SENSITIVE
      Values of the search type for each criteria.
      static java.lang.String TYPE_MATCH_IGNORE_CASE
      Values of the search type for each criteria.
      • Fields inherited from interface com.ibm.commerce.beans.DataBean

        emptyString
    • Constructor Summary

      Constructors 
      Constructor and Description
      CatalogSearchListDataBean()
      Constructor for CatalogSearchListDataBean.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      java.lang.String buildQuery()
      Constructs the SQL query.
      void buildResultDataBean(java.util.Vector resultVector)
      Constructs the list of result data beans.
      CatalogSearchDataBean[] getCatalogList()
      Returns the list of data beans found from the search or list, represented by an array of CatalogSearchDataBean object.
      CatalogSearchDataBean getCatalogListData(int index)
      Returns the specific data bean at the passed index within the array of data beans returned, represented by a CatalogSearchDataBean object.
      java.lang.String getCatentryBuyable()
      Gets the buyable flag of catalog entry that is being searched against.
      java.lang.String getCatentryPublished()
      Gets the published flag of catalog entry that is being searched against.
      java.lang.String getCatentryType()
      Gets the type of catalog entry that is being searched against, can be either all types of catalog entry, or items only.
      java.lang.String getCatgroupPublished()
      Gets the published flag of catalog group that is being searched against.
      java.lang.String getOrderby()
      Gets the parameter that is used to order the results in the SQL query.
      java.lang.String getSearchType()
      Gets the type of search to be performed, which identifies whether this search logic is used to search for category or catalog entry.
      java.lang.String getSrName()
      Gets the name of the item to search for, this is the value of the name criteria.
      java.lang.String getSrNameType()
      Gets the type of search that is being performed to the name criteria.
      java.lang.String getSrPartNumber()
      Gets the SKU of the item to search for, this is the value of the SKU criteria.
      java.lang.String getSrPartNumberType()
      Gets the type of search that is being performed to the SKU criteria.
      java.lang.String getSrShortDescription()
      Gets the short description of the item to search for, this is the value of the short description criteria.
      java.lang.String getSrShortDescriptionType()
      Gets the type of search that is being performed to the short description criteria.
      void setCatalogList(java.util.Vector newCatalogList)
      Sets the list of data beans found from the search or list.
      void setCatentryBuyable(java.lang.String newCatentryBuyable)
      Sets the buyable flag of catalog entry that is being searched against.
      void setCatentryPublished(java.lang.String newCatentryPublished)
      Sets the published flag of catalog entry that is being searched against.
      void setCatentryType(java.lang.String newCatentryType)
      Sets the type of catalog entry that is being searched against, can be either all types of catalog entry, or items only.
      void setCatgroupPublished(java.lang.String newCatgroupPublished)
      Sets the published flag of catalog group that is being searched against.
      void setOrderby(java.lang.String newOrderby)
      Sets the parameter that is used to order the results in the SQL query.
      void setSearchType(java.lang.String newSearchType)
      Sets the type of search to be performed, which identifies whether this search logic is used to search for category or catalog entry.
      void setSrName(java.lang.String newSrName)
      Sets the name of the item to search for, this is the value of the name criteria.
      void setSrNameType(java.lang.String newSrNameType)
      Sets the type of search that is being performed to the name criteria.
      void setSrPartNumber(java.lang.String newSrPartNumber)
      Sets the SKU of the item to search for, this is the value of the SKU criteria.
      void setSrPartNumberType(java.lang.String newSrPartNumberType)
      Sets the type of search that is being performed to the SKU criteria.
      void setSrShortDescription(java.lang.String newSrShortDescription)
      Sets the short description of the item to search for, this is the value of the short description criteria.
      void setSrShortDescriptionType(java.lang.String newSrShortDescriptionType)
      Sets the type of search that is being performed to the short description criteria.
      • Methods inherited from class com.ibm.commerce.tools.util.CommonSearchHelperBean

        escapeSQLstring, getDefaultLanguageId, getIndexBegin, getIndexEnd, getLanguageId, getListSize, getResultList, getResultSetSize, getStoreId, getStoreIds, getStoreIdsInEntityType, getStoreRelType, getUpperCaseFunction, getUseCursor, populate, setIndexBegin, setIndexEnd, setLanguageId, setResultList, setResultSetSize, setStoreId, setStoreIds, setStoreIdsInEntityType, setStoreRelType, setUseCursor
      • Methods inherited from class com.ibm.commerce.beans.SmartDataBeanImpl

        fulfills, getCommandContext, getHttpRequest, getHttpResponse, getResources, getViewCommandContext, setCommandContext, setHttpRequest, setHttpResponse, setViewCommandContext
      • Methods inherited from class com.ibm.commerce.beans.InputDataBeanImpl

        getRequestProperties, setRequestProperties
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface com.ibm.commerce.beans.InputDataBean

        getRequestProperties, setRequestProperties
    • Field Detail

      • CATENTRY_TYPE_BUNDLE

        public static final java.lang.String CATENTRY_TYPE_BUNDLE
        Values of the catalog entry type, for example: Product, Item, Package, and so on.
        See Also:
        Constant Field Values
      • CATENTRY_TYPE_DYNAMIC_KIT

        public static final java.lang.String CATENTRY_TYPE_DYNAMIC_KIT
        Values of the catalog entry type, for example: Product, Item, Package, and so on.
        See Also:
        Constant Field Values
      • CATENTRY_TYPE_ITEM

        public static final java.lang.String CATENTRY_TYPE_ITEM
        Values of the catalog entry type, for example: Product, Item, Package, and so on.
        See Also:
        Constant Field Values
      • CATENTRY_TYPE_PACKAGE

        public static final java.lang.String CATENTRY_TYPE_PACKAGE
        Values of the catalog entry type, for example: Product, Item, Package, and so on.
        See Also:
        Constant Field Values
      • CATENTRY_TYPE_PRODUCT

        public static final java.lang.String CATENTRY_TYPE_PRODUCT
        Values of the catalog entry type, for example: Product, Item, Package, and so on.
        See Also:
        Constant Field Values
      • COPYRIGHT

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

        public static final java.lang.String ORDER_BY_CATEGORY_NAME
        Database column on the category tables used in the order by clause of the SQL query to do sorting.
        See Also:
        Constant Field Values
      • ORDER_BY_CATEGORY_PARENT

        public static final java.lang.String ORDER_BY_CATEGORY_PARENT
        Database column on the category tables used in the order by clause of the SQL query to do sorting.
        See Also:
        Constant Field Values
      • ORDER_BY_CATEGORY_SHORTDESC

        public static final java.lang.String ORDER_BY_CATEGORY_SHORTDESC
        Database column on the category tables used in the order by clause of the SQL query to do sorting.
        See Also:
        Constant Field Values
      • ORDER_BY_PRODUCT_CODE

        public static final java.lang.String ORDER_BY_PRODUCT_CODE
        Database column on the catalog entry tables used in the order by clause of the SQL query to do sorting.
        See Also:
        Constant Field Values
      • ORDER_BY_PRODUCT_NAME

        public static final java.lang.String ORDER_BY_PRODUCT_NAME
        Database column on the catalog entry tables used in the order by clause of the SQL query to do sorting.
        See Also:
        Constant Field Values
      • ORDER_BY_PRODUCT_SHORTDESC

        public static final java.lang.String ORDER_BY_PRODUCT_SHORTDESC
        Database column on the catalog entry tables used in the order by clause of the SQL query to do sorting.
        See Also:
        Constant Field Values
      • ORDER_BY_PRODUCT_TYPE

        public static final java.lang.String ORDER_BY_PRODUCT_TYPE
        Database column on the catalog entry tables used in the order by clause of the SQL query to do sorting.
        See Also:
        Constant Field Values
      • SEARCH_TYPE_CATENTRY

        public static final java.lang.String SEARCH_TYPE_CATENTRY
        Values used to determine the kind of search it's performing, either catalog entry or category.
        See Also:
        Constant Field Values
      • SEARCH_TYPE_CATGROUP

        public static final java.lang.String SEARCH_TYPE_CATGROUP
        Values used to determine the kind of search it's performing, either catalog entry or category.
        See Also:
        Constant Field Values
      • TYPE_LIKE_CASE_SENSITIVE

        public static final java.lang.String TYPE_LIKE_CASE_SENSITIVE
        Values of the search type for each criteria. TYPE_LIKE_CASE_SENSITIVE - Matches containing and case sensitive.
        See Also:
        Constant Field Values
      • TYPE_LIKE_IGNORE_CASE

        public static final java.lang.String TYPE_LIKE_IGNORE_CASE
        Values of the search type for each criteria. TYPE_LIKE_IGNORE_CASE - Matches containing and case insensitive.
        See Also:
        Constant Field Values
      • TYPE_MATCH_CASE_SENSITIVE

        public static final java.lang.String TYPE_MATCH_CASE_SENSITIVE
        Values of the search type for each criteria. TYPE_MATCH_CASE_SENSITIVE - Exact phrase and case sensitive.
        See Also:
        Constant Field Values
      • TYPE_MATCH_IGNORE_CASE

        public static final java.lang.String TYPE_MATCH_IGNORE_CASE
        Values of the search type for each criteria. TYPE_MATCH_IGNORE_CASE - Exact phrase and case insensitive.
        See Also:
        Constant Field Values
    • Constructor Detail

      • CatalogSearchListDataBean

        public CatalogSearchListDataBean()
        Constructor for CatalogSearchListDataBean.
    • Method Detail

      • buildQuery

        public java.lang.String buildQuery()
                                    throws java.lang.Exception
        Constructs the SQL query. Here the query must be pieced together using the user given parameters for the search if necessary and called to execute. This would override the buildQuery method found in the com.ibm.commerce.tools.util.CommonSearchHelperBean and be called by the populate() method found in the com.ibm.commerce.tools.util.CommonSearchHelperBean.
        The entire search logic can be customized by modifying the generation of the query. The following are sample queries that would be generated by this method:
        • Catalog entry search - select distinct CATENTRY.CATENTRY_ID, CATENTRY.PARTNUMBER, CATENTRY.MEMBER_ID, CATENTRY.CATENTTYPE_ID, CATENTDESC.NAME, CATENTDESC.SHORTDESCRIPTION, STORECENT.STOREENT_ID from CATENTRY, CATENTDESC, STORECENT where STORECENT.STOREENT_ID in (1) and CATENTRY.BUYABLE = 1 and CATENTRY.MARKFORDELETE <> 1 and CATENTRY.PARTNUMBER is not null and CATENTDESC.PUBLISHED = 1 and (CATENTDESC.LANGUAGE_ID = -2 or (CATENTDESC.LANGUAGE_ID = -1 and not exists(select CED.CATENTRY_ID from CATENTDESC CED where CED.LANGUAGE_ID = -2 and CED.CATENTRY_ID = CATENTRY.CATENTRY_ID))) and CATENTRY.CATENTTYPE_ID LIKE 'ItemBean%' and UCASE(CATENTDESC.NAME) LIKE '%SKU%' and CATENTRY.CATENTRY_ID = CATENTDESC.CATENTRY_ID and CATENTRY.CATENTRY_ID = STORECENT.CATENTRY_ID order by CATENTRY.PARTNUMBER asc;
        • Category search - select distinct CATGROUP.CATGROUP_ID, CATGROUP.IDENTIFIER, CATGROUP.MEMBER_ID, CATGRPDESC.NAME, CATGRPDESC.SHORTDESCRIPTION, STORECGRP.STOREENT_ID from CATGROUP, CATGRPDESC, STORECGRP where STORECGRP.STOREENT_ID in (1) and CATGROUP.MARKFORDELETE <> 1 and (CATGRPDESC.LANGUAGE_ID = -1 or (CATGRPDESC.LANGUAGE_ID = -1 and not exists(select cgd.CATGROUP_ID from CATGRPDESC cgd where cgd.LANGUAGE_ID = -1 and cgd.CATGROUP_ID = CATGROUP.CATGROUP_ID))) and CATGRPDESC.CATGROUP_ID = CATGROUP.CATGROUP_ID and CATGROUP.CATGROUP_ID = STORECGRP.CATGROUP_ID order by CATGRPDESC.NAME asc;
        Specified by:
        buildQuery in class com.ibm.commerce.tools.util.CommonSearchHelperBean
        Returns:
        The SQL query string.
        Throws:
        java.lang.Exception - Thrown when an exception is encountered whether constructing the query.
      • buildResultDataBean

        public void buildResultDataBean(java.util.Vector resultVector)
        Constructs the list of result data beans. After the SQL has been executed and a result vector has been returned, the buildResultDataBean method takes this result vector and parses the results depending on what type of search has been executed. This is called by the populate() method found in the com.ibm.commerce.tools.util.CommonSearchHelperBean.
        Specified by:
        buildResultDataBean in class com.ibm.commerce.tools.util.CommonSearchHelperBean
        Parameters:
        resultVector - The result vector returned from the query execution.
      • getCatalogList

        public CatalogSearchDataBean[] getCatalogList()
        Returns the list of data beans found from the search or list, represented by an array of CatalogSearchDataBean object. These are data beans the hold a returned row's data. For each row returned it will have its own data bean.
        Returns:
        The list of entries that were found.
      • getCatalogListData

        public CatalogSearchDataBean getCatalogListData(int index)
                                                 throws java.lang.ArrayIndexOutOfBoundsException
        Returns the specific data bean at the passed index within the array of data beans returned, represented by a CatalogSearchDataBean object. If the index is larger than the size of the array, an ArrayIndexOutOfBoundsException is thrown.
        Parameters:
        index - The index of the result array.
        Returns:
        The specific entry that was found in the array of CatalogSearchDataBean object.
        Throws:
        java.lang.ArrayIndexOutOfBoundsException - Thrown when access an array with an out of bound index.
      • getCatentryBuyable

        public java.lang.String getCatentryBuyable()
        Gets the buyable flag of catalog entry that is being searched against.
        Returns:
        The buyable flag of catalog entry.
      • getCatentryPublished

        public java.lang.String getCatentryPublished()
        Gets the published flag of catalog entry that is being searched against. The value of '0' indicates the catalog entry is not published and should not be displayed, the value of '1' indicates it is published and should be displayed.
        Returns:
        The published flag of catalog entry.
      • getCatentryType

        public java.lang.String getCatentryType()
        Gets the type of catalog entry that is being searched against, can be either all types of catalog entry, or items only.
        Returns:
        Type of catalog entry.
      • getCatgroupPublished

        public java.lang.String getCatgroupPublished()
        Gets the published flag of catalog group that is being searched against. The value of '0' indicates the catalog group is not published and should not be displayed, the value of '1' indicates it is published and should be displayed.
        Returns:
        The published flag of catalog group.
      • getOrderby

        public java.lang.String getOrderby()
        Gets the parameter that is used to order the results in the SQL query.
        Returns:
        Order by value used in the SQL query.
      • getSearchType

        public java.lang.String getSearchType()
        Gets the type of search to be performed, which identifies whether this search logic is used to search for category or catalog entry.
        Returns:
        The type of search to be performed.
      • getSrName

        public java.lang.String getSrName()
        Gets the name of the item to search for, this is the value of the name criteria.
        Returns:
        Name of the item.
      • getSrNameType

        public java.lang.String getSrNameType()
        Gets the type of search that is being performed to the name criteria.
        Returns:
        Type of search on name criteria.
      • getSrPartNumber

        public java.lang.String getSrPartNumber()
        Gets the SKU of the item to search for, this is the value of the SKU criteria.
        Returns:
        SKU of the item.
      • getSrPartNumberType

        public java.lang.String getSrPartNumberType()
        Gets the type of search that is being performed to the SKU criteria.
        Returns:
        Type of search on SKU criteria.
      • getSrShortDescription

        public java.lang.String getSrShortDescription()
        Gets the short description of the item to search for, this is the value of the short description criteria.
        Returns:
        Short description of the item.
      • getSrShortDescriptionType

        public java.lang.String getSrShortDescriptionType()
        Gets the type of search that is being performed to the short description criteria.
        Returns:
        Type of search on short description criteria.
      • setCatalogList

        public void setCatalogList(java.util.Vector newCatalogList)
        Sets the list of data beans found from the search or list. These are data beans that hold a returned rows data. For each row returned it will have its own data bean.
        Parameters:
        newCatalogList - List of data beans that represents the search result list.
      • setCatentryBuyable

        public void setCatentryBuyable(java.lang.String newCatentryBuyable)
        Sets the buyable flag of catalog entry that is being searched against.
        Parameters:
        newCatentryBuyable - The buyable flag of catalog entry.
      • setCatentryPublished

        public void setCatentryPublished(java.lang.String newCatentryPublished)
        Sets the published flag of catalog entry that is being searched against. The value of '0' indicates the catalog entry is not published and should not be displayed, the value of '1' indicates it is published and should be displayed.
        Parameters:
        newCatentryPublished - The published flag of catalog entry.
      • setCatentryType

        public void setCatentryType(java.lang.String newCatentryType)
        Sets the type of catalog entry that is being searched against, can be either all types of catalog entry, or items only.
        Parameters:
        newCatentryType - Type of catalog entry.
      • setCatgroupPublished

        public void setCatgroupPublished(java.lang.String newCatgroupPublished)
        Sets the published flag of catalog group that is being searched against. The value of '0' indicates the catalog group is not published and should not be displayed, the value of '1' indicates it is published and should be displayed.
        Parameters:
        newCatgroupPublished - The published flag of catalog group.
      • setOrderby

        public void setOrderby(java.lang.String newOrderby)
        Sets the parameter that is used to order the results in the SQL query.
        Parameters:
        newOrderby - Order by value used in the SQL query.
      • setSearchType

        public void setSearchType(java.lang.String newSearchType)
        Sets the type of search to be performed, which identifies whether this search logic is used to search for category or catalog entry.
        Parameters:
        newSearchType - The type of search to be performed.
      • setSrName

        public void setSrName(java.lang.String newSrName)
        Sets the name of the item to search for, this is the value of the name criteria.
        Parameters:
        newSrName - Name of the item.
      • setSrNameType

        public void setSrNameType(java.lang.String newSrNameType)
        Sets the type of search that is being performed to the name criteria.
        Parameters:
        newSrNameType - Type of search on name criteria.
      • setSrPartNumber

        public void setSrPartNumber(java.lang.String newSrPartNumber)
        Sets the SKU of the item to search for, this is the value of the SKU criteria.
        Parameters:
        newSrPartNumber - SKU of the item.
      • setSrPartNumberType

        public void setSrPartNumberType(java.lang.String newSrPartNumberType)
        Sets the type of search that is being performed to the SKU criteria.
        Parameters:
        newSrPartNumberType - Type of search on SKU criteria.
      • setSrShortDescription

        public void setSrShortDescription(java.lang.String newSrShortDescription)
        Sets the short description of the item to search for, this is the value of the short description criteria.
        Parameters:
        newSrShortDescription - Short description of the item.
      • setSrShortDescriptionType

        public void setSrShortDescriptionType(java.lang.String newSrShortDescriptionType)
        Sets the type of search that is being performed to the short description criteria.
        Parameters:
        newSrShortDescriptionType - Type of search on short description criteria.