com.ibm.commerce.tools.campaigns
Class CatalogSearchListDataBean

java.lang.Object
  |
  +--com.ibm.commerce.tools.util.CommonSearchHelperBean
        |
        +--com.ibm.commerce.tools.campaigns.CatalogSearchListDataBean

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 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 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 EJB'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.ServerJDBCHelperAccessBean 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.ServerJDBCHelperAccessBean. 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
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. TYPE_LIKE_CASE_SENSITIVE - Matches containing and case sensitive TYPE_LIKE_IGNORE_CASE - Matches containing and case insensitive TYPE_MATCH_CASE_SENSITIVE - Exact phrase and case sensitive TYPE_MATCH_IGNORE_CASE - Exact phrase and case insensitive
static java.lang.String TYPE_LIKE_IGNORE_CASE           Values of the search type for each criteria. TYPE_LIKE_CASE_SENSITIVE - Matches containing and case sensitive TYPE_LIKE_IGNORE_CASE - Matches containing and case insensitive TYPE_MATCH_CASE_SENSITIVE - Exact phrase and case sensitive TYPE_MATCH_IGNORE_CASE - Exact phrase and case insensitive
static java.lang.String TYPE_MATCH_CASE_SENSITIVE           Values of the search type for each criteria. TYPE_LIKE_CASE_SENSITIVE - Matches containing and case sensitive TYPE_LIKE_IGNORE_CASE - Matches containing and case insensitive TYPE_MATCH_CASE_SENSITIVE - Exact phrase and case sensitive TYPE_MATCH_IGNORE_CASE - Exact phrase and case insensitive
static java.lang.String TYPE_MATCH_IGNORE_CASE           Values of the search type for each criteria. TYPE_LIKE_CASE_SENSITIVE - Matches containing and case sensitive TYPE_LIKE_IGNORE_CASE - Matches containing and case insensitive TYPE_MATCH_CASE_SENSITIVE - Exact phrase and case sensitive TYPE_MATCH_IGNORE_CASE - Exact phrase and case insensitive
 
Constructor Summary
CatalogSearchListDataBean()
          Constructor for CatalogSearchListDataBean.
 
Method Summary
 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 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 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 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 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 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail
public static final java.lang.String COPYRIGHT
IBM copyright notice field.
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

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_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_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

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 TYPE_LIKE_IGNORE_CASE - Matches containing and case insensitive TYPE_MATCH_CASE_SENSITIVE - Exact phrase and case sensitive TYPE_MATCH_IGNORE_CASE - Exact phrase and case insensitive
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_CASE_SENSITIVE - Matches containing and case sensitive TYPE_LIKE_IGNORE_CASE - Matches containing and case insensitive TYPE_MATCH_CASE_SENSITIVE - Exact phrase and case sensitive TYPE_MATCH_IGNORE_CASE - Exact phrase 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_LIKE_CASE_SENSITIVE - Matches containing and case sensitive TYPE_LIKE_IGNORE_CASE - Matches containing and case insensitive TYPE_MATCH_CASE_SENSITIVE - Exact phrase and case sensitive TYPE_MATCH_IGNORE_CASE - Exact phrase and case insensitive
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_LIKE_CASE_SENSITIVE - Matches containing and case sensitive TYPE_LIKE_IGNORE_CASE - Matches containing and case insensitive TYPE_MATCH_CASE_SENSITIVE - Exact phrase and case sensitive TYPE_MATCH_IGNORE_CASE - Exact phrase and case insensitive
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

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.

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.

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.

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.

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.
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 (select CED.CATENTRY_ID from CATENTDESC CED where CED.LANGUAGE_ID = -2 and CED.CATENTRY_ID = CATENTRY.CATENTRY_ID) is null)) 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 CATALOG.CATALOG_ID, CATALOG.IDENTIFIER, CATALOG.MEMBER_ID, CATGROUP.CATGROUP_ID, CATGROUP.IDENTIFIER, CATGROUP.MEMBER_ID, CATGRPDESC.NAME, CATGRPDESC.SHORTDESCRIPTION, CPARENT.CATGROUP_ID, CPARENT.IDENTIFIER, CDPARENT.NAME, STORECAT.STOREENT_ID from CATALOG, CATGROUP, CATGRPDESC, STORECAT, STORECGRP, CATGROUP CPARENT, CATGRPDESC CDPARENT where STORECAT.STOREENT_ID in (1) and STORECGRP.STOREENT_ID in (1) and CATGROUP.MARKFORDELETE <> 1 and (CATGRPDESC.LANGUAGE_ID = -2 or (CATGRPDESC.LANGUAGE_ID = -1 and (select cgd.CATGROUP_ID from CATGRPDESC cgd where cgd.LANGUAGE_ID = -2 and cgd.CATGROUP_ID = CATGROUP.CATGROUP_ID) is null)) and (CDPARENT.LANGUAGE_ID = -2 or (CDPARENT.LANGUAGE_ID = -1 and (select cgd.CATGROUP_ID from CATGRPDESC cgd where cgd.LANGUAGE_ID = -2 and cgd.CATGROUP_ID = CDPARENT.CATGROUP_ID) is null)) and STORECAT.STOREENT_ID = STORECGRP.STOREENT_ID and CATGRPDESC.CATGROUP_ID = CATGROUP.CATGROUP_ID and CATGROUP.CATGROUP_ID = STORECGRP.CATGROUP_ID and CATALOG.CATALOG_ID = STORECAT.CATALOG_ID and CPARENT.CATGROUP_ID = CDPARENT.CATGROUP_ID and (CPARENT.CATGROUP_ID in (select cgr.CATGROUP_ID_PARENT from CATGRPREL cgr where cgr.CATGROUP_ID_CHILD = CATGROUP.CATGROUP_ID and cgr.CATALOG_ID = CATALOG.CATALOG_ID) or CPARENT.CATGROUP_ID in (select ctg.CATGROUP_ID from CATTOGRP ctg where ctg.CATGROUP_ID = CATGROUP.CATGROUP_ID and ctg.CATALOG_ID = CATALOG.CATALOG_ID)) order by CATGRPDESC.NAME asc;
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.
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 rows 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.

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

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

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

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

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

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

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

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

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

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

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

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

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