You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by bt...@apache.org on 2019/01/08 08:00:45 UTC
[26/47] james-project git commit: MAILBOX-364 EventFactory should
expose a builder for MailboxAclUpdated event
MAILBOX-364 EventFactory should expose a builder for MailboxAclUpdated event
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/098dbe44
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/098dbe44
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/098dbe44
Branch: refs/heads/master
Commit: 098dbe44341d4d34099d1dd33dc6962a6ecb564e
Parents: 2c46d62
Author: Benoit Tellier <bt...@linagora.com>
Authored: Wed Dec 19 13:46:24 2018 +0700
Committer: Benoit Tellier <bt...@linagora.com>
Committed: Tue Jan 8 14:40:28 2019 +0700
----------------------------------------------------------------------
.../james/mailbox/store/event/EventFactory.java | 34 ++++++++++++++++----
.../store/event/MailboxEventDispatcher.java | 7 +++-
2 files changed, 34 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/james-project/blob/098dbe44/mailbox/store/src/main/java/org/apache/james/mailbox/store/event/EventFactory.java
----------------------------------------------------------------------
diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/event/EventFactory.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/event/EventFactory.java
index 0205560..de9ed6e 100644
--- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/event/EventFactory.java
+++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/event/EventFactory.java
@@ -168,6 +168,32 @@ public class EventFactory {
}
}
+ public static class MailboxAclUpdatedBuilder extends MailboxEventBuilder<MailboxAclUpdatedBuilder> {
+ private ACLDiff aclDiff;
+
+ public MailboxAclUpdatedBuilder aclDiff(ACLDiff aclDiff) {
+ this.aclDiff = aclDiff;
+ return this;
+ }
+
+ @Override
+ protected MailboxAclUpdatedBuilder backReference() {
+ return this;
+ }
+
+ public MailboxListener.MailboxACLUpdated build() {
+ Preconditions.checkState(aclDiff != null, "Field `aclDiff` is compulsory");
+ mailboxEventChecks();
+
+ return new MailboxListener.MailboxACLUpdated(
+ sessionId,
+ user,
+ path,
+ aclDiff,
+ mailboxId);
+ }
+ }
+
public static class MailboxAddedBuilder extends MailboxEventBuilder<MailboxAddedBuilder> {
@Override
protected MailboxAddedBuilder backReference() {
@@ -275,12 +301,8 @@ public class EventFactory {
return new MailboxAddedBuilder();
}
- public MailboxListener.MailboxACLUpdated aclUpdated(MailboxSession session, MailboxPath mailboxPath, ACLDiff aclDiff, MailboxId mailboxId) {
- return aclUpdated(session.getSessionId(), session.getUser(), mailboxPath, aclDiff, mailboxId);
- }
-
- public MailboxListener.MailboxACLUpdated aclUpdated(MailboxSession.SessionId sessionId, User user, MailboxPath mailboxPath, ACLDiff aclDiff, MailboxId mailboxId) {
- return new MailboxListener.MailboxACLUpdated(sessionId, user, mailboxPath, aclDiff, mailboxId);
+ public MailboxAclUpdatedBuilder aclUpdated() {
+ return new MailboxAclUpdatedBuilder();
}
public MessageMoveEvent moved(MailboxSession session, MessageMoves messageMoves, Collection<MessageId> messageIds) {
http://git-wip-us.apache.org/repos/asf/james-project/blob/098dbe44/mailbox/store/src/main/java/org/apache/james/mailbox/store/event/MailboxEventDispatcher.java
----------------------------------------------------------------------
diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/event/MailboxEventDispatcher.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/event/MailboxEventDispatcher.java
index 122394f..da360d5 100644
--- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/event/MailboxEventDispatcher.java
+++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/event/MailboxEventDispatcher.java
@@ -178,7 +178,12 @@ public class MailboxEventDispatcher {
}
public void aclUpdated(MailboxSession session, MailboxPath mailboxPath, ACLDiff aclDiff, MailboxId mailboxId) {
- event(eventFactory.aclUpdated(session, mailboxPath, aclDiff, mailboxId));
+ event(eventFactory.aclUpdated()
+ .mailboxSession(session)
+ .path(mailboxPath)
+ .mailboxId(mailboxId)
+ .aclDiff(aclDiff)
+ .build());
}
public void moved(MailboxSession session, MessageMoves messageMoves, Collection<MessageId> messageIds) {
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org