com.ibm.commerce.tools.experimentation.search

Class CatalogEntrySearchListDataBean

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


    public class CatalogEntrySearchListDataBean
    extends com.ibm.commerce.tools.util.CommonSearchHelperBean
    This data bean finds catalog entries in a store. It accepts parameters to be used as the search criteria, generates and executes a 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 database side execution, the most important methods that would be necessary are the ones that contruct the database query and the list of data beans. Methods are also provided to get a list of entries that have been found and to get a specific entry that has been found. You can extend this class with extra getters and setters to add extra search criteria.

    To make use of com.ibm.commerce.tools.util.CommonSearchHelperBean class, a query must first be created that returns the desired results from the database. Some hints as to how this is done can be taken from looking at the current enterprise beans 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 by calling set methods in the JSP.

    com.ibm.commerce.tools.util.CommonSearchHelperBean provides a method to execute the SQL statement. It sets up a cursor and an instance of a JDBC helper class com.ibm.commerce.base.objects.ServerJDBCHelperBean, and passes the cursor and the returned SQL string (built in the buildQuery method implemented in this class) to the com.ibm.commerce.base.objects.ServerJDBCHelperBean instance. The result size is then set, taken from the cursor. With the use of a cursor, high volumes of returned results can be divided into separate segments, and be displayed onto an appropriate number of pages.

    The buildResultDataBean method must also be implemented. 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 COPYRIGHT
      IBM copyright notice field.
      • Fields inherited from interface com.ibm.commerce.beans.DataBean

        emptyString
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      java.lang.String buildQuery()
      This method constructs the SQL query.
      void buildResultDataBean(java.util.Vector resultVector)
      This method constructs the list of result data beans.
      CatalogEntrySearchDataBean[] getCatalogEntryList()
      This method returns the list of data beans found from the search or list, represented by an array of CatalogEntrySearchDataBean objects.
      CatalogEntrySearchDataBean getCatalogEntryListData(int index)
      This method returns the specific data bean at the passed index within the array of data beans returned, represented by the CatalogEntrySearchDataBean o bject.
      java.lang.String getCatentryName()
      This method returns the name of the catalog entry to be searched for, this is the value of the name criteria.
      java.lang.String getCatentryNameType()
      This method returns the type of search that is being performed to the catalog entry name criteria.
      java.lang.String getMarkForDelete()
      This method returns the 'mark for delete' flag that should be used in building the search query.
      java.lang.String getPartNumber()
      This method returns the part number of the catalog entry to be searched for, this is the value of the part number criteria.
      java.lang.String getPartNumberType()
      This method returns the type of search that is being performed to the catalog entry part number criteria.
      java.lang.String getPublished()
      This method returns the 'published' flag that should be used in building the search query.
      void setCatalogEntryList(java.util.Vector newCatalogEntryList)
      This method sets the list of data beans found from the search or list, represented by an array of CatalogEntrySearchDataBean objects.
      void setCatentryName(java.lang.String newCatentryName)
      This method sets the name of the catalog entry to be searched for, this is the value of the name criteria.
      void setCatentryNameType(java.lang.String newCatentryNameType)
      This method sets the type of search that is being performed to the catalog entry name criteria.
      void setMarkForDelete(java.lang.String newMarkForDelete)
      This method sets the 'mark for delete' flag that should be used in building the search query.
      void setPartNumber(java.lang.String newPartNumber)
      This method sets the part number of the catalog entry to be searched for, this is the value of the part number criteria.
      void setPartNumberType(java.lang.String newPartNumberType)
      This method sets the type of search that is being performed to the catalog entry part number criteria.
      void setPublished(java.lang.String newPublished)
      This method sets the 'published' flag that should be used in building the search query.
      • 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

      • COPYRIGHT

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

      • CatalogEntrySearchListDataBean

        public CatalogEntrySearchListDataBean()
        The default constructor for this class.
    • Method Detail

      • buildQuery

        public java.lang.String buildQuery()
                                    throws java.lang.Exception
        This method constructs the SQL query. Here the query must be put together using the user given parameters for the search to be performed properly. This implements the buildQuery abstract method in com.ibm.commerce.tools.util.CommonSearchHelperBean and be called by the populate method found in the same abstract class.
        Specified by:
        buildQuery in class com.ibm.commerce.tools.util.CommonSearchHelperBean
        Returns:
        The SQL query string that is used to search for catalog entries.
        Throws:
        java.lang.Exception - Thrown when an exception is encountered whether constructing the query.
      • buildResultDataBean

        public void buildResultDataBean(java.util.Vector resultVector)
        This method constructs the list of result data beans. After the SQL has been executed and a result vector has been returned, a list of data beans will be populated. 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.
      • getCatalogEntryList

        public CatalogEntrySearchDataBean[] getCatalogEntryList()
        This method returns the list of data beans found from the search or list, represented by an array of CatalogEntrySearchDataBean objects. These are data beans that hold a returned rows data. For each row returned it will have its own data bean.
        Returns:
        The list of catalog entry data beans.
      • getCatalogEntryListData

        public CatalogEntrySearchDataBean getCatalogEntryListData(int index)
                                                           throws java.lang.ArrayIndexOutOfBoundsException
        This method returns the specific data bean at the passed index within the array of data beans returned, represented by the CatalogEntrySearchDataBean o bject. If the index is larger than the size of the array, an ArrayIndexOutOfBoundsException will be thrown.
        Parameters:
        index - The index of the result array.
        Returns:
        The specific entry that was found in the array of CatalogEntrySearchDataBean object.
        Throws:
        java.lang.ArrayIndexOutOfBoundsException - Thrown when access an array with an out of bound index.
      • getCatentryName

        public java.lang.String getCatentryName()
        This method returns the name of the catalog entry to be searched for, this is the value of the name criteria.
        Returns:
        The catalog entry name in the name criteria.
      • getCatentryNameType

        public java.lang.String getCatentryNameType()
        This method returns the type of search that is being performed to the catalog entry name criteria.
        Returns:
        Type of search on the catalog entry name criteria.
      • getMarkForDelete

        public java.lang.String getMarkForDelete()
        This method returns the 'mark for delete' flag that should be used in building the search query.
        Returns:
        The catalog entry 'mark for delete' flag.
      • getPartNumber

        public java.lang.String getPartNumber()
        This method returns the part number of the catalog entry to be searched for, this is the value of the part number criteria.
        Returns:
        The catalog entry part number in the part number criteria.
      • getPartNumberType

        public java.lang.String getPartNumberType()
        This method returns the type of search that is being performed to the catalog entry part number criteria.
        Returns:
        Type of search on the catalog entry part number criteria.
      • getPublished

        public java.lang.String getPublished()
        This method returns the 'published' flag that should be used in building the search query.
        Returns:
        The catalog entry 'published' flag.
      • setCatalogEntryList

        public void setCatalogEntryList(java.util.Vector newCatalogEntryList)
        This method sets the list of data beans found from the search or list, represented by an array of CatalogEntrySearchDataBean objects. These are data beans that each hold data about a returned row. Each row returned will have its own data bean.
        Parameters:
        newCatalogEntryList - The list of catalog entry data beans.
      • setCatentryName

        public void setCatentryName(java.lang.String newCatentryName)
        This method sets the name of the catalog entry to be searched for, this is the value of the name criteria.
        Parameters:
        newCatentryName - The catalog entry name in the name criteria.
      • setCatentryNameType

        public void setCatentryNameType(java.lang.String newCatentryNameType)
        This method sets the type of search that is being performed to the catalog entry name criteria.
        Parameters:
        newCatentryNameType - Type of search on the catalog entry name criteria.
      • setMarkForDelete

        public void setMarkForDelete(java.lang.String newMarkForDelete)
        This method sets the 'mark for delete' flag that should be used in building the search query.
        Parameters:
        newMarkForDelete - The catalog entry 'mark for delete' flag.
      • setPartNumber

        public void setPartNumber(java.lang.String newPartNumber)
        This method sets the part number of the catalog entry to be searched for, this is the value of the part number criteria.
        Parameters:
        newPartNumber - The catalog entry part number in the part number criteria.
      • setPartNumberType

        public void setPartNumberType(java.lang.String newPartNumberType)
        This method sets the type of search that is being performed to the catalog entry part number criteria.
        Parameters:
        newPartNumberType - Type of search on the catalog entry part number criteria.
      • setPublished

        public void setPublished(java.lang.String newPublished)
        This method sets the 'published' flag that should be used in building the search query.
        Parameters:
        newPublished - The catalog entry 'published' flag.