javax.mail.Message.setFlags()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(8.6k)|赞(0)|评价(0)|浏览(224)

本文整理了Java中javax.mail.Message.setFlags()方法的一些代码示例,展示了Message.setFlags()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Message.setFlags()方法的具体详情如下:
包路径:javax.mail.Message
类名称:Message
方法名:setFlags

Message.setFlags介绍

[英]Set the specified flags on this message to the specified value. Note that any flags in this message that are not specified in the given Flags object are unaffected.

This will result in a MessageChangedEvent being delivered to any MessageChangedListener registered on this Message's containing folder.
[中]将此消息上的指定标志设置为指定值。请注意,此消息中未在给定Flags对象中指定的任何标志均不受影响。
这将导致一个MessageChangedEvent被传递到在该邮件的包含文件夹中注册的任何MessageChangedListener。

代码示例

代码示例来源:origin: oblac/jodd

msg.setFlags(flagsToSet, true);
msg.setFlags(flagsToUnset, false);

代码示例来源:origin: camunda/camunda-bpm-platform

for (int i = 0; i < msgs.length; i++) {
  try {
  msgs[i].setFlags(flag, value);
  } catch (MessageRemovedException me) {

代码示例来源:origin: com.sun.mail/javax.mail

for (int i = 0; i < msgs.length; i++) {
  try {
  msgs[i].setFlags(flag, value);
  } catch (MessageRemovedException me) {

代码示例来源:origin: camunda/camunda-bpm-platform

/**
 * Set the specified flag on this message to the specified value.
 *
 * This will result in a <code>MessageChangedEvent</code> being 
 * delivered to any MessageChangedListener registered on this 
 * Message's containing folder. <p>
 *
 * The default implementation uses the <code>setFlags</code> method.
 *
 * @param flag    Flags.Flag object containing the flag to be set
 * @param set    the value to be set
 * @exception    IllegalWriteException if the underlying 
 *            implementation does not support modification 
 *            of existing values.
 * @exception    IllegalStateException if this message is
 *            obtained from a READ_ONLY folder.
 * @exception       MessagingException for other failures
 * @see        javax.mail.event.MessageChangedEvent
 */
public void setFlag(Flags.Flag flag, boolean set)
      throws MessagingException {
Flags f = new Flags(flag);
setFlags(f, set);
}

代码示例来源:origin: com.sun.mail/javax.mail

/**
 * Set the specified flag on this message to the specified value.
 *
 * This will result in a <code>MessageChangedEvent</code> being 
 * delivered to any MessageChangedListener registered on this 
 * Message's containing folder. <p>
 *
 * The default implementation uses the <code>setFlags</code> method.
 *
 * @param flag    Flags.Flag object containing the flag to be set
 * @param set    the value to be set
 * @exception    IllegalWriteException if the underlying 
 *            implementation does not support modification 
 *            of existing values.
 * @exception    IllegalStateException if this message is
 *            obtained from a READ_ONLY folder.
 * @exception       MessagingException for other failures
 * @see        javax.mail.event.MessageChangedEvent
 */
public void setFlag(Flags.Flag flag, boolean set)
      throws MessagingException {
Flags f = new Flags(flag);
setFlags(f, set);
}

代码示例来源:origin: camunda/camunda-bpm-platform

try {
Message msg = getMessage(msgnums[i]);
msg.setFlags(flag, value);
} catch (MessageRemovedException me) {

代码示例来源:origin: camunda/camunda-bpm-platform

try {
Message msg = getMessage(i);
msg.setFlags(flag, value);
} catch (MessageRemovedException me) {

代码示例来源:origin: com.sun.mail/javax.mail

try {
Message msg = getMessage(msgnums[i]);
msg.setFlags(flag, value);
} catch (MessageRemovedException me) {

代码示例来源:origin: com.sun.mail/javax.mail

try {
Message msg = getMessage(i);
msg.setFlags(flag, value);
} catch (MessageRemovedException me) {

代码示例来源:origin: spring-projects/spring-integration

private void setMessageFlags(Message[] filteredMessages) throws MessagingException {
  boolean recentFlagSupported = false;
  Flags flags = getFolder().getPermanentFlags();
  if (flags != null) {
    recentFlagSupported = flags.contains(Flags.Flag.RECENT);
  }
  for (Message message : filteredMessages) {
    if (!recentFlagSupported) {
      if (flags != null && flags.contains(Flags.Flag.USER)) {
        if (this.logger.isDebugEnabled()) {
          this.logger.debug("USER flags are supported by this mail server. Flagging message with '"
              + this.userFlag + "' user flag");
        }
        Flags siFlags = new Flags();
        siFlags.add(this.userFlag);
        message.setFlags(siFlags, true);
      }
      else {
        this.logger.debug("USER flags are not supported by this mail server. " +
            "Flagging message with system flag");
        message.setFlag(Flags.Flag.FLAGGED, true);
      }
    }
    setAdditionalFlags(message);
  }
}

代码示例来源:origin: org.apache.geronimo.specs/geronimo-javamail_1.4_spec

/**
 * Set flags on the messages to the supplied value; all messages must belong to this folder.
 * This method may be overridden by subclasses that can optimize the setting
 * of flags on multiple messages at once; the default implementation simply calls
 * {@link Message#setFlags(Flags, boolean)} for each supplied messages.
 *
 * @param messages whose flags should be set
 * @param flags    the set of flags to modify
 * @param value    the value the flags should be set to
 * @throws MessagingException if there was a problem accessing the store
 */
public void setFlags(Message[] messages, Flags flags, boolean value) throws MessagingException {
  for (int i = 0; i < messages.length; i++) {
    Message message = messages[i];
    message.setFlags(flags, value);
  }
}

代码示例来源:origin: org.apache.geronimo.specs/geronimo-javamail_1.3.1_spec

/**
 * Set flags on the messages to the supplied value; all messages must belong to this folder.
 * This method may be overridden by subclasses that can optimize the setting
 * of flags on multiple messages at once; the default implementation simply calls
 * {@link Message#setFlags(Flags, boolean)} for each supplied messages.
 *
 * @param messages whose flags should be set
 * @param flags    the set of flags to modify
 * @param value    the value the flags should be set to
 * @throws MessagingException if there was a problem accessing the store
 */
public void setFlags(Message[] messages, Flags flags, boolean value) throws MessagingException {
  for (int i = 0; i < messages.length; i++) {
    Message message = messages[i];
    message.setFlags(flags, value);
  }
}

代码示例来源:origin: org.apache.geronimo.specs/geronimo-javamail_1.4_spec

/**
 * Set a flag to the supplied value.
 * The default implmentation uses {@link #setFlags(Flags, boolean)}.
 *
 * @param flag the flag to set
 * @param set  the value for that flag
 * @throws MessagingException if there was a problem accessing the Store
 */
public void setFlag(Flags.Flag flag, boolean set) throws MessagingException {
  setFlags(new Flags(flag), set);
}

代码示例来源:origin: org.apache.geronimo.specs/geronimo-javamail_1.3.1_spec

/**
 * Set a flag to the supplied value.
 * The default implmentation uses {@link #setFlags(Flags, boolean)}.
 *
 * @param flag the flag to set
 * @param set  the value for that flag
 * @throws MessagingException if there was a problem accessing the store
 */
public void setFlag(Flags.Flag flag, boolean set) throws MessagingException {
  setFlags(new Flags(flag), set);
}

代码示例来源:origin: google/mail-importer

@Override
public void setFlags(Flags flag, boolean set)
  throws RuntimeMessagingException {
 try {
  delegate.setFlags(flag, set);
 } catch (MessagingException e) {
  throw new RuntimeMessagingException(e);
 }
}

代码示例来源:origin: org.apache.geronimo.specs/geronimo-javamail_1.4_spec

/**
 * Set flags on a set of messages to the supplied value.
 * This method may be overridden by subclasses that can optimize the setting
 * of flags on multiple messages at once; the default implementation simply
 * gets each message and then calls {@link Message#setFlags(Flags, boolean)}.
 *
 * @param ids   the indexes of the messages to set
 * @param flags the set of flags end modify
 * @param value the value the flags should be set end
 * @throws MessagingException if there was a problem accessing the store
 */
public void setFlags(int ids[], Flags flags, boolean value) throws MessagingException {
  for (int i = 0; i < ids.length; i++) {
    Message message = getMessage(ids[i]);
    message.setFlags(flags, value);
  }
}

代码示例来源:origin: org.apache.geronimo.specs/geronimo-javamail_1.3.1_spec

/**
 * Set flags on a set of messages to the supplied value.
 * This method may be overridden by subclasses that can optimize the setting
 * of flags on multiple messages at once; the default implementation simply
 * gets each message and then calls {@link Message#setFlags(Flags, boolean)}.
 *
 * @param ids   the indexes of the messages to set
 * @param flags the set of flags end modify
 * @param value the value the flags should be set end
 * @throws MessagingException if there was a problem accessing the store
 */
public void setFlags(int ids[], Flags flags, boolean value) throws MessagingException {
  for (int i = 0; i < ids.length; i++) {
    Message message = getMessage(ids[i]);
    message.setFlags(flags, value);
  }
}

代码示例来源:origin: de.saly/javamail-mock2-fullmock

@Override
public synchronized void setFlags(final Message[] msgs, final Flags flag, final boolean value) throws MessagingException {
  abortIdle();
  checkOpened();
  for (final Message message : msgs) {
    final Message m = mailboxFolder.getById(((MockMessage) message).getMockid());
    if (m != null) {
      m.setFlags(flag, value);
    }
  }
}

代码示例来源:origin: de.saly/javamail-mock2-halfmock

@Override
public synchronized void setFlags(final Message[] msgs, final Flags flag, final boolean value) throws MessagingException {
  abortIdle();
  checkOpened();
  for (final Message message : msgs) {
    final Message m = mailboxFolder.getById(((MockMessage) message).getMockid());
    if (m != null) {
      m.setFlags(flag, value);
    }
  }
}

代码示例来源:origin: salyh/javamail-mock2

@Override
public synchronized void setFlags(final Message[] msgs, final Flags flag, final boolean value) throws MessagingException {
  abortIdle();
  checkOpened();
  for (final Message message : msgs) {
    final Message m = mailboxFolder.getById(((MockMessage) message).getMockid());
    if (m != null) {
      m.setFlags(flag, value);
    }
  }
}

相关文章