下面列出了怎么用javax.mail.search.ReceivedDateTerm的API类实例代码及写法,或者点击链接到github查看源代码。
/**
* Set filter on message received date.
*
* @param receiveddate messages will be filtered on receiveddate
*/
public void setReceivedDateTermEQ( Date receiveddate ) {
if ( this.protocol == MailConnectionMeta.PROTOCOL_POP3 ) {
log.logError( BaseMessages.getString( PKG, "MailConnection.Error.ReceivedDatePOP3Unsupported" ) );
} else {
addSearchTerm( new ReceivedDateTerm( ComparisonTerm.EQ, receiveddate ) );
}
}
/**
* Set filter on message received date.
*
* @param futureDate messages will be filtered on futureDate
*/
public void setReceivedDateTermLT( Date futureDate ) {
if ( this.protocol == MailConnectionMeta.PROTOCOL_POP3 ) {
log.logError( BaseMessages.getString( PKG, "MailConnection.Error.ReceivedDatePOP3Unsupported" ) );
} else {
addSearchTerm( new ReceivedDateTerm( ComparisonTerm.LT, futureDate ) );
}
}
/**
* Set filter on message received date.
*
* @param pastDate messages will be filtered on pastDate
*/
public void setReceivedDateTermGT( Date pastDate ) {
if ( this.protocol == MailConnectionMeta.PROTOCOL_POP3 ) {
log.logError( BaseMessages.getString( PKG, "MailConnection.Error.ReceivedDatePOP3Unsupported" ) );
} else {
addSearchTerm( new ReceivedDateTerm( ComparisonTerm.GT, pastDate ) );
}
}
public void setReceivedDateTermBetween( Date beginDate, Date endDate ) {
if ( this.protocol == MailConnectionMeta.PROTOCOL_POP3 ) {
log.logError( BaseMessages.getString( PKG, "MailConnection.Error.ReceivedDatePOP3Unsupported" ) );
} else {
addSearchTerm( new AndTerm( new ReceivedDateTerm( ComparisonTerm.LT, endDate ), new ReceivedDateTerm(
ComparisonTerm.GT, beginDate ) ) );
}
}
private static SearchTermBuilder createReceivedDateTermBuilder(final int searchTerm) {
return new SearchTermBuilder() {
@Override
public SearchTerm build() {
return new ReceivedDateTerm(searchTerm, parseDate(getParameters()));
}
};
}
/**
* Set filter on message received date.
*
* @param receiveddate
* messages will be filtered on receiveddate
*/
public void setReceivedDateTermEQ( Date receiveddate ) {
if ( this.protocol == MailConnectionMeta.PROTOCOL_POP3 ) {
log.logError( BaseMessages.getString( PKG, "MailConnection.Error.ReceivedDatePOP3Unsupported" ) );
} else {
addSearchTerm( new ReceivedDateTerm( ComparisonTerm.EQ, receiveddate ) );
}
}
/**
* Set filter on message received date.
*
* @param futureDate
* messages will be filtered on futureDate
*/
public void setReceivedDateTermLT( Date futureDate ) {
if ( this.protocol == MailConnectionMeta.PROTOCOL_POP3 ) {
log.logError( BaseMessages.getString( PKG, "MailConnection.Error.ReceivedDatePOP3Unsupported" ) );
} else {
addSearchTerm( new ReceivedDateTerm( ComparisonTerm.LT, futureDate ) );
}
}
/**
* Set filter on message received date.
*
* @param pastDate
* messages will be filtered on pastDate
*/
public void setReceivedDateTermGT( Date pastDate ) {
if ( this.protocol == MailConnectionMeta.PROTOCOL_POP3 ) {
log.logError( BaseMessages.getString( PKG, "MailConnection.Error.ReceivedDatePOP3Unsupported" ) );
} else {
addSearchTerm( new ReceivedDateTerm( ComparisonTerm.GT, pastDate ) );
}
}
public void setReceivedDateTermBetween( Date beginDate, Date endDate ) {
if ( this.protocol == MailConnectionMeta.PROTOCOL_POP3 ) {
log.logError( BaseMessages.getString( PKG, "MailConnection.Error.ReceivedDatePOP3Unsupported" ) );
} else {
addSearchTerm( new AndTerm( new ReceivedDateTerm( ComparisonTerm.LT, endDate ), new ReceivedDateTerm(
ComparisonTerm.GT, beginDate ) ) );
}
}