org.apache.ws.jaxme.sqls.impl
Class CombinedConstraintImpl

java.lang.Object
  extended by org.apache.ws.jaxme.sqls.impl.ConstraintImpl
      extended by org.apache.ws.jaxme.sqls.impl.CombinedConstraintImpl
All Implemented Interfaces:
CombinedConstraint, Constraint

public class CombinedConstraintImpl
extends ConstraintImpl
implements CombinedConstraint

Author:
Jochen Wiedmann

Nested Class Summary
static class CombinedConstraintImpl.TypeImpl
          Default implementation of CombinedConstraint.Type.
 
Nested classes/interfaces inherited from interface org.apache.ws.jaxme.sqls.CombinedConstraint
CombinedConstraint.Type
 
Constructor Summary
protected CombinedConstraintImpl(ConstrainedStatement pConstrainedStatement, CombinedConstraint.Type pType)
           
 
Method Summary
 void addColumnSetQuery(ColumnSet pSet, TableReference pTableReference)
          Adds a check for the columns of the given column set.
 void addConstraint(java.util.Map pMap, Constraint pConstraint)
          Clones the given Constraint, mapping the column references from the given constraint to the values in the given map.
 void addJoin(ForeignKey pKey, TableReference pReferencingTable, TableReference pReferencedTable)
          Creates a JOIN condition matching the given foreign key.
 void addJoin(TableReference pReferencingTable, ColumnSet pReferencingColumnSet, TableReference pReferencedTable, ColumnSet pReferencedColumnSet)
          Creates a JOIN condition matching the given column reference.
 CombinedConstraint createAndConstraint()
          Creates an AndConstraint and inserts it at the current position.
 BooleanConstraint createBETWEEN()
          Creates a "BETWEEN" condition with the given select statement and inserts it at the current position.
 BooleanConstraint createEQ()
          Creates an "equals" condition (=) and inserts it at the current position.
 void createEXISTS(SelectStatement pStatement)
          Creates an "EXISTS" condition with the given select statement and inserts it at the current position.
 BooleanConstraint createGE()
          Creates a "greater or equal" condition (>=) and inserts it at the current position.
 BooleanConstraint createGT()
          Creates a "greater than" condition (>) and inserts it at the current position.
 BooleanConstraint createIN()
          Creates an "IN" condition and inserts it at the current position.
 BooleanConstraint createISNULL()
          Creates an "IS NULL" condition and inserts it at the current position.
 BooleanConstraint createLE()
          Creates a "lower or equal" condition (<=) and inserts it at the current position.
 BooleanConstraint createLIKE()
          Creates a "LIKE" condition and inserts it at the current position.
 BooleanConstraint createLT()
          Creates a "lower than" condition (<) and inserts it at the current position.
 BooleanConstraint createNE()
          Creates a "not equals" condition (<>) and inserts it at the current position.
 CombinedConstraint createOrConstraint()
          Creates an OrConstraint and inserts it at the current position.
 int getNumParts()
          Returns the number of parts, that have been added with the various createSomething() methods.
 java.util.Iterator getParts()
          Returns an Iterator to the parts, that have been added with the various createSomething() methods.
 CombinedConstraint.Type getType()
          Returns the type, either of CombinedConstraint.Type.AND or CombinedConstraint.Type.OR.
 boolean isNOT()
          Returns whether the combined constraint is inverted by adding a prepending NOT.
 void setNOT(boolean pNot)
          Sets whether the combined constraint is inverted by adding a prepending NOT.
 
Methods inherited from class org.apache.ws.jaxme.sqls.impl.ConstraintImpl
getConstrainedStatement
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.ws.jaxme.sqls.Constraint
getConstrainedStatement
 

Constructor Detail

CombinedConstraintImpl

protected CombinedConstraintImpl(ConstrainedStatement pConstrainedStatement,
                                 CombinedConstraint.Type pType)
Method Detail

getType

public CombinedConstraint.Type getType()
Description copied from interface: CombinedConstraint
Returns the type, either of CombinedConstraint.Type.AND or CombinedConstraint.Type.OR.

Specified by:
getType in interface CombinedConstraint

createAndConstraint

public CombinedConstraint createAndConstraint()
Description copied from interface: CombinedConstraint
Creates an AndConstraint and inserts it at the current position.

Specified by:
createAndConstraint in interface CombinedConstraint

createOrConstraint

public CombinedConstraint createOrConstraint()
Description copied from interface: CombinedConstraint
Creates an OrConstraint and inserts it at the current position.

Specified by:
createOrConstraint in interface CombinedConstraint

createEQ

public BooleanConstraint createEQ()
Description copied from interface: CombinedConstraint
Creates an "equals" condition (=) and inserts it at the current position.

Specified by:
createEQ in interface CombinedConstraint

createNE

public BooleanConstraint createNE()
Description copied from interface: CombinedConstraint
Creates a "not equals" condition (<>) and inserts it at the current position.

Specified by:
createNE in interface CombinedConstraint

createLT

public BooleanConstraint createLT()
Description copied from interface: CombinedConstraint
Creates a "lower than" condition (<) and inserts it at the current position.

Specified by:
createLT in interface CombinedConstraint

createGT

public BooleanConstraint createGT()
Description copied from interface: CombinedConstraint
Creates a "greater than" condition (>) and inserts it at the current position.

Specified by:
createGT in interface CombinedConstraint

createLE

public BooleanConstraint createLE()
Description copied from interface: CombinedConstraint
Creates a "lower or equal" condition (<=) and inserts it at the current position.

Specified by:
createLE in interface CombinedConstraint

createGE

public BooleanConstraint createGE()
Description copied from interface: CombinedConstraint
Creates a "greater or equal" condition (>=) and inserts it at the current position.

Specified by:
createGE in interface CombinedConstraint

createLIKE

public BooleanConstraint createLIKE()
Description copied from interface: CombinedConstraint
Creates a "LIKE" condition and inserts it at the current position.

Specified by:
createLIKE in interface CombinedConstraint

createISNULL

public BooleanConstraint createISNULL()
Description copied from interface: CombinedConstraint
Creates an "IS NULL" condition and inserts it at the current position.

Specified by:
createISNULL in interface CombinedConstraint

createIN

public BooleanConstraint createIN()
Description copied from interface: CombinedConstraint
Creates an "IN" condition and inserts it at the current position.

Specified by:
createIN in interface CombinedConstraint

createEXISTS

public void createEXISTS(SelectStatement pStatement)
Description copied from interface: CombinedConstraint
Creates an "EXISTS" condition with the given select statement and inserts it at the current position.

Specified by:
createEXISTS in interface CombinedConstraint

createBETWEEN

public BooleanConstraint createBETWEEN()
Description copied from interface: CombinedConstraint
Creates a "BETWEEN" condition with the given select statement and inserts it at the current position.

Specified by:
createBETWEEN in interface CombinedConstraint

addColumnSetQuery

public void addColumnSetQuery(ColumnSet pSet,
                              TableReference pTableReference)
Description copied from interface: CombinedConstraint
Adds a check for the columns of the given column set. For example, if the column set consists of the columns A and B, then the following will be added: A=? AND B=?.

Specified by:
addColumnSetQuery in interface CombinedConstraint

addJoin

public void addJoin(ForeignKey pKey,
                    TableReference pReferencingTable,
                    TableReference pReferencedTable)
Description copied from interface: CombinedConstraint
Creates a JOIN condition matching the given foreign key. In other words, if the foreign key consists of the columns A and B referencing the columns X and Y, then the following will be added: A=X AND B=Y.

Specified by:
addJoin in interface CombinedConstraint
Parameters:
pKey - The foreign key being matched.
pReferencingTable - A reference to the table returned by the foreign keys ColumnSet.getTable() method.
pReferencedTable - A reference to the table returned by the foreign keys ForeignKey.getReferencedTable() method.

addJoin

public void addJoin(TableReference pReferencingTable,
                    ColumnSet pReferencingColumnSet,
                    TableReference pReferencedTable,
                    ColumnSet pReferencedColumnSet)
Description copied from interface: CombinedConstraint
Creates a JOIN condition matching the given column reference. In other words, if the referencing ColumnSet contains the columns A and B, and the referenced column set contains ColumnSet, X and Y, then the following will be added: A=X AND B=Y.

Specified by:
addJoin in interface CombinedConstraint

getNumParts

public int getNumParts()
Description copied from interface: CombinedConstraint
Returns the number of parts, that have been added with the various createSomething() methods.

Specified by:
getNumParts in interface CombinedConstraint

getParts

public java.util.Iterator getParts()
Description copied from interface: CombinedConstraint
Returns an Iterator to the parts, that have been added with the various createSomething() methods.

Specified by:
getParts in interface CombinedConstraint

addConstraint

public void addConstraint(java.util.Map pMap,
                          Constraint pConstraint)
Description copied from interface: CombinedConstraint
Clones the given Constraint, mapping the column references from the given constraint to the values in the given map.

Specified by:
addConstraint in interface CombinedConstraint
Parameters:
pMap - A Map with the constraints pConstraint table references as keys. The values are table references of the current constraints statement.
pConstraint - The constraint being cloned.

setNOT

public void setNOT(boolean pNot)
Description copied from interface: CombinedConstraint
Sets whether the combined constraint is inverted by adding a prepending NOT.

Specified by:
setNOT in interface CombinedConstraint

isNOT

public boolean isNOT()
Description copied from interface: CombinedConstraint
Returns whether the combined constraint is inverted by adding a prepending NOT.

Specified by:
isNOT in interface CombinedConstraint