use of javax.mail.search.SearchTerm in project jodd by oblac.
the class EmailFilterTest method testOr2.
@Test
public void testOr2() {
EmailFilter emailFilter = filter().or(filter().from("from"), filter().to("to"));
SearchTerm expected = new OrTerm(new FromStringTerm("from"), new RecipientStringTerm(Message.RecipientType.TO, "to"));
assertEquals(expected, emailFilter.searchTerm);
}
use of javax.mail.search.SearchTerm in project jodd by oblac.
the class EmailFilter method and.
/**
* Defines AND group of filters.
*/
public EmailFilter and(EmailFilter... emailFilters) {
SearchTerm[] searchTerms = new SearchTerm[emailFilters.length];
for (int i = 0; i < emailFilters.length; i++) {
searchTerms[i] = emailFilters[i].searchTerm;
}
concat(new AndTerm(searchTerms));
return this;
}
use of javax.mail.search.SearchTerm in project jodd by oblac.
the class EmailFilter method subject.
/**
* Defines filter for SUBJECT field.
*/
public EmailFilter subject(String subject) {
SearchTerm subjectTerm = new SubjectTerm(subject);
concat(subjectTerm);
return this;
}
use of javax.mail.search.SearchTerm in project jodd by oblac.
the class EmailFilter method messageNumber.
/**
* Defines message number filter.
*/
public EmailFilter messageNumber(int messageNumber) {
SearchTerm msgIdTerm = new MessageNumberTerm(messageNumber);
concat(msgIdTerm);
return this;
}
use of javax.mail.search.SearchTerm in project jodd by oblac.
the class EmailFilter method to.
/**
* Defines filter for TO field.
*/
public EmailFilter to(String toAddress) {
SearchTerm toTerm = new RecipientStringTerm(Message.RecipientType.TO, toAddress);
concat(toTerm);
return this;
}
Aggregations