java.lang.Object | +--com.ibm.commerce.tools.util.CommonSearchHelperBean | +--com.ibm.commerce.tools.campaigns.CatalogSearchListDataBean
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.
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
public static final java.lang.String ORDER_BY_PRODUCT_CODE
public static final java.lang.String ORDER_BY_PRODUCT_NAME
public static final java.lang.String ORDER_BY_PRODUCT_SHORTDESC
public static final java.lang.String ORDER_BY_PRODUCT_TYPE
public static final java.lang.String ORDER_BY_CATEGORY_NAME
public static final java.lang.String ORDER_BY_CATEGORY_SHORTDESC
public static final java.lang.String ORDER_BY_CATEGORY_PARENT
public static final java.lang.String TYPE_LIKE_CASE_SENSITIVE
public static final java.lang.String TYPE_LIKE_IGNORE_CASE
public static final java.lang.String TYPE_MATCH_CASE_SENSITIVE
public static final java.lang.String TYPE_MATCH_IGNORE_CASE
public static final java.lang.String SEARCH_TYPE_CATENTRY
public static final java.lang.String SEARCH_TYPE_CATGROUP
public static final java.lang.String CATENTRY_TYPE_PRODUCT
public static final java.lang.String CATENTRY_TYPE_ITEM
public static final java.lang.String CATENTRY_TYPE_PACKAGE
public static final java.lang.String CATENTRY_TYPE_BUNDLE
public static final java.lang.String CATENTRY_TYPE_DYNAMIC_KIT
Constructor Detail |
---|
public CatalogSearchListDataBean()
Method Detail |
---|
public java.lang.String buildQuery() throws java.lang.Exception
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;
java.lang.Exception
- Thrown when an exception is encountered
whether constructing the query.public void buildResultDataBean(java.util.Vector resultVector)
com.ibm.commerce.tools.util.CommonSearchHelperBean
.
resultVector
- the result vector returned from the query
executionpublic CatalogSearchDataBean[] getCatalogList()
CatalogSearchDataBean
object. These are data beans
the hold a returned rows data. For each row returned it will have its own data
bean.
public CatalogSearchDataBean getCatalogListData(int index) throws java.lang.ArrayIndexOutOfBoundsException
CatalogSearchDataBean
object. If
the index is larger than the size of the array, an
ArrayIndexOutOfBoundsException
is thrown.
index
- the index of the result arrayCatalogSearchDataBean
objectjava.lang.ArrayIndexOutOfBoundsException
- Thrown when access
an array with an out of bound index.public java.lang.String getSrName()
public java.lang.String getSrNameType()
public java.lang.String getOrderby()
public java.lang.String getSrPartNumber()
public java.lang.String getSrPartNumberType()
public java.lang.String getSearchType()
public java.lang.String getSrShortDescription()
public java.lang.String getSrShortDescriptionType()
public java.lang.String getCatentryType()
public void setCatalogList(java.util.Vector newCatalogList)
newCatalogList
- list of data beans that represents the search
result listpublic void setSrName(java.lang.String newSrName)
newSrName
- name of the itempublic void setSrNameType(java.lang.String newSrNameType)
newSrNameType
- type of search on name
criteriapublic void setOrderby(java.lang.String newOrderby)
newOrderby
- order by value used in the SQL
querypublic void setSrPartNumber(java.lang.String newSrPartNumber)
newSrPartNumber
- SKU of the itempublic void setSrPartNumberType(java.lang.String newSrPartNumberType)
newSrPartNumberType
- type of search on SKU
criteriapublic void setSearchType(java.lang.String newSearchType)
newSearchType
- the type of search to be
performedpublic void setSrShortDescription(java.lang.String newSrShortDescription)
newSrShortDescription
- short description of the
itempublic void setSrShortDescriptionType(java.lang.String newSrShortDescriptionType)
newSrShortDescriptionType
- type of search on short
description criteriapublic void setCatentryType(java.lang.String newCatentryType)
newCatentryType
- type of catalog entry