This is an automated email from the ASF dual-hosted git repository.

rcordier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git


The following commit(s) were added to refs/heads/master by this push:
     new bf5b333793 JAMES-2586 Move some class related to ACLUpdated event from 
apache-james-mailbox-cassandra -> apache-james-mailbox-event-json
bf5b333793 is described below

commit bf5b3337930839f643aaa852bb7bbc41b3e5f126
Author: Tung Tran <[email protected]>
AuthorDate: Wed Apr 3 17:54:08 2024 +0700

    JAMES-2586 Move some class related to ACLUpdated event from 
apache-james-mailbox-cassandra -> apache-james-mailbox-event-json
    
    - In order to make it more generic, that can re-usable
---
 mailbox/cassandra/pom.xml                          |  4 +++
 .../mailbox/cassandra/mail/CassandraACLMapper.java |  4 +--
 .../mail/eventsourcing/acl/ACLModule.java          |  8 ++++--
 .../mail/eventsourcing/acl/AclV2DAOSubscriber.java |  4 ++-
 .../eventsourcing/acl/DeleteMailboxCommand.java    |  1 +
 .../eventsourcing/acl/MailboxACLAggregate.java     |  2 ++
 .../mail/eventsourcing/acl/SetACLCommand.java      |  1 +
 .../mail/eventsourcing/acl/UpdateACLCommand.java   |  1 +
 .../eventsourcing/acl/UserRightsDAOSubscriber.java |  4 ++-
 .../mail/eventsourcing/acl/ACLUpdatedDTOTest.java  |  2 ++
 mailbox/event/json/pom.xml                         |  4 +++
 .../apache/james/event}/MailboxAggregateId.java    | 21 ++++++++--------
 .../java/org/apache/james/event}/acl/ACLDTO.java   |  2 +-
 .../org/apache/james/event}/acl/ACLDiffDTO.java    |  3 ++-
 .../org/apache/james/event}/acl/ACLUpdated.java    |  7 +++---
 .../org/apache/james/event}/acl/ACLUpdatedDTO.java | 29 ++++++++++------------
 16 files changed, 60 insertions(+), 37 deletions(-)

diff --git a/mailbox/cassandra/pom.xml b/mailbox/cassandra/pom.xml
index 5f76210e69..5ab053841d 100644
--- a/mailbox/cassandra/pom.xml
+++ b/mailbox/cassandra/pom.xml
@@ -52,6 +52,10 @@
             <type>test-jar</type>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>${james.groupId}</groupId>
+            <artifactId>apache-james-mailbox-event-json</artifactId>
+        </dependency>
         <dependency>
             <groupId>${james.groupId}</groupId>
             <artifactId>apache-james-mailbox-store</artifactId>
diff --git 
a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraACLMapper.java
 
b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraACLMapper.java
index b73aa1e79d..d67c21526e 100644
--- 
a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraACLMapper.java
+++ 
b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraACLMapper.java
@@ -25,6 +25,8 @@ import jakarta.inject.Inject;
 
 import org.apache.commons.lang3.NotImplementedException;
 import 
org.apache.james.backends.cassandra.init.configuration.CassandraConfiguration;
+import org.apache.james.event.MailboxAggregateId;
+import org.apache.james.event.acl.ACLUpdated;
 import org.apache.james.eventsourcing.Command;
 import org.apache.james.eventsourcing.CommandHandler;
 import org.apache.james.eventsourcing.EventSourcingSystem;
@@ -32,10 +34,8 @@ import org.apache.james.eventsourcing.Subscriber;
 import org.apache.james.eventsourcing.eventstore.EventStore;
 import org.apache.james.mailbox.acl.ACLDiff;
 import org.apache.james.mailbox.cassandra.ids.CassandraId;
-import org.apache.james.mailbox.cassandra.mail.eventsourcing.acl.ACLUpdated;
 import 
org.apache.james.mailbox.cassandra.mail.eventsourcing.acl.AclV2DAOSubscriber;
 import 
org.apache.james.mailbox.cassandra.mail.eventsourcing.acl.DeleteMailboxCommand;
-import 
org.apache.james.mailbox.cassandra.mail.eventsourcing.acl.MailboxAggregateId;
 import org.apache.james.mailbox.cassandra.mail.eventsourcing.acl.SetACLCommand;
 import 
org.apache.james.mailbox.cassandra.mail.eventsourcing.acl.UpdateACLCommand;
 import 
org.apache.james.mailbox.cassandra.mail.eventsourcing.acl.UserRightsDAOSubscriber;
diff --git 
a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/eventsourcing/acl/ACLModule.java
 
b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/eventsourcing/acl/ACLModule.java
index b932aa0a24..1ff80fb8d8 100644
--- 
a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/eventsourcing/acl/ACLModule.java
+++ 
b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/eventsourcing/acl/ACLModule.java
@@ -19,17 +19,21 @@
 
 package org.apache.james.mailbox.cassandra.mail.eventsourcing.acl;
 
+import org.apache.james.event.acl.ACLUpdated;
+import org.apache.james.event.acl.ACLUpdatedDTO;
 import org.apache.james.eventsourcing.eventstore.dto.EventDTOModule;
 import org.apache.james.json.DTOModule;
+import org.apache.james.mailbox.cassandra.ids.CassandraId;
+import org.apache.james.mailbox.model.MailboxId;
 
 public interface ACLModule {
-
     String UPDATE_TYPE_NAME = "acl-updated";
+    MailboxId.Factory mailboxIdFactory = new CassandraId.Factory();
 
     EventDTOModule<ACLUpdated, ACLUpdatedDTO> ACL_UPDATE =
         new DTOModule.Builder<>(ACLUpdated.class)
             .convertToDTO(ACLUpdatedDTO.class)
-            .toDomainObjectConverter(ACLUpdatedDTO::toEvent)
+            .toDomainObjectConverter(dto -> dto.toEvent(mailboxIdFactory))
             .toDTOConverter(ACLUpdatedDTO::from)
             .typeName(UPDATE_TYPE_NAME)
             .withFactory(EventDTOModule::new);
diff --git 
a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/eventsourcing/acl/AclV2DAOSubscriber.java
 
b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/eventsourcing/acl/AclV2DAOSubscriber.java
index d338858138..e6db566f16 100644
--- 
a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/eventsourcing/acl/AclV2DAOSubscriber.java
+++ 
b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/eventsourcing/acl/AclV2DAOSubscriber.java
@@ -19,9 +19,11 @@
 
 package org.apache.james.mailbox.cassandra.mail.eventsourcing.acl;
 
+import org.apache.james.event.acl.ACLUpdated;
 import org.apache.james.eventsourcing.Event;
 import org.apache.james.eventsourcing.EventWithState;
 import org.apache.james.eventsourcing.ReactiveSubscriber;
+import org.apache.james.mailbox.cassandra.ids.CassandraId;
 import org.apache.james.mailbox.cassandra.mail.CassandraACLDAOV2;
 
 import reactor.core.publisher.Flux;
@@ -43,7 +45,7 @@ public class AclV2DAOSubscriber implements ReactiveSubscriber 
{
             return Flux.fromStream(
                 aclUpdated.getAclDiff()
                     .commands())
-                .flatMap(command -> acldaov2.updateACL(aclUpdated.mailboxId(), 
command))
+                .flatMap(command -> acldaov2.updateACL((CassandraId) 
aclUpdated.mailboxId(), command))
                 .then();
         }
         return Mono.empty();
diff --git 
a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/eventsourcing/acl/DeleteMailboxCommand.java
 
b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/eventsourcing/acl/DeleteMailboxCommand.java
index feec9c4646..32e66de36e 100644
--- 
a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/eventsourcing/acl/DeleteMailboxCommand.java
+++ 
b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/eventsourcing/acl/DeleteMailboxCommand.java
@@ -21,6 +21,7 @@ package 
org.apache.james.mailbox.cassandra.mail.eventsourcing.acl;
 
 import java.util.List;
 
+import org.apache.james.event.MailboxAggregateId;
 import org.apache.james.eventsourcing.Command;
 import org.apache.james.eventsourcing.EventWithState;
 import org.apache.james.eventsourcing.eventstore.EventStore;
diff --git 
a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/eventsourcing/acl/MailboxACLAggregate.java
 
b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/eventsourcing/acl/MailboxACLAggregate.java
index f419455e6b..775853cd8d 100644
--- 
a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/eventsourcing/acl/MailboxACLAggregate.java
+++ 
b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/eventsourcing/acl/MailboxACLAggregate.java
@@ -22,6 +22,8 @@ package 
org.apache.james.mailbox.cassandra.mail.eventsourcing.acl;
 import java.util.List;
 import java.util.Optional;
 
+import org.apache.james.event.MailboxAggregateId;
+import org.apache.james.event.acl.ACLUpdated;
 import org.apache.james.eventsourcing.Event;
 import org.apache.james.eventsourcing.EventWithState;
 import org.apache.james.eventsourcing.eventstore.History;
diff --git 
a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/eventsourcing/acl/SetACLCommand.java
 
b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/eventsourcing/acl/SetACLCommand.java
index a0f44b3659..5f434ef0fa 100644
--- 
a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/eventsourcing/acl/SetACLCommand.java
+++ 
b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/eventsourcing/acl/SetACLCommand.java
@@ -21,6 +21,7 @@ package 
org.apache.james.mailbox.cassandra.mail.eventsourcing.acl;
 
 import java.util.List;
 
+import org.apache.james.event.MailboxAggregateId;
 import org.apache.james.eventsourcing.Command;
 import org.apache.james.eventsourcing.EventWithState;
 import org.apache.james.eventsourcing.eventstore.EventStore;
diff --git 
a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/eventsourcing/acl/UpdateACLCommand.java
 
b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/eventsourcing/acl/UpdateACLCommand.java
index b5222b6729..23b9e04993 100644
--- 
a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/eventsourcing/acl/UpdateACLCommand.java
+++ 
b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/eventsourcing/acl/UpdateACLCommand.java
@@ -21,6 +21,7 @@ package 
org.apache.james.mailbox.cassandra.mail.eventsourcing.acl;
 
 import java.util.List;
 
+import org.apache.james.event.MailboxAggregateId;
 import org.apache.james.eventsourcing.Command;
 import org.apache.james.eventsourcing.EventWithState;
 import org.apache.james.eventsourcing.eventstore.EventStore;
diff --git 
a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/eventsourcing/acl/UserRightsDAOSubscriber.java
 
b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/eventsourcing/acl/UserRightsDAOSubscriber.java
index 1e76ad5e0d..d902c7dd7c 100644
--- 
a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/eventsourcing/acl/UserRightsDAOSubscriber.java
+++ 
b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/eventsourcing/acl/UserRightsDAOSubscriber.java
@@ -19,9 +19,11 @@
 
 package org.apache.james.mailbox.cassandra.mail.eventsourcing.acl;
 
+import org.apache.james.event.acl.ACLUpdated;
 import org.apache.james.eventsourcing.Event;
 import org.apache.james.eventsourcing.EventWithState;
 import org.apache.james.eventsourcing.ReactiveSubscriber;
+import org.apache.james.mailbox.cassandra.ids.CassandraId;
 import org.apache.james.mailbox.cassandra.mail.CassandraUserMailboxRightsDAO;
 import org.reactivestreams.Publisher;
 
@@ -39,7 +41,7 @@ public class UserRightsDAOSubscriber implements 
ReactiveSubscriber {
         Event event = eventWithState.event();
         if (event instanceof ACLUpdated) {
             ACLUpdated aclUpdated = (ACLUpdated) event;
-            return userRightsDAO.update(aclUpdated.mailboxId(), 
aclUpdated.getAclDiff());
+            return userRightsDAO.update((CassandraId) aclUpdated.mailboxId(), 
aclUpdated.getAclDiff());
         }
         return Mono.empty();
     }
diff --git 
a/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/eventsourcing/acl/ACLUpdatedDTOTest.java
 
b/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/eventsourcing/acl/ACLUpdatedDTOTest.java
index 76c1080e9d..badc52a5f3 100644
--- 
a/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/eventsourcing/acl/ACLUpdatedDTOTest.java
+++ 
b/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/eventsourcing/acl/ACLUpdatedDTOTest.java
@@ -20,6 +20,8 @@
 package org.apache.james.mailbox.cassandra.mail.eventsourcing.acl;
 
 import org.apache.james.JsonSerializationVerifier;
+import org.apache.james.event.acl.ACLUpdated;
+import org.apache.james.event.MailboxAggregateId;
 import org.apache.james.eventsourcing.EventId;
 import org.apache.james.mailbox.acl.ACLDiff;
 import org.apache.james.mailbox.cassandra.ids.CassandraId;
diff --git a/mailbox/event/json/pom.xml b/mailbox/event/json/pom.xml
index 6aafd95ac4..d627524e33 100644
--- a/mailbox/event/json/pom.xml
+++ b/mailbox/event/json/pom.xml
@@ -32,6 +32,10 @@
     <description>Apache James Mailbox Event JSON Scala 
Serialization</description>
 
     <dependencies>
+        <dependency>
+            <groupId>${james.groupId}</groupId>
+            <artifactId>event-sourcing-event-store-api</artifactId>
+        </dependency>
         <dependency>
             <groupId>${james.groupId}</groupId>
             <artifactId>testing-base</artifactId>
diff --git 
a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/eventsourcing/acl/MailboxAggregateId.java
 
b/mailbox/event/json/src/main/java/org/apache/james/event/MailboxAggregateId.java
similarity index 77%
rename from 
mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/eventsourcing/acl/MailboxAggregateId.java
rename to 
mailbox/event/json/src/main/java/org/apache/james/event/MailboxAggregateId.java
index 067f9bca0c..be78bf7de1 100644
--- 
a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/eventsourcing/acl/MailboxAggregateId.java
+++ 
b/mailbox/event/json/src/main/java/org/apache/james/event/MailboxAggregateId.java
@@ -17,27 +17,28 @@
  * under the License.                                           *
  ****************************************************************/
 
-package org.apache.james.mailbox.cassandra.mail.eventsourcing.acl;
+package org.apache.james.event;
 
 import java.util.Objects;
 
 import org.apache.james.eventsourcing.AggregateId;
-import org.apache.james.mailbox.cassandra.ids.CassandraId;
+import org.apache.james.mailbox.model.MailboxId;
 
 public class MailboxAggregateId implements AggregateId {
-    private final CassandraId cassandraId;
 
-    public MailboxAggregateId(CassandraId cassandraId) {
-        this.cassandraId = cassandraId;
+    private final MailboxId mailboxId;
+
+    public MailboxAggregateId(MailboxId mailboxId) {
+        this.mailboxId = mailboxId;
     }
 
-    public CassandraId asMailboxId() {
-        return cassandraId;
+    public MailboxId asMailboxId() {
+        return mailboxId;
     }
 
     @Override
     public String asAggregateKey() {
-        return cassandraId.serialize();
+        return mailboxId.serialize();
     }
 
     @Override
@@ -45,13 +46,13 @@ public class MailboxAggregateId implements AggregateId {
         if (o instanceof MailboxAggregateId) {
             MailboxAggregateId that = (MailboxAggregateId) o;
 
-            return Objects.equals(this.cassandraId, that.cassandraId);
+            return Objects.equals(this.mailboxId, that.mailboxId);
         }
         return false;
     }
 
     @Override
     public final int hashCode() {
-        return Objects.hash(cassandraId);
+        return Objects.hash(mailboxId);
     }
 }
diff --git 
a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/eventsourcing/acl/ACLDTO.java
 b/mailbox/event/json/src/main/java/org/apache/james/event/acl/ACLDTO.java
similarity index 97%
rename from 
mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/eventsourcing/acl/ACLDTO.java
rename to 
mailbox/event/json/src/main/java/org/apache/james/event/acl/ACLDTO.java
index 05a5bf78d2..81122bdb4e 100644
--- 
a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/eventsourcing/acl/ACLDTO.java
+++ b/mailbox/event/json/src/main/java/org/apache/james/event/acl/ACLDTO.java
@@ -17,7 +17,7 @@
  * under the License.                                           *
  ****************************************************************/
 
-package org.apache.james.mailbox.cassandra.mail.eventsourcing.acl;
+package org.apache.james.event.acl;
 
 import java.util.Map;
 import java.util.Objects;
diff --git 
a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/eventsourcing/acl/ACLDiffDTO.java
 b/mailbox/event/json/src/main/java/org/apache/james/event/acl/ACLDiffDTO.java
similarity index 97%
rename from 
mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/eventsourcing/acl/ACLDiffDTO.java
rename to 
mailbox/event/json/src/main/java/org/apache/james/event/acl/ACLDiffDTO.java
index 9b72e1d60d..7cf2cd7d1a 100644
--- 
a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/eventsourcing/acl/ACLDiffDTO.java
+++ 
b/mailbox/event/json/src/main/java/org/apache/james/event/acl/ACLDiffDTO.java
@@ -17,7 +17,8 @@
  * under the License.                                           *
  ****************************************************************/
 
-package org.apache.james.mailbox.cassandra.mail.eventsourcing.acl;
+package org.apache.james.event.acl;
+
 
 import java.util.Objects;
 
diff --git 
a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/eventsourcing/acl/ACLUpdated.java
 b/mailbox/event/json/src/main/java/org/apache/james/event/acl/ACLUpdated.java
similarity index 93%
rename from 
mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/eventsourcing/acl/ACLUpdated.java
rename to 
mailbox/event/json/src/main/java/org/apache/james/event/acl/ACLUpdated.java
index 048b8b70b5..749aec1665 100644
--- 
a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/eventsourcing/acl/ACLUpdated.java
+++ 
b/mailbox/event/json/src/main/java/org/apache/james/event/acl/ACLUpdated.java
@@ -17,15 +17,16 @@
  * under the License.                                           *
  ****************************************************************/
 
-package org.apache.james.mailbox.cassandra.mail.eventsourcing.acl;
+package org.apache.james.event.acl;
 
 import java.util.Objects;
 
+import org.apache.james.event.MailboxAggregateId;
 import org.apache.james.eventsourcing.AggregateId;
 import org.apache.james.eventsourcing.Event;
 import org.apache.james.eventsourcing.EventId;
 import org.apache.james.mailbox.acl.ACLDiff;
-import org.apache.james.mailbox.cassandra.ids.CassandraId;
+import org.apache.james.mailbox.model.MailboxId;
 
 public class ACLUpdated implements Event {
     private final MailboxAggregateId id;
@@ -38,7 +39,7 @@ public class ACLUpdated implements Event {
         this.aclDiff = aclDiff;
     }
 
-    public CassandraId mailboxId() {
+    public MailboxId mailboxId() {
         return id.asMailboxId();
     }
 
diff --git 
a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/eventsourcing/acl/ACLUpdatedDTO.java
 
b/mailbox/event/json/src/main/java/org/apache/james/event/acl/ACLUpdatedDTO.java
similarity index 81%
rename from 
mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/eventsourcing/acl/ACLUpdatedDTO.java
rename to 
mailbox/event/json/src/main/java/org/apache/james/event/acl/ACLUpdatedDTO.java
index 5cf72d169e..e0b9225daa 100644
--- 
a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/eventsourcing/acl/ACLUpdatedDTO.java
+++ 
b/mailbox/event/json/src/main/java/org/apache/james/event/acl/ACLUpdatedDTO.java
@@ -7,7 +7,7 @@
  * "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                   *
+ *   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  *
@@ -15,35 +15,32 @@
  * KIND, either express or implied.  See the License for the    *
  * specific language governing permissions and limitations      *
  * under the License.                                           *
- ***************************************************************/
+ ****************************************************************/
 
-package org.apache.james.mailbox.cassandra.mail.eventsourcing.acl;
+package org.apache.james.event.acl;
 
 import java.util.Objects;
 
+import org.apache.james.event.MailboxAggregateId;
 import org.apache.james.eventsourcing.EventId;
 import org.apache.james.eventsourcing.eventstore.dto.EventDTO;
-import org.apache.james.mailbox.cassandra.ids.CassandraId;
+import org.apache.james.mailbox.model.MailboxId;
 
 import com.fasterxml.jackson.annotation.JsonCreator;
 import com.fasterxml.jackson.annotation.JsonIgnore;
 import com.fasterxml.jackson.annotation.JsonProperty;
 import com.google.common.base.Preconditions;
 
-class ACLUpdatedDTO implements EventDTO {
+public class ACLUpdatedDTO implements EventDTO {
 
-    static ACLUpdatedDTO from(ACLUpdated event, String type) {
+    public static ACLUpdatedDTO from(ACLUpdated event, String type) {
         Preconditions.checkNotNull(event);
 
         return new ACLUpdatedDTO(
-                event.eventId().serialize(),
-                event.getAggregateId().asAggregateKey(),
-                type,
-                ACLDiffDTO.fromACLDiff(event.getAclDiff()));
-    }
-
-    static ACLUpdatedDTO from(ACLUpdated event) {
-        return from(event, ACLModule.UPDATE_TYPE_NAME);
+            event.eventId().serialize(),
+            event.getAggregateId().asAggregateKey(),
+            type,
+            ACLDiffDTO.fromACLDiff(event.getAclDiff()));
     }
 
     private final int eventId;
@@ -63,9 +60,9 @@ class ACLUpdatedDTO implements EventDTO {
     }
 
     @JsonIgnore
-    public ACLUpdated toEvent() {
+    public ACLUpdated toEvent(MailboxId.Factory mailboxIdFactory) {
         return new ACLUpdated(
-            new MailboxAggregateId(CassandraId.of(aggregateKey)),
+            new MailboxAggregateId(mailboxIdFactory.fromString(aggregateKey)),
             EventId.fromSerialized(eventId),
             aclDiff.asACLDiff());
     }


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

Reply via email to