Top Description Fields Constructors Methods
com.sun.mail.imap.protocol

public Class SearchSequence

extends Object
Class Inheritance
Imports
java.util.*, java.io.IOException, javax.mail.*, javax.mail.search.*, com.sun.mail.iap.*, com.sun.mail.imap.OlderTerm, .YoungerTerm, .ModifiedSinceTerm

This class traverses a search-tree and generates the corresponding IMAP search sequence. Each IMAPProtocol instance contains an instance of this class, which might be subclassed by subclasses of IMAPProtocol to add support for additional product-specific search terms.
Authors
John Mani, Bill Shannon

Field Summary

Modifier and TypeField and Description
protected Calendar
private static String[]
monthTable

Print an IMAP Date string, that is suitable for the Date SEARCH commands.

private IMAPProtocol

Constructor Summary

AccessConstructor and Description
public
SearchSequence(IMAPProtocol
the IMAPProtocol object for the server
p
)

Create a SearchSequence for this IMAPProtocol.

public
SearchSequence()

Deprecated
Create a SearchSequence.

Method Summary

Modifier and TypeMethod and Description
protected Argument
and(AndTerm term, String charset)

protected Argument
body(BodyTerm term, String charset)

protected Argument
flag(FlagTerm term)

protected Argument
from(String address, String charset)

public Argument

Returns:

the SEARCH Argument
generateSequence
(SearchTerm
the search term
term
,
String
charset for the search
charset
)

Generate the IMAP search sequence for the given search expression.

protected Argument
header(HeaderTerm term, String charset)

public static boolean

Returns:

true if only ASCII
isAscii
(SearchTerm
the search term
term
)

Check if the "text" terms in the given SearchTerm contain non US-ASCII characters.

public static boolean

Returns:

true if only ASCII
isAscii
(SearchTerm[]
the search terms
terms
)

Check if any of the "text" terms in the given SearchTerms contain non US-ASCII characters.

public static boolean

Returns:

true if only ASCII
isAscii
(String
the string
s
)

Does this string contain only ASCII characters?

protected Argument
protected Argument

Returns:

the SEARCH Argument
modifiedSince
(ModifiedSinceTerm
the search term
term
)

Generate argument for ModifiedSinceTerm.

protected Argument
not(NotTerm term, String charset)

protected Argument

Returns:

the SEARCH Argument
older
(OlderTerm
the search term
term
)

Generate argument for OlderTerm.

protected Argument
or(OrTerm term, String charset)

protected Argument
protected Argument
recipient(Message.RecipientType type, String address, String charset)

protected Argument
protected Argument
size(SizeTerm term)

protected Argument
subject(SubjectTerm term, String charset)

protected String
protected Argument

Returns:

the SEARCH Argument
younger
(YoungerTerm
the search term
term
)

Generate argument for YoungerTerm.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

calback to summary
protected Calendar cal
monthTableback to summary
private static String[] monthTable

Print an IMAP Date string, that is suitable for the Date SEARCH commands. The IMAP Date string is : date ::= date_day "-" date_month "-" date_year Note that this format does not contain the TimeZone

protocolback to summary
private IMAPProtocol protocol

Constructor Detail

SearchSequenceback to summary
public SearchSequence(IMAPProtocol p)

Create a SearchSequence for this IMAPProtocol.

Parameters
p:IMAPProtocol

the IMAPProtocol object for the server

Since
JavaMail 1.6.0
SearchSequenceback to summary
public SearchSequence()

Deprecated

Create a SearchSequence.

Annotations
@Deprecated

Method Detail

andback to summary
protected Argument and(AndTerm term, String charset) throws SearchException, IOException
bodyback to summary
protected Argument body(BodyTerm term, String charset) throws SearchException, IOException
flagback to summary
protected Argument flag(FlagTerm term) throws SearchException
fromback to summary
protected Argument from(String address, String charset) throws SearchException, IOException
generateSequenceback to summary
public Argument generateSequence(SearchTerm term, String charset) throws SearchException, IOException

Generate the IMAP search sequence for the given search expression.

Parameters
term:SearchTerm

the search term

charset:String

charset for the search

Returns:Argument

the SEARCH Argument

Exceptions
SearchException:
for failures
IOException:
for I/O errors
headerback to summary
protected Argument header(HeaderTerm term, String charset) throws SearchException, IOException
isAsciiback to summary
public static boolean isAscii(SearchTerm term)

Check if the "text" terms in the given SearchTerm contain non US-ASCII characters.

Parameters
term:SearchTerm

the search term

Returns:boolean

true if only ASCII

isAsciiback to summary
public static boolean isAscii(SearchTerm[] terms)

Check if any of the "text" terms in the given SearchTerms contain non US-ASCII characters.

Parameters
terms:SearchTerm[]

the search terms

Returns:boolean

true if only ASCII

isAsciiback to summary
public static boolean isAscii(String s)

Does this string contain only ASCII characters?

Parameters
s:String

the string

Returns:boolean

true if only ASCII

messageidback to summary
protected Argument messageid(MessageIDTerm term, String charset) throws SearchException, IOException
modifiedSinceback to summary
protected Argument modifiedSince(ModifiedSinceTerm term) throws SearchException

Generate argument for ModifiedSinceTerm.

Parameters
term:ModifiedSinceTerm

the search term

Returns:Argument

the SEARCH Argument

Exceptions
SearchException:
for failures
Since
JavaMail 1.5.1
notback to summary
protected Argument not(NotTerm term, String charset) throws SearchException, IOException
olderback to summary
protected Argument older(OlderTerm term) throws SearchException

Generate argument for OlderTerm.

Parameters
term:OlderTerm

the search term

Returns:Argument

the SEARCH Argument

Exceptions
SearchException:
for failures
Since
JavaMail 1.5.1
orback to summary
protected Argument or(OrTerm term, String charset) throws SearchException, IOException
receiveddateback to summary
protected Argument receiveddate(DateTerm term) throws SearchException
recipientback to summary
protected Argument recipient(Message.RecipientType type, String address, String charset) throws SearchException, IOException
sentdateback to summary
protected Argument sentdate(DateTerm term) throws SearchException
sizeback to summary
protected Argument size(SizeTerm term) throws SearchException
subjectback to summary
protected Argument subject(SubjectTerm term, String charset) throws SearchException, IOException
toIMAPDateback to summary
protected String toIMAPDate(Date date)
youngerback to summary
protected Argument younger(YoungerTerm term) throws SearchException

Generate argument for YoungerTerm.

Parameters
term:YoungerTerm

the search term

Returns:Argument

the SEARCH Argument

Exceptions
SearchException:
for failures
Since
JavaMail 1.5.1