Package com.sun.mail.imap.protocol
Class SearchSequence
- java.lang.Object
-
- com.sun.mail.imap.protocol.SearchSequence
-
public class SearchSequence extends Object
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.- Author:
- John Mani, Bill Shannon
-
-
Constructor Summary
Constructors Constructor Description SearchSequence()Deprecated.SearchSequence(IMAPProtocol p)Create a SearchSequence for this IMAPProtocol.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Argumentand(AndTerm term, String charset)protected Argumentbody(BodyTerm term, String charset)protected Argumentflag(FlagTerm term)protected Argumentfrom(String address, String charset)ArgumentgenerateSequence(SearchTerm term, String charset)Generate the IMAP search sequence for the given search expression.protected Argumentheader(HeaderTerm term, String charset)static booleanisAscii(SearchTerm term)Check if the "text" terms in the given SearchTerm contain non US-ASCII characters.static booleanisAscii(SearchTerm[] terms)Check if any of the "text" terms in the given SearchTerms contain non US-ASCII characters.static booleanisAscii(String s)Does this string contain only ASCII characters?protected Argumentmessageid(MessageIDTerm term, String charset)protected ArgumentmodifiedSince(ModifiedSinceTerm term)Generate argument for ModifiedSinceTerm.protected Argumentnot(NotTerm term, String charset)protected Argumentolder(OlderTerm term)Generate argument for OlderTerm.protected Argumentor(OrTerm term, String charset)protected Argumentreceiveddate(DateTerm term)protected Argumentrecipient(Message.RecipientType type, String address, String charset)protected Argumentsentdate(DateTerm term)protected Argumentsize(SizeTerm term)protected Argumentsubject(SubjectTerm term, String charset)protected StringtoIMAPDate(Date date)protected Argumentyounger(YoungerTerm term)Generate argument for YoungerTerm.
-
-
-
Field Detail
-
cal
protected Calendar cal
-
-
Constructor Detail
-
SearchSequence
public SearchSequence(IMAPProtocol p)
Create a SearchSequence for this IMAPProtocol.- Parameters:
p- the IMAPProtocol object for the server- Since:
- JavaMail 1.6.0
-
SearchSequence
@Deprecated public SearchSequence()
Deprecated.Create a SearchSequence.
-
-
Method Detail
-
generateSequence
public Argument generateSequence(SearchTerm term, String charset) throws SearchException, IOException
Generate the IMAP search sequence for the given search expression.- Parameters:
term- the search termcharset- charset for the search- Returns:
- the SEARCH Argument
- Throws:
SearchException- for failuresIOException- for I/O errors
-
isAscii
public static boolean isAscii(SearchTerm term)
Check if the "text" terms in the given SearchTerm contain non US-ASCII characters.- Parameters:
term- the search term- Returns:
- true if only ASCII
-
isAscii
public static boolean isAscii(SearchTerm[] terms)
Check if any of the "text" terms in the given SearchTerms contain non US-ASCII characters.- Parameters:
terms- the search terms- Returns:
- true if only ASCII
-
isAscii
public static boolean isAscii(String s)
Does this string contain only ASCII characters?- Parameters:
s- the string- Returns:
- true if only ASCII
-
and
protected Argument and(AndTerm term, String charset) throws SearchException, IOException
- Throws:
SearchExceptionIOException
-
or
protected Argument or(OrTerm term, String charset) throws SearchException, IOException
- Throws:
SearchExceptionIOException
-
not
protected Argument not(NotTerm term, String charset) throws SearchException, IOException
- Throws:
SearchExceptionIOException
-
header
protected Argument header(HeaderTerm term, String charset) throws SearchException, IOException
- Throws:
SearchExceptionIOException
-
messageid
protected Argument messageid(MessageIDTerm term, String charset) throws SearchException, IOException
- Throws:
SearchExceptionIOException
-
flag
protected Argument flag(FlagTerm term) throws SearchException
- Throws:
SearchException
-
from
protected Argument from(String address, String charset) throws SearchException, IOException
- Throws:
SearchExceptionIOException
-
recipient
protected Argument recipient(Message.RecipientType type, String address, String charset) throws SearchException, IOException
- Throws:
SearchExceptionIOException
-
subject
protected Argument subject(SubjectTerm term, String charset) throws SearchException, IOException
- Throws:
SearchExceptionIOException
-
body
protected Argument body(BodyTerm term, String charset) throws SearchException, IOException
- Throws:
SearchExceptionIOException
-
size
protected Argument size(SizeTerm term) throws SearchException
- Throws:
SearchException
-
sentdate
protected Argument sentdate(DateTerm term) throws SearchException
- Throws:
SearchException
-
receiveddate
protected Argument receiveddate(DateTerm term) throws SearchException
- Throws:
SearchException
-
older
protected Argument older(OlderTerm term) throws SearchException
Generate argument for OlderTerm.- Parameters:
term- the search term- Returns:
- the SEARCH Argument
- Throws:
SearchException- for failures- Since:
- JavaMail 1.5.1
-
younger
protected Argument younger(YoungerTerm term) throws SearchException
Generate argument for YoungerTerm.- Parameters:
term- the search term- Returns:
- the SEARCH Argument
- Throws:
SearchException- for failures- Since:
- JavaMail 1.5.1
-
modifiedSince
protected Argument modifiedSince(ModifiedSinceTerm term) throws SearchException
Generate argument for ModifiedSinceTerm.- Parameters:
term- the search term- Returns:
- the SEARCH Argument
- Throws:
SearchException- for failures- Since:
- JavaMail 1.5.1
-
-