JAMES-2342 Move MessageMoves to mailbox-api

Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/a986c5eb
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/a986c5eb
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/a986c5eb

Branch: refs/heads/master
Commit: a986c5eb20e6fc54cc2992fe21b5d98252223126
Parents: da4b71a
Author: Antoine Duprat <[email protected]>
Authored: Tue Mar 6 12:04:04 2018 +0100
Committer: Antoine Duprat <[email protected]>
Committed: Thu Mar 8 11:01:22 2018 +0100

----------------------------------------------------------------------
 .../james/mailbox/model/MessageMoves.java       | 47 ++++++++++++++++++++
 .../mailbox/store/StoreMessageIdManager.java    | 24 +---------
 2 files changed, 48 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/a986c5eb/mailbox/api/src/main/java/org/apache/james/mailbox/model/MessageMoves.java
----------------------------------------------------------------------
diff --git 
a/mailbox/api/src/main/java/org/apache/james/mailbox/model/MessageMoves.java 
b/mailbox/api/src/main/java/org/apache/james/mailbox/model/MessageMoves.java
new file mode 100644
index 0000000..db67afc
--- /dev/null
+++ b/mailbox/api/src/main/java/org/apache/james/mailbox/model/MessageMoves.java
@@ -0,0 +1,47 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+package org.apache.james.mailbox.model;
+
+import java.util.Collection;
+import java.util.Set;
+
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Sets;
+
+public class MessageMoves {
+    private final ImmutableSet<MailboxId> previousMailboxIds;
+    private final ImmutableSet<MailboxId> targetMailboxIds;
+
+    public MessageMoves(Collection<MailboxId> previousMailboxIds, 
Collection<MailboxId> targetMailboxIds) {
+        this.previousMailboxIds = ImmutableSet.copyOf(previousMailboxIds);
+        this.targetMailboxIds = ImmutableSet.copyOf(targetMailboxIds);
+    }
+
+    public boolean isChange() {
+        return !previousMailboxIds.equals(targetMailboxIds);
+    }
+
+    public Set<MailboxId> addedMailboxIds() {
+        return Sets.difference(targetMailboxIds, previousMailboxIds);
+    }
+
+    public Set<MailboxId> removedMailboxIds() {
+        return Sets.difference(previousMailboxIds, targetMailboxIds);
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/james-project/blob/a986c5eb/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMessageIdManager.java
----------------------------------------------------------------------
diff --git 
a/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMessageIdManager.java
 
b/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMessageIdManager.java
index fb8b45f..4b00807 100644
--- 
a/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMessageIdManager.java
+++ 
b/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMessageIdManager.java
@@ -44,6 +44,7 @@ import org.apache.james.mailbox.model.MailboxId;
 import org.apache.james.mailbox.model.MessageAttachment;
 import org.apache.james.mailbox.model.MessageId;
 import org.apache.james.mailbox.model.MessageMetaData;
+import org.apache.james.mailbox.model.MessageMoves;
 import org.apache.james.mailbox.model.MessageResult;
 import org.apache.james.mailbox.model.QuotaRoot;
 import org.apache.james.mailbox.model.UpdatedFlags;
@@ -68,32 +69,9 @@ import com.github.fge.lambdas.functions.ThrowingFunction;
 import com.github.steveash.guavate.Guavate;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Sets;
 
 public class StoreMessageIdManager implements MessageIdManager {
 
-    public static class MessageMoves {
-        private final ImmutableSet<MailboxId> previousMailboxIds;
-        private final ImmutableSet<MailboxId> targetMailboxIds;
-
-        public MessageMoves(Collection<MailboxId> previousMailboxIds, 
Collection<MailboxId> targetMailboxIds) {
-            this.previousMailboxIds = ImmutableSet.copyOf(previousMailboxIds);
-            this.targetMailboxIds = ImmutableSet.copyOf(targetMailboxIds);
-        }
-
-        public boolean isChange() {
-            return !previousMailboxIds.equals(targetMailboxIds);
-        }
-
-        public Set<MailboxId> addedMailboxIds() {
-            return Sets.difference(targetMailboxIds, previousMailboxIds);
-        }
-
-        public Set<MailboxId> removedMailboxIds() {
-            return Sets.difference(previousMailboxIds, targetMailboxIds);
-        }
-    }
-
     private static class MetadataWithMailboxId {
         private final MessageMetaData messageMetaData;
         private final MailboxId mailboxId;


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to