|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.ibm.commerce.search.rulequery.RuleQuery
Search interface that is used to construct queries to search a catalog. The query will return catentry ids that match search criteria. This class provides a set of methods where each method can used to construct a predicate (search criteria specified in WHERE clause of an SQL). The search interface expects the predicates to be in post-fix format. For example post fix equaivalent of A and B and C or D or E is ABC and D or E or where A,B,C,D and E are individual predicates. Note the post-fix format is not strictly binary i.e. there can be more than two operands related to an operator. Due to this flexibility there are some restrictions on how to arrange the predicates and it is the responsibility of the user to arrange the predicates in correct order.
Constructor Summary | |
RuleQuery()
RuleQuery constructor with no arguments. |
|
RuleQuery(int inStoreID,
int inUserID)
Rule query constructor with store and user id as arguments. |
|
RuleQuery(int inStoreID,
TradingAgreementAccessBean[] agreements,
java.lang.Long userId)
RuleQuery constructor with store id, Trading agreement access bean and user id as arguments. |
|
RuleQuery(com.ibm.commerce.search.rulequery.Query q)
RuleQuery constructor with Query as argument. |
|
RuleQuery(TradingAgreementAccessBean[] agreements,
java.lang.Long userId)
RuleQuery constructor with Trading Agreement Access bean and user id as arguments. |
|
RuleQuery(java.util.Vector inStoreIDs,
int inUserID)
Rule query constructor with multiple store id and single user id as arguments. |
|
RuleQuery(java.util.Vector inStoreIDs,
TradingAgreementAccessBean[] agreements,
java.lang.Long userId)
RuleQuery constructor with multiple store id, Trading agreement access bean and user id as arguments. |
Method Summary | |
protected com.ibm.commerce.search.rulequery.Attribute |
addAttributeFunction(com.ibm.commerce.search.rulequery.Attribute attr,
int function)
Adds function to a table column. |
void |
addFilterAttribute(int attribute,
int operator)
Adds a predicate to query Where clause to filter a row, example, TABLE.COLUMN IS NOT NULL. |
void |
addFilterAttribute(int attribute,
int operator,
int function)
Adds a predicate to query Where clause to filter a row, example FUNCTION(TABLE.COLUMN) IS NULL. |
void |
addFilterAttribute(int attribute,
int operator,
java.lang.String value)
Adds a predicate to query Where clause to filter a row, example, TABLE.COLUMN LIKE '%VALUE%'. |
void |
addFilterAttribute(int attribute,
int operator,
java.lang.String value,
int function)
Adds a predicate to query Where clause to filter a row, example FUNCTION(TABLE.COLUMN) LIKE '%VALUE%'. |
void |
addFilterOperand(com.ibm.commerce.search.rulequery.Attribute attr)
Adds a WHERE clause predicate into temporary filter predicate collection. |
void |
addFilterOperand(com.ibm.commerce.search.rulequery.Predicate predicate)
Adds a collection of WHERE clause predicates into temporary filter predicate collection. |
void |
addFilterOperator(int operator)
Adds an operator that combines a set of filter predicates. |
protected com.ibm.commerce.search.rulequery.Operator |
addFilterOperatorType(int operType)
Maps constants that represent an filter operator to actual operator. |
void |
addGlobalPredicate()
Method to insert a predicate that will be applied to entire query like BUYABLE/PUBLISHABLE/LANGUAGE_ID. |
void |
addGroupByAttribute(int attribute)
To set group by operator Creation date: (6/20/2001 1:53:37 PM) |
protected com.ibm.commerce.search.rulequery.Operator |
addOperatorType(int operType)
Maps constants that represent an operator to actual operator. |
void |
addOrderByAttribute(int attribute,
int operator)
To set order by operator Creation date: (6/20/2001 1:53:37 PM) |
void |
addResultOperator(int operator)
To add result set with operators like max, min, count. |
void |
addRule()
Adds an set of predicates to a Query. |
void |
addRule(int aQueryType)
Adds a set of predicate to Query. |
void |
addSelectAttribute(int attribute,
int operator)
Adds a predicate to query Where clause, example, TABLE.COLUMN IS NOT NULL. |
void |
addSelectAttribute(int attribute,
int operator,
int function)
Adds a predicate to query Where clause, example FUNCTION(TABLE.COLUMN) IS NULL. |
void |
addSelectAttribute(int attribute,
int operator,
java.lang.String value)
Adds a predicate to query Where clause, example, TABLE.COLUMN LIKE '%VALUE%'. |
void |
addSelectAttribute(int attribute,
int operator,
java.lang.String value,
int function)
Adds a predicate to query Where clause, example FUNCTION(TABLE.COLUMN) LIKE '%VALUE%'. |
void |
addSelectAttribute(java.lang.String attribute,
int operator,
java.lang.String value,
int attrValueType,
java.lang.String languageId,
java.lang.String prodType)
Adds a Rich attribute predicate. |
void |
addSelectAttribute(java.lang.String attribute,
int operator,
java.lang.String value,
int attrValueType,
java.lang.String languageId,
java.lang.String prodType,
int function)
Adds a Rich attribute predicate. |
void |
addSelectOperand(com.ibm.commerce.search.rulequery.Attribute attr)
Adds a WHERE clause predicate into temporary select set predicate collection. |
void |
addSelectOperand(com.ibm.commerce.search.rulequery.Predicate predicate)
Adds a collection of WHERE clause predicates into temporary select set predicate collection. |
void |
addSelectOperator(int operator)
Adds an operator that combines a set of filter predicates. |
protected com.ibm.commerce.search.rulequery.Predicate |
buildPredicate()
Assembles the complete WHERE clause. |
protected java.lang.String |
evaluateSelectivity(com.ibm.commerce.search.catalog.SmartQuery query)
Evaluates a sub query in WHERE clause. |
java.util.Vector |
execute()
Executes catalog search query and retrieves all the catentry ids that satisfy the query. |
java.util.Vector |
execute(com.ibm.commerce.search.rulequery.Cursor aCursor)
Executes catalog search query and retrieves a set of catentry id between a start value and end value specified in the cursor object. |
protected boolean |
findAttribute(com.ibm.commerce.search.rulequery.Predicate p,
java.lang.String s)
This method can be used to find a particular column s in Predicate p. |
protected java.lang.String |
findAttributeInfoName(int attrId)
Maps a static integer constant that defines a column name to the singleton class name that describes the column name, its data type, and the table it belong to. |
java.lang.Integer |
getCatgrpSchemaType()
Do not modify. |
protected com.ibm.commerce.search.rulequery.Predicate |
getEntitlementPredicate()
Constructs the entitlement predicate. |
protected com.ibm.commerce.search.base.Predicate |
getGlobalPredicate()
Do not modify. |
protected com.ibm.commerce.search.catalog.AttributeInfo |
getInstanceOfAttrInfoByClassName(java.lang.String classname)
Given a class name in com.ibm.commerce.search.catalog package, gets the instance of the class. |
java.lang.Long |
getLongUserId()
Do not modify. |
com.ibm.commerce.search.base.Query |
getMcQuery()
Do not modify. |
com.ibm.commerce.search.rulequery.Predicate |
getPredicate()
Do not modify. |
int |
getQueryType()
Do not modify. |
java.lang.Integer |
getRASchemaType()
Do not modify. |
java.util.Vector |
getResultSet()
Do not modify. |
int |
getSelectivitySize()
Do not modify. |
java.util.Vector |
getSourceTables()
Do not modify. |
int |
getStoreID()
Do not modify. |
java.util.Vector |
getStoreIDs()
Do not modify. |
java.lang.Integer |
getUserID()
Do not modify. |
boolean |
isPriceSummary()
Returns if there is summary table for price or not true if there is summary table false otherwise |
void |
reset()
Re-initialize filterSet and selectSet variables Creation date: (10/30/00 5:52:47 AM) |
void |
setAgreements(TradingAgreementAccessBean[] newAgreements)
Do not modify. |
void |
setCatgrpSchemaType(java.lang.Integer newCatgrpSchemaType)
Do not modify. |
void |
setDefaultResultSelection()
To set default result selection variable. |
void |
setDistinct()
To set disctict operator Creation date: (6/20/2001 9:33:19 AM) |
void |
setDistinct(boolean distinctFlag)
To set disctict operator. |
protected void |
setGlobalPredicate(com.ibm.commerce.search.rulequery.Predicate globalPredicate)
Set the globalPredicate variable Creation date: (8/23/2001 4:00:11 PM) |
void |
setLongUserId(java.lang.Long newLongUserId)
Do not modify. |
void |
setRASchemaType(java.lang.Integer newRASchemaType)
Do not modify. |
void |
setSelectivitySize(int newSelectivitySize)
Set selectivity size Creation date: (8/25/2001 7:02:13 PM) |
void |
setStoreID(int newStoreID)
Set store id. |
void |
setStoreIDs(java.util.Vector newStoreIDs)
Set collection of store ids Creation date: (7/20/2001 2:25:32 PM) |
void |
setUserID(int newUserID)
Set user id Creation date: (6/25/2001 2:41:44 PM) |
java.lang.String |
toString()
Returns query string Creation date: (11/16/00 3:58:11 PM) |
protected com.ibm.commerce.search.rulequery.Predicate |
translatePredicate(int key,
com.ibm.commerce.search.rulequery.Predicate p)
This method does predicate translation based on the key passed. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected TradingAgreementAccessBean[] agreements
public static final int AND_Operator
public static final int ANY_QueryType
public static final int ASC_Operator
public static final int ATTRIBUTE_ATTRIBUTE_ID_Attr
public static final int ATTRIBUTE_CATENTRY_ID_Attr
public static final int ATTRIBUTE_LANGUAGE_ID_Attr
public static final int ATTRIBUTE_NAME_Attr
public static final int ATTRVALUE_ATTRIBUTE_ID_Attr
public static final int ATTRVALUE_CATENTRY_ID_Attr
public static final int ATTRVALUE_FLOATVALUE_Attr
public static final int ATTRVALUE_INTEGERVALUE_Attr
public static final int ATTRVALUE_LANGUAGE_ID_Attr
public static final int ATTRVALUE_NAME_Attr
public static final int ATTRVALUE_STRINGVALUE_Attr
public static final int AVG_Operator
public static final int BOTH_QueryType
public static final int BUNDLE_CatEntryType
public static final int CATENTDESC_AVAILABILITY_DATE_Attr
public static final int CATENTDESC_CATENTRY_ID_Attr
public static final int CATENTDESC_KEYWORD_Attr
public static final int CATENTDESC_LANGUAGE_ID_Attr
public static final int CATENTDESC_LONGDESCRIPTION_Attr
public static final int CATENTDESC_NAME_Attr
public static final int CATENTDESC_PARTNUMBER_Attr
public static final int CATENTDESC_PUBLISHED_Attr
public static final int CATENTDESC_SHORT_DESC_Attr
public static final int CATENTDESC_SHORTDESCRIPTION_Attr
public static final int CATENTDESC_THUMBNAIL_Attr
public static final int CATENTREL_CATENTRY_ID_CHILD_Attr
public static final int CATENTREL_CATENTRY_ID_PARENT_Attr
public static final int CATENTREL_CATREL_TYPE_ID_Attr
public static final int CATENTRY_BUYABLE_Attr
public static final int CATENTRY_CATENTRY_ID_Attr
public static final int CATENTRY_ID_Attr
public static final int CATENTRY_MARKFORDELETE_Attr
public static final int CATENTRY_MFNAME_Attr
public static final int CATENTRY_MFPARTNUMBER_Attr
public static final int CATENTRY_ONAUCTION_Attr
public static final int CATENTRY_ONSPECIAL_Attr
public static final int CATENTRY_PARTNUMBER_Attr
public static final int CATENTRY_SKU_Attr
public static final int CATENTRY_SKU_QueryType
public static final int CATGPENREL_CATALOG_ID_Attr
public static final int CATGPENREL_CATENTRY_ID_Attr
public static final int CATGPENREL_CATGROUP_ID_Attr
public static final int CATGROUP_CATGROUP_ID_Attr
public static final int CATGRPDESC_LANGUAGE_ID_Attr
public static final int CATGRPDESC_LONGDESCRIPTION_Attr
public static final int CATGRPDESC_NAME_Attr
public static final int CATGRPDESC_SHORTDESCRIPTION_Attr
public static final java.lang.String COPYRIGHT
public static final int COUNT_Operator
public boolean defaultResultSelection
public static final int DESC_Operator
public static final int EQ_Operator
protected com.ibm.commerce.search.rulequery.Predicate filterSet
protected java.util.Vector filterSetTmp
public static final int GE_Operator
public static final int GENERIC_QueryType
protected com.ibm.commerce.search.rulequery.Predicate globalPredicate
public static final int GROUP_BY_Operator
public static final int GT_Operator
public static final int IN_Operator
public static final int INVSTVW_QUANTITY_AVAILABLE_Attr
public static final int INVSTVW_QUANTITY_MEASURE_Attr
public static final int IS_NOT_NULL_Operator
public static final int IS_NULL_Operator
public static final int ITEM_CatEntryType
public static final int ITEM_QueryType
public static final int LE_Operator
public static final int LEFT_LIKE_Operator
public static final int LIKE_Operator
public static final int LISTPRICE_Attr
public static final int LISTPRICE_CATENTRY_ID_Attr
public static final int LISTPRICE_CURRENCY_Attr
public static final int LISTPRICE_LISTPRICE_Attr
public static final int LT_Operator
public static final int MAX_Operator
protected com.ibm.commerce.search.rulequery.Query mcQuery
public static final int MIN_Operator
public static final int NE_Operator
public static final int NOT_GT_Operator
public static final int NOT_IN_Operator
public static final int NOT_LEFT_LIKE_Operator
public static final int NOT_LIKE_Operator
public static final int NOT_LT_Operator
public static final int NOT_RIGHT_LIKE_Operator
public static final int OFFER_MAXIMUMQUANTITY_Attr
public static final int OFFER_MINIMUMQUANTITY_Attr
public static final int OFFER_OFFER_ID_Attr
public static final int OFFER_TRADEPOSCN_ID_Attr
public static final int OFFERPRICE_CURRENCY_Attr
public static final int OFFERPRICE_OFFER_ID_Attr
public static final int OFFERPRICE_PRICE_Attr
public static final int OR_Operator
public static final int ORDER_BY_Operator
public static final int PACKAGE_CatEntryType
public static final int PRODUCT_CatEntryType
protected java.util.Vector productSetInList
protected java.util.Vector productSetOutList
public static final int PRSETCEREL_CATENTRY_ID_Attr
public static final int PRSETCEREL_PRODUCTSET_ID_Attr
protected java.lang.String queryString
public static final int RIGHT_LIKE_Operator
protected com.ibm.commerce.search.rulequery.Predicate selectSet
protected java.util.Vector selectSetTmp
public static final int STDPRICEVW_CATENTRY_ID_Attr
public static final int STDPRICEVW_CURRENCY_Attr
public static final int STDPRICEVW_PRICE_Attr
public static final int STORECATENTRY_STORE_ID_Attr
public static final int STOREINVENTORY_QUANTITY_Attr
public static final int STOREINVENTORY_QUANTITY_MEASURE_Attr
public static final int SUM_Operator
public static final int TRADEPOSCN_TRADEPOSCN_ID_Attr
public static final int TRADEPOSCN_TYPE_ID_Attr
public static final int UPPER_Function
public static final int USER_ID_Attr
Constructor Detail |
public RuleQuery()
public RuleQuery(int inStoreID, int inUserID)
inStoreID
- The store id that will be added to search criteria.inUserID
- The user id.public RuleQuery(int inStoreID, TradingAgreementAccessBean[] agreements, java.lang.Long userId)
inStoreID
- The store id to be added to search criteria.agreements
- The trading agreement access bean array to process entitlement.userID
- The user id to process entitlement.public RuleQuery(com.ibm.commerce.search.rulequery.Query q)
q
- A query classpublic RuleQuery(TradingAgreementAccessBean[] agreements, java.lang.Long userId)
agreements
- The trading agreement access bean array to process entitlement.userID
- The user id to process entitlement.public RuleQuery(java.util.Vector inStoreIDs, int inUserID)
inStoreID
- Store id collection that will be added to search criteria.inUserID
- The user id.public RuleQuery(java.util.Vector inStoreIDs, TradingAgreementAccessBean[] agreements, java.lang.Long userId)
inStoreID
- The store id to be added to search criteria.agreements
- The trading agreement access bean array to process entitlement.userID
- The user id to process entitlement.Method Detail |
protected com.ibm.commerce.search.rulequery.Attribute addAttributeFunction(com.ibm.commerce.search.rulequery.Attribute attr, int function)
attr
- The table column meta data (Attribute object).function
- The function to be associated with the column.public void addFilterAttribute(int attribute, int operator) throws java.lang.Exception
The
- static integer constant equivalent of a column name.The
- static integer constant equivalent of an operator.public void addFilterAttribute(int attribute, int operator, int function) throws java.lang.Exception
The
- static integer constant equivalent of a column name.The
- static integer constant equivalent of an operator.The
- static integer constant equivalent of a function. At present only UPPER function is supported.public void addFilterAttribute(int attribute, int operator, java.lang.String value) throws java.lang.Exception
The
- static integer constant equivalent of a column name.The
- static integer constant equivalent of an operator.The
- value to be filtered from the database.public void addFilterAttribute(int attribute, int operator, java.lang.String value, int function) throws java.lang.Exception
The
- static integer constant equivalent of a column name.The
- static integer constant equivalent of an operator.The
- value to be filtered from the database.The
- static integer constant equivalent of a function. At present only UPPER function is supported.public void addFilterOperand(com.ibm.commerce.search.rulequery.Attribute attr) throws java.lang.Exception
A
- WHERE clause predicatepublic void addFilterOperand(com.ibm.commerce.search.rulequery.Predicate predicate) throws java.lang.Exception
A
- collection of WHERE clause predicatespublic void addFilterOperator(int operator)
The
- static integer constant equivalent of an operator.protected com.ibm.commerce.search.rulequery.Operator addFilterOperatorType(int operType)
operType
- The operator static integer constant.public void addGlobalPredicate()
public void addGroupByAttribute(int attribute) throws java.lang.Exception
protected com.ibm.commerce.search.rulequery.Operator addOperatorType(int operType)
operType
- The operator static integer constant.public void addOrderByAttribute(int attribute, int operator) throws java.lang.Exception
public void addResultOperator(int operator) throws java.lang.Exception
operator
- The operator to be added to result set.public void addRule()
public void addRule(int aQueryType)
aQueryType
- The type of result to be retrieved by the query. The search interface can retrieve only Products, only Items or Both.public void addSelectAttribute(int attribute, int operator) throws java.lang.Exception
The
- static integer constant equivalent of a column name.The
- static integer constant equivalent of an operator.public void addSelectAttribute(int attribute, int operator, int function) throws java.lang.Exception
The
- static integer constant equivalent of a column name.The
- static integer constant equivalent of an operator.The
- static integer constant equivalent of a function. At present only UPPER function is supported.public void addSelectAttribute(int attribute, int operator, java.lang.String value) throws java.lang.Exception
The
- static integer constant equivalent of a column name.The
- static integer constant equivalent of an operator.The
- value to be filtered from the database.public void addSelectAttribute(int attribute, int operator, java.lang.String value, int function) throws java.lang.Exception
The
- static integer constant equivalent of a column name.The
- static integer constant equivalent of an operator.The
- value to be filtered from the database.The
- static integer constant equivalent of a function. At present only UPPER function is supported.public void addSelectAttribute(java.lang.String attribute, int operator, java.lang.String value, int attrValueType, java.lang.String languageId, java.lang.String prodType) throws java.lang.Exception
attribute
- A search attribute, for example Color, Size.operator
- The static integer operator constant.value
- The value of a search attribute, for example Red, Length = 32.attrValueType
- The column in AttrValue table that must be used to search for the value, example Intergervalue, Stringvalue, Floatvalue or Name.languageId
- The language id that must be used for searching the rich attribute.prodType
- The Parent - Child relationship defined in CATENREL table. At present this method only supports Product_Item or NULL.public void addSelectAttribute(java.lang.String attribute, int operator, java.lang.String value, int attrValueType, java.lang.String languageId, java.lang.String prodType, int function) throws java.lang.Exception
attribute
- A search attribute, for example Color, Size.operator
- The static integer operator constant.value
- The value of a search attribute, for example Red, Length = 32.attrValueType
- The column in AttrValue table that must be used to search for the value, example Intergervalue, Stringvalue, Floatvalue or Name.languageId
- The language id that must be used for searching the rich attribute.prodType
- The Parent - Child relationship defined in CATENREL table. At present this method only supports Product_Item or NULL.function
- The static integer operator for UPPER functionpublic void addSelectOperand(com.ibm.commerce.search.rulequery.Attribute attr) throws java.lang.Exception
A
- WHERE clause predicatepublic void addSelectOperand(com.ibm.commerce.search.rulequery.Predicate predicate) throws java.lang.Exception
predicate
- A collection of predicates.public void addSelectOperator(int operator)
The
- static integer constant equivalent of an operator.protected com.ibm.commerce.search.rulequery.Predicate buildPredicate() throws java.lang.Exception
protected java.lang.String evaluateSelectivity(com.ibm.commerce.search.catalog.SmartQuery query) throws java.lang.Exception
query
- The sub-query in the where clause.public java.util.Vector execute() throws java.lang.Exception
public java.util.Vector execute(com.ibm.commerce.search.rulequery.Cursor aCursor) throws java.lang.Exception
The
- cursor object.protected boolean findAttribute(com.ibm.commerce.search.rulequery.Predicate p, java.lang.String s) throws java.lang.Exception
p
- A collection of where clause predicate.s
- The column name.protected java.lang.String findAttributeInfoName(int attrId)
attrId
- The static integer constant that defines a column name.public java.lang.Integer getCatgrpSchemaType()
protected final com.ibm.commerce.search.rulequery.Predicate getEntitlementPredicate() throws java.lang.Exception
protected com.ibm.commerce.search.base.Predicate getGlobalPredicate()
protected com.ibm.commerce.search.catalog.AttributeInfo getInstanceOfAttrInfoByClassName(java.lang.String classname) throws java.lang.Exception
classname
- The name of a class in com.ibm.commerce.search.catalog package.public java.lang.Long getLongUserId()
public com.ibm.commerce.search.base.Query getMcQuery()
public com.ibm.commerce.search.rulequery.Predicate getPredicate() throws java.lang.Exception
public int getQueryType()
public java.lang.Integer getRASchemaType()
public java.util.Vector getResultSet()
public int getSelectivitySize()
public java.util.Vector getSourceTables()
public int getStoreID()
public java.util.Vector getStoreIDs()
public java.lang.Integer getUserID()
public boolean isPriceSummary()
public void reset()
public void setAgreements(TradingAgreementAccessBean[] newAgreements)
newAgreements
- com.ibm.commerce.contract.objects.TradingAgreementAccessBean[]public void setCatgrpSchemaType(java.lang.Integer newCatgrpSchemaType)
newCatgrpSchemaType
- java.lang.Integerpublic void setDefaultResultSelection()
public void setDistinct()
public void setDistinct(boolean distinctFlag)
true
- to set distinct, false otherwise.protected void setGlobalPredicate(com.ibm.commerce.search.rulequery.Predicate globalPredicate)
globalPredicate
- The global predicate.public void setLongUserId(java.lang.Long newLongUserId)
newLongUserId
- java.lang.Longpublic void setRASchemaType(java.lang.Integer newRASchemaType)
newRASchemaType
- java.lang.Integerpublic void setSelectivitySize(int newSelectivitySize)
newSelectivitySize
- The new selectivity size.public void setStoreID(int newStoreID)
newStoreID
- The new store id.public void setStoreIDs(java.util.Vector newStoreIDs)
newStoreIDs
- The new store ids.public void setUserID(int newUserID)
newUserID
- The new user id.public java.lang.String toString()
toString
in class java.lang.Object
protected com.ibm.commerce.search.rulequery.Predicate translatePredicate(int key, com.ibm.commerce.search.rulequery.Predicate p) throws java.lang.Exception
k
- The key for translationp
- The predicate to be translated.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |