SK.gnome.dwarf.mail.store.search
Class TextKey

java.lang.Object
  extended bySK.gnome.dwarf.mail.store.search.SearchKey
      extended bySK.gnome.dwarf.mail.store.search.TextKey

public class TextKey
extends SearchKey

This key matches the given text and the actual message content.


Field Summary
protected  boolean header
          If only the message header will be matched.
protected  java.lang.String charset
          The charset of the matched text.
static int PARTIAL
          This key type specifies that a partial word will be matched.
static int SUBSTRING
          This key type specifies that a substring will be matched.
protected  java.lang.String text
          The matched text.
static int WORD
          This key type specifies that a single word will be matched.
 
Fields inherited from class SK.gnome.dwarf.mail.store.search.SearchKey
type
 
Constructor Summary
TextKey(int type, java.lang.String text, java.lang.String charset, boolean header)
          Creates a new TextKey with the given type.
TextKey(java.lang.String text, java.lang.String charset, boolean header)
          Creates a new TextKey.
 
Method Summary
 java.lang.String getCharset()
          Returns the charset of the matched text.
 boolean getSearchHeader()
          Returns whether only the message header will be matched.
 java.lang.String getText()
          Returns the matched text.
 boolean match(MailMessage message)
          Matches the given text and the actual message content.
 java.lang.String toString()
          Returns the string represenation of the key.
 
Methods inherited from class SK.gnome.dwarf.mail.store.search.SearchKey
addError, clearErrors, getErrors, getType, hasError
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SUBSTRING

public static final int SUBSTRING
This key type specifies that a substring will be matched.

See Also:
Constant Field Values

WORD

public static final int WORD
This key type specifies that a single word will be matched.

See Also:
Constant Field Values

PARTIAL

public static final int PARTIAL
This key type specifies that a partial word will be matched.

See Also:
Constant Field Values

text

protected java.lang.String text
The matched text.


charset

protected java.lang.String charset
The charset of the matched text.


header

protected boolean header
If only the message header will be matched.

Constructor Detail

TextKey

public TextKey(java.lang.String text,
               java.lang.String charset,
               boolean header)
Creates a new TextKey.

The key type will be set to SUBSTRING.

Parameters:
text - the matched text
charset - the charset of the matched text
header - if only the header will be matched

TextKey

public TextKey(int type,
               java.lang.String text,
               java.lang.String charset,
               boolean header)
Creates a new TextKey with the given type.

Parameters:
type - the key type
text - the matched text
charset - the charset of the matched text
header - if only the header will be matched
Method Detail

getText

public java.lang.String getText()
Returns the matched text.


getCharset

public java.lang.String getCharset()
Returns the charset of the matched text.


getSearchHeader

public boolean getSearchHeader()
Returns whether only the message header will be matched.


match

public boolean match(MailMessage message)
              throws MailException
Matches the given text and the actual message content.

For now, only messages of MIME type "text/*" or "message/rfc822" with a "text/*" type of the nested message are searched.

Specified by:
match in class SearchKey
Parameters:
message - the searched message
Returns:
true if the given key criteria and message matches, false otherwise
Throws:
MailException - if an error occurs

toString

public java.lang.String toString()
Description copied from class: SearchKey
Returns the string represenation of the key.

Overrides:
toString in class SearchKey
Returns:
the key string


Copyright (c) 2004-2005, Gnome Ltd. All rights reserved.