Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## oracle.ifs.search
Class AttributeQualification

    java.lang.Object
      oracle.ifs.search.SearchQualification
          oracle.ifs.search.AttributeQualification

All Implemented Interfaces:
  java.io.Serializable, java.lang.Cloneable

Direct Known Subclasses:
  AttributeSubqueryQualification

    public class AttributeQualification

extends SearchQualification

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);

See Also:
  Serialized Form
(Published)

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` | `ENDS_WITH` Represents a ENDS WITH operation.
`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.
`protected java.lang.String` | `m_Attribute` Represents the Name of the Attribute.
`protected int` | `m_AttributeDataType` Represents the Attribute's dataType.
`protected java.lang.String` | `m_AttributeId` Stores the Attribute's objectid.
`protected AttributeValue` | `m_AVValue` Comparison Value as an AttributeValue.
`protected java.lang.String` | `m_Class` Represents the Search Class.
`protected int` | `m_CompOper` Represents the type of comparison to be performed.
`protected int` | `m_DateCompLevel` Represents the date comparison level.
`protected java.util.Date` | `m_DateValue` Represents the Date value.
`protected java.lang.Character` | `m_EscapeClause` The character to use as the escape clause.
`protected boolean` | `m_IgnoreCase` Represents case sensitiveness of the search.
`protected static java.util.Hashtable` | `m_Opers` Mapping from operator Strings to integer values.
`protected static java.util.Hashtable` | `m_ReverseOpers` Mapping from integer values to operator Strings.
`protected java.lang.String` | `m_SQLValue` Represents the value converted to SQL.
`protected java.lang.String` | `m_Value` Represents the comparison Value.
`static int` | `NOT_EQUAL` Represents an 'not_equal' comparison.
`static int` | `NOT_LIKE` Represents a NOT LIKE operation.
`static int` | `STARTS_WITH` Represents a STARTS WITH operation.

Fields inherited from class oracle.ifs.search.SearchQualification
`LATE_BIND_OPER`

Constructor Summary
`AttributeQualification()` Constructs an AttributeQualification.

Method Summary
`protected void` | `accept(oracle.ifs.search.SearchQualificationVisitor v)` Accepts a SearchQualificationVisitor.
`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.
`java.lang.Character` | `getEscapeClauseCharacter()` Returns the escape clause character to use for LIKE operations.
`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.
`protected boolean` | `isLateBound()` Checks if Qualification is Late Bound.
`static java.lang.String` | `operatorTypeName(int operator)` Gets the String corresponding to the integer operator.
`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` | `setEscapeClauseCharacter(java.lang.Character escape)` Sets the escape clause character to use for LIKE operations.
`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.
`void` | `setValueLateBound()` Sets the value to indicate that it will be specified at search execution time.
`protected static java.lang.String` | `toSQL(java.lang.String table, java.lang.String attr, int oper, java.lang.String value, boolean ignoreCase)` Helper function used by SQLGenerator for generating the SQL of the Search.
`protected java.lang.String` | `toSQL(java.lang.String table, java.lang.String attr, java.lang.String value)` Helper function used by SQLGenerator for generating the SQL of the Search.
`protected static void` | `validateOperator(int oper)` Checks if operator is valid.

Methods inherited from class oracle.ifs.search.SearchQualification
`clone`

Methods inherited from class java.lang.Object
`equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### m_Attribute

    protected java.lang.String m_Attribute

  Description copied from class: `AttributeQualification`
  Represents the Name of the Attribute.

  (Unpublished)

### m_AttributeDataType

    protected int m_AttributeDataType

  Description copied from class: `AttributeQualification`
  Represents the Attribute's dataType.

  See Also:
    `Attribute`
  (Unpublished)

### m_Class

    protected java.lang.String m_Class

  Description copied from class: `AttributeQualification`
  Represents the Search Class.

  (Unpublished)

### m_Value

    protected java.lang.String m_Value

  Description copied from class: `AttributeQualification`
  Represents the comparison Value.

  (Unpublished)

### m_SQLValue

    protected java.lang.String m_SQLValue

  Description copied from class: `AttributeQualification`
  Represents the value converted to SQL. Quotes in String's are escaped, Dates are converted based on the Date Comparison Level etc. See ValidationVaisitor & SearchValidator for details.

  See Also:
    `SearchValidator`
  (Unpublished)

### m_DateValue

    protected java.util.Date m_DateValue

  Description copied from class: `AttributeQualification`
  Represents the Date value. This is used in place of m_SQLValue for Date -> SQL genreation.

  See Also:
    `SearchValidator`
  (Unpublished)

### m_CompOper

    protected int m_CompOper

  Description copied from class: `AttributeQualification`
  Represents the type of comparison to be performed.

  (Unpublished)

### m_DateCompLevel

    protected int m_DateCompLevel

  Description copied from class: `AttributeQualification`
  Represents the date comparison level.

  (Unpublished)

### m_IgnoreCase

    protected boolean m_IgnoreCase

  Description copied from class: `AttributeQualification`
  Represents case sensitiveness of the search.

  (Unpublished)

### m_EscapeClause

    protected java.lang.Character m_EscapeClause

  Description copied from class: `AttributeQualification`
  The character to use as the escape clause. Null indicates that no escape clause will be emitted.

  (Unpublished)

### m_AVValue

    protected AttributeValue m_AVValue

  Description copied from class: `AttributeQualification`
  Comparison Value as an AttributeValue.

  See Also:
    `AttributeValue`
  (Unpublished)

### m_AttributeId

    protected java.lang.String m_AttributeId

  Description copied from class: `AttributeQualification`
  Stores the Attribute's objectid.

  (Unpublished)

### EQUAL

    public static final int EQUAL

  Description copied from class: `AttributeQualification`
  Represents an 'equality' comparison.

  See Also:
    Constant Field Values
  (Published)

### LESS_THAN

    public static final int LESS_THAN

  Description copied from class: `AttributeQualification`
  Represents an 'less-than' comparison.

  See Also:
    Constant Field Values
  (Published)

### LESS_THAN_EQUAL

    public static final int LESS_THAN_EQUAL

  Description copied from class: `AttributeQualification`
  Represents an 'less-than-equal' comparison.

  See Also:
    Constant Field Values
  (Published)

### GREATER_THAN

    public static final int GREATER_THAN

  Description copied from class: `AttributeQualification`
  Represents an 'greater-than' comparison.

  See Also:
    Constant Field Values
  (Published)

### GREATER_THAN_EQUAL

    public static final int GREATER_THAN_EQUAL

  Description copied from class: `AttributeQualification`
  Represents an 'greater-than-equal' comparison.

  See Also:
    Constant Field Values
  (Published)

### NOT_EQUAL

    public static final int NOT_EQUAL

  Description copied from class: `AttributeQualification`
  Represents an 'not_equal' comparison.

  See Also:
    Constant Field Values
  (Published)

### IS_NULL

    public static final int IS_NULL

  Description copied from class: `AttributeQualification`
  Represents an 'is-null' comparison.

  See Also:
    Constant Field Values
  (Published)

### IS_NOT_NULL

    public static final int IS_NOT_NULL

  Description copied from class: `AttributeQualification`
  Represents an 'is-not-null' comparison.

  See Also:
    Constant Field Values
  (Published)

### LIKE

    public static final int LIKE

  Description copied from class: `AttributeQualification`
  Represents an 'like' comparison. The '%' character has special meaning in the value. It represents 0 or more characters.

  See Also:
    Constant Field Values
  (Published)

### NOT_LIKE

    public static final int NOT_LIKE

  Description copied from class: `AttributeQualification`
  Represents a NOT LIKE operation.

  See Also:
    Constant Field Values
  (Published)

### ENDS_WITH

    public static final int ENDS_WITH

  Description copied from class: `AttributeQualification`
  Represents a ENDS WITH operation.

  See Also:
    Constant Field Values
  (Unpublished)

### STARTS_WITH

    public static final int STARTS_WITH

  Description copied from class: `AttributeQualification`
  Represents a STARTS WITH operation.

  See Also:
    Constant Field Values
  (Unpublished)

### DATE_COMP_YEAR

    public static final int DATE_COMP_YEAR

  Description copied from class: `AttributeQualification`
  Compare dates only based on the year.

  See Also:
    Constant Field Values
  (Published)

### DATE_COMP_MONTH

    public static final int DATE_COMP_MONTH

  Description copied from class: `AttributeQualification`
  Compare dates based on the year & month.

  See Also:
    Constant Field Values
  (Published)

### DATE_COMP_DAY

    public static final int DATE_COMP_DAY

  Description copied from class: `AttributeQualification`
  Compare dates on the year, month and day.

  See Also:
    Constant Field Values
  (Published)

### DATE_COMP_HOUR

    public static final int DATE_COMP_HOUR

  Description copied from class: `AttributeQualification`
  Compare dates on the year, month, day and hour.

  See Also:
    Constant Field Values
  (Published)

### DATE_COMP_MIN

    public static final int DATE_COMP_MIN

  Description copied from class: `AttributeQualification`
  Compare dates on the year, month, day, hour and minute.

  See Also:
    Constant Field Values
  (Published)

### DATE_COMP_SEC

    public static final int DATE_COMP_SEC

  Description copied from class: `AttributeQualification`
  Compare dates on the year, month, day, hour, minute and second. This is the default.

  See Also:
    Constant Field Values
  (Published)

### m_Opers

    protected static final java.util.Hashtable m_Opers

  Description copied from class: `AttributeQualification`
  Mapping from operator Strings to integer values.

  (Unpublished)

### m_ReverseOpers

    protected static final java.util.Hashtable m_ReverseOpers

  Description copied from class: `AttributeQualification`
  Mapping from integer values to operator Strings.

  (Unpublished)

Constructor Detail

### AttributeQualification

    public AttributeQualification()

  Constructs an AttributeQualification. Default date comparison level is setto DATE_COMP_SEC.

  (Published)

Method Detail

### setAttribute

    public void setAttribute(java.lang.String attrName)

  Description copied from class: `AttributeQualification`
  Sets the Attribute Name. Uses the first Result class from search specification as the class name.

  Parameters:
    `attrName` - The attribute used for the condition.
  (Published)

### setAttribute

    public void setAttribute(java.lang.String className,
                             java.lang.String attrName)

  Description copied from class: `AttributeQualification`
  Sets the class name and attribute name for this AttributeQualification. If the className is null, then it's default value is, name of the the first Result class. className should be name of valid iFS class. attrName should be the name of a valid attribute of that class.

  Parameters:
    `className` - the class of the attribute
    `attrName` - the attribute name
  See Also:
    `SearchSpecification`, `SearchClassSpecification`
  (Published)

### getAttributeClassname

    public java.lang.String getAttributeClassname()
                                           throws IfsException

  Description copied from class: `AttributeQualification`
  Return the search class of this object.

  Returns:
    the Search Class.
  Throws:
    `IfsException` - if the operation fails
  (Published)

### getAttributeName

    public java.lang.String getAttributeName()

  Description copied from class: `AttributeQualification`
  Return the attribute name of this object.

  Returns:
    the Attribute.
  (Published)

### setOperatorType

    public void setOperatorType(java.lang.String oper)
                         throws IfsException

  Description copied from class: `AttributeQualification`
  Sets the comparision operator.

  Parameters:
    `oper` - comparison operator
  Throws:
    `IfsException` - if specified operator is not supported
  (Published)

### setOperatorType

    public void setOperatorType(int oper)
                         throws IfsException

  Description copied from class: `AttributeQualification`
  Set the comparision operator.

  Parameters:
    `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`
  Throws:
    `IfsException` - if specified operator is not supported.
  (Published)

### getOperatorType

    public int getOperatorType()
                        throws IfsException

  Description copied from class: `AttributeQualification`
  Gets the operator type of this attribute qualification.

  Returns:
    the operator of the Qualification.
  Throws:
    `IfsException` - if the operation fails
  (Published)

### operatorTypeName

    public static java.lang.String operatorTypeName(int operator)
                                             throws IfsException

  Description copied from class: `AttributeQualification`
  Gets the String corresponding to the integer operator. If the operator is not valid, it throws an exception.

  Parameters:
    `operator` - integer representing the 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`
  Throws:
    `IfsException` - if the operation fails

### setValue

    public void setValue(java.lang.String value)

  Description copied from class: `AttributeQualification`
  Sets the comparison Value. The preferred style is to use the other variant which uses AttributeValue as parameter type. If value is SearchQualification.LATE_BIND_OPER, then the qualification is late bound and values will have to be supplied at search execution time.

  Parameters:
    `value` - comparison value
  (Published)

### setValue

    public void setValue(AttributeValue av)
                  throws IfsException

  Description copied from class: `AttributeQualification`
  Sets the comparison value. Calls setValue(av, null)

  Parameters:
    `av` - the comparison value specified as an AttrbuteValue
  Throws:
    `IfsException`
  See Also:
    `AttributeQualification.setValue(AttributeValue, LibrarySession)`
  (Published)

### setValueLateBound

    public void setValueLateBound()
                           throws IfsException

  Description copied from class: `AttributeQualification`
  Sets the value to indicate that it will be specified at search execution time.

  Throws:
    `IfsException`
  (Published)

### setValue

    public void setValue(AttributeValue av,
                         LibrarySession sess)
                  throws IfsException

  Description copied from class: `AttributeQualification`
  Sets the comparison Value. The specified value must be a scalar type, and it cannot be null.

  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.

  Parameters:
    `av` - the comparison Value as an AttributeValue
    `sess` - the LibrarySession to use for converting values to strings.
  Throws:
    `IfsException` - 22002 if av is null or IfsException 10400 if av is not of a supported type or IfsException if any other failure
  See Also:
    `AttributeValue`
  (Published)

### getValue

    public java.lang.String getValue()

  Description copied from class: `AttributeQualification`
  Returns the string representation of the comparison value.

  Returns:
    the comparison value.
  (Published)

### setDateComparisonLevel

    public void setDateComparisonLevel(int df)

  Description copied from class: `AttributeQualification`
  Sets the date comparison value. The default is DATE_COMP_SEC.

  Parameters:
    `df` - date comparision level; see DATE_COMP_ constants.
  (Published)

### setCaseIgnored

    public void setCaseIgnored(boolean value)
                        throws IfsException

  Description copied from class: `AttributeQualification`
  Sets up case sensitive behavior based on the parameter. Default behavior is case sensitive.

  Parameters:
    `value` - if true, the searches will be case insensitive.
  Throws:
    `IfsException` - if the operation fails
  (Published)

### getDateComparisonLevel

    public int getDateComparisonLevel()

  Description copied from class: `AttributeQualification`
  Returns the date comparison level.

  Returns:
    date comparison level.
  (Published)

### isCaseIgnored

    public boolean isCaseIgnored()
                          throws IfsException

  Description copied from class: `AttributeQualification`
  Returns true if this AttributeQualification is case insensitive.

  Returns:
    boolean true or false.
  Throws:
    `IfsException` - if the operation fails
  (Published)

### setEscapeClauseCharacter

    public void setEscapeClauseCharacter(java.lang.Character escape)
                                  throws IfsException

  Description copied from class: `AttributeQualification`
  Sets the escape clause character to use for LIKE operations.

  A null value indicates that no escape clause will be emitted.

  Parameters:
    `escape` - the escape clause character to emit for LIKE operations
  Throws:
    `IfsException` - if the operation fails
  (Published)

### getEscapeClauseCharacter

    public java.lang.Character getEscapeClauseCharacter()
                                                 throws IfsException

  Description copied from class: `AttributeQualification`
  Returns the escape clause character to use for LIKE operations.

  A null value indicates that no escape clause will be emitted.

  Returns:
    the escape clause character to emit for LIKE operations
  Throws:
    `IfsException` - if the operation fails
  (Published)

### toSQL

    protected java.lang.String toSQL(java.lang.String table,
                                     java.lang.String attr,
                                     java.lang.String value)

  Description copied from class: `AttributeQualification`
  Helper function used by SQLGenerator for generating the SQL of the Search. Returns `table.attr 'oper' value`

  Parameters:
    `table` - table being searched
    `attr` - attribute being searched
    `value` - value being compared.
  Returns:
    sql for the condition.
  See Also:
    `SQLGenerator`
  (Unpublished)

### toSQL

    protected static java.lang.String toSQL(java.lang.String table,
                                            java.lang.String attr,
                                            int oper,
                                            java.lang.String value,
                                            boolean ignoreCase)

  Description copied from class: `AttributeQualification`
  Helper function used by SQLGenerator for generating the SQL of the Search.

  Parameters:
    `table` - table being searched
    `attr` - attribute being searched
    `oper` - comparison operator
    `value` - value being compared.
    `ignoreCase` - If the data type is string, set this to true or false.
  Returns:
    sql for the condition.
  See Also:
    `SQLGenerator`
  (Unpublished)

### validateOperator

    protected static void validateOperator(int oper)
                                    throws IfsException

  Description copied from class: `AttributeQualification`
  Checks if operator is valid. See list of constants for list of supported operators.

  Parameters:
    `oper` - comparison oper
  Throws:
    `IfsException` - 22103 if operator is not valid.
  (Unpublished)

### accept

    protected void accept(oracle.ifs.search.SearchQualificationVisitor v)
                   throws IfsException

  Description copied from class: `AttributeQualification`
  Accepts a SearchQualificationVisitor. Calls visitAttributeQualifier on the visitor. The code in visitAttributeQualifier is specific to the Visitor.

  Specified by:
    `accept` in class `SearchQualification`
  Parameters:
    `v` - SearchQualificationVisitor
  Throws:
    `IfsException` - thrown if Visitor code throws.
  (Unpublished)

### isLateBound

    protected boolean isLateBound()

  Description copied from class: `AttributeQualification`
  Checks if Qualification is Late Bound. An AttributeQualification is LateBound if the value is not null and is equal to the SearchQualification.LATE_BIND_OPER.

  Overrides:
    `isLateBound` in class `SearchQualification`
  Returns:
    true if AQ is lateBound, false otherwise.
  (Unpublished)

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD