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 AttributeSearchSpecification

    java.lang.Object
      oracle.ifs.search.SearchSpecification
          oracle.ifs.search.AttributeSearchSpecification

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

Direct Known Subclasses:
  ContextSearchSpecification

    public class AttributeSearchSpecification

extends SearchSpecification

An AttributeSpecification represents a non Context Search. The Specification contains the ClassSpecification, SortSpecification and SearchQualification. This class should be used when your searches contain only Attribute based conditions and no context based conditions.

>      // Usage Examples

>      // How to build a Attribute Search specification

>      // Construct the AttributeSearchSpecification.
>      AttributeSearchSpecification asp = new AttributeSearchSpecification();

>      // Let's assume we have the 3 parts needed.
>      // They are SearchClassSpecification - SELECT list and FROM list
>      // SearchQualification - WHERE condition
>      // SearchSortSpecification - ORDER BY clause
>      SearchClassSpecification someSearchSpec = ...;
>      SearchSortSpecification someSortSpec = ... ;
>      SearchQualification someSearchQual = ...;
>      LibrarySession sess = ...;

>      // Set the search class spec
>      asp.setSearchClassSpecification(someSearchSpec);

>      // Set the search qualification
>      asp.setSearchQualification(someSearchQual);

>      // Set the sort specification
>      asp.setSearchSortSpecification(someSortSpec);

>      // Now we are ready to build a Search  or create a View.

>      // Building a search
>      Search someSearch = new Search(sess, asp);

>      // Or creating a view
>      ViewSpecification viewSpec = new ViewSpecification("TestView", asp);

>      // ---------------------------------------------------------------
>      // Complete example of a Search using AttributeSearchSpecification
>      // ---------------------------------------------------------------

>      // Let's build a search that looks for all DOCUMENTS with a given
>      // ACL and are named FOO.

>      // Let's build the WHERE condition first.
>      // It will be - DOC.ACL = GIVEN-ACL and DOC.NAME='FOO'

>      // DOC.ACL = GIVEN-ACL
>      AttributeQualification aq1 = new AttributeQualification();
>      aq1.setAttribute(PublicObject.ACL_ATTRIBUTE);
>      aq1.setOperatorType(AttributeQualification.EQUAL);
>      aq1.setValue(AttributeValue.newAttributeValue(acl));

>      // DOC.NAME= 'FOO'
>      AttributeQualification aq2 = new AttributeQualification();
>      aq2.setAttribute(PublicObject.NAME_ATTRIBUTE);
>      aq2.setOperatorType(AttributeQualification.EQUAL);
>      aq2.setValue("FOO");

>      // Put them together with an AND. With that our
>      // SearchQualification is ready.
>      SearchClause sc = new SearchClause(aq1, aq2, SearchClause.AND);

>      // Let's build the SearchClassSpecification
>      SearchClassSpecification classSpec = new SearchClassSpecification();
>      classSpec.addSearchClass(Document.CLASS_NAME);

>      // Let's build the SearchSortSpecification

>      // Let' sort by create date
>      SearchSortSpecification sortSpec = new SearchSortSpecification();
>      sortSpec.add(PublicObject.CREATEDATE_ATTRIBUTE, true);

>      // Now that all 3 components are built, it is time to build
>      // AttributeSearchSpecification,nd attache the 3 components.

>      AttributeSearchSpecification sp = new AttributeSearchSpecification();
>      sp.setSearchClassSpecification(classSpec);
>      sp.setSearchQualification(sc);
>      sp.setSearchSortSpecification(sortSpec)

>      // Now we are ready to construct the search object.
>      // You can even build a view at this point using ViewSpecification.
>      Search s = new Search(m_Session, sp);

>      // Open the search. This runs the query.
>      s.open();

>      // At this point you can do next() on the Search and get the SearchResultObject
>      // for each row in searcn result. After processing the results, remember to close
>      // the search.

>      // close
>      s.close();

See Also:
  `SearchClassSpecification`, `SearchSortSpecification`, `SearchQualification`, Serialized Form
(Published)

Field Summary
`protected SearchClassSpecification` | `m_ClassSpecification` The SearchClassSpecification, that specifies the search & result classes.
`protected SearchQualification` | `m_Qual` The SearchTree.
`protected SearchSortSpecification` | `m_SortSpec` The SearchSortSpecification, that describes the sort order for the Search Results.

Fields inherited from class oracle.ifs.search.SearchSpecification
`CLEAR_PLAN_TABLE_PARAMETER, m_SecurityBindingInPlace, PLAN_NAME_PARAMETER, PLAN_TABLE_PARAMETER, SEARCH_ID_PARAMETER, SEARCH_SPEC_PARAMETER`

Constructor Summary
`AttributeSearchSpecification()`

Method Summary
`void` | `addOptimizerHint(java.lang.String sqlHint)` Add an optimizer hint.
`protected void` | `bindValuesInPlace(oracle.ifs.search.BindValuesInSpecVisitor vis)` bindValuesInPlace- sets the bind Values in the SearchTree.
`java.lang.Object` | `clone()` Returns a clone of this AttributeSearchSpecification.
`protected void` | `copy(AttributeSearchSpecification src)` Copies the elements from the src AttributeSearchSpecification into this object.
`java.lang.String` | `getEffectiveOptimizerHint()` Get a string representing all the supplied hints.
`int` | `getMaxItemCount()` Gets the maximum number of items that the search will return.
`java.util.Vector` | `getOptimizerHints()` Get all hints.
`java.lang.String[]` | `getResultClasses()` Returns the result classes of the Search.
`SearchClassSpecification` | `getSearchClassSpecification()` Gets SearchClassSpecification of this search.
`SearchQualification` | `getSearchQualification()` Returns the SearchQualification of this search.
`SearchSortSpecification` | `getSearchSortSpecification()` Gets the SearchSortSpecification for this object.
`protected java.util.Enumeration` | `getSQL(java.lang.String prefix, S_Search srchObj, S_LibrarySession sess, java.util.Vector avs, boolean searchCountOnly)` Returns an Enumeration of PreparedStatements.
`java.lang.String` | `getSQLString(java.lang.String prefix, S_LibrarySession session, boolean searchCountOnly)` Returns the SQL string for this SearchSpecification.
`protected java.lang.String` | `getViewStatement(ViewSpecification vsp, S_LibrarySession sess)` Generates a View creation statement, based on the ViewSpecification.
`protected void` | `replaceFirstOptimizerHint(java.lang.String sqlHint)` Replaces the first SQL hint in the hint vector.
`void` | `setMaxItemCount(int maxCount)` Sets the max number of items that should to be returned from the search.
`void` | `setResultClass(java.lang.String clss)` If Class Specification is not set, initializes the SearchClassSpecification, and adds clss as a result class; else this is a noop.
`void` | `setSearchClassSpecification(SearchClassSpecification scp)` Sets the SearchClassSpecification for this Search.
`void` | `setSearchQualification(SearchQualification s)` Sets the SearchQualification.
`void` | `setSearchSortSpecification(SearchSortSpecification sortSpec)` Sets the SearchSortSpecification.
`protected int` | `setSecurityParameters(S_LibrarySession sess, java.sql.PreparedStatement stmt, S_Search srch, int startIdx)` Sets the userid in the security clause, returns the bind offset, which is passed to the bindVisitor.
`void` | `validate(LibrarySession sess)` Constructs or finds a SearchValidator for the specified session.

Methods inherited from class oracle.ifs.search.SearchSpecification
`contentClasses, createView, explainPlan, getBoundSpecification, getContextScoreMap, getSQL, getSQL`

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

Field Detail

### m_ClassSpecification

    protected SearchClassSpecification m_ClassSpecification

  Description copied from class: `AttributeSearchSpecification`
  The SearchClassSpecification, that specifies the search & result classes.

  (Unpublished)

### m_Qual

    protected SearchQualification m_Qual

  Description copied from class: `AttributeSearchSpecification`
  The SearchTree.

  (Unpublished)

### m_SortSpec

    protected SearchSortSpecification m_SortSpec

  Description copied from class: `AttributeSearchSpecification`
  The SearchSortSpecification, that describes the sort order for the Search Results.

  (Unpublished)

Constructor Detail

### AttributeSearchSpecification

    public AttributeSearchSpecification()

(Published)

Method Detail

### setSearchClassSpecification

    public void setSearchClassSpecification(SearchClassSpecification scp)
                                     throws IfsException

  Description copied from class: `AttributeSearchSpecification`
  Sets the SearchClassSpecification for this Search. SearchClassSpecification is used to generate the SELECT list and FROM list of the search.

  Parameters:
    `scp` - SearchClassSpecification
  Throws:
    `IfsException` - if the operation fails
  (Published)

### setMaxItemCount

    public void setMaxItemCount(int maxCount)
                         throws IfsException

  Description copied from class: `AttributeSearchSpecification`
  Sets the max number of items that should to be returned from the search. If this number is non zero, then underlying SQL select statement is modified to include a condition on the rownum, so that only the desired number of rows are returned.

  The maxItemCount value affects regular searches only. It does not affect the results of getItemCount(). It also does not alter the SQL, if used to create a view using ViewSpecification.

  The SQL is constructed in a way so that the ORDER BY clause and rownum condition can co-exist.

  Parameters:
    `maxCount` - max number of items that should be returned from this search
  Throws:
    `IfsException` - if the operation fails
  (Published)

### getMaxItemCount

    public int getMaxItemCount()
                        throws IfsException

  Description copied from class: `AttributeSearchSpecification`
  Gets the maximum number of items that the search will return. If a call to setMaxItemCount has not been done prior to this call, then it returns a 0 indicating it will return all the elements.

  Returns:
    max number of items that the search will return
  Throws:
    `IfsException` - if the operation fails
  (Published)

### addOptimizerHint

    public void addOptimizerHint(java.lang.String sqlHint)

  Description copied from class: `AttributeSearchSpecification`
  Add an optimizer hint. This will be used at the SQL construction time to pass hints to database query optimizer. When multiple calls to this method are used to pass in hints, we generate a space separated list of hints that retains the original order of calls to this method.

  The SELECT statmenet used for this search will specify the hint in a comment block right after the SELECT keyword. By using hints, one can alter the query execution plan of the database optimizer. Therefore, users have to be careful in choosing hints appropriately.

  Parameters:
    `sqlHint` - add a SQL-hint. This will be added to the SELECT statement.
  (Published)

### replaceFirstOptimizerHint

    protected void replaceFirstOptimizerHint(java.lang.String sqlHint)

  Description copied from class: `AttributeSearchSpecification`
  Replaces the first SQL hint in the hint vector. This is used by the fast response context search. Regular context searches and fast context searches use different hints. Every search starts out as a regular search and has the the usual 'INDEX()' hint. If a search is marked as fast response type, then it needs to change the hint to a 'leading(...)' hint. This method is used to achieve that.

  (Unpublished)

### getOptimizerHints

    public java.util.Vector getOptimizerHints()
                                       throws IfsException

  Description copied from class: `AttributeSearchSpecification`
  Get all hints. This returns a vector filled with all the hints that have been added so far using the addOptimizerHint() method.

  Returns:
    optimizer hints used by this search class spec.
  Throws:
    `IfsException` - if the operation fails
  (Published)

### getEffectiveOptimizerHint

    public java.lang.String getEffectiveOptimizerHint()
                                               throws IfsException

  Description copied from class: `AttributeSearchSpecification`
  Get a string representing all the supplied hints. Use this method to inspect the effective hint string constructed by the search API code. Search API also uses this method during SQL generation.

  Returns:
    a string representing concatenation of all user supplied; This is used in the SELECT statement.
  Throws:
    `IfsException` - if the operation fails
  (Published)

### setSearchQualification

    public void setSearchQualification(SearchQualification s)
                                throws IfsException

  Description copied from class: `AttributeSearchSpecification`
  Sets the SearchQualification. SearchQualification is used to generate the WHERE condition of the search.

  Parameters:
    `s` - SearchQualification representing SearchTree
  Throws:
    `IfsException` - if the operation fails
  (Published)

### getSearchQualification

    public SearchQualification getSearchQualification()

  Description copied from class: `AttributeSearchSpecification`
  Returns the SearchQualification of this search. SearchQualification encapsulates the WHERE condition of this search.

  Returns:
    the SearchTree
  (Published)

### setSearchSortSpecification

    public void setSearchSortSpecification(SearchSortSpecification sortSpec)
                                    throws IfsException

  Description copied from class: `AttributeSearchSpecification`
  Sets the SearchSortSpecification. SerachSortSpecification is used to generate the ORDER BY clause of this search.

  Parameters:
    `sortSpec` - SearchSortSpecification describing Sort behavior.
  Throws:
    `IfsException` - if the operation fails
  (Published)

### getSearchSortSpecification

    public SearchSortSpecification getSearchSortSpecification()
                                                       throws IfsException

  Description copied from class: `AttributeSearchSpecification`
  Gets the SearchSortSpecification for this object. SearchSortSpecification encapsulates the ORDER BY clause of this search.

  Returns:
    SearchSortSpecification for this object.
  Throws:
    `IfsException`
  (Published)

### setResultClass

    public void setResultClass(java.lang.String clss)
                        throws IfsException

  Description copied from class: `AttributeSearchSpecification`
  If Class Specification is not set, initializes the SearchClassSpecification, and adds clss as a result class; else this is a noop.

  Parameters:
    `clss` - single search class, which is also the result class
  Throws:
    `IfsException`
  (Unpublished)

### getResultClasses

    public java.lang.String[] getResultClasses()
                                        throws IfsException

  Description copied from class: `AttributeSearchSpecification`
  Returns the result classes of the Search.

  Specified by:
    `getResultClasses` in class `SearchSpecification`
  Returns:
    list of result classes
  Throws:
    `IfsException`
  (Unpublished)

### getSearchClassSpecification

    public SearchClassSpecification getSearchClassSpecification()
                                                         throws IfsException

  Description copied from class: `AttributeSearchSpecification`
  Gets SearchClassSpecification of this search. SearchClassSpecification encapsulates the SELECT list and FROM list of this search.

  Specified by:
    `getSearchClassSpecification` in class `SearchSpecification`
  Returns:
    SearchClassSpecification of this object
  Throws:
    `IfsException` - if the operation fails
  (Published)

### validate

    public void validate(LibrarySession sess)
                  throws IfsException

  Description copied from class: `AttributeSearchSpecification`
  Constructs or finds a SearchValidator for the specified session. Calls on it to do the actual Validation.

  Specified by:
    `validate` in class `SearchSpecification`
  Parameters:
    `sess` - LibrarySession in which validation is performed.
  Throws:
    `IfsException` - if validation fails
  See Also:
    `SearchValidator`
  (Unpublished)

### getSQL

    protected java.util.Enumeration getSQL(java.lang.String prefix,
                                           S_Search srchObj,
                                           S_LibrarySession sess,
                                           java.util.Vector avs,
                                           boolean searchCountOnly)
                                    throws IfsException

  Description copied from class: `AttributeSearchSpecification`
  Returns an Enumeration of PreparedStatements. For an AttributeSearchSpecification Enumeration contains only one statement. Finds or constructs a SQLGenerator object for the session, and calls on it generate the SQL statement. The srchObj creates the PreparedStatement from the sqlStr.

  The security parameters are bound by calling setSecurityParameters. Finally the BindValuesVisitor traverse the searchTree, binding any late bound Qualification values.

  Specified by:
    `getSQL` in class `SearchSpecification`
  Parameters:
    `prefix` - the generated SQL is prefixed with this String, this is used for explain plan.
    `srchObj` - server side Search object in which Search is being executed.
    `sess` - server side session in which Search is being executed.
    `avs` - list of bind values
  Returns:
    list of PreparedStatements
  Throws:
    `IfsException` - if sql generation fails
  See Also:
    `SearchSpecification.getSQL(String, S_Search, S_LibrarySession, Vector, boolean)`
  (Unpublished)

### getSQLString

    public java.lang.String getSQLString(java.lang.String prefix,
                                         S_LibrarySession session,
                                         boolean searchCountOnly)
                                  throws IfsException

  Description copied from class: `AttributeSearchSpecification`
  Returns the SQL string for this SearchSpecification.

  Specified by:
    `getSQLString` in class `SearchSpecification`
  Parameters:
    `prefix` - sql generated is prefixed with this String. Used during explain plan.
    `session` - server-side session
    `searchCountOnly` - if true, it generates a count(*) in select.
  Returns:
    the SQL generated for this specification.
  Throws:
    `IfsException` - if the operation fails.
  (Unpublished)

### getViewStatement

    protected java.lang.String getViewStatement(ViewSpecification vsp,
                                                S_LibrarySession sess)
                                         throws IfsException

  Description copied from class: `AttributeSearchSpecification`
  Generates a View creation statement, based on the ViewSpecification.

  Specified by:
    `getViewStatement` in class `SearchSpecification`
  Parameters:
    `vsp` - details about the View for which the creation statement is to be generated.
    `sess` - server-side session.
  Returns:
    String containing SQL to create the view
  Throws:
    `IfsException` - if operation fails.
  (Unpublished)

### bindValuesInPlace

    protected void bindValuesInPlace(oracle.ifs.search.BindValuesInSpecVisitor vis)
                              throws IfsException

  Description copied from class: `AttributeSearchSpecification`
  bindValuesInPlace- sets the bind Values in the SearchTree. This is currently used for creating SQL Views. Calls on the Head of the SearchTree to accept the visitor.

  Specified by:
    `bindValuesInPlace` in class `SearchSpecification`
  Parameters:
    `vis` - BindValues Visitor
  Throws:
    `IfsException` - if operation fails.
  (Unpublished)

### setSecurityParameters

    protected int setSecurityParameters(S_LibrarySession sess,
                                        java.sql.PreparedStatement stmt,
                                        S_Search srch,
                                        int startIdx)
                                 throws IfsException

  Description copied from class: `AttributeSearchSpecification`
  Sets the userid in the security clause, returns the bind offset, which is passed to the bindVisitor. If security needs to be applied for this Search, it calls on the SQLGeneration_Helper to setSecurity parameters for each public class.

  Parameters:
    `sess` - server-side session in which Search is being executed.
    `stmt` - PreparedStatement for the Search, Security Values are bound into this statement.
    `srch` - Server side Search object in which Search is being executed.
    `startIdx` - Bind offset in PreparedStatement.
  Returns:
    offset in PreparedStatement after SecurityParameters are bound
  Throws:
    `IfsException` - if operation fails.
  (Unpublished)

### clone

    public java.lang.Object clone()

  Description copied from class: `AttributeSearchSpecification`
  Returns a clone of this AttributeSearchSpecification. Does a deep copy, by cloning the individual elements.

  Overrides:
    `clone` in class `SearchSpecification`
  Returns:
    Return a clone of this AttributeSearchSpecification.
  (Published)

### copy

    protected void copy(AttributeSearchSpecification src)
                 throws IfsException

  Description copied from class: `AttributeSearchSpecification`
  Copies the elements from the src AttributeSearchSpecification into this object. The copies are created by cloning.

  Parameters:
    `src` - Source AttributeSearchSpecification
  Throws:
    `IfsException`
  (Unpublished)

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