Compoze Software, Inc.

com.compoze.exchange.webdav.sql
Class Condition


java.lang.Object

  |

  +--com.compoze.exchange.webdav.sql.AbstractSqlFragment

        |

        +--com.compoze.exchange.webdav.sql.Condition

All Implemented Interfaces:
ISqlFragment, java.io.Serializable
Direct Known Subclasses:
IsNullCondition, NotCondition

public class Condition
extends AbstractSqlFragment
implements ISqlFragment

This class provides the implementation for creating a condition statement.

The following example demonstrates how to use this class:

 Condition cond = Condition.create(new GreaterThanOperator("urn:schemas:contacts:givenName", "Skip"), true);
 cond.add(new GreaterThanOperator("urn:schemas:contacts:givenName", "Skippy"), true);

 System.out.println(cond);
 

Calling toSQL() or toString() will return the SQL representation of this object. For example, the above example would yield:

 ("urn:schemas:contacts:givenName" > 'Skip') OR ("urn:schemas:contacts:givenName" > 'Skippy') 
 

See Also:
Serialized Form

Constructor Summary
protected Condition()
          Constructor.
protected Condition(Condition condition, boolean bOr)
          Constructor.
protected Condition(IOperator op, boolean bOr)
          Constructor.
protected Condition(IPredicate predicate, boolean bOr)
          Constructor.
 
Method Summary
 void add(Condition condition)
          Adds a condition statement.
 void add(Condition condition, boolean bOr)
          Adds a condition statement.
 void add(IOperator op)
          Adds an operator clause.
 void add(IOperator op, boolean bOr)
          Adds an operator clause.
 void add(IPredicate predicate)
          Adds a predicate clause.
 void add(IPredicate predicate, boolean bOr)
          Adds a predicate clause.
static Condition create()
          Creates an empty condition statement.
static Condition create(Condition condition)
          Creates a condition with a specfied condition statement.
static Condition create(Condition condition, boolean bOr)
          Creates a condition with a specfied condition statement.
static Condition create(IOperator op)
          Creates a condition with a specfied operator clause.
static Condition create(IOperator op, boolean bOr)
          Creates a condition with a specfied operator clause.
static Condition create(IPredicate predicate)
          Creates a condition with a specfied predicate clause.
static Condition create(IPredicate predicate, boolean bOr)
          Creates a condition with a specfied predicate clause.
 ISqlFragment getCondition()
          Gets the condition statement.
 boolean isEmpty()
          Checks whether this condition contains sub-conditions.
 boolean isOr()
          Checks whether this condition is 'OR'd.
static void main(java.lang.String[] args)
           
 java.lang.String toSQL()
          Returns a SQL representation of the condition statement.
 
Methods inherited from class com.compoze.exchange.webdav.sql.AbstractSqlFragment
escape, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Condition


protected Condition()
Constructor.

Condition


protected Condition(Condition condition,
                    boolean bOr)
Constructor.
Parameters:
condition - the condition statement.
bOr - true to or together; false otherwise.

Condition


protected Condition(IOperator op,
                    boolean bOr)
Constructor.
Parameters:
op - the operator statement.
bOr - true to or together; false otherwise.

Condition


protected Condition(IPredicate predicate,
                    boolean bOr)
Constructor.
Parameters:
predicate - the predicate statement.
bOr - true to or together; false otherwise.
Method Detail

isEmpty


public boolean isEmpty()
Checks whether this condition contains sub-conditions.
Returns:
true if this condition contains no sub-conditions; false otherwise.

isOr


public boolean isOr()
Checks whether this condition is 'OR'd.
Returns:
true if this condition is 'OR'd; false otherwise.

getCondition


public ISqlFragment getCondition()
Gets the condition statement.
Returns:
the condition statement.

create


public static Condition create()
Creates an empty condition statement.
Returns:
the condition

create


public static Condition create(Condition condition)
Creates a condition with a specfied condition statement.
Parameters:
condition - the condition statement to create condition with.
Returns:
the condition.

create


public static Condition create(Condition condition,
                               boolean bOr)
Creates a condition with a specfied condition statement.
Parameters:
condition - the condition statement to create condition with.
bOr - true to or together; false otherwise.
Returns:
the condition.

create


public static Condition create(IOperator op)
Creates a condition with a specfied operator clause.
Parameters:
op - the operator clause to create condition with.
Returns:
the condition.

create


public static Condition create(IOperator op,
                               boolean bOr)
Creates a condition with a specfied operator clause.
Parameters:
op - the operator clause to create condition with.
bOr - true to or together; false otherwise.
Returns:
the condition.

create


public static Condition create(IPredicate predicate)
Creates a condition with a specfied predicate clause.
Parameters:
predicate - the predicate clause to create condition with.
bOr - true to or together; false otherwise.

create


public static Condition create(IPredicate predicate,
                               boolean bOr)
Creates a condition with a specfied predicate clause.
Parameters:
predicate - the predicate clause to create condition with.
bOr - true to or together; false otherwise.

add


public void add(Condition condition)
Adds a condition statement.
Parameters:
condition - the condition statemnt to add.

add


public void add(Condition condition,
                boolean bOr)
Adds a condition statement.
Parameters:
condition - the condition statemnt to add.
bOr - true to or together; false otherwise.

add


public void add(IOperator op)
Adds an operator clause.
Parameters:
op - the operator clause to add.

add


public void add(IOperator op,
                boolean bOr)
Adds an operator clause.
Parameters:
op - the operator clause to add.
bOr - true to or together; false otherwise.

add


public void add(IPredicate predicate)
Adds a predicate clause.
Parameters:
predicate - the predicate clause to add.

add


public void add(IPredicate predicate,
                boolean bOr)
Adds a predicate clause.
Parameters:
predicate - the predicate clause to add.
bOr - true to or together; false otherwise.

toSQL


public java.lang.String toSQL()
Returns a SQL representation of the condition statement.
Specified by:
toSQL in interface ISqlFragment
Overrides:
toSQL in class AbstractSqlFragment
Returns:
the SQL representation of the condition statement.

main


public static void main(java.lang.String[] args)

Compoze Software, Inc.

Copyright ©1999-2003 Compoze Software, Inc. All rights reserved.