Search in sources :

Example 6 with SearchTerm

use of javax.mail.search.SearchTerm in project jodd by oblac.

the class EmailFilter method messageId.

/**
	 * Defines filter for message id.
	 */
public EmailFilter messageId(String messageId) {
    SearchTerm msgIdTerm = new MessageIDTerm(messageId);
    concat(msgIdTerm);
    return this;
}
Also used : MessageIDTerm(javax.mail.search.MessageIDTerm) SearchTerm(javax.mail.search.SearchTerm)

Example 7 with SearchTerm

use of javax.mail.search.SearchTerm in project jodd by oblac.

the class EmailFilter method not.

/**
	 * Appends single filter as NOT.
	 */
public EmailFilter not(EmailFilter emailFilter) {
    SearchTerm searchTerm = new NotTerm(emailFilter.searchTerm);
    concat(searchTerm);
    return this;
}
Also used : NotTerm(javax.mail.search.NotTerm) SearchTerm(javax.mail.search.SearchTerm)

Example 8 with SearchTerm

use of javax.mail.search.SearchTerm in project jodd by oblac.

the class EmailFilter method flags.

/**
	 * Defines filter for many flags at once.
	 */
public EmailFilter flags(Flags flags, boolean value) {
    SearchTerm flagTerm = new FlagTerm(flags, value);
    concat(flagTerm);
    return this;
}
Also used : FlagTerm(javax.mail.search.FlagTerm) SearchTerm(javax.mail.search.SearchTerm)

Example 9 with SearchTerm

use of javax.mail.search.SearchTerm in project jodd by oblac.

the class EmailFilter method sentDate.

/**
	 * Defines filter for sent date.
	 */
public EmailFilter sentDate(Operator operator, long milliseconds) {
    SearchTerm term = new SentDateTerm(operator.value, new java.util.Date(milliseconds));
    concat(term);
    return this;
}
Also used : SentDateTerm(javax.mail.search.SentDateTerm) SearchTerm(javax.mail.search.SearchTerm)

Example 10 with SearchTerm

use of javax.mail.search.SearchTerm in project jodd by oblac.

the class EmailFilter method or.

/**
	 * Defines OR group of filters.
	 */
public EmailFilter or(EmailFilter... emailFilters) {
    SearchTerm[] searchTerms = new SearchTerm[emailFilters.length];
    for (int i = 0; i < emailFilters.length; i++) {
        searchTerms[i] = emailFilters[i].searchTerm;
    }
    concat(new OrTerm(searchTerms));
    return this;
}
Also used : OrTerm(javax.mail.search.OrTerm) SearchTerm(javax.mail.search.SearchTerm)

Aggregations

SearchTerm (javax.mail.search.SearchTerm)38 RecipientStringTerm (javax.mail.search.RecipientStringTerm)9 FromStringTerm (javax.mail.search.FromStringTerm)8 Test (org.junit.Test)8 OrTerm (javax.mail.search.OrTerm)6 SubjectTerm (javax.mail.search.SubjectTerm)6 AndTerm (javax.mail.search.AndTerm)5 Message (javax.mail.Message)3 InternetAddress (javax.mail.internet.InternetAddress)3 MimeMessage (javax.mail.internet.MimeMessage)3 FlagTerm (javax.mail.search.FlagTerm)3 HeaderTerm (javax.mail.search.HeaderTerm)3 NotTerm (javax.mail.search.NotTerm)3 IMAPFolder (com.sun.mail.imap.IMAPFolder)2 Date (java.util.Date)2 Flags (javax.mail.Flags)2 MessagingException (javax.mail.MessagingException)2 BodyTerm (javax.mail.search.BodyTerm)2 MessageIDTerm (javax.mail.search.MessageIDTerm)2 ReceivedDateTerm (javax.mail.search.ReceivedDateTerm)2