james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From btell...@apache.org
Subject [james-project] 03/06: JAMES-2782 one more stage of adding file prefix for exporting operation
Date Mon, 10 Jun 2019 04:15:56 GMT
This is an automated email from the ASF dual-hosted git repository.

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

commit b266d75e3a8e20cff424576ffeae48e5f7a33738
Author: Tran Tien Duc <dtran@linagora.com>
AuthorDate: Thu Jun 6 17:29:37 2019 +0700

    JAMES-2782 one more stage of adding file prefix for exporting operation
---
 .../org/apache/james/blob/export/api/BlobExportMechanism.java | 11 ++++++++++-
 .../org/apache/james/webadmin/vault/routes/ExportService.java |  2 ++
 .../webadmin/vault/routes/DeletedMessagesVaultRoutesTest.java |  2 +-
 3 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/server/blob/blob-export-api/src/main/java/org/apache/james/blob/export/api/BlobExportMechanism.java
b/server/blob/blob-export-api/src/main/java/org/apache/james/blob/export/api/BlobExportMechanism.java
index e88aba1..d9fffa5 100644
--- a/server/blob/blob-export-api/src/main/java/org/apache/james/blob/export/api/BlobExportMechanism.java
+++ b/server/blob/blob-export-api/src/main/java/org/apache/james/blob/export/api/BlobExportMechanism.java
@@ -39,7 +39,16 @@ public interface BlobExportMechanism {
 
     @FunctionalInterface
     interface ExplanationStage {
-        FileExtensionStage explanation(String explanation);
+        FilePrefixStage explanation(String explanation);
+    }
+
+    @FunctionalInterface
+    interface FilePrefixStage {
+        FileExtensionStage filePrefix(Optional<String> prefix);
+
+        default FileExtensionStage noFileCustomPrefix() {
+            return filePrefix(Optional.empty());
+        }
     }
 
     @FunctionalInterface
diff --git a/server/protocols/webadmin/webadmin-mailbox-deleted-message-vault/src/main/java/org/apache/james/webadmin/vault/routes/ExportService.java
b/server/protocols/webadmin/webadmin-mailbox-deleted-message-vault/src/main/java/org/apache/james/webadmin/vault/routes/ExportService.java
index 14c100c..9e12fcf 100644
--- a/server/protocols/webadmin/webadmin-mailbox-deleted-message-vault/src/main/java/org/apache/james/webadmin/vault/routes/ExportService.java
+++ b/server/protocols/webadmin/webadmin-mailbox-deleted-message-vault/src/main/java/org/apache/james/webadmin/vault/routes/ExportService.java
@@ -20,6 +20,7 @@
 package org.apache.james.webadmin.vault.routes;
 
 import java.io.IOException;
+import java.util.Optional;
 
 import javax.inject.Inject;
 
@@ -66,6 +67,7 @@ class ExportService {
         blobExport.blobId(blobId)
             .with(exportToAddress)
             .explanation(exportMessage(user))
+            .filePrefix(Optional.of("deleted-message-of-" + user.asString() + "_"))
             .fileExtension(FileExtension.ZIP)
             .export();
     }
diff --git a/server/protocols/webadmin/webadmin-mailbox-deleted-message-vault/src/test/java/org/apache/james/webadmin/vault/routes/DeletedMessagesVaultRoutesTest.java
b/server/protocols/webadmin/webadmin-mailbox-deleted-message-vault/src/test/java/org/apache/james/webadmin/vault/routes/DeletedMessagesVaultRoutesTest.java
index 9375a6d..adb1e8c 100644
--- a/server/protocols/webadmin/webadmin-mailbox-deleted-message-vault/src/test/java/org/apache/james/webadmin/vault/routes/DeletedMessagesVaultRoutesTest.java
+++ b/server/protocols/webadmin/webadmin-mailbox-deleted-message-vault/src/test/java/org/apache/james/webadmin/vault/routes/DeletedMessagesVaultRoutesTest.java
@@ -135,7 +135,7 @@ class DeletedMessagesVaultRoutesTest {
     private class NoopBlobExporting implements BlobExportMechanism {
         @Override
         public ShareeStage blobId(BlobId blobId) {
-            return exportTo -> explanation -> fileExtension -> () -> export(exportTo,
explanation);
+            return exportTo -> explanation -> fileCustomPrefix -> fileExtension
-> () -> export(exportTo, explanation);
         }
 
         void export(MailAddress exportTo, String explanation) {


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


Mime
View raw message