Search in sources :

Example 26 with SearchTerm

use of javax.mail.search.SearchTerm in project camel by apache.

the class SearchTermBuilder method recipient.

public SearchTermBuilder recipient(Op op, Message.RecipientType type, String pattern) {
    SearchTerm st = new RecipientStringTerm(type, pattern);
    addTerm(op, st);
    return this;
}
Also used : RecipientStringTerm(javax.mail.search.RecipientStringTerm) SearchTerm(javax.mail.search.SearchTerm)

Example 27 with SearchTerm

use of javax.mail.search.SearchTerm in project camel by apache.

the class SearchTermBuilder method header.

public SearchTermBuilder header(Op op, String headerName, String pattern) {
    SearchTerm st = new HeaderTerm(headerName, pattern);
    addTerm(op, st);
    return this;
}
Also used : HeaderTerm(javax.mail.search.HeaderTerm) SearchTerm(javax.mail.search.SearchTerm)

Example 28 with SearchTerm

use of javax.mail.search.SearchTerm in project camel by apache.

the class SearchTermBuilder method flag.

public SearchTermBuilder flag(Op op, Flags flags, boolean set) {
    SearchTerm st = new FlagTerm(flags, set);
    addTerm(op, st);
    return this;
}
Also used : FlagTerm(javax.mail.search.FlagTerm) SearchTerm(javax.mail.search.SearchTerm)

Example 29 with SearchTerm

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

the class EmailFilterTest method testReceivedDate.

@Test
public void testReceivedDate() {
    EmailFilter emailFilter = EmailFilter.filter().receivedDate(EmailFilter.Operator.EQ, 1000).sentDate(EmailFilter.Operator.GT, 2000);
    SearchTerm expected = new AndTerm(new ReceivedDateTerm(3, new Date(1000)), new SentDateTerm(5, new Date(2000)));
    assertEquals(expected, emailFilter.searchTerm);
}
Also used : AndTerm(javax.mail.search.AndTerm) ReceivedDateTerm(javax.mail.search.ReceivedDateTerm) SentDateTerm(javax.mail.search.SentDateTerm) SearchTerm(javax.mail.search.SearchTerm) Date(java.util.Date) Test(org.junit.Test)

Example 30 with SearchTerm

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

the class EmailFilterTest method testAndOrNot.

@Test
public void testAndOrNot() {
    EmailFilter emailFilter = filter().from("from").to("to").or().not().subject("subject").from("from2");
    SearchTerm expected = new OrTerm(new OrTerm(new AndTerm(new FromStringTerm("from"), new RecipientStringTerm(Message.RecipientType.TO, "to")), new NotTerm(new SubjectTerm("subject"))), new FromStringTerm("from2"));
    assertEquals(expected, emailFilter.searchTerm);
}
Also used : AndTerm(javax.mail.search.AndTerm) OrTerm(javax.mail.search.OrTerm) FromStringTerm(javax.mail.search.FromStringTerm) RecipientStringTerm(javax.mail.search.RecipientStringTerm) NotTerm(javax.mail.search.NotTerm) SearchTerm(javax.mail.search.SearchTerm) SubjectTerm(javax.mail.search.SubjectTerm) Test(org.junit.Test)

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