com.jtri.base
Class DynaFilter

java.lang.Object
  extended bycom.jtri.base.DynaFilter
All Implemented Interfaces:
IFilter, IFilterDB, java.io.Serializable

public class DynaFilter
extends java.lang.Object
implements IFilter, IFilterDB

This is the default class for a filter that knows how to resolve itself back to sql. It contains a list of fields by name and filterfields objects to resolve the query.

Author:
atorres
See Also:
Serialized Form

Constructor Summary
DynaFilter()
           
DynaFilter(boolean restrictive)
           
 
Method Summary
 boolean checkIfValid()
          Returns true if the filter is in a valid state
 java.util.Map getDbFields()
           
 java.lang.Object getField(java.lang.String prop)
           
 java.util.Map getFields()
           
 IFilterDB getFilterDB()
           
 boolean isRestrictive()
          A restrictive filter is meant to restrict the creation of beans only whith certain values.
 void restrict(java.lang.Object bean)
          Restrict the bean object, setting all properties to the same value as the filter.
 void setDbFields(java.util.Map map)
           
 void setField(java.lang.String prop, DynaFilterField field, java.lang.Object val)
           
 void setFields(java.util.Map map)
           
 void setFromMapFilter(java.util.Map map)
           
 int setParams(java.lang.String from, java.sql.PreparedStatement st, int pos)
          Deprecated.  
 int setParams(java.lang.String from, org.hibernate.Query q, int pos)
           
 java.lang.String toSql(java.lang.String from)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DynaFilter

public DynaFilter()

DynaFilter

public DynaFilter(boolean restrictive)
Method Detail

getFields

public java.util.Map getFields()
Returns:

setFields

public void setFields(java.util.Map map)
Parameters:
map -

setField

public void setField(java.lang.String prop,
                     DynaFilterField field,
                     java.lang.Object val)

getField

public java.lang.Object getField(java.lang.String prop)

toSql

public java.lang.String toSql(java.lang.String from)
Specified by:
toSql in interface IFilterDB

setParams

public int setParams(java.lang.String from,
                     java.sql.PreparedStatement st,
                     int pos)
              throws java.sql.SQLException
Deprecated.  

Parameters:
from -
st -
pos -
Returns:
Throws:
java.sql.SQLException

setParams

public int setParams(java.lang.String from,
                     org.hibernate.Query q,
                     int pos)
              throws org.hibernate.HibernateException
Specified by:
setParams in interface IFilterDB
Throws:
org.hibernate.HibernateException

getDbFields

public java.util.Map getDbFields()
Returns:

setDbFields

public void setDbFields(java.util.Map map)
Parameters:
map -

setFromMapFilter

public void setFromMapFilter(java.util.Map map)

getFilterDB

public IFilterDB getFilterDB()
Specified by:
getFilterDB in interface IFilter

restrict

public void restrict(java.lang.Object bean)
              throws java.lang.Exception
Restrict the bean object, setting all properties to the same value as the filter. Only values with operation "=" and not null value will be setted

Parameters:
bean -
Throws:
java.lang.Exception

isRestrictive

public boolean isRestrictive()
Description copied from interface: IFilter
A restrictive filter is meant to restrict the creation of beans only whith certain values.

Specified by:
isRestrictive in interface IFilter
Returns:
true if this filter is restrictive

checkIfValid

public boolean checkIfValid()
Description copied from interface: IFilter
Returns true if the filter is in a valid state

Specified by:
checkIfValid in interface IFilter
Returns:
true