javax.mail.Flags.getUserFlags()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(7.3k)|赞(0)|评价(0)|浏览(127)

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

Flags.getUserFlags介绍

[英]Return all the user flags in this Flags object. Returns an array of size zero if no flags are set.
[中]返回此flags对象中的所有用户标志。如果未设置任何标志,则返回大小为零的数组。

代码示例

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

String[] uf = flags.getUserFlags(); // get the user flag strings
for (int i = 0; i < uf.length; i++) {
  if (first)

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

String[] uf = flags.getUserFlags(); // get the user flag strings
for (int i = 0; i < uf.length; i++) {
  if (first)

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

String[] s = flags.getUserFlags();

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

String[] s = flags.getUserFlags();

代码示例来源:origin: org.mnode.mstor/mstor

public final boolean contains(final Object tag) {
  if (tag instanceof String) {
    String flag = TAG_PREFIX + tag;
    String[] userFlags = flags.getUserFlags();
    for (String userFlag : userFlags) {
      if (userFlag.equals(flag)) {
        return true;
      }
    }
  }
  return false;
}

代码示例来源:origin: org.mnode.mstor/mstor

public final int size() {
  int tagCount = 0;
  String[] userFlags = flags.getUserFlags();
  for (String userFlag : userFlags) {
    if (userFlag.startsWith(TAG_PREFIX)) {
      tagCount++;
    }
  }
  return tagCount;
}

代码示例来源:origin: org.apache.james/apache-james-mailbox-elasticsearch

@JsonProperty(JsonMessageConstants.USER_FLAGS)
public String[] getUserFlags() {
  return flags.getUserFlags();
}

代码示例来源:origin: apache/james-project

/**
 * Gets an iterator for the users flags changed.
 * 
 * @return <code>String</code> <code>Iterator</code>, not null
 */
public Iterator<String> userFlagIterator() {
  return Arrays.asList(modifiedFlags.getUserFlags()).iterator();
}

代码示例来源:origin: org.mnode.mstor/mstor

/**
 * @return
 */
private Set<String> getTagSet() {
  Set<String> tags = new HashSet<String>();
  String[] userFlags = flags.getUserFlags();
  for (String userFlag : userFlags) {
    if (userFlag.startsWith(TAG_PREFIX)) {
      tags.add(userFlag.split(TAG_PREFIX)[1]);
    }
  }
  return tags;
}

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

protected Argument flag(FlagTerm term) throws SearchException {
boolean set = term.getTestSet();
Argument result = new Argument();
Flags flags = term.getFlags();
Flags.Flag[] sf = flags.getSystemFlags();
String[] uf = flags.getUserFlags();
if (sf.length == 0 && uf.length == 0)
  throw new SearchException("Invalid FlagTerm");
for (int i = 0; i < sf.length; i++) {
  if (sf[i] == Flags.Flag.DELETED)
  result.writeAtom(set ? "DELETED": "UNDELETED");
  else if (sf[i] == Flags.Flag.ANSWERED)
  result.writeAtom(set ? "ANSWERED": "UNANSWERED");
  else if (sf[i] == Flags.Flag.DRAFT)
  result.writeAtom(set ? "DRAFT": "UNDRAFT");
  else if (sf[i] == Flags.Flag.FLAGGED)
  result.writeAtom(set ? "FLAGGED": "UNFLAGGED");
  else if (sf[i] == Flags.Flag.RECENT)
  result.writeAtom(set ? "RECENT": "OLD");
  else if (sf[i] == Flags.Flag.SEEN)
  result.writeAtom(set ? "SEEN": "UNSEEN");
}
for (int i = 0; i < uf.length; i++) {
  result.writeAtom(set ? "KEYWORD" : "UNKEYWORD");
  result.writeAtom(uf[i]);
}

return result;
}

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

protected Argument flag(FlagTerm term) throws SearchException {
boolean set = term.getTestSet();
Argument result = new Argument();
Flags flags = term.getFlags();
Flags.Flag[] sf = flags.getSystemFlags();
String[] uf = flags.getUserFlags();
if (sf.length == 0 && uf.length == 0)
  throw new SearchException("Invalid FlagTerm");
for (int i = 0; i < sf.length; i++) {
  if (sf[i] == Flags.Flag.DELETED)
  result.writeAtom(set ? "DELETED": "UNDELETED");
  else if (sf[i] == Flags.Flag.ANSWERED)
  result.writeAtom(set ? "ANSWERED": "UNANSWERED");
  else if (sf[i] == Flags.Flag.DRAFT)
  result.writeAtom(set ? "DRAFT": "UNDRAFT");
  else if (sf[i] == Flags.Flag.FLAGGED)
  result.writeAtom(set ? "FLAGGED": "UNFLAGGED");
  else if (sf[i] == Flags.Flag.RECENT)
  result.writeAtom(set ? "RECENT": "OLD");
  else if (sf[i] == Flags.Flag.SEEN)
  result.writeAtom(set ? "SEEN": "UNSEEN");
}
for (int i = 0; i < uf.length; i++) {
  result.writeAtom(set ? "KEYWORD" : "UNKEYWORD");
  result.writeAtom(uf[i]);
}

return result;
}

代码示例来源:origin: apache/james-project

public boolean flagsChanged() {
  if (modifiedFlags.getSystemFlags().length > 0 || modifiedFlags.getUserFlags().length > 0) {
    return true;
  } else {
    return false;
  }
}

代码示例来源:origin: apache/james-project

private static void addModifiedUserFlags(Flags oldFlags, Flags newFlags, Flags modifiedFlags) {
  addModifiedUserFlags(oldFlags, newFlags, oldFlags.getUserFlags(), modifiedFlags);
  addModifiedUserFlags(oldFlags, newFlags, newFlags.getUserFlags(), modifiedFlags);
}

代码示例来源:origin: org.mnode.mstor/mstor

/**
 * {@inheritDoc}
 */
public void setFlags(Flags flags) {
  this.flags.clear();
  for (Flag flag : flags.getSystemFlags()) {
    this.flags.add(getFlagName(flag));
  }
  Collections.addAll(this.flags, flags.getUserFlags());
}

代码示例来源:origin: org.apache.james/james-server-jmap

public Keywords fromFlags(Flags flags) {
  return fromSet(Stream.concat(
        Stream.of(flags.getUserFlags())
          .flatMap(this::asKeyword),
        Stream.of(flags.getSystemFlags())
          .map(Keyword::fromFlag))
      .collect(Guavate.toImmutableSet()));
}

代码示例来源:origin: apache/james-project

public static boolean flagsChanged(Flags flagsOld, Flags flagsNew) {
  Flags modifiedFlags = new Flags();
  addModifiedSystemFlags(flagsOld, flagsNew, modifiedFlags);
  addModifiedUserFlags(flagsOld, flagsNew, modifiedFlags);
  if (modifiedFlags.getSystemFlags().length > 0 || modifiedFlags.getUserFlags().length > 0) {
    return true;
  } else {
    return false;
  }
}

代码示例来源:origin: org.apache.james/apache-james-mailbox-cassandra

public CompletableFuture<Void> updateIndexOnAdd(MailboxMessage message, CassandraId mailboxId) {
  Flags flags = message.createFlags();
  return CompletableFuture.allOf(
    checkDeletedOnAdd(mailboxId, message.createFlags(), message.getUid()),
    updateFirstUnseenOnAdd(mailboxId, message.createFlags(), message.getUid()),
    addRecentOnSave(mailboxId, message),
    incrementUnseenOnSave(mailboxId, flags),
    mailboxCounterDAO.incrementCount(mailboxId),
    applicableFlagDAO.updateApplicableFlags(mailboxId, ImmutableSet.copyOf(flags.getUserFlags())));
}

代码示例来源:origin: org.apache.james/apache-james-mailbox-store

public FlagsDataTransferObject(Flags flags) {
  this.answered = flags.contains(Flags.Flag.ANSWERED);
  this.flagged = flags.contains(Flags.Flag.FLAGGED);
  this.recent = flags.contains(Flags.Flag.RECENT);
  this.deleted = flags.contains(Flags.Flag.DELETED);
  this.draft = flags.contains(Flags.Flag.DRAFT);
  this.seen = flags.contains(Flags.Flag.SEEN);
  this.userFlags = flags.getUserFlags();
}

代码示例来源:origin: org.apache.james/apache-james-mailbox-store

@Override
public synchronized void setFlags(Flags flags) {
  answered = flags.contains(Flags.Flag.ANSWERED);
  deleted = flags.contains(Flags.Flag.DELETED);
  draft = flags.contains(Flags.Flag.DRAFT);
  flagged = flags.contains(Flags.Flag.FLAGGED);
  recent = flags.contains(Flags.Flag.RECENT);
  seen = flags.contains(Flags.Flag.SEEN);
  userFlags = flags.getUserFlags();
}

代码示例来源:origin: org.apache.james/james-server-jmap

@Test
public void applyStateShouldReturnFlagsWithUserFlagStringWhenKeywordsContainForwarded() {
  ImmutableMap<String, Boolean> keywords = ImmutableMap.of(
      "$Answered", Keyword.FLAG_VALUE,
      FORWARDED, Keyword.FLAG_VALUE);
  UpdateMessagePatch testee = UpdateMessagePatch.builder()
    .keywords(keywords)
    .build();
  Flags isSeen = new Flags(Flags.Flag.SEEN);
  assertThat(testee.applyToState(isSeen).getUserFlags())
    .containsExactly(FORWARDED);
}

相关文章