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

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

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

Flags.getSystemFlags介绍

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

代码示例

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

sb.append("("); // start of flag_list
Flags.Flag[] sf = flags.getSystemFlags(); // get the system flags
boolean first = true;
for (int i = 0; i < sf.length; i++) {

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

StringBuilder sb = new StringBuilder("("); // start of flag_list
Flags.Flag[] sf = flags.getSystemFlags(); // get the system flags
boolean first = true;
for (int i = 0; i < sf.length; i++) {

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

Flags.Flag[] sf = flags.getSystemFlags();

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

Flags.Flag[] sf = flags.getSystemFlags();

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

/**
 * Gets the flag filtered on.
 * 
 * @return the flag, not null
 */
public Flag getFlag() {
  // safe because the Flags(Flag) does system flags, 
  // and James code also constructs FlagCriterion only with system flags
  return flag.getSystemFlags()[0];
}

代码示例来源:origin: org.apache.james.protocols/protocols-imap

public static final HumanReadableText permanentFlags(Flags flags) {
  String text;
  if (flags.getSystemFlags() != null && flags.getSystemFlags().length > 0) {
    text = "Limited";
  } else {
    text = "No permanent flags permitted";
  }
  return new HumanReadableText("org.apache.james.imap.PERMANENT_FLAGS", text);
}

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

/**
 * Gets an iterator for the system flags changed.
 * 
 * @return <code>Flags.Flag</code> <code>Iterator</code>, not null
 */
public Iterator<Flags.Flag> systemFlagIterator() {
  return Arrays.asList(modifiedFlags.getSystemFlags()).iterator();
}

代码示例来源:origin: org.apache.james/apache-james-imap-api

public static final HumanReadableText permanentFlags(Flags flags) {
  String text;
  if (flags.getSystemFlags() != null && flags.getSystemFlags().length > 0) {
    text = "Limited";
  } else {
    text = "No permanent flags permitted";
  }
  return new HumanReadableText("org.apache.james.imap.PERMANENT_FLAGS", text);
}

代码示例来源: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: 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/james-server-jmap

@Test
public void applyStateShouldReturnNewFlagsWhenKeywords() {
  ImmutableMap<String, Boolean> keywords = ImmutableMap.of(
      "$Answered", true,
      "$Flagged", true);
  UpdateMessagePatch testee = UpdateMessagePatch.builder()
    .keywords(keywords)
    .build();
  Flags isSeen = new Flags(Flags.Flag.SEEN);
  assertThat(testee.applyToState(isSeen).getSystemFlags())
    .containsExactly(Flags.Flag.ANSWERED, Flags.Flag.FLAGGED);
}

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

@Test
public void applyStateShouldReturnFlagsWithDeletedFlagWhenKeywordsDoNotContainDeletedButOriginFlagsHaveDeleted() {
  ImmutableMap<String, Boolean> keywords = ImmutableMap.of(
      "$Answered", Keyword.FLAG_VALUE);
  UpdateMessagePatch testee = UpdateMessagePatch.builder()
    .keywords(keywords)
    .build();
  Flags isSeen = new Flags(Flags.Flag.DELETED);
  assertThat(testee.applyToState(isSeen).getSystemFlags())
    .containsOnly(Flags.Flag.DELETED, Flags.Flag.ANSWERED);
}

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

@Test
public void applyStateShouldReturnRemoveFlagsWhenKeywords() {
  UpdateMessagePatch testee = UpdateMessagePatch.builder()
    .keywords(ImmutableMap.of())
    .build();
  Flags isSeen = new Flags(Flags.Flag.SEEN);
  assertThat(testee.applyToState(isSeen).getSystemFlags()).isEmpty();
}

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

@Test
public void applyStateShouldReturnFlagsWithoutUserFlagWhenKeywordsContainForwarded() {
  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).getSystemFlags())
    .doesNotContain(Flags.Flag.USER);
}

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

@Test
public void applyToStateShouldResetSpecifiedOldKeywords() {
  UpdateMessagePatch testee = UpdateMessagePatch.builder()
    .isAnswered(false)
    .build();
  Flags isSeen = new Flags(Flags.Flag.ANSWERED);
  assertThat(testee.applyToState(isSeen).getSystemFlags())
    .containsExactly();
}

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

@Test
public void applyToStateShouldNotResetSystemFlagsWhenUsingOldKeywords() {
  UpdateMessagePatch testee = UpdateMessagePatch.builder()
    .isAnswered(true)
    .build();
  Flags isSeen = new Flags(Flags.Flag.SEEN);
  assertThat(testee.applyToState(isSeen).getSystemFlags())
    .containsExactly(Flags.Flag.ANSWERED, Flags.Flag.SEEN);
}

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

@Test
public void applyToStateShouldNotModifySpecifiedOldKeywordsWhenAlreadySet() {
  UpdateMessagePatch testee = UpdateMessagePatch.builder()
    .isAnswered(true)
    .build();
  Flags isSeen = new Flags(Flags.Flag.ANSWERED);
  assertThat(testee.applyToState(isSeen).getSystemFlags())
    .containsExactly(Flags.Flag.ANSWERED);
}

相关文章