Class SQLLessOrGreaterBaseClause
- java.lang.Object
-
- net.sf.jasperreports.engine.query.SQLLessOrGreaterBaseClause
-
- All Implemented Interfaces:
JRClauseFunction
- Direct Known Subclasses:
DateRangeSQLLessOrGreaterClause
,JRSqlLessOrGreaterClause
public abstract class SQLLessOrGreaterBaseClause extends Object implements JRClauseFunction
- Author:
- Sanda Zaharia (shertage@users.sourceforge.net)
-
-
Field Summary
Fields Modifier and Type Field Description protected static String
CLAUSE_TRUISM
static String
EXCEPTION_MESSAGE_KEY_QUERY_LESS_GREATER_CLAUSE_DB_COLUMN_TOKEN_MISSING
static String
EXCEPTION_MESSAGE_KEY_QUERY_LESS_GREATER_CLAUSE_NAME_TOKEN_MISSING
static String
EXCEPTION_MESSAGE_KEY_QUERY_LESS_GREATER_CLAUSE_PARAMETER_TOKEN_MISSING
protected static String
OPERATOR_GREATER
protected static String
OPERATOR_GREATER_OR_EQUAL
protected static String
OPERATOR_LESS
protected static String
OPERATOR_LESS_OR_EQUAL
protected static int
POSITION_CLAUSE_ID
protected static int
POSITION_DB_COLUMN
protected static int
POSITION_PARAMETER
-
Constructor Summary
Constructors Modifier Constructor Description protected
SQLLessOrGreaterBaseClause()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
apply(JRClauseTokens clauseTokens, JRQueryClauseContext queryContext)
Creates either a LESS or a GREATER SQL clause, depending on the clause ID.protected abstract ClauseFunctionParameterHandler
createParameterHandler(JRQueryClauseContext queryContext, String clauseId, String parameterName)
protected void
handleLessOrGreaterOperator(StringBuffer sBuffer, String clauseId)
Appends the appropriate inequality sign to the query string, depending on the clause ID value
-
-
-
Field Detail
-
EXCEPTION_MESSAGE_KEY_QUERY_LESS_GREATER_CLAUSE_DB_COLUMN_TOKEN_MISSING
public static final String EXCEPTION_MESSAGE_KEY_QUERY_LESS_GREATER_CLAUSE_DB_COLUMN_TOKEN_MISSING
- See Also:
- Constant Field Values
-
EXCEPTION_MESSAGE_KEY_QUERY_LESS_GREATER_CLAUSE_NAME_TOKEN_MISSING
public static final String EXCEPTION_MESSAGE_KEY_QUERY_LESS_GREATER_CLAUSE_NAME_TOKEN_MISSING
- See Also:
- Constant Field Values
-
EXCEPTION_MESSAGE_KEY_QUERY_LESS_GREATER_CLAUSE_PARAMETER_TOKEN_MISSING
public static final String EXCEPTION_MESSAGE_KEY_QUERY_LESS_GREATER_CLAUSE_PARAMETER_TOKEN_MISSING
- See Also:
- Constant Field Values
-
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 String OPERATOR_LESS
- See Also:
- Constant Field Values
-
OPERATOR_LESS_OR_EQUAL
protected static final String OPERATOR_LESS_OR_EQUAL
- See Also:
- Constant Field Values
-
OPERATOR_GREATER
protected static final String OPERATOR_GREATER
- See Also:
- Constant Field Values
-
OPERATOR_GREATER_OR_EQUAL
protected static final String OPERATOR_GREATER_OR_EQUAL
- See Also:
- Constant Field Values
-
CLAUSE_TRUISM
protected static final String CLAUSE_TRUISM
- See Also:
- Constant Field Values
-
-
Method Detail
-
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 first token is the SQL column (or column combination) to be used in the clause.
- The second token is the name of the report parameter that contains the value to compare to.
The method constructs one of the following clauses:
column < ?
if the clause ID isLESS
column <= ?
if the clause ID isLESS]
column >= ?
if the clause ID isGREATER
column > ?
if the clause ID is[GREATER
0 = 0
).- Specified by:
apply
in interfaceJRClauseFunction
- Parameters:
clauseTokens
- the clause tokensqueryContext
- the query context
-
createParameterHandler
protected abstract ClauseFunctionParameterHandler createParameterHandler(JRQueryClauseContext queryContext, String clauseId, String parameterName)
-
handleLessOrGreaterOperator
protected void handleLessOrGreaterOperator(StringBuffer sBuffer, 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 queryclauseId
- the clause ID
-
-