{"action":"created","comment":{"url":"https://api.github.com/repos/linagora/james-project/pulls/comments/57713628","id":57713628,"diff_hunk":"@@ -0,0 +1,78 @@\n+/****************************************************************\n+ * Licensed to the Apache Software Foundation (ASF) under one   *\n+ * or more contributor license agreements.  See the NOTICE file *\n+ * distributed with this work for additional information        *\n+ * regarding copyright ownership.  The ASF licenses this file   *\n+ * to you under the Apache License, Version 2.0 (the            *\n+ * \"License\"); you may not use this file except in compliance   *\n+ * with the License.  You may obtain a copy of the License at   *\n+ *                                                              *\n+ *   http://www.apache.org/licenses/LICENSE-2.0                 *\n+ *                                                              *\n+ * Unless required by applicable law or agreed to in writing,   *\n+ * software distributed under the License is distributed on an  *\n+ * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *\n+ * KIND, either express or implied.  See the License for the    *\n+ * specific language governing permissions and limitations      *\n+ * under the License.                                           *\n+ ****************************************************************/\n+\n+package org.apache.james.jmap.methods;\n+\n+import java.util.Set;\n+import java.util.stream.Stream;\n+\n+import javax.inject.Inject;\n+\n+import org.apache.james.jmap.model.ClientId;\n+import org.apache.james.jmap.model.SetMailboxesRequest;\n+import org.apache.james.jmap.model.SetMailboxesResponse;\n+import org.apache.james.mailbox.MailboxSession;\n+import org.apache.james.mailbox.store.mail.model.MailboxId;\n+\n+import com.google.common.annotations.VisibleForTesting;\n+import com.google.common.base.Preconditions;\n+\n+public class SetMailboxesMethod<Id extends MailboxId> implements Method {\n+\n+    private static final Request.Name METHOD_NAME = Request.name(\"setMailboxes\");\n+    @VisibleForTesting static final Response.Name RESPONSE_NAME = Response.name(\"mailboxes\");\n+\n+    private final Set<SetMailboxesProcessor<Id>> processors;\n+\n+    @Inject\n+    public SetMailboxesMethod(Set<SetMailboxesProcessor<Id>> processors) {\n+        this.processors = processors;\n+    }\n+\n+    @Override\n+    public Request.Name requestHandled() {\n+        return METHOD_NAME;\n+    }\n+\n+    @Override\n+    public Class<? extends JmapRequest> requestType() {\n+        return org.apache.james.jmap.model.SetMailboxesRequest.class;\n+    }\n+\n+    @Override\n+    public Stream<JmapResponse> process(JmapRequest request, ClientId clientId, MailboxSession mailboxSession) {\n+        Preconditions.checkNotNull(request);\n+        Preconditions.checkNotNull(clientId);\n+        Preconditions.checkNotNull(mailboxSession);\n+        Preconditions.checkArgument(request instanceof SetMailboxesRequest);\n+        SetMailboxesRequest setMailboxesRequest = (SetMailboxesRequest) request;\n+        return processors.stream()\n+            .map(processor -> processor.process(setMailboxesRequest))\n+            .map(response -> toJmapResponse(clientId, response)\n+            );","path":"server/protocols/jmap/src/main/java/org/apache/james/jmap/methods/SetMailboxesMethod.java","position":68,"original_position":68,"commit_id":"34d979c9e4266121fda842b1141125ac730d3d51","original_commit_id":"f83a3efd9a23f036ec0a3cf2e0a8afdafe0d4281","user":{"login":"rouazana","id":1398581,"avatar_url":"https://avatars.githubusercontent.com/u/1398581?v=3","gravatar_id":"","url":"https://api.github.com/users/rouazana","html_url":"https://github.com/rouazana","followers_url":"https://api.github.com/users/rouazana/followers","following_url":"https://api.github.com/users/rouazana/following{/other_user}","gists_url":"https://api.github.com/users/rouazana/gists{/gist_id}","starred_url":"https://api.github.com/users/rouazana/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rouazana/subscriptions","organizations_url":"https://api.github.com/users/rouazana/orgs","repos_url":"https://api.github.com/users/rouazana/repos","events_url":"https://api.github.com/users/rouazana/events{/privacy}","received_events_url":"https://api.github.com/users/rouazana/received_events","type":"User","site_admin":false},"body":"ok","created_at":"2016-03-29T12:22:16Z","updated_at":"2016-03-29T12:22:16Z","html_url":"https://github.com/linagora/james-project/pull/196#discussion_r57713628","pull_request_url":"https://api.github.com/repos/linagora/james-project/pulls/196","_links":{"self":{"href":"https://api.github.com/repos/linagora/james-project/pulls/comments/57713628"},"html":{"href":"https://github.com/linagora/james-project/pull/196#discussion_r57713628"},"pull_request":{"href":"https://api.github.com/repos/linagora/james-project/pulls/196"}}},"pull_request":{"url":"https://api.github.com/repos/linagora/james-project/pulls/196","id":64437595,"html_url":"https://github.com/linagora/james-project/pull/196","diff_url":"https://github.com/linagora/james-project/pull/196.diff","patch_url":"https://github.com/linagora/james-project/pull/196.patch","issue_url":"https://api.github.com/repos/linagora/james-project/issues/196","number":196,"state":"open","locked":false,"title":"James 1710 SetMailboxesMethod implementation","user":{"login":"rouazana","id":1398581,"avatar_url":"https://avatars.githubusercontent.com/u/1398581?v=3","gravatar_id":"","url":"https://api.github.com/users/rouazana","html_url":"https://github.com/rouazana","followers_url":"https://api.github.com/users/rouazana/followers","following_url":"https://api.github.com/users/rouazana/following{/other_user}","gists_url":"https://api.github.com/users/rouazana/gists{/gist_id}","starred_url":"https://api.github.com/users/rouazana/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rouazana/subscriptions","organizations_url":"https://api.github.com/users/rouazana/orgs","repos_url":"https://api.github.com/users/rouazana/repos","events_url":"https://api.github.com/users/rouazana/events{/privacy}","received_events_url":"https://api.github.com/users/rouazana/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-03-29T09:36:44Z","updated_at":"2016-03-29T12:22:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"00c8e0b69048a7934ab422d77d99ed9d262f3815","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/linagora/james-project/pulls/196/commits","review_comments_url":"https://api.github.com/repos/linagora/james-project/pulls/196/comments","review_comment_url":"https://api.github.com/repos/linagora/james-project/pulls/comments{/number}","comments_url":"https://api.github.com/repos/linagora/james-project/issues/196/comments","statuses_url":"https://api.github.com/repos/linagora/james-project/statuses/34d979c9e4266121fda842b1141125ac730d3d51","head":{"label":"rouazana:JAMES-1710","ref":"JAMES-1710","sha":"34d979c9e4266121fda842b1141125ac730d3d51","user":{"login":"rouazana","id":1398581,"avatar_url":"https://avatars.githubusercontent.com/u/1398581?v=3","gravatar_id":"","url":"https://api.github.com/users/rouazana","html_url":"https://github.com/rouazana","followers_url":"https://api.github.com/users/rouazana/followers","following_url":"https://api.github.com/users/rouazana/following{/other_user}","gists_url":"https://api.github.com/users/rouazana/gists{/gist_id}","starred_url":"https://api.github.com/users/rouazana/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rouazana/subscriptions","organizations_url":"https://api.github.com/users/rouazana/orgs","repos_url":"https://api.github.com/users/rouazana/repos","events_url":"https://api.github.com/users/rouazana/events{/privacy}","received_events_url":"https://api.github.com/users/rouazana/received_events","type":"User","site_admin":false},"repo":{"id":42306065,"name":"james-project","full_name":"rouazana/james-project","owner":{"login":"rouazana","id":1398581,"avatar_url":"https://avatars.githubusercontent.com/u/1398581?v=3","gravatar_id":"","url":"https://api.github.com/users/rouazana","html_url":"https://github.com/rouazana","followers_url":"https://api.github.com/users/rouazana/followers","following_url":"https://api.github.com/users/rouazana/following{/other_user}","gists_url":"https://api.github.com/users/rouazana/gists{/gist_id}","starred_url":"https://api.github.com/users/rouazana/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rouazana/subscriptions","organizations_url":"https://api.github.com/users/rouazana/orgs","repos_url":"https://api.github.com/users/rouazana/repos","events_url":"https://api.github.com/users/rouazana/events{/privacy}","received_events_url":"https://api.github.com/users/rouazana/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rouazana/james-project","description":"Mirror of Apache James Project","fork":true,"url":"https://api.github.com/repos/rouazana/james-project","forks_url":"https://api.github.com/repos/rouazana/james-project/forks","keys_url":"https://api.github.com/repos/rouazana/james-project/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rouazana/james-project/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rouazana/james-project/teams","hooks_url":"https://api.github.com/repos/rouazana/james-project/hooks","issue_events_url":"https://api.github.com/repos/rouazana/james-project/issues/events{/number}","events_url":"https://api.github.com/repos/rouazana/james-project/events","assignees_url":"https://api.github.com/repos/rouazana/james-project/assignees{/user}","branches_url":"https://api.github.com/repos/rouazana/james-project/branches{/branch}","tags_url":"https://api.github.com/repos/rouazana/james-project/tags","blobs_url":"https://api.github.com/repos/rouazana/james-project/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rouazana/james-project/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rouazana/james-project/git/refs{/sha}","trees_url":"https://api.github.com/repos/rouazana/james-project/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rouazana/james-project/statuses/{sha}","languages_url":"https://api.github.com/repos/rouazana/james-project/languages","stargazers_url":"https://api.github.com/repos/rouazana/james-project/stargazers","contributors_url":"https://api.github.com/repos/rouazana/james-project/contributors","subscribers_url":"https://api.github.com/repos/rouazana/james-project/subscribers","subscription_url":"https://api.github.com/repos/rouazana/james-project/subscription","commits_url":"https://api.github.com/repos/rouazana/james-project/commits{/sha}","git_commits_url":"https://api.github.com/repos/rouazana/james-project/git/commits{/sha}","comments_url":"https://api.github.com/repos/rouazana/james-project/comments{/number}","issue_comment_url":"https://api.github.com/repos/rouazana/james-project/issues/comments{/number}","contents_url":"https://api.github.com/repos/rouazana/james-project/contents/{+path}","compare_url":"https://api.github.com/repos/rouazana/james-project/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rouazana/james-project/merges","archive_url":"https://api.github.com/repos/rouazana/james-project/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rouazana/james-project/downloads","issues_url":"https://api.github.com/repos/rouazana/james-project/issues{/number}","pulls_url":"https://api.github.com/repos/rouazana/james-project/pulls{/number}","milestones_url":"https://api.github.com/repos/rouazana/james-project/milestones{/number}","notifications_url":"https://api.github.com/repos/rouazana/james-project/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rouazana/james-project/labels{/name}","releases_url":"https://api.github.com/repos/rouazana/james-project/releases{/id}","deployments_url":"https://api.github.com/repos/rouazana/james-project/deployments","created_at":"2015-09-11T12:02:10Z","updated_at":"2015-09-11T12:02:10Z","pushed_at":"2016-03-29T09:34:25Z","git_url":"git://github.com/rouazana/james-project.git","ssh_url":"git@github.com:rouazana/james-project.git","clone_url":"https://github.com/rouazana/james-project.git","svn_url":"https://github.com/rouazana/james-project","homepage":null,"size":11167,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"trunk"}},"base":{"label":"linagora:master","ref":"master","sha":"efed669b3d02a75e1993fb52549909e13e8e8db2","user":{"login":"linagora","id":1230365,"avatar_url":"https://avatars.githubusercontent.com/u/1230365?v=3","gravatar_id":"","url":"https://api.github.com/users/linagora","html_url":"https://github.com/linagora","followers_url":"https://api.github.com/users/linagora/followers","following_url":"https://api.github.com/users/linagora/following{/other_user}","gists_url":"https://api.github.com/users/linagora/gists{/gist_id}","starred_url":"https://api.github.com/users/linagora/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/linagora/subscriptions","organizations_url":"https://api.github.com/users/linagora/orgs","repos_url":"https://api.github.com/users/linagora/repos","events_url":"https://api.github.com/users/linagora/events{/privacy}","received_events_url":"https://api.github.com/users/linagora/received_events","type":"Organization","site_admin":false},"repo":{"id":39182136,"name":"james-project","full_name":"linagora/james-project","owner":{"login":"linagora","id":1230365,"avatar_url":"https://avatars.githubusercontent.com/u/1230365?v=3","gravatar_id":"","url":"https://api.github.com/users/linagora","html_url":"https://github.com/linagora","followers_url":"https://api.github.com/users/linagora/followers","following_url":"https://api.github.com/users/linagora/following{/other_user}","gists_url":"https://api.github.com/users/linagora/gists{/gist_id}","starred_url":"https://api.github.com/users/linagora/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/linagora/subscriptions","organizations_url":"https://api.github.com/users/linagora/orgs","repos_url":"https://api.github.com/users/linagora/repos","events_url":"https://api.github.com/users/linagora/events{/privacy}","received_events_url":"https://api.github.com/users/linagora/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/linagora/james-project","description":"Mirror of Apache James Project","fork":true,"url":"https://api.github.com/repos/linagora/james-project","forks_url":"https://api.github.com/repos/linagora/james-project/forks","keys_url":"https://api.github.com/repos/linagora/james-project/keys{/key_id}","collaborators_url":"https://api.github.com/repos/linagora/james-project/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/linagora/james-project/teams","hooks_url":"https://api.github.com/repos/linagora/james-project/hooks","issue_events_url":"https://api.github.com/repos/linagora/james-project/issues/events{/number}","events_url":"https://api.github.com/repos/linagora/james-project/events","assignees_url":"https://api.github.com/repos/linagora/james-project/assignees{/user}","branches_url":"https://api.github.com/repos/linagora/james-project/branches{/branch}","tags_url":"https://api.github.com/repos/linagora/james-project/tags","blobs_url":"https://api.github.com/repos/linagora/james-project/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/linagora/james-project/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/linagora/james-project/git/refs{/sha}","trees_url":"https://api.github.com/repos/linagora/james-project/git/trees{/sha}","statuses_url":"https://api.github.com/repos/linagora/james-project/statuses/{sha}","languages_url":"https://api.github.com/repos/linagora/james-project/languages","stargazers_url":"https://api.github.com/repos/linagora/james-project/stargazers","contributors_url":"https://api.github.com/repos/linagora/james-project/contributors","subscribers_url":"https://api.github.com/repos/linagora/james-project/subscribers","subscription_url":"https://api.github.com/repos/linagora/james-project/subscription","commits_url":"https://api.github.com/repos/linagora/james-project/commits{/sha}","git_commits_url":"https://api.github.com/repos/linagora/james-project/git/commits{/sha}","comments_url":"https://api.github.com/repos/linagora/james-project/comments{/number}","issue_comment_url":"https://api.github.com/repos/linagora/james-project/issues/comments{/number}","contents_url":"https://api.github.com/repos/linagora/james-project/contents/{+path}","compare_url":"https://api.github.com/repos/linagora/james-project/compare/{base}...{head}","merges_url":"https://api.github.com/repos/linagora/james-project/merges","archive_url":"https://api.github.com/repos/linagora/james-project/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/linagora/james-project/downloads","issues_url":"https://api.github.com/repos/linagora/james-project/issues{/number}","pulls_url":"https://api.github.com/repos/linagora/james-project/pulls{/number}","milestones_url":"https://api.github.com/repos/linagora/james-project/milestones{/number}","notifications_url":"https://api.github.com/repos/linagora/james-project/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/linagora/james-project/labels{/name}","releases_url":"https://api.github.com/repos/linagora/james-project/releases{/id}","deployments_url":"https://api.github.com/repos/linagora/james-project/deployments","created_at":"2015-07-16T07:04:59Z","updated_at":"2016-03-17T09:08:41Z","pushed_at":"2016-03-29T09:36:44Z","git_url":"git://github.com/linagora/james-project.git","ssh_url":"git@github.com:linagora/james-project.git","clone_url":"https://github.com/linagora/james-project.git","svn_url":"https://github.com/linagora/james-project","homepage":null,"size":12546,"stargazers_count":2,"watchers_count":2,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":6,"mirror_url":null,"open_issues_count":10,"forks":6,"open_issues":10,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/linagora/james-project/pulls/196"},"html":{"href":"https://github.com/linagora/james-project/pull/196"},"issue":{"href":"https://api.github.com/repos/linagora/james-project/issues/196"},"comments":{"href":"https://api.github.com/repos/linagora/james-project/issues/196/comments"},"review_comments":{"href":"https://api.github.com/repos/linagora/james-project/pulls/196/comments"},"review_comment":{"href":"https://api.github.com/repos/linagora/james-project/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/linagora/james-project/pulls/196/commits"},"statuses":{"href":"https://api.github.com/repos/linagora/james-project/statuses/34d979c9e4266121fda842b1141125ac730d3d51"}}}}