in geronimo-mail_2.1_impl/geronimo-mail_2.1_provider/src/main/java/org/apache/geronimo/mail/store/imap/connection/IMAPCommand.java [785:842]
public void appendSearchTerm(SearchTerm term, String charset) throws MessagingException {
// we need to do this manually, by inspecting the term object against the various SearchTerm types
// defined by the mail spec.
// Flag searches are used internally by other operations, so this is a good one to check first.
if (term instanceof FlagTerm) {
appendFlag((FlagTerm)term, charset);
}
// after that, I'm not sure there's any optimal order to these. Let's start with the conditional
// modifiers (AND, OR, NOT), then just hit each of the header types
else if (term instanceof AndTerm) {
appendAnd((AndTerm)term, charset);
}
else if (term instanceof OrTerm) {
appendOr((OrTerm)term, charset);
}
else if (term instanceof NotTerm) {
appendNot((NotTerm)term, charset);
}
// multiple forms of From: search
else if (term instanceof FromTerm) {
appendFrom((FromTerm)term, charset);
}
else if (term instanceof FromStringTerm) {
appendFrom((FromStringTerm)term, charset);
}
else if (term instanceof HeaderTerm) {
appendHeader((HeaderTerm)term, charset);
}
else if (term instanceof RecipientTerm) {
appendRecipient((RecipientTerm)term, charset);
}
else if (term instanceof RecipientStringTerm) {
appendRecipient((RecipientStringTerm)term, charset);
}
else if (term instanceof SubjectTerm) {
appendSubject((SubjectTerm)term, charset);
}
else if (term instanceof BodyTerm) {
appendBody((BodyTerm)term, charset);
}
else if (term instanceof SizeTerm) {
appendSize((SizeTerm)term, charset);
}
else if (term instanceof SentDateTerm) {
appendSentDate((SentDateTerm)term, charset);
}
else if (term instanceof ReceivedDateTerm) {
appendReceivedDate((ReceivedDateTerm)term, charset);
}
else if (term instanceof MessageIDTerm) {
appendMessageID((MessageIDTerm)term, charset);
}
else {
// don't know what this is
throw new SearchException("Unsupported search type");
}
}