javax.mail.search.OrTerm Java Examples

The following examples show how to use javax.mail.search.OrTerm. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SearchTermBuilder.java    From greenmail with Apache License 2.0 6 votes vote down vote up
private static SearchTermBuilder createTextSearchTermBuilder() {
    return new SearchTermBuilder() {
        @Override
        public SearchTerm build() {
            String query = getParameters().get(0);
            SearchTerm[] terms = {
              new RecipientStringTerm(Message.RecipientType.TO, query),
              new RecipientStringTerm(Message.RecipientType.CC, query),
              new RecipientStringTerm(Message.RecipientType.BCC, query),
              new FromStringTerm(query),
              new SubjectTerm(query),
              new BodyTerm(query)
            };
            return new OrTerm(terms);
        }
    };
}
 
Example #2
Source File: SearchTermBuilder.java    From greenmail with Apache License 2.0 5 votes vote down vote up
private static SearchTermBuilder createORTermBuilder() {
return new SearchTermBuilder() {
         @Override
         public SearchTerm build() {
            return new OrTerm(new SubjectTerm(getParameters().get(0)),new SubjectTerm(getParameters().get(1)));
         }
     };	}
 
Example #3
Source File: DeleteMailConnector.java    From camunda-bpm-mail with Apache License 2.0 3 votes vote down vote up
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);
  }