org.objectweb.telosys.dal.sql
Class Criteria

java.lang.Object
  extended byorg.objectweb.telosys.common.TelosysObject
      extended byorg.objectweb.telosys.dal.sql.Criteria
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
SQLCriterias

public class Criteria
extends TelosysObject
implements java.io.Serializable

A Criteria object is a collection of Criterion objects to be used together to build dynamic SQL Queries

See Also:
Serialized Form

Constructor Summary
Criteria(Criterion[] critArray, java.lang.String sOperator)
          Build a new criteria ( collection of criterion objects )
 
Method Summary
 void doNotUse(int i)
          Fix the given criterion as "not used"
 int getCount()
           
 java.lang.String[] getDynamicParameters()
          Build a String array containing the useful parameters values
 int[] getDynamicTypes()
          Build a int array containing the useful parameters types
 java.lang.String getDynamicWhere()
          Build the SQL where clause dynamicaly with the useful criterion objects
 java.lang.String getOperator()
           
 int getParamType(int i)
          Return the parameter type expected for the given criterion index
 java.lang.String getSqlExpression(int i)
          Return the SQL criterion expression ( ie "thecolumn = ?"
 Criterion[] getUsefulCriteria()
          Build an array containing the useful Criterion objects
 int getUsefulParametersCount()
          Return the number of useful parameters
 void reset()
          Reset each criterion as "not used"
 void useWithValue(int i, java.lang.String sParamVal)
          Fix the given criterion as "useful" and set its parameter value
 
Methods inherited from class org.objectweb.telosys.common.TelosysObject
error, error, error, getFlagTrace, info, setFlagTrace, trace, warn
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Criteria

public Criteria(Criterion[] critArray,
                java.lang.String sOperator)
Build a new criteria ( collection of criterion objects )

Parameters:
critArray - array of criterion objects to be used in conjunction for dynamic request
sOperator - where operator to use between each criterion ( "and" / "or" )
Method Detail

getOperator

public java.lang.String getOperator()

getCount

public int getCount()

getSqlExpression

public java.lang.String getSqlExpression(int i)
Return the SQL criterion expression ( ie "thecolumn = ?" )

Parameters:
i - criterion index ( from 1 to N )
Returns:

getParamType

public int getParamType(int i)
Return the parameter type expected for the given criterion index

Parameters:
i - criterion index ( from 1 to N )
Returns:

useWithValue

public void useWithValue(int i,
                         java.lang.String sParamVal)
Fix the given criterion as "useful" and set its parameter value

Parameters:
i - criterion index ( from 1 to N )
sParamVal - criterion parameter value

doNotUse

public void doNotUse(int i)
Fix the given criterion as "not used"

Parameters:
i - criterion index ( from 1 to N )

reset

public void reset()
Reset each criterion as "not used"


getDynamicWhere

public java.lang.String getDynamicWhere()
Build the SQL where clause dynamicaly with the useful criterion objects

Returns:
the SQL where clause built

getUsefulParametersCount

public int getUsefulParametersCount()
Return the number of useful parameters

Returns:

getDynamicTypes

public int[] getDynamicTypes()
Build a int array containing the useful parameters types

Returns:

getDynamicParameters

public java.lang.String[] getDynamicParameters()
Build a String array containing the useful parameters values

Returns:

getUsefulCriteria

public Criterion[] getUsefulCriteria()
Build an array containing the useful Criterion objects

Returns: