Search in sources :

Example 1 with ReceivedDateTerm

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;
}
Also used : ReceivedDateTerm(javax.mail.search.ReceivedDateTerm)

Example 2 with ReceivedDateTerm

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;
}
Also used : ReceivedDateTerm(javax.mail.search.ReceivedDateTerm) SearchTerm(javax.mail.search.SearchTerm)

Example 3 with ReceivedDateTerm

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

Aggregations

ReceivedDateTerm (javax.mail.search.ReceivedDateTerm)3 SearchTerm (javax.mail.search.SearchTerm)2 Date (java.util.Date)1 AndTerm (javax.mail.search.AndTerm)1 SentDateTerm (javax.mail.search.SentDateTerm)1 Test (org.junit.Test)1