|
Oracle Content Management SDK | |||||||||
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. Most Attribute names have java constants in the java classes corresponding to the class object they belong to. ID and CLASSID attributes are an exception to that rule. Use those strings directly as attribute names, to search based on ID and CLASSID.
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 Multi Value Attributes the Specified search value is always treated as a Single-Value.
// // Usage examples // // Simple String attribute, case ignored // Name = 'Foo' condition // AttributeQualification aq1 = new AttributeQualification(); aq1.setAttribute(PublicObject.NAME_ATTRIBUTE); aq1.setOperatorType(AttributeQualification.EQUAL); aq1.setValue("Foo"); aq1.setCaseIgnored(true); // // String attribute, late bound // Name = ? condition. // AttributeQualification aq1 = new AttributeQualification(); aq1.setAttribute(PublicObject.NAME_ATTRIBUTE); aq1.setOperatorType(AttributeQualification.EQUAL); aq1.setValue(SearchQualification.LATE_BIND_OPER); // // Date attribute // CreateDate < today condition // AttributeQualification aq1 = new AttributeQualification(); aq1.setAttribute(PublicObject.CREATEDATE_ATTRIBUTE); aq1.setOperatorType(AttributeQualification.LESS_THAN); Date today = new Date(); AttribuetValue av = AttributeValue.newAttributeValue(today); aq1.setValue(av, session); // session required for Date attribute aq1.setDateComparisionLevel(AttributeQualification.DATE_COMP_DAY); // // Object type Attribute, Eg. ACL // Condition - ACL = Public // AttributeQualification aq1 = new AttributeQualification(); aq1.setAttribute(PublicObject.ACL_ATTRIBUTE); aq1.setOperatorType(AttributeQualification.EQUAL); AccessControlList publicAcl; // Let's assume this represents PUBLIC acl AttribuetValue av = AttributeValue.newAttributeValue(publicAcl); aq1.setValue(av);
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. |
Fields inherited from class oracle.ifs.search.SearchQualification |
LATE_BIND_OPER |
Constructor Summary | |
AttributeQualification()
Constructs an AttributeQualification. |
Method Summary | |
java.lang.String |
getAttributeClassname()
Return the search class of this object. |
java.lang.String |
getAttributeName()
Return the attribute name of this object. |
int |
getDateComparisonLevel()
Returns the date comparison level. |
int |
getOperatorType()
Gets the operator type of this attribute qualification. |
java.lang.String |
getValue()
Returns the string representation of the comparison value. |
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 class name and attribute name for this AttributeQualification. |
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.public void setAttribute(java.lang.String className, java.lang.String attrName)
className
- the class of the attributeattrName
- the attribute nameSearchSpecification
,
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
Supplied attribute value is used to generate a appropriate query at search execution time. 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 any other failureAttributeValue
public java.lang.String getValue()
public void setDateComparisonLevel(int df)
df
- date comparision level; see DATE_COMP_ constants.public void setCaseIgnored(boolean value) throws IfsException
IfsException
- if the operation failspublic int getDateComparisonLevel()
public boolean isCaseIgnored() throws IfsException
IfsException
- if the operation fails
|
Oracle Content Management SDK | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |