Tabnine Logo
MessageMoves.addedMailboxIds
Code IndexAdd Tabnine to your IDE (free)

How to use
addedMailboxIds
method
in
org.apache.james.mailbox.model.MessageMoves

Best Java code snippets using org.apache.james.mailbox.model.MessageMoves.addedMailboxIds (Showing top 7 results out of 315)

origin: org.apache.james/apache-james-mailbox-store

public boolean isMoveTo(MailboxId mailboxId) {
  return messageMoves.addedMailboxIds()
      .contains(mailboxId);
}
origin: apache/james-project

public boolean isMoveTo(MailboxId mailboxId) {
  return messageMoves.addedMailboxIds()
      .contains(mailboxId);
}
origin: apache/james-project

public Stream<MailboxId> impactedMailboxIds() {
  return Stream.concat(
    addedMailboxIds().stream(),
    removedMailboxIds().stream());
}
origin: org.apache.james/apache-james-mailbox-store

private Map<QuotaRoot, Integer> buildMapQuotaRoot(MessageMoves messageMoves, MailboxMapper mailboxMapper) throws MailboxException {
  Map<QuotaRoot, Integer> messageCountByQuotaRoot = new HashMap<>();
  for (MailboxId mailboxId : messageMoves.addedMailboxIds()) {
    QuotaRoot quotaRoot = retrieveQuotaRoot(mailboxMapper, mailboxId);
    int currentCount = Optional.ofNullable(messageCountByQuotaRoot.get(quotaRoot))
      .orElse(0);
    messageCountByQuotaRoot.put(quotaRoot, currentCount + 1);
  }
  for (MailboxId mailboxId : messageMoves.removedMailboxIds()) {
    QuotaRoot quotaRoot = retrieveQuotaRoot(mailboxMapper, mailboxId);
    int currentCount = Optional.ofNullable(messageCountByQuotaRoot.get(quotaRoot))
      .orElse(0);
    messageCountByQuotaRoot.put(quotaRoot, currentCount - 1);
  }
  return messageCountByQuotaRoot;
}
origin: org.apache.james/apache-james-mailbox-store

private void applyMessageMoveNoMailboxChecks(MailboxSession mailboxSession, List<MailboxMessage> currentMailboxMessages, MessageMoves messageMoves) throws MailboxException {
  MailboxMessage mailboxMessage = currentMailboxMessages.stream().findAny().orElseThrow(() -> new MailboxNotFoundException("can't load message"));
  validateQuota(messageMoves, mailboxSession, mailboxMessage);
  addMessageToMailboxes(mailboxMessage, messageMoves.addedMailboxIds(), mailboxSession);
  removeMessageFromMailboxes(mailboxMessage, messageMoves.removedMailboxIds(), mailboxSession);
  dispatcher.moved(mailboxSession, messageMoves, ImmutableMap.of(mailboxMessage.getUid(), mailboxMessage));
}
origin: org.apache.james/james-server-jmap

private void assertValidUpdate(List<MessageResult> messagesToBeUpdated, UpdateMessagePatch updateMessagePatch, MailboxSession session) throws MailboxException {
  List<MailboxId> outboxMailboxes = mailboxIdFor(Role.OUTBOX, session);
  ImmutableList<MailboxId> previousMailboxes = messagesToBeUpdated.stream()
    .map(MessageResult::getMailboxId)
    .collect(Guavate.toImmutableList());
  List<MailboxId> targetMailboxes = getTargetedMailboxes(previousMailboxes, updateMessagePatch);
  boolean isDraft = messagesToBeUpdated.stream()
    .map(MessageResult::getFlags)
    .map(Keywords.factory().filterImapNonExposedKeywords()::fromFlags)
    .reduce(new KeywordsCombiner())
    .orElse(Keywords.DEFAULT_VALUE)
    .contains(Keyword.DRAFT);
  MessageMoves messageMoves = MessageMoves.builder()
    .previousMailboxIds(previousMailboxes)
    .targetMailboxIds(targetMailboxes)
    .build();
  boolean targetContainsOutbox = messageMoves.addedMailboxIds().stream().anyMatch(outboxMailboxes::contains);
  boolean targetIsOnlyOutbox = targetMailboxes.stream().allMatch(outboxMailboxes::contains);
  assertOutboxMoveTargetsOnlyOutBox(targetContainsOutbox, targetIsOnlyOutbox);
  assertOutboxMoveOriginallyHasDraftKeywordSet(targetContainsOutbox, isDraft);
}
origin: org.apache.james/apache-james-mailbox-store

private void applyMessageMoves(MailboxSession mailboxSession, List<MailboxMessage> currentMailboxMessages, MessageMoves messageMoves) throws MailboxException {
  assertRightsOnMailboxes(messageMoves.addedMailboxIds(), mailboxSession, Right.Insert);
  assertRightsOnMailboxes(messageMoves.removedMailboxIds(), mailboxSession, Right.DeleteMessages);
  applyMessageMoveNoMailboxChecks(mailboxSession, currentMailboxMessages, messageMoves);
}
org.apache.james.mailbox.modelMessageMovesaddedMailboxIds

Popular methods of MessageMoves

  • builder
  • removedMailboxIds
  • <init>
  • isChange

Popular in Java

  • Making http requests using okhttp
  • onCreateOptionsMenu (Activity)
  • setContentView (Activity)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • BufferedImage (java.awt.image)
    The BufferedImage subclass describes an java.awt.Image with an accessible buffer of image data. All
  • BufferedWriter (java.io)
    Wraps an existing Writer and buffers the output. Expensive interaction with the underlying reader is
  • Charset (java.nio.charset)
    A charset is a named mapping between Unicode characters and byte sequences. Every Charset can decode
  • NoSuchElementException (java.util)
    Thrown when trying to retrieve an element past the end of an Enumeration or Iterator.
  • SortedMap (java.util)
    A map that has its keys ordered. The sorting is according to either the natural ordering of its keys
  • Stream (java.util.stream)
    A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now