use of javax.mail.search.ReceivedDateTerm in project camel by apache.
the class SearchTermBuilder method received.
public SearchTermBuilder received(Op op, Comparison comparison, Date date) {
ReceivedDateTerm st = new ReceivedDateTerm(comparison.asNum(), date);
addTerm(op, st);
return this;
}
use of javax.mail.search.ReceivedDateTerm in project jodd by oblac.
the class EmailFilter method receivedDate.
/**
* Defines filter for received date.
*/
public EmailFilter receivedDate(Operator operator, long milliseconds) {
SearchTerm term = new ReceivedDateTerm(operator.value, new java.util.Date(milliseconds));
concat(term);
return this;
}
use of javax.mail.search.ReceivedDateTerm 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);
}
Aggregations