org.opennms.web.filter
Class BaseFilter<T>

java.lang.Object
  extended by org.opennms.web.filter.BaseFilter<T>
All Implemented Interfaces:
Filter
Direct Known Subclasses:
MultiArgFilter, OneArgFilter

public abstract class BaseFilter<T>
extends Object
implements Filter

BaseFilter

Author:
brozow

Field Summary
protected  String m_filterName
           
protected  SQLType<T> m_sqlType
           
 
Constructor Summary
BaseFilter(String filterType, SQLType<T> sqlType, String fieldName, String propertyName)
           
 
Method Summary
abstract  int bindParam(PreparedStatement ps, int parameterIndex)
          Binds the parameter values corresponding to the ? tokens in the string returned from getParamSql() to a prepared statement.
 void bindValue(PreparedStatement ps, int parameterIndex, T value)
           
 String formatValue(T value)
           
abstract  org.hibernate.criterion.Criterion getCriterion()
          Criterion used to construction an OnmsCritieria
 String getDescription()
          Returns a terse string (including a "=") that describes this filter in such a way to easily be included in an HTTP GET parameter.
abstract  String getParamSql()
          Returns a parameterized SQL where clause.
 String getPropertyName()
           
abstract  String getSql()
          Returns an expression for a SQL where clause.
 String getSQLFieldName()
           
abstract  String getTextDescription()
          Returns a terse but human-readable string describing this filter in such a way to easily be included in a search results list.
 String getValueAsString(T value)
           
abstract  String getValueString()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_filterName

protected String m_filterName

m_sqlType

protected SQLType<T> m_sqlType
Constructor Detail

BaseFilter

public BaseFilter(String filterType,
                  SQLType<T> sqlType,
                  String fieldName,
                  String propertyName)
Method Detail

getSQLFieldName

public String getSQLFieldName()

getPropertyName

public String getPropertyName()

getDescription

public final String getDescription()
Description copied from interface: Filter
Returns a terse string (including a "=") that describes this filter in such a way to easily be included in an HTTP GET parameter.

Some examples:

Specified by:
getDescription in interface Filter

bindValue

public final void bindValue(PreparedStatement ps,
                            int parameterIndex,
                            T value)
                     throws SQLException
Throws:
SQLException

formatValue

public String formatValue(T value)

getValueAsString

public final String getValueAsString(T value)

getValueString

public abstract String getValueString()

getCriterion

public abstract org.hibernate.criterion.Criterion getCriterion()
Description copied from interface: Filter
Criterion used to construction an OnmsCritieria

Specified by:
getCriterion in interface Filter
Returns:
A Criterion that represents a criteria restriction imposed by this filter

bindParam

public abstract int bindParam(PreparedStatement ps,
                              int parameterIndex)
                       throws SQLException
Description copied from interface: Filter
Binds the parameter values corresponding to the ? tokens in the string returned from getParamSql() to a prepared statement. Returns the number of parameters that were bound.

Specified by:
bindParam in interface Filter
Throws:
SQLException

getParamSql

public abstract String getParamSql()
Description copied from interface: Filter
Returns a parameterized SQL where clause. Remember to include a trailing space, but no leading AND or OR.

Specified by:
getParamSql in interface Filter

getSql

public abstract String getSql()
Description copied from interface: Filter
Returns an expression for a SQL where clause. Remember to include a trailing space, but no leading AND or OR.

Specified by:
getSql in interface Filter

getTextDescription

public abstract String getTextDescription()
Description copied from interface: Filter
Returns a terse but human-readable string describing this filter in such a way to easily be included in a search results list.

Some examples (corresponding to the examples in getDescription):

Specified by:
getTextDescription in interface Filter

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2009. All Rights Reserved.