Dashboard Builder Commons 6.2.0.CR3

org.jboss.dashboard.commons.filter
Class SQLFilterByCriteria

java.lang.Object
  extended by org.jboss.dashboard.commons.filter.SQLFilterByCriteria

public class SQLFilterByCriteria
extends Object

This helper class is addressed to be used by dynamic SQL generation custom algorithms. The main goal is to automate the generation of the SQL criteria part.


Field Summary
protected  FilterByCriteria filter
          The filter to decorate.
protected  String sqlWildcard
          The SQL wildcard.
 
Constructor Summary
SQLFilterByCriteria()
           
SQLFilterByCriteria(FilterByCriteria filter)
           
 
Method Summary
 void addProperty(String propertyId, Object minValue, boolean minValueIncluded, Object maxValue, boolean maxValueIncluded, Collection allowedValues, int allowMode)
           
 boolean addProperty(String propertyId, String filterCriteria)
           
 boolean containsProperty(Collection propIds)
           
 boolean containsProperty(String propertyId)
           
 String getExtraInfo(String propertyId)
           
 String getGt()
           
 String getGtOrEq()
           
 Locale getLocale()
           
 String getLt()
           
 String getLtOrEq()
           
 List getPropertyAllowedValues(String propertyId)
           
 int getPropertyAllowMode(String propertyId)
           
 String[] getPropertyIds()
           
 Comparable getPropertyMaxValue(String propertyId)
           
 Comparable getPropertyMinValue(String propertyId)
           
 int getPropertyPriority(String propertyId)
           
 String getSqlWildcard()
           
 String getVariableName(String propertyId)
           
 String getWildcard()
           
 boolean maxValueIncluded(String propertyId)
           
 boolean minValueIncluded(String propertyId)
           
 boolean pass(Object obj)
           
 boolean pass(String propertyId, Object value)
           
 void removeAllProperty()
           
 void removeProperty(String propertyId)
           
 void setExtraInfo(String propertyId, String extraInfo)
           
 void setFilterCondition(String booleanExpression)
           
 void setLocale(Locale locale)
           
 void setVariableName(String propertyId, String varName)
           
 String SQL_formatValue(Object value)
           
 String SQL_getWhereClause(boolean exclusive, String[] propSQLClauses)
          Get and SQL where clause composed of several single property SQL where clauses.
 String SQL_getWhereClause(String propertyId, String propertySQLName)
           
 String SQL_getWhereClause(String propertyId, String sqlColumn, boolean ignoreCase)
          Retrieves the SQL condition that defines the contraints set for the given property.
 List SQL_getWhereClause(String propertyId, String sqlColumn, boolean ignoreCase, boolean forPreparedStatement)
          Retrieves the SQL condition that defines the contraints set for the given property.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

filter

protected FilterByCriteria filter
The filter to decorate.


sqlWildcard

protected String sqlWildcard
The SQL wildcard.

Constructor Detail

SQLFilterByCriteria

public SQLFilterByCriteria()

SQLFilterByCriteria

public SQLFilterByCriteria(FilterByCriteria filter)
Method Detail

getSqlWildcard

public String getSqlWildcard()

SQL_formatValue

public String SQL_formatValue(Object value)

SQL_getWhereClause

public String SQL_getWhereClause(String propertyId,
                                 String propertySQLName)

SQL_getWhereClause

public String SQL_getWhereClause(String propertyId,
                                 String sqlColumn,
                                 boolean ignoreCase)
Retrieves the SQL condition that defines the contraints set for the given property. The filter constraints defined for the property determines the structure of the SQL clause.

Parameters:
propertyId - The property identifier.
sqlColumn - The SQL literal identifying the property within the SQL query.
ignoreCase - In case on an String, case sentitiveness control.
Returns:
An SQL fragment for usage in a WHERE clause of an SQL query statement. Null if property is not included in the filter.

E.g: getSQLWhereClause(TEST_STRING, "p.testString") might return "p.testString IN ('s1','s2')"


SQL_getWhereClause

public List SQL_getWhereClause(String propertyId,
                               String sqlColumn,
                               boolean ignoreCase,
                               boolean forPreparedStatement)
Retrieves the SQL condition that defines the contraints set for the given property. The filter constraints defined for the property determines the structure of the SQL clause.

Parameters:
propertyId - The property identifier.
sqlColumn - The SQL literal identifying the property within the SQL query.
ignoreCase - In case on an String, case sentitiveness control.
forPreparedStatement - The SQL fragment is generated to be used in a JDBC prepared statement.
Returns:
A list of: SQL fragment plus a set of object instances representing the property contrains.

E.g: getPreparedStatementFragment(TEST_STRING, "p.testString", false, true) might return "(p.testString?) or p.testString=?"


SQL_getWhereClause

public String SQL_getWhereClause(boolean exclusive,
                                 String[] propSQLClauses)
Get and SQL where clause composed of several single property SQL where clauses.

Parameters:
exclusive - If true all the single property SQL criteria must be satisfied.
propSQLClauses - an array of SQL where clauses.
Returns:
An SQL fragment for usage in a WHERE clause of an SQL query statement.

getLocale

public Locale getLocale()

setLocale

public void setLocale(Locale locale)

addProperty

public void addProperty(String propertyId,
                        Object minValue,
                        boolean minValueIncluded,
                        Object maxValue,
                        boolean maxValueIncluded,
                        Collection allowedValues,
                        int allowMode)

addProperty

public boolean addProperty(String propertyId,
                           String filterCriteria)

getPropertyIds

public String[] getPropertyIds()

containsProperty

public boolean containsProperty(String propertyId)

containsProperty

public boolean containsProperty(Collection propIds)

removeProperty

public void removeProperty(String propertyId)

removeAllProperty

public void removeAllProperty()

getPropertyPriority

public int getPropertyPriority(String propertyId)

getPropertyMinValue

public Comparable getPropertyMinValue(String propertyId)

minValueIncluded

public boolean minValueIncluded(String propertyId)

getPropertyMaxValue

public Comparable getPropertyMaxValue(String propertyId)

maxValueIncluded

public boolean maxValueIncluded(String propertyId)

getPropertyAllowedValues

public List getPropertyAllowedValues(String propertyId)

getPropertyAllowMode

public int getPropertyAllowMode(String propertyId)

setVariableName

public void setVariableName(String propertyId,
                            String varName)

getVariableName

public String getVariableName(String propertyId)

setExtraInfo

public void setExtraInfo(String propertyId,
                         String extraInfo)

getExtraInfo

public String getExtraInfo(String propertyId)

setFilterCondition

public void setFilterCondition(String booleanExpression)

getWildcard

public String getWildcard()

getGt

public String getGt()

getGtOrEq

public String getGtOrEq()

getLt

public String getLt()

getLtOrEq

public String getLtOrEq()

pass

public boolean pass(String propertyId,
                    Object value)

pass

public boolean pass(Object obj)

Dashboard Builder Commons 6.2.0.CR3

Copyright © 2012-2014 JBoss by Red Hat. All Rights Reserved.