Example usage for javax.mail.search FlagTerm getFlags

List of usage examples for javax.mail.search FlagTerm getFlags

Introduction

In this page you can find the example usage for javax.mail.search FlagTerm getFlags.

Prototype

public Flags getFlags() 

Source Link

Document

Return the Flags to test.

Usage

From source file:org.sourceforge.net.javamail4ews.store.EwsFolder.java

public synchronized Message[] search(SearchTerm paramSearchTerm) throws MessagingException {
    if (paramSearchTerm instanceof FlagTerm) {
        FlagTerm flagTerm = (FlagTerm) paramSearchTerm;
        Flags flags = flagTerm.getFlags();
        if (flags.equals(new Flags(Flags.Flag.SEEN))) {
            try {
                return getUnreadMessage(0);
            } catch (Exception e) {
                throw new MessagingException(e.getMessage(), e);
            }// w w  w .j a va  2s  . c o m
        }
    }
    throw new MessagingException("Ews folder don't support search with search term " + paramSearchTerm);
}