|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--oracle.ifs.search.SearchQualification | +--oracle.ifs.search.AttributeQualification
An AttributeQualification encapsulates a condition on a Attribute. We support conditions
on both single-valued & multi-valued attributes. Currently we only support the comparison
operators <, <=, >, >=, =, <>
. Additionally we support checks on null and the
'LIKE' operator only for Strings.
An AttributeQualification is specified by a AttributeName, Class, operator, and a Comparison Value. Additionally for date Attributes we support a Date Comparison Level, which allows users to specify how dates are compared. For e.g. sometimes it is useful to only compare the years or only the year and months etc.
Roughly, an AttributeQualification on a Single-Value Attribute translates to the SQL condition
Class.Attr 'oper' value
. While on a Multi_value Attribute it translates to,
exists (select list of Class.Attr values where Attr.value 'oper' value)
Currently, for Multi-Value Attributes Clients can check whether a particular condition holds
for the list of values. For e.g. if the client setups an AttributeQualifier for a MultiValue
Attribute 'X' with the operator set to >
and value 123;the ResultObjects of the search, will
contain at least one 'X' value which is greater than 123. This covers the most common query about
containment i.e. most often users want to check if a particular value is in the list of values.
Hence for MV Attributes the Specified value is always treated as a Single-Value.
Below is an example of how to do a simple content search, using an AttributeQualification.
// specify sort order String [] ctxClauseName = {"Test1"}; // order by SCORE // set DESCENDING sort order // order by SCORE DESCENDING, 'NAME' ASCENDING boolean [] sortOrders = {false, true}; // SearchSortSpecification sortSpec = new SearchSortSpecification( new String[] {"DOCUMENT", "DOCUMENT"}, new String[] {ContextQualification.ORDER_PREFIX + "." + ctxClauseName[0], "NAME"}, sortOrders); // // get the 'PUBLIC' AccessControlList object Collection c = sess.getSystemAccessControlListCollection(); AccessControlList acl = (AccessControlList) c.getItems("Public"); // AttributeQualification aq1 = new AttributeQualification(); aq1.setAttribute("ACL"); aq1.setOperator(AttributeQualification.EQUAL); aq1.setValue(AttributeValue.newAttributeValue(acl)); // AttributeQualification aq2 = new AttributeQualification(); aq2.setAttribute("NAME"); aq2.setOperatorType(AttributeQualification.LIKE); aq2.setValue("Hie%"); // SearchClause sc = new SearchClause( aq1, aq2, SearchClause.AND ); // // join with CONTENTOBJECT JoinQualification jq = new JoinQualification(); jq.setLeftAttribute("DOCUMENT", "CONTENTOBJECT"); jq.setRightAttribute("CONTENTOBJECT", null); // // add to the SearchClause sc = new SearchClause( sc, jq, SearchClause.AND ); // // create a query expression using interMedia Text query syntax String searchWord1 = "hierarchy"; String searchWord2 = "interfaces"; String queryOperator = " & "; String queryExpr = searchWord1 + queryOperator + searchWord2; // // create a ContextQualification and specify the query expression ContextQualification cq = new ContextQualification(); cq.setQuery(queryExpr); cq.setName(ctxClauseName[0]); // // add to the SearchClause sc = new SearchClause( sc, cq, SearchClause.AND ); // ContextSearchSpecification cp = new ContextSearchSpecification(); cp.setContextClassname("CONTENTOBJECT"); cp.setSearchClassSpecification(new SearchClassSpecification(new String[] {"DOCUMENT", "CONTENTOBJECT"})); cp.setSearchQualification(sc); cp.setSearchSortSpecification(sortSpec); // Search s = new Search(sess, cp); // s.open(); ... s.close();
Field Summary | |
static int |
DATE_COMP_DAY
Compare dates on the year, month and day. |
static int |
DATE_COMP_HOUR
Compare dates on the year, month, day and hour. |
static int |
DATE_COMP_MIN
Compare dates on the year, month, day, hour and minute. |
static int |
DATE_COMP_MONTH
Compare dates based on the year & month. |
static int |
DATE_COMP_SEC
Compare dates on the year, month, day, hour, minute and second. |
static int |
DATE_COMP_YEAR
Compare dates only based on the year. |
static int |
EQUAL
Represents an 'equality' comparison. |
static int |
GREATER_THAN
Represents an 'greater-than' comparison. |
static int |
GREATER_THAN_EQUAL
Represents an 'greater-than-equal' comparison. |
static int |
IS_NOT_NULL
Represents an 'is-not-null' comparison. |
static int |
IS_NULL
Represents an 'is-null' comparison. |
static int |
LESS_THAN
Represents an 'less-than' comparison. |
static int |
LESS_THAN_EQUAL
Represents an 'less-than-equal' comparison. |
static int |
LIKE
Represents an 'like' comparison. |
static int |
NOT_EQUAL
Represents an 'not_equal' comparison. |
static int |
NOT_LIKE
Represents a NOT LIKE operation. |
Constructor Summary | |
AttributeQualification()
Constructs an AttributeQualification. |
Method Summary | |
java.lang.String |
getAttributeClassname()
Return the Search Class of this AttributeQualification. |
java.lang.String |
getAttributeName()
Return the Attribute of this Qualification |
int |
getDateComparisonLevel()
Returns the date comparison level. |
int |
getOperatorType()
Gets the operator type of this attribute qualification. |
java.lang.String |
getValue()
Returns the comparison value as a String. |
boolean |
isCaseIgnored()
Returns true if this AttributeQualification is case insensitive. |
void |
setAttribute(java.lang.String attrName)
Sets the Attribute Name. |
void |
setAttribute(java.lang.String className,
java.lang.String attrName)
Sets the Attribute Name & Class. |
void |
setCaseIgnored(boolean value)
Sets up case sensitive behavior based on the parameter. |
void |
setDateComparisonLevel(int df)
Sets the date comparison value. |
void |
setOperatorType(int oper)
Set the comparision operator. |
void |
setOperatorType(java.lang.String oper)
Sets the comparision operator. |
void |
setValue(AttributeValue av)
Sets the comparison value. |
void |
setValue(AttributeValue av,
LibrarySession sess)
Sets the comparison Value. |
void |
setValue(java.lang.String value)
Sets the comparison Value. |
Methods inherited from class oracle.ifs.search.SearchQualification |
clone |
Field Detail |
public static final int EQUAL
public static final int LESS_THAN
public static final int LESS_THAN_EQUAL
public static final int GREATER_THAN
public static final int GREATER_THAN_EQUAL
public static final int NOT_EQUAL
public static final int IS_NULL
public static final int IS_NOT_NULL
public static final int LIKE
public static final int NOT_LIKE
public static final int DATE_COMP_YEAR
public static final int DATE_COMP_MONTH
public static final int DATE_COMP_DAY
public static final int DATE_COMP_HOUR
public static final int DATE_COMP_MIN
public static final int DATE_COMP_SEC
Constructor Detail |
public AttributeQualification()
Method Detail |
public void setAttribute(java.lang.String attrName)
attrName
- The attribute used for the condition.setAttribute(String, String)
public void setAttribute(java.lang.String className, java.lang.String attrName)
className
- The class of the attributeattrName
- The attribute used for the condition.SearchSpecification
,
SearchClassSpecification
public java.lang.String getAttributeClassname() throws IfsException
IfsException
- if the operation failspublic java.lang.String getAttributeName()
public void setOperatorType(java.lang.String oper) throws IfsException
oper
- comparison operatorIfsException
- if specified operator is not supportedpublic void setOperatorType(int oper) throws IfsException
oper
- comaprison operator; must be one of
AttributeQualification.EQUAL
,
AttributeQualification.GREATER_THAN
,
AttributeQualification.GREATER_THAN_EQUAL
,
AttributeQualification.IS_NOT_NULL
,
AttributeQualification.IS_NULL
,
AttributeQualification.LESS_THAN
,
AttributeQualification.LESS_THAN_EQUAL
,
AttributeQualification.LIKE
IfsException
- if specified operator is not supported.public int getOperatorType() throws IfsException
IfsException
- if the operation failspublic void setValue(java.lang.String value)
value
- comparison valuepublic void setValue(AttributeValue av) throws IfsException
av
- the comparison value specified as an AttrbuteValuesetValue(AttributeValue, LibrarySession)
public void setValue(AttributeValue av, LibrarySession sess) throws IfsException
AttributeValue.newAttributeValue("hello world")
At this point the value is converted to a String. For Dates if the session is null, an exception will be thrown, because a Locale is needed to convert dates to Strings.
av
- the comparison Value as an AttributeValuesess
- the LibrarySession to use for converting values to strings.IfsException
- 22002 if av is nullIfsException
- 10400 if av is not of a supported typeIfsException
- if string conversion fails.AttributeValue
public java.lang.String getValue()
public void setDateComparisonLevel(int df)
df
- date comparison level. See DATE constants for a list of levels.public void setCaseIgnored(boolean value) throws IfsException
IfsException
- if the operation failspublic int getDateComparisonLevel()
public boolean isCaseIgnored() throws IfsException
IfsException
- if the operation fails
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |