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 StringCLAUSE_TRUISMstatic StringEXCEPTION_MESSAGE_KEY_QUERY_LESS_GREATER_CLAUSE_DB_COLUMN_TOKEN_MISSINGstatic StringEXCEPTION_MESSAGE_KEY_QUERY_LESS_GREATER_CLAUSE_NAME_TOKEN_MISSINGstatic StringEXCEPTION_MESSAGE_KEY_QUERY_LESS_GREATER_CLAUSE_PARAMETER_TOKEN_MISSINGprotected static StringOPERATOR_GREATERprotected static StringOPERATOR_GREATER_OR_EQUALprotected static StringOPERATOR_LESSprotected static StringOPERATOR_LESS_OR_EQUALprotected static intPOSITION_CLAUSE_IDprotected static intPOSITION_DB_COLUMNprotected static intPOSITION_PARAMETER
-
Constructor Summary
Constructors Modifier Constructor Description protectedSQLLessOrGreaterBaseClause()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidapply(JRClauseTokens clauseTokens, JRQueryClauseContext queryContext)Creates either a LESS or a GREATER SQL clause, depending on the clause ID.protected abstract ClauseFunctionParameterHandlercreateParameterHandler(JRQueryClauseContext queryContext, String clauseId, String parameterName)protected voidhandleLessOrGreaterOperator(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 isLESScolumn <= ?if the clause ID isLESS]column >= ?if the clause ID isGREATERcolumn > ?if the clause ID is[GREATER
0 = 0).- Specified by:
applyin 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
-
-