oracle.ifs.search
Class SearchClause


java.lang.Object

  |

  +--oracle.ifs.search.SearchQualification

        |

        +--oracle.ifs.search.SearchClause

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

public class SearchClause
extends SearchQualification

A SearchClause provides the means of combining Individual Qualifications into a SearchTree. A SearchClause composes one or two Qualifications. The composing operators are AND, OR or NOT. The first two compose two Qualifications, while NOT takes one Qualification. Their semantics are obvious. For the NOT operator the RHS Qualification is used.

The SearchClause is a subClass of SearchQualification, this allows the composed Qualification of a SearchClause to be another SearchClause. This way a SearchTree of any depth can be constructed.

The SearchClause is an instance of the 'Composite Pattern', for details see 'Design Patterns' by Gamma et. all.

 // Code Sample
 //
 // Search Clause is used to express AND, OR, NOT operations on 1 or 2 operands.
 // See a case ANDing and AttribuuteQualification and JoinQualification below.
 //
 AtrributeQualification aq;
 JoinQualification jq;
 //
 SearchClause sc = new SearchClause(aq, jq, SearchClause.AND)
 //
 // Search clause can be built from Search Clauses also.
 SearchClause sc1, sc2;
 SearchClause sc = new SearchCaluse(sc1, sc2, SearchClause.OR)
 //
 // Example below shows implementing a complete WHERE condition.
 // WHERE Document.Name like 'Doc%' AND
 //       Document is in "/home/tuser1" 
 //
 // Create a AttributeQualification Search
 AttributeQualification aq = new AttributeQualification();
 aq.setAttribute("DOCUMENT", "NAME");
 aq.setOperatorType(AttributeQualification.LIKE);
 aq.setValue("Doc%");
 //
 // Create Folder Restrict option now.
 FolderRestrictQualification frq = new FolderRestrictQualification();
 FolderPathResolver fpr;
 Folder startFolder = (Folder) fpr.findPublicObjectByPath("/home/tuser1");
 frq.setStartFolder(startFolder);
 frq.setMaxLevels(1);
 //
 // Now put the two together.
 SearchClause sc  = new SearchCaluse(aq, frq, SearchCaluse.AND);
  

See Also:
Serialized Form

Field Summary
static int AND
          Represents the 'AND' operator.
static int NOT
          Represents the 'NOT' operator
static int OR
          Represents the 'OR' operator.
 
Constructor Summary
SearchClause()
          Constructs a SearchClause.
SearchClause(SearchQualification l, SearchQualification r, int oper)
          Constructs a SearchClause.
SearchClause(SearchQualification l, SearchQualification r, java.lang.String oper)
          Constructs a SearchClause.
 
Method Summary
 java.lang.Object clone()
          Returns a clone of this SearchClause.
 SearchQualification getLeftSearchQualification()
          Returns the left side SearchQualification.
 int getOperatorType()
          Return the composing operator.
 SearchQualification getRightSearchQualification()
          Return the right side SearchQualification.
 void setLeftSearchQualification(SearchQualification s)
          Set the left hand side SearchQualification.
 void setOperatorType(int oper)
          Set the composing operator.
 void setOperatorType(java.lang.String oper)
          Set the operator to put together SearchQualifications.
 void setRightSearchQualification(SearchQualification s)
          Set the right side SearchQualification.
 

Field Detail


NOT


public static final int NOT
Represents the 'NOT' operator

AND


public static final int AND
Represents the 'AND' operator.

OR


public static final int OR
Represents the 'OR' operator.
Constructor Detail

SearchClause


public SearchClause()
Constructs a SearchClause. By default the left and right Qualifications are null.

SearchClause


public SearchClause(SearchQualification l,
                    SearchQualification r,
                    java.lang.String oper)
             throws IfsException
Constructs a SearchClause. Based on the Qualifications and operator.
Parameters:
l - LHS Qualification
r - RHS Qualification
oper - composing operator, should be AND, OR or NOT.
Throws:
IfsException - 22103 if oper is not valid.

SearchClause


public SearchClause(SearchQualification l,
                    SearchQualification r,
                    int oper)
             throws IfsException
Constructs a SearchClause. Based on the Qualifications and operator.
Parameters:
l - LHS Qualification
r - RHS Qualification
oper - composing operator, should be AND, OR or NOT. Use public constants SearchClause.NOT, SearchClause.OR, SearchClause.AND
Throws:
IfsException - 22103 if oper is not valid.
Method Detail

setLeftSearchQualification


public void setLeftSearchQualification(SearchQualification s)
                                throws IfsException
Set the left hand side SearchQualification. Null value allowed only for NOT operation.
Parameters:
s - the composed qualification
Throws:
IfsException - if the operation fails

getLeftSearchQualification


public SearchQualification getLeftSearchQualification()
                                               throws IfsException
Returns the left side SearchQualification.
Returns:
left SearchQualification.
Throws:
IfsException - if the operation fails

setRightSearchQualification


public void setRightSearchQualification(SearchQualification s)
                                 throws IfsException
Set the right side SearchQualification. Cannot be null.
Parameters:
s - the composed qualification
Throws:
IfsException - if the operation fails

getRightSearchQualification


public SearchQualification getRightSearchQualification()
Return the right side SearchQualification.
Returns:
RHS SearchQualification.

setOperatorType


public void setOperatorType(java.lang.String oper)
                     throws IfsException
Set the operator to put together SearchQualifications.
Parameters:
oper - composing operator; Must be one of, AND, OR, NOT.
Throws:
IfsException - if operation fails.

setOperatorType


public void setOperatorType(int oper)
                     throws IfsException
Set the composing operator.
Parameters:
oper - composing operator; Must be one of, SearchClause.AND SearchClause.OR SearchClause.NOT
Throws:
IfsException - if the operation fails

getOperatorType


public int getOperatorType()
Return the composing operator.
Returns:
composing operator.

clone


public java.lang.Object clone()
Returns a clone of this SearchClause. Clones the LHS & RHS and then creates a new SearchClause from the clones.
Overrides:
clone in class SearchQualification
Returns:
Return a clone of this SearchClause.