本文整理汇总了Java中javax.mail.search.OrTerm类的典型用法代码示例。如果您正苦于以下问题:Java OrTerm类的具体用法?Java OrTerm怎么用?Java OrTerm使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OrTerm类属于javax.mail.search包,在下文中一共展示了OrTerm类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: multipleFieldsShouldReturnOrTerm
import javax.mail.search.OrTerm; //导入依赖的package包/类
@Test
public void multipleFieldsShouldReturnOrTerm() {
final Set fields = new HashSet();
fields.add("to");
fields.add("from");
fields.add("cc");
Rule rule = Rule.create()
.sourceFolder("INBOX")
.matchingText("testText")
.fields(fields);
SearchTerm term = rule.getSearchTerm();
Assert.assertTrue(term instanceof OrTerm);
SearchTerm[] terms = ((OrTerm) term).getTerms();
for (SearchTerm t : terms) {
Assert.assertTrue(t instanceof FromStringTerm
|| (t instanceof RecipientStringTerm && ((RecipientStringTerm) t).getRecipientType() == Message.RecipientType.CC)
|| (t instanceof RecipientStringTerm && ((RecipientStringTerm) t).getRecipientType() == Message.RecipientType.TO));
}
}
开发者ID:PacktPublishing,项目名称:Java-9-Programming-Blueprints,代码行数:21,代码来源:RuleTest.java
示例2: getSearchTerm
import javax.mail.search.OrTerm; //导入依赖的package包/类
/**
* Returns a <pre>{@link SearchTerm}</pre> to be used when retrieving messages.
* Default term is only for unseen emails, but when retrieveSeenEmails is
* set to true it returns a union of terms for both unseen and seen messages.
*
* @return a search term to be used for message retrieval.
*/
private SearchTerm getSearchTerm() {
Flags seenFlag = new Flags(Flag.SEEN);
FlagTerm unseenFlagTerm = new FlagTerm(seenFlag, false);
if (retrieveSeenEmails) {
FlagTerm seenFlagTerm = new FlagTerm(seenFlag, true);
return new OrTerm(unseenFlagTerm, seenFlagTerm);
}
return unseenFlagTerm;
}
开发者ID:theparanoidtimes,项目名称:tabellarium,代码行数:17,代码来源:ImapMailboxFolderTaskExecutor.java
示例3: getMessagesByIds
import javax.mail.search.OrTerm; //导入依赖的package包/类
protected Message[] getMessagesByIds(Folder folder, List<String> messageIds) throws MessagingException {
List<MessageIDTerm> idTerms = messageIds.stream()
.map(MessageIDTerm::new)
.collect(Collectors.toList());
OrTerm searchTerm = new OrTerm(idTerms.toArray(new MessageIDTerm[idTerms.size()]));
return folder.search(searchTerm);
}
开发者ID:camunda,项目名称:camunda-bpm-mail,代码行数:11,代码来源:DeleteMailConnector.java
注:本文中的javax.mail.search.OrTerm类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论