Compoze Software, Inc.

com.compoze.ebusiness
Class AbstractFilter

java.lang.Object
  |
  +--com.compoze.ebusiness.AbstractFilter
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
AppointmentFilter, ContactFilter, DistributionListFilter, ForumFilter, MessageFilter, ToDoFilter, TopicFilter

public abstract class AbstractFilter
extends java.lang.Object
implements java.io.Serializable

This class is the base class for filters.

See Also:
Serialized Form

Field Summary
protected  java.util.Map m_rules
           
protected  com.compoze.ejb.persistence.database.WhereFilterRule m_where
           
 
Constructor Summary
AbstractFilter()
           
 
Method Summary
 void clearWhereClause()
          Clears the where clause.
protected  com.compoze.ejb.persistence.database.IComparisonFilterRule getBaseRule()
          Gets the base rule using the or'd setting.
 com.compoze.ejb.persistence.database.IFilterRule getFilterRule()
           
 boolean getOr()
          Gets or property.
 java.lang.String getWhereClause()
          Gets the where clause.
 boolean isEmpty()
          Checks if the filter is empty.
protected  void setBeginsRule(java.lang.String field, java.lang.String value)
          Sets filtering by the specified field and values.
protected  void setGreaterThanRule(java.lang.String field, java.util.Date givenDate)
          Sets the rule.
protected  void setLessThanRule(java.lang.String field, java.util.Date givenDate)
          Sets the rule.
protected  void setNotRule(java.lang.String field, int[] values)
          Sets filtering by 'not' the specified field and values.
 void setOr(boolean bOr)
          Sets or property.
protected  void setRule(java.lang.String field, boolean bFlag)
          Sets filtering by the specified field and value.
protected  void setRule(java.lang.String field, java.util.Date startDate, java.util.Date endDate)
          Sets the rule.
protected  void setRule(java.lang.String field, int iValue)
          Sets filtering by the specified field and value.
protected  void setRule(java.lang.String field, int[] values)
          Sets filtering by the specified field and values.
protected  void setRule(java.lang.String field, int iValue, boolean bGreaterThan)
          Sets filtering by the specified field and value.
protected  void setRule(java.lang.String field, int iFromValue, int iToValue)
          Sets filtering by the specified field and betweent the specified to and from values.
protected  void setRule(java.lang.String field, long[] values)
          Sets filtering by the specified field and values.
protected  void setRule(java.lang.String field, long lValue, boolean bGreaterThan)
          Sets filtering by the specified field and value.
protected  void setRule(java.lang.String field, long lFromValue, long lToValue)
          Sets filtering by the specified field and betweent the specified to and from values.
protected  void setRule(java.lang.String field, java.lang.String[] values, boolean bExactMatch)
          Sets fitlering by the specified field and values.
 void setWhereClause(java.lang.String sWhereClause)
          Sets the where clause for filtering.
 java.lang.String toRule()
           
 java.lang.String toString()
          Returns a string representation of the object.
protected  void unsetBeginsRule(java.lang.String field)
          Unsets the begins string rule.
protected  void unsetNotRule(java.lang.String field)
          Unsets filtering by 'not' the specified field and values.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_rules

protected java.util.Map m_rules

m_where

protected com.compoze.ejb.persistence.database.WhereFilterRule m_where
Constructor Detail

AbstractFilter

public AbstractFilter()
Method Detail

setWhereClause

public void setWhereClause(java.lang.String sWhereClause)
Sets the where clause for filtering. This overrides the use of the filter rules and uses the specified where clause when filtering. No validation of the where clause is performed therefore it is the caller's responsibility to use valid sql.

Warning: the where clause should be valid for the configured database. This method should be used with extreme caution.

Parameters:
sWhereClause - the where clause or null to clear the where clause

getWhereClause

public java.lang.String getWhereClause()
Gets the where clause.
Returns:
the where clause or null if not set

clearWhereClause

public void clearWhereClause()
Clears the where clause.

setOr

public void setOr(boolean bOr)
Sets or property. If or is specified then the restriction values are or'd instead of and'd to specify the filter.
Parameters:
bOr - if true, filter is or'd

getOr

public boolean getOr()
Gets or property. If or is specified then the restriction values are or'd instead of and'd to specify the filter.
Returns:
the or property, if true, filter is or'd

getBaseRule

protected com.compoze.ejb.persistence.database.IComparisonFilterRule getBaseRule()
Gets the base rule using the or'd setting.
Returns:
the base rule

setRule

protected void setRule(java.lang.String field,
                       java.lang.String[] values,
                       boolean bExactMatch)
Sets fitlering by the specified field and values.
Parameters:
field - the field
values - the values to test
bExactMatch - true for an exact match of the values; false otherwise

setRule

protected void setRule(java.lang.String field,
                       int[] values)
Sets filtering by the specified field and values.
Parameters:
field - the field
values - the values to test

setNotRule

protected void setNotRule(java.lang.String field,
                          int[] values)
Sets filtering by 'not' the specified field and values.
Parameters:
field - the field
values - the values to test

unsetNotRule

protected void unsetNotRule(java.lang.String field)
Unsets filtering by 'not' the specified field and values.
Parameters:
field - the field

setRule

protected void setRule(java.lang.String field,
                       boolean bFlag)
Sets filtering by the specified field and value.
Parameters:
field - the field
bFlag - the value to test

setRule

protected void setRule(java.lang.String field,
                       int iValue,
                       boolean bGreaterThan)
Sets filtering by the specified field and value.
Parameters:
field - the field
iValue - the value to test
bGreaterThan - true for topic count greater than specified count; false for count less than specified count

setRule

protected void setRule(java.lang.String field,
                       int iValue)
Sets filtering by the specified field and value.
Parameters:
field - the field
iValue - the value to test

setRule

protected void setRule(java.lang.String field,
                       int iFromValue,
                       int iToValue)
Sets filtering by the specified field and betweent the specified to and from values.
Parameters:
field - the field
iFromValue - the from value
iToValue - the to value

setRule

protected void setRule(java.lang.String field,
                       long[] values)
Sets filtering by the specified field and values.
Parameters:
field - the field
values - the values to test

setRule

protected void setRule(java.lang.String field,
                       long lValue,
                       boolean bGreaterThan)
Sets filtering by the specified field and value.
Parameters:
field - the field
iValue - the value to test
bGreaterThan - true for topic count greater than specified count; false for count less than specified count

setRule

protected void setRule(java.lang.String field,
                       long lFromValue,
                       long lToValue)
Sets filtering by the specified field and betweent the specified to and from values.
Parameters:
field - the field
iFromValue - the from value
iToValue - the to value

setRule

protected void setRule(java.lang.String field,
                       java.util.Date startDate,
                       java.util.Date endDate)
Sets the rule.
Parameters:
field - the field
givenDate - the given date to test

setGreaterThanRule

protected void setGreaterThanRule(java.lang.String field,
                                  java.util.Date givenDate)
Sets the rule.
Parameters:
field - the field
givenDate - the given date to test

setLessThanRule

protected void setLessThanRule(java.lang.String field,
                               java.util.Date givenDate)
Sets the rule.
Parameters:
field - the field
givenDate - the given date to test

setBeginsRule

protected void setBeginsRule(java.lang.String field,
                             java.lang.String value)
Sets filtering by the specified field and values.
Parameters:
field - the field
values - the values to test
bExactMatch - true for an exact match of the values; false otherwise

unsetBeginsRule

protected void unsetBeginsRule(java.lang.String field)
Unsets the begins string rule.
Parameters:
field - the field

toRule

public java.lang.String toRule()

isEmpty

public boolean isEmpty()
Checks if the filter is empty.
Returns:
true if the filter is empty; false otherwise

getFilterRule

public com.compoze.ejb.persistence.database.IFilterRule getFilterRule()

toString

public java.lang.String toString()
Returns a string representation of the object.
Overrides:
toString in class java.lang.Object
Returns:
the string representation of the object

Compoze Software, Inc.

Copyright ©1999-2003 Compoze Software, Inc. All rights reserved.