You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by GitBox <gi...@apache.org> on 2021/03/10 08:45:59 UTC

[GitHub] [james-project] chibenwa commented on a change in pull request #327: JAMES-3514 Fetch list of mailbox for a user based on mailboxpath

chibenwa commented on a change in pull request #327:
URL: https://github.com/apache/james-project/pull/327#discussion_r591220090



##########
File path: mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMailboxMapper.java
##########
@@ -356,4 +358,10 @@ private boolean isPathChildOfMailbox(Mailbox candidate, Mailbox mailbox, char de
                 .map(Pair::getLeft)
                 .flatMap(this::retrieveMailbox, CONCURRENCY));
     }
+    
+    @Override
+    public List<Mailbox> findMailboxesForUser(MailboxPath mailboxPath) throws MailboxException {

Review comment:
       How is it different from `findMailboxByPath` ? When is there several mailboxes for a single path?

##########
File path: mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/JPAMailboxMapper.java
##########
@@ -227,4 +230,19 @@ private JPAMailbox loadJpaMailbox(MailboxId id) throws MailboxNotFoundException
     public Flux<Mailbox> findNonPersonalMailboxes(Username userName, Right right) {
         return Flux.empty();
     }
+    
+    public List<Mailbox> findMailboxesForUser(MailboxPath mailboxPath) throws MailboxException {
+        try {
+            return getEntityManager().createNamedQuery("findMailboxByUserName", JPAMailbox.class)
+                    .setParameter("namespaceParam", mailboxPath.getNamespace())
+                    .setParameter("userParam", mailboxPath.getUser().asString())

Review comment:
       This is exactely 
   
   ```
   findMailboxWithPathLike(MailboxQuery.builder()
                       .userAndNamespaceFrom(inboxPath)
                       .expression(Wildcard.INSTANCE)
                       .build()
                       .asUserBound())
   ```
   
   No need to add a new method...




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org