{"action":"created","comment":{"url":"https://api.github.com/repos/SpineEventEngine/core-java/pulls/comments/79658489","id":79658489,"diff_hunk":"@@ -0,0 +1,191 @@\n+/*\n+ * Copyright 2016, TeamDev Ltd. All rights reserved.\n+ *\n+ * Redistribution and use in source and/or binary forms, with or without\n+ * modification, must retain the above copyright notice and the following\n+ * disclaimer.\n+ *\n+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n+ * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n+ */\n+\n+package org.spine3.server.entity;\n+\n+import com.google.protobuf.Descriptors;\n+import com.google.protobuf.FieldMask;\n+import com.google.protobuf.Message;\n+import com.google.protobuf.ProtocolStringList;\n+import org.spine3.protobuf.KnownTypes;\n+import org.spine3.protobuf.TypeUrl;\n+\n+import javax.annotation.Nullable;\n+import java.lang.reflect.Constructor;\n+import java.lang.reflect.InvocationTargetException;\n+import java.util.ArrayList;\n+import java.util.Collection;\n+import java.util.Collections;\n+import java.util.List;\n+\n+/**\n+ * A utility class for {@code FieldMask} processing against instances of {@link Message}.\n+ *\n+ * @author Dmytro Dashenkov\n+ */\n+@SuppressWarnings(\"UtilityClass\")\n+public class FieldMasks {\n+\n+    private FieldMasks() {\n+    }\n+\n+    /**\n+     * <p>Applies given {@code FieldMask} to given collection of {@link Message}s.\n+     * Does not change the {@link Collection} itself.\n+     *\n+     * <p>The {@code FieldMask} must be valid for this operation.\n+     *\n+     * <p>In case of failure (e.g. wrong {@code TypeUrl} in the field mask) this method silently handles it\n+     * without any exception or error thrown.\n+     *\n+     * @param mask     {@code FieldMask} to apply to each item of the input {@link Collection}.\n+     * @param entities {@link Message}s to filter.\n+     * @param typeUrl  Type of the {@link Message}s.\n+     * @return Non-null unmodifiable {@link Collection} of {@link Message}s of the same type that the input had.\n+     * @see #isValid(FieldMask)\n+     */\n+    @SuppressWarnings({\"MethodWithMultipleLoops\", \"unchecked\"})\n+    public static <M extends  Message, B extends Message.Builder> Collection<M> applyMask(@SuppressWarnings(\"TypeMayBeWeakened\") FieldMask mask, Collection<M> entities, TypeUrl typeUrl) {\n+        final List<M> filtered = new ArrayList<>();","path":"server/src/main/java/org/spine3/server/entity/FieldMasks.java","position":null,"original_position":66,"commit_id":"c4a142d78d2cbb7e7b623b32de74569dd93684fe","original_commit_id":"fb8a89d4f3e6664a9b30cedfde0ab29ec553f5cc","user":{"login":"dmdashenkov","id":18305364,"avatar_url":"https://avatars.githubusercontent.com/u/18305364?v=3","gravatar_id":"","url":"https://api.github.com/users/dmdashenkov","html_url":"https://github.com/dmdashenkov","followers_url":"https://api.github.com/users/dmdashenkov/followers","following_url":"https://api.github.com/users/dmdashenkov/following{/other_user}","gists_url":"https://api.github.com/users/dmdashenkov/gists{/gist_id}","starred_url":"https://api.github.com/users/dmdashenkov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmdashenkov/subscriptions","organizations_url":"https://api.github.com/users/dmdashenkov/orgs","repos_url":"https://api.github.com/users/dmdashenkov/repos","events_url":"https://api.github.com/users/dmdashenkov/events{/privacy}","received_events_url":"https://api.github.com/users/dmdashenkov/received_events","type":"User","site_admin":false},"body":"Done","created_at":"2016-09-20T16:50:37Z","updated_at":"2016-09-20T16:50:37Z","html_url":"https://github.com/SpineEventEngine/core-java/pull/175#discussion_r79658489","pull_request_url":"https://api.github.com/repos/SpineEventEngine/core-java/pulls/175","_links":{"self":{"href":"https://api.github.com/repos/SpineEventEngine/core-java/pulls/comments/79658489"},"html":{"href":"https://github.com/SpineEventEngine/core-java/pull/175#discussion_r79658489"},"pull_request":{"href":"https://api.github.com/repos/SpineEventEngine/core-java/pulls/175"}}},"pull_request":{"url":"https://api.github.com/repos/SpineEventEngine/core-java/pulls/175","id":85748793,"html_url":"https://github.com/SpineEventEngine/core-java/pull/175","diff_url":"https://github.com/SpineEventEngine/core-java/pull/175.diff","patch_url":"https://github.com/SpineEventEngine/core-java/pull/175.patch","issue_url":"https://api.github.com/repos/SpineEventEngine/core-java/issues/175","number":175,"state":"open","locked":false,"title":"Field mask for stand query result","user":{"login":"dmdashenkov","id":18305364,"avatar_url":"https://avatars.githubusercontent.com/u/18305364?v=3","gravatar_id":"","url":"https://api.github.com/users/dmdashenkov","html_url":"https://github.com/dmdashenkov","followers_url":"https://api.github.com/users/dmdashenkov/followers","following_url":"https://api.github.com/users/dmdashenkov/following{/other_user}","gists_url":"https://api.github.com/users/dmdashenkov/gists{/gist_id}","starred_url":"https://api.github.com/users/dmdashenkov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmdashenkov/subscriptions","organizations_url":"https://api.github.com/users/dmdashenkov/orgs","repos_url":"https://api.github.com/users/dmdashenkov/repos","events_url":"https://api.github.com/users/dmdashenkov/events{/privacy}","received_events_url":"https://api.github.com/users/dmdashenkov/received_events","type":"User","site_admin":false},"body":" - Added implementation of applying field mask for stand query result.\r\n - Added tests for this feature.","created_at":"2016-09-19T07:39:55Z","updated_at":"2016-09-20T16:50:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b1735035b8538a5ba58917bbffb511c0668bdaff","assignee":{"login":"armiol","id":82468,"avatar_url":"https://avatars.githubusercontent.com/u/82468?v=3","gravatar_id":"","url":"https://api.github.com/users/armiol","html_url":"https://github.com/armiol","followers_url":"https://api.github.com/users/armiol/followers","following_url":"https://api.github.com/users/armiol/following{/other_user}","gists_url":"https://api.github.com/users/armiol/gists{/gist_id}","starred_url":"https://api.github.com/users/armiol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/armiol/subscriptions","organizations_url":"https://api.github.com/users/armiol/orgs","repos_url":"https://api.github.com/users/armiol/repos","events_url":"https://api.github.com/users/armiol/events{/privacy}","received_events_url":"https://api.github.com/users/armiol/received_events","type":"User","site_admin":false},"assignees":[{"login":"armiol","id":82468,"avatar_url":"https://avatars.githubusercontent.com/u/82468?v=3","gravatar_id":"","url":"https://api.github.com/users/armiol","html_url":"https://github.com/armiol","followers_url":"https://api.github.com/users/armiol/followers","following_url":"https://api.github.com/users/armiol/following{/other_user}","gists_url":"https://api.github.com/users/armiol/gists{/gist_id}","starred_url":"https://api.github.com/users/armiol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/armiol/subscriptions","organizations_url":"https://api.github.com/users/armiol/orgs","repos_url":"https://api.github.com/users/armiol/repos","events_url":"https://api.github.com/users/armiol/events{/privacy}","received_events_url":"https://api.github.com/users/armiol/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/SpineEventEngine/core-java/pulls/175/commits","review_comments_url":"https://api.github.com/repos/SpineEventEngine/core-java/pulls/175/comments","review_comment_url":"https://api.github.com/repos/SpineEventEngine/core-java/pulls/comments{/number}","comments_url":"https://api.github.com/repos/SpineEventEngine/core-java/issues/175/comments","statuses_url":"https://api.github.com/repos/SpineEventEngine/core-java/statuses/c4a142d78d2cbb7e7b623b32de74569dd93684fe","head":{"label":"SpineEventEngine:stand-query-impl","ref":"stand-query-impl","sha":"c4a142d78d2cbb7e7b623b32de74569dd93684fe","user":{"login":"SpineEventEngine","id":12821626,"avatar_url":"https://avatars.githubusercontent.com/u/12821626?v=3","gravatar_id":"","url":"https://api.github.com/users/SpineEventEngine","html_url":"https://github.com/SpineEventEngine","followers_url":"https://api.github.com/users/SpineEventEngine/followers","following_url":"https://api.github.com/users/SpineEventEngine/following{/other_user}","gists_url":"https://api.github.com/users/SpineEventEngine/gists{/gist_id}","starred_url":"https://api.github.com/users/SpineEventEngine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SpineEventEngine/subscriptions","organizations_url":"https://api.github.com/users/SpineEventEngine/orgs","repos_url":"https://api.github.com/users/SpineEventEngine/repos","events_url":"https://api.github.com/users/SpineEventEngine/events{/privacy}","received_events_url":"https://api.github.com/users/SpineEventEngine/received_events","type":"Organization","site_admin":false},"repo":{"id":38311906,"name":"core-java","full_name":"SpineEventEngine/core-java","owner":{"login":"SpineEventEngine","id":12821626,"avatar_url":"https://avatars.githubusercontent.com/u/12821626?v=3","gravatar_id":"","url":"https://api.github.com/users/SpineEventEngine","html_url":"https://github.com/SpineEventEngine","followers_url":"https://api.github.com/users/SpineEventEngine/followers","following_url":"https://api.github.com/users/SpineEventEngine/following{/other_user}","gists_url":"https://api.github.com/users/SpineEventEngine/gists{/gist_id}","starred_url":"https://api.github.com/users/SpineEventEngine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SpineEventEngine/subscriptions","organizations_url":"https://api.github.com/users/SpineEventEngine/orgs","repos_url":"https://api.github.com/users/SpineEventEngine/repos","events_url":"https://api.github.com/users/SpineEventEngine/events{/privacy}","received_events_url":"https://api.github.com/users/SpineEventEngine/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/SpineEventEngine/core-java","description":"The Java implementation of the framework core.","fork":false,"url":"https://api.github.com/repos/SpineEventEngine/core-java","forks_url":"https://api.github.com/repos/SpineEventEngine/core-java/forks","keys_url":"https://api.github.com/repos/SpineEventEngine/core-java/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SpineEventEngine/core-java/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SpineEventEngine/core-java/teams","hooks_url":"https://api.github.com/repos/SpineEventEngine/core-java/hooks","issue_events_url":"https://api.github.com/repos/SpineEventEngine/core-java/issues/events{/number}","events_url":"https://api.github.com/repos/SpineEventEngine/core-java/events","assignees_url":"https://api.github.com/repos/SpineEventEngine/core-java/assignees{/user}","branches_url":"https://api.github.com/repos/SpineEventEngine/core-java/branches{/branch}","tags_url":"https://api.github.com/repos/SpineEventEngine/core-java/tags","blobs_url":"https://api.github.com/repos/SpineEventEngine/core-java/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SpineEventEngine/core-java/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SpineEventEngine/core-java/git/refs{/sha}","trees_url":"https://api.github.com/repos/SpineEventEngine/core-java/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SpineEventEngine/core-java/statuses/{sha}","languages_url":"https://api.github.com/repos/SpineEventEngine/core-java/languages","stargazers_url":"https://api.github.com/repos/SpineEventEngine/core-java/stargazers","contributors_url":"https://api.github.com/repos/SpineEventEngine/core-java/contributors","subscribers_url":"https://api.github.com/repos/SpineEventEngine/core-java/subscribers","subscription_url":"https://api.github.com/repos/SpineEventEngine/core-java/subscription","commits_url":"https://api.github.com/repos/SpineEventEngine/core-java/commits{/sha}","git_commits_url":"https://api.github.com/repos/SpineEventEngine/core-java/git/commits{/sha}","comments_url":"https://api.github.com/repos/SpineEventEngine/core-java/comments{/number}","issue_comment_url":"https://api.github.com/repos/SpineEventEngine/core-java/issues/comments{/number}","contents_url":"https://api.github.com/repos/SpineEventEngine/core-java/contents/{+path}","compare_url":"https://api.github.com/repos/SpineEventEngine/core-java/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SpineEventEngine/core-java/merges","archive_url":"https://api.github.com/repos/SpineEventEngine/core-java/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SpineEventEngine/core-java/downloads","issues_url":"https://api.github.com/repos/SpineEventEngine/core-java/issues{/number}","pulls_url":"https://api.github.com/repos/SpineEventEngine/core-java/pulls{/number}","milestones_url":"https://api.github.com/repos/SpineEventEngine/core-java/milestones{/number}","notifications_url":"https://api.github.com/repos/SpineEventEngine/core-java/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SpineEventEngine/core-java/labels{/name}","releases_url":"https://api.github.com/repos/SpineEventEngine/core-java/releases{/id}","deployments_url":"https://api.github.com/repos/SpineEventEngine/core-java/deployments","created_at":"2015-06-30T13:50:58Z","updated_at":"2016-09-09T16:53:47Z","pushed_at":"2016-09-20T16:46:23Z","git_url":"git://github.com/SpineEventEngine/core-java.git","ssh_url":"git@github.com:SpineEventEngine/core-java.git","clone_url":"https://github.com/SpineEventEngine/core-java.git","svn_url":"https://github.com/SpineEventEngine/core-java","homepage":null,"size":5684,"stargazers_count":2,"watchers_count":2,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":2,"default_branch":"master"}},"base":{"label":"SpineEventEngine:stand-in-memory","ref":"stand-in-memory","sha":"604265b3eea0f77fa162c15ee4c35d1c781b2863","user":{"login":"SpineEventEngine","id":12821626,"avatar_url":"https://avatars.githubusercontent.com/u/12821626?v=3","gravatar_id":"","url":"https://api.github.com/users/SpineEventEngine","html_url":"https://github.com/SpineEventEngine","followers_url":"https://api.github.com/users/SpineEventEngine/followers","following_url":"https://api.github.com/users/SpineEventEngine/following{/other_user}","gists_url":"https://api.github.com/users/SpineEventEngine/gists{/gist_id}","starred_url":"https://api.github.com/users/SpineEventEngine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SpineEventEngine/subscriptions","organizations_url":"https://api.github.com/users/SpineEventEngine/orgs","repos_url":"https://api.github.com/users/SpineEventEngine/repos","events_url":"https://api.github.com/users/SpineEventEngine/events{/privacy}","received_events_url":"https://api.github.com/users/SpineEventEngine/received_events","type":"Organization","site_admin":false},"repo":{"id":38311906,"name":"core-java","full_name":"SpineEventEngine/core-java","owner":{"login":"SpineEventEngine","id":12821626,"avatar_url":"https://avatars.githubusercontent.com/u/12821626?v=3","gravatar_id":"","url":"https://api.github.com/users/SpineEventEngine","html_url":"https://github.com/SpineEventEngine","followers_url":"https://api.github.com/users/SpineEventEngine/followers","following_url":"https://api.github.com/users/SpineEventEngine/following{/other_user}","gists_url":"https://api.github.com/users/SpineEventEngine/gists{/gist_id}","starred_url":"https://api.github.com/users/SpineEventEngine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SpineEventEngine/subscriptions","organizations_url":"https://api.github.com/users/SpineEventEngine/orgs","repos_url":"https://api.github.com/users/SpineEventEngine/repos","events_url":"https://api.github.com/users/SpineEventEngine/events{/privacy}","received_events_url":"https://api.github.com/users/SpineEventEngine/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/SpineEventEngine/core-java","description":"The Java implementation of the framework core.","fork":false,"url":"https://api.github.com/repos/SpineEventEngine/core-java","forks_url":"https://api.github.com/repos/SpineEventEngine/core-java/forks","keys_url":"https://api.github.com/repos/SpineEventEngine/core-java/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SpineEventEngine/core-java/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SpineEventEngine/core-java/teams","hooks_url":"https://api.github.com/repos/SpineEventEngine/core-java/hooks","issue_events_url":"https://api.github.com/repos/SpineEventEngine/core-java/issues/events{/number}","events_url":"https://api.github.com/repos/SpineEventEngine/core-java/events","assignees_url":"https://api.github.com/repos/SpineEventEngine/core-java/assignees{/user}","branches_url":"https://api.github.com/repos/SpineEventEngine/core-java/branches{/branch}","tags_url":"https://api.github.com/repos/SpineEventEngine/core-java/tags","blobs_url":"https://api.github.com/repos/SpineEventEngine/core-java/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SpineEventEngine/core-java/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SpineEventEngine/core-java/git/refs{/sha}","trees_url":"https://api.github.com/repos/SpineEventEngine/core-java/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SpineEventEngine/core-java/statuses/{sha}","languages_url":"https://api.github.com/repos/SpineEventEngine/core-java/languages","stargazers_url":"https://api.github.com/repos/SpineEventEngine/core-java/stargazers","contributors_url":"https://api.github.com/repos/SpineEventEngine/core-java/contributors","subscribers_url":"https://api.github.com/repos/SpineEventEngine/core-java/subscribers","subscription_url":"https://api.github.com/repos/SpineEventEngine/core-java/subscription","commits_url":"https://api.github.com/repos/SpineEventEngine/core-java/commits{/sha}","git_commits_url":"https://api.github.com/repos/SpineEventEngine/core-java/git/commits{/sha}","comments_url":"https://api.github.com/repos/SpineEventEngine/core-java/comments{/number}","issue_comment_url":"https://api.github.com/repos/SpineEventEngine/core-java/issues/comments{/number}","contents_url":"https://api.github.com/repos/SpineEventEngine/core-java/contents/{+path}","compare_url":"https://api.github.com/repos/SpineEventEngine/core-java/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SpineEventEngine/core-java/merges","archive_url":"https://api.github.com/repos/SpineEventEngine/core-java/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SpineEventEngine/core-java/downloads","issues_url":"https://api.github.com/repos/SpineEventEngine/core-java/issues{/number}","pulls_url":"https://api.github.com/repos/SpineEventEngine/core-java/pulls{/number}","milestones_url":"https://api.github.com/repos/SpineEventEngine/core-java/milestones{/number}","notifications_url":"https://api.github.com/repos/SpineEventEngine/core-java/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SpineEventEngine/core-java/labels{/name}","releases_url":"https://api.github.com/repos/SpineEventEngine/core-java/releases{/id}","deployments_url":"https://api.github.com/repos/SpineEventEngine/core-java/deployments","created_at":"2015-06-30T13:50:58Z","updated_at":"2016-09-09T16:53:47Z","pushed_at":"2016-09-20T16:46:23Z","git_url":"git://github.com/SpineEventEngine/core-java.git","ssh_url":"git@github.com:SpineEventEngine/core-java.git","clone_url":"https://github.com/SpineEventEngine/core-java.git","svn_url":"https://github.com/SpineEventEngine/core-java","homepage":null,"size":5684,"stargazers_count":2,"watchers_count":2,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/SpineEventEngine/core-java/pulls/175"},"html":{"href":"https://github.com/SpineEventEngine/core-java/pull/175"},"issue":{"href":"https://api.github.com/repos/SpineEventEngine/core-java/issues/175"},"comments":{"href":"https://api.github.com/repos/SpineEventEngine/core-java/issues/175/comments"},"review_comments":{"href":"https://api.github.com/repos/SpineEventEngine/core-java/pulls/175/comments"},"review_comment":{"href":"https://api.github.com/repos/SpineEventEngine/core-java/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/SpineEventEngine/core-java/pulls/175/commits"},"statuses":{"href":"https://api.github.com/repos/SpineEventEngine/core-java/statuses/c4a142d78d2cbb7e7b623b32de74569dd93684fe"}}}}
{"actor":{"display_login":"dmdashenkov"}}