james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From btell...@apache.org
Subject [06/15] james-project git commit: JAMES-2266 Swagger documentation for fixing Ghost mailbox bug
Date Fri, 05 Jan 2018 09:17:32 GMT
JAMES-2266 Swagger documentation for fixing Ghost mailbox bug


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

Branch: refs/heads/master
Commit: 7596420184d3e057c30226641c3b1429d972565b
Parents: 800e88f
Author: benwa <btellier@linagora.com>
Authored: Wed Dec 27 17:25:05 2017 +0700
Committer: benwa <btellier@linagora.com>
Committed: Fri Jan 5 16:06:56 2018 +0700

----------------------------------------------------------------------
 .../routes/CassandraMailboxMergingRoutes.java   | 35 +++++++++++++++++++-
 1 file changed, 34 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/75964201/server/protocols/webadmin/webadmin-cassandra/src/main/java/org/apache/james/webadmin/routes/CassandraMailboxMergingRoutes.java
----------------------------------------------------------------------
diff --git a/server/protocols/webadmin/webadmin-cassandra/src/main/java/org/apache/james/webadmin/routes/CassandraMailboxMergingRoutes.java
b/server/protocols/webadmin/webadmin-cassandra/src/main/java/org/apache/james/webadmin/routes/CassandraMailboxMergingRoutes.java
index b778ef6..9ac36a6 100644
--- a/server/protocols/webadmin/webadmin-cassandra/src/main/java/org/apache/james/webadmin/routes/CassandraMailboxMergingRoutes.java
+++ b/server/protocols/webadmin/webadmin-cassandra/src/main/java/org/apache/james/webadmin/routes/CassandraMailboxMergingRoutes.java
@@ -20,6 +20,9 @@
 package org.apache.james.webadmin.routes;
 
 import javax.inject.Inject;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
 
 import org.apache.james.mailbox.cassandra.ids.CassandraId;
 import org.apache.james.mailbox.cassandra.mail.task.MailboxMergingTask;
@@ -38,10 +41,20 @@ import org.eclipse.jetty.http.HttpStatus;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiResponse;
+import io.swagger.annotations.ApiResponses;
+import io.swagger.annotations.ResponseHeader;
 import spark.Request;
 import spark.Response;
 import spark.Service;
 
+@Api(tags = "Mailbox merging route for fixing Ghost mailbox bug described in MAILBOX-322")
+@Path(":cassandra/mailbox/merging")
+@Produces("application/json")
 public class CassandraMailboxMergingRoutes implements Routes {
 
     private static final Logger LOGGER = LoggerFactory.getLogger(CassandraMailboxMergingRoutes.class);
@@ -68,7 +81,27 @@ public class CassandraMailboxMergingRoutes implements Routes {
         service.post(BASE, this::mergeMailboxes, jsonTransformer);
     }
 
-    private Object mergeMailboxes(Request request, Response response) {
+
+    @POST
+    @ApiOperation("Triggers the merge of 2 mailboxes. Old mailbox Id will no more be accessible,
rights and messages will be merged.")
+    @ApiImplicitParams(
+        {
+            @ApiImplicitParam(
+                required = true,
+                paramType = "body",
+                dataType = "Mailbox merging request",
+                example = "{\"oldMailboxId\":\"4555-656-4554\",\"oldMailboxId\":\"9693-665-2500\"}",
+                value = "The mailboxes to merge together.")
+        })
+    @ApiResponses(
+        {
+            @ApiResponse(code = HttpStatus.CREATED_201, message = "The taskId of the given
scheduled task",
+                response = TaskIdDto.class, responseHeaders = {
+                @ResponseHeader(name = "Location", description = "URL of the resource associated
with the scheduled task")
+            }),
+            @ApiResponse(code = HttpStatus.BAD_REQUEST_400, message = "Error with supplied
data (JSON parsing or invalid mailbox ids)")
+        })
+    public Object mergeMailboxes(Request request, Response response) {
         try {
             LOGGER.debug("Cassandra upgrade launched");
             MailboxMergingRequest mailboxMergingRequest = jsonExtractor.parse(request.body());


---------------------------------------------------------------------
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