Compoze Software, Inc.

com.compoze.mail
Class AbstractMessageFilter

java.lang.Object
  |
  +--com.compoze.mail.AbstractMessageFilter
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
MessageFilter

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

This class is the base for a message filter.

See Also:
Serialized Form

Field Summary
protected  boolean m_bFilterOr
           
protected  boolean m_bOr
           
protected  AbstractMessageFilter m_filter
           
 
Constructor Summary
AbstractMessageFilter()
           
 
Method Summary
 java.util.List acceptMessages(java.util.Collection messages)
          Checks if the filter accepts messages in the list.
abstract  boolean accepts(IMessage message)
          Checks if the filter accepts specified message.
 void addFilter(AbstractMessageFilter filter, boolean bOr)
          Adds the filter to this filter.
protected  boolean compareDate(java.util.Date givenDate, java.util.Date startDate, java.util.Date endDate)
          Compares a given date to determine if within a specified range.
protected  boolean compareString(java.lang.String sStr1, java.lang.String sStr2, boolean bExact, boolean bCaseSensitive)
          Compares two strings.
protected  boolean compareStringStartsWith(java.lang.String sStr, java.lang.String sPrefix)
          Compares two strings.
 AbstractMessageFilter getFilter()
          Gets the filter added to this message filter.
abstract  com.compoze.ejb.persistence.database.IFilterRule getFilterRule()
          Gets the filter rule associated with this message filter.
 void setOr(boolean bOr)
          Sets the or.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_bOr

protected boolean m_bOr

m_bFilterOr

protected boolean m_bFilterOr

m_filter

protected AbstractMessageFilter m_filter
Constructor Detail

AbstractMessageFilter

public AbstractMessageFilter()
Method Detail

accepts

public abstract boolean accepts(IMessage message)
                         throws MailException
Checks if the filter accepts specified message.
Parameters:
message - the message to check
Returns:
true if the filter accepts the message; false otherwise

acceptMessages

public java.util.List acceptMessages(java.util.Collection messages)
                              throws MailException
Checks if the filter accepts messages in the list.
Parameters:
messages - a collection of IMessage objects to check
Returns:
a list of IMessage objects the filter accepts or an empty list of no messages are accepted

setOr

public void setOr(boolean bOr)
Sets the or.

addFilter

public void addFilter(AbstractMessageFilter filter,
                      boolean bOr)
Adds the filter to this filter.
Parameters:
filter - the filter
bOr - true to 'or' the filter; false otherwise

compareStringStartsWith

protected boolean compareStringStartsWith(java.lang.String sStr,
                                          java.lang.String sPrefix)
Compares two strings.
Parameters:
sStr1 - the string to compare for
sStr2 - the string to compare with
Returns:
true if the strings compare; false otherwise

compareString

protected boolean compareString(java.lang.String sStr1,
                                java.lang.String sStr2,
                                boolean bExact,
                                boolean bCaseSensitive)
Compares two strings.
Parameters:
sStr1 - the string to compare for
sStr2 - the string to compare with
bExact - true for an exact match
bCaseSensitive - true for case sensitive match
Returns:
true if the strings compare; false otherwise

compareDate

protected boolean compareDate(java.util.Date givenDate,
                              java.util.Date startDate,
                              java.util.Date endDate)
Compares a given date to determine if within a specified range.
Parameters:
givenDate - the given date
startDate - the start date (may not be null)
endDate - the end date (may not be null)
Returns:
true if the given date is within the specified range; false otherwise

getFilter

public AbstractMessageFilter getFilter()
Gets the filter added to this message filter.
Returns:
the filter or null if not set
See Also:
addFilter(AbstractMessageFilter,boolean)

getFilterRule

public abstract com.compoze.ejb.persistence.database.IFilterRule getFilterRule()
Gets the filter rule associated with this message filter.
Returns:
the filter rule or null for no filtering

Compoze Software, Inc.

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