net.sf.jasperreports.engine.query
Class JRSqlLessOrGreaterClause

java.lang.Object
  extended by net.sf.jasperreports.engine.query.JRSqlLessOrGreaterClause
All Implemented Interfaces:
JRClauseFunction

public class JRSqlLessOrGreaterClause
extends java.lang.Object
implements JRClauseFunction

Base LESS/GREATER clause function for SQL queries.

The first token in the $X{...} syntax is the function ID token. Possible values for the LESS | GREATER clause function ID token are:

Version:
$Id: JRSqlLessOrGreaterClause.java 5180 2012-03-29 13:23:12Z teodord $
Author:
sanda zaharia (shertage@users.sourceforge.net)

Field Summary
protected static java.lang.String CLAUSE_TRUISM
           
protected static java.lang.String OPERATOR_GREATER
           
protected static java.lang.String OPERATOR_GREATER_OR_EQUAL
           
protected static java.lang.String OPERATOR_LESS
           
protected static java.lang.String OPERATOR_LESS_OR_EQUAL
           
protected static int POSITION_CLAUSE_ID
           
protected static int POSITION_DB_COLUMN
           
protected static int POSITION_PARAMETER
           
protected static JRSqlLessOrGreaterClause singleton
           
 
Constructor Summary
JRSqlLessOrGreaterClause()
           
 
Method Summary
 void apply(JRClauseTokens clauseTokens, JRQueryClauseContext queryContext)
          Creates either a LESS or a GREATER SQL clause, depending on the clause ID.
protected  void handleLessOrGreaterOperator(java.lang.StringBuffer sBuffer, java.lang.String clauseId)
          Appends the appropriate inequality sign to the query string, depending on the clause ID value
static JRSqlLessOrGreaterClause instance()
          Returns the singleton function instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

POSITION_CLAUSE_ID

protected static final int POSITION_CLAUSE_ID
See Also:
Constant Field Values

POSITION_DB_COLUMN

protected static final int POSITION_DB_COLUMN
See Also:
Constant Field Values

POSITION_PARAMETER

protected static final int POSITION_PARAMETER
See Also:
Constant Field Values

OPERATOR_LESS

protected static final java.lang.String OPERATOR_LESS
See Also:
Constant Field Values

OPERATOR_LESS_OR_EQUAL

protected static final java.lang.String OPERATOR_LESS_OR_EQUAL
See Also:
Constant Field Values

OPERATOR_GREATER

protected static final java.lang.String OPERATOR_GREATER
See Also:
Constant Field Values

OPERATOR_GREATER_OR_EQUAL

protected static final java.lang.String OPERATOR_GREATER_OR_EQUAL
See Also:
Constant Field Values

CLAUSE_TRUISM

protected static final java.lang.String CLAUSE_TRUISM
See Also:
Constant Field Values

singleton

protected static final JRSqlLessOrGreaterClause singleton
Constructor Detail

JRSqlLessOrGreaterClause

public JRSqlLessOrGreaterClause()
Method Detail

instance

public static JRSqlLessOrGreaterClause instance()
Returns the singleton function instance.

Returns:
the singleton function instance

apply

public void apply(JRClauseTokens clauseTokens,
                  JRQueryClauseContext queryContext)
Creates either a LESS or a GREATER SQL clause, depending on the clause ID.

The method expects two clause tokens (after the ID token):

The method constructs one of the following clauses:

If the value to compare to is null, the method generates a SQL clause that will always evaluate to true (e.g. 0 = 0).

Specified by:
apply in interface JRClauseFunction
Parameters:
clauseTokens - the clause tokens
queryContext - the query context

handleLessOrGreaterOperator

protected void handleLessOrGreaterOperator(java.lang.StringBuffer sBuffer,
                                           java.lang.String clauseId)
Appends the appropriate inequality sign to the query string, depending on the clause ID value

Parameters:
sBuffer - the StringBuffer that contains the generated query
clauseId - the clause ID


© 2001-2010 Jaspersoft Corporation www.jaspersoft.com