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;
}
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;
}
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;
}
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);
}
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);
}
Aggregations