{"action":"created","comment":{"url":"https://api.github.com/repos/SpineEventEngine/core-java/pulls/comments/145039388","pull_request_review_id":69779030,"id":145039388,"diff_hunk":"@@ -218,6 +219,55 @@ public static boolean isExternal(EventContext context) {\n     }\n \n     /**\n+     * Clears enrichments of the specified event.\n+     *\n+     * <p>Use this method to decrease a size of an event, if enrichments aren't important.\n+     *\n+     * <p>A result won't contain:\n+     * <ul>\n+     *     <li>the enrichment from the event context;</li>\n+     *     <li>the enrichment from the first-level origin.</li>\n+     * </ul>\n+     *\n+     * <p>Enrichments will not be removed from second-level and deeper origins,\n+     * because it's a heavy performance operation.\n+     *\n+     * @param event the event to clear enrichments\n+     * @return the event without enrichments\n+     */\n+    @Internal\n+    public static Event clearEnrichments(Event event) {\n+        final EventContext context = event.getContext();\n+        final EventContext.Builder resultContext = context.toBuilder()\n+                                                          .clearEnrichment();\n+        final EventContext.OriginCase originCase = resultContext.getOriginCase();\n+        switch (originCase) {\n+            case EVENT_CONTEXT:\n+                resultContext.setEventContext(context.getEventContext()\n+                                                     .toBuilder()\n+                                                     .clearEnrichment());\n+                break;\n+            case REJECTION_CONTEXT:\n+                resultContext.setRejectionContext(context.getRejectionContext()\n+                                                         .toBuilder()\n+                                                         .clearEnrichment());\n+                break;\n+            case COMMAND_CONTEXT:\n+                // Nothing to remove.\n+                break;\n+            case ORIGIN_NOT_SET:\n+                // Does nothing because there is no origin for this event.\n+                break;\n+            default:\n+                throw newIllegalStateException(\"Unsupported origin case is encountered: %s\",\n+                                               originCase);\n+        }\n+        return event.toBuilder()","path":"core/src/main/java/io/spine/core/Events.java","position":55,"original_position":55,"commit_id":"dc085c3dd063fb7e9cbc48505b6f7a466957604b","original_commit_id":"dc085c3dd063fb7e9cbc48505b6f7a466957604b","user":{"login":"armiol","id":82468,"avatar_url":"https://avatars0.githubusercontent.com/u/82468?v=4","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},"body":"Please extract a `result` variable.","created_at":"2017-10-17T06:49:36Z","updated_at":"2017-10-17T06:51:34Z","html_url":"https://github.com/SpineEventEngine/core-java/pull/602#discussion_r145039388","pull_request_url":"https://api.github.com/repos/SpineEventEngine/core-java/pulls/602","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/SpineEventEngine/core-java/pulls/comments/145039388"},"html":{"href":"https://github.com/SpineEventEngine/core-java/pull/602#discussion_r145039388"},"pull_request":{"href":"https://api.github.com/repos/SpineEventEngine/core-java/pulls/602"}}},"pull_request":{"url":"https://api.github.com/repos/SpineEventEngine/core-java/pulls/602","id":146448974,"html_url":"https://github.com/SpineEventEngine/core-java/pull/602","diff_url":"https://github.com/SpineEventEngine/core-java/pull/602.diff","patch_url":"https://github.com/SpineEventEngine/core-java/pull/602.patch","issue_url":"https://api.github.com/repos/SpineEventEngine/core-java/issues/602","number":602,"state":"open","locked":false,"title":"Remove an enrichment information from events before storing to `AggregateStorage`","user":{"login":"dmytro-grankin","id":25301769,"avatar_url":"https://avatars2.githubusercontent.com/u/25301769?v=4","gravatar_id":"","url":"https://api.github.com/users/dmytro-grankin","html_url":"https://github.com/dmytro-grankin","followers_url":"https://api.github.com/users/dmytro-grankin/followers","following_url":"https://api.github.com/users/dmytro-grankin/following{/other_user}","gists_url":"https://api.github.com/users/dmytro-grankin/gists{/gist_id}","starred_url":"https://api.github.com/users/dmytro-grankin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmytro-grankin/subscriptions","organizations_url":"https://api.github.com/users/dmytro-grankin/orgs","repos_url":"https://api.github.com/users/dmytro-grankin/repos","events_url":"https://api.github.com/users/dmytro-grankin/events{/privacy}","received_events_url":"https://api.github.com/users/dmytro-grankin/received_events","type":"User","site_admin":false},"body":"Storage of `Aggregate` event records stores event enrichments, that aren't needed and take a lot of space.\r\n\r\nTo fix this behavior, `AggregateStorage.writeEvent(...)` method was changed and now it clears enrichments from the event context and the enrichment from the first-level origin of the specified event. But the event will still contain enrichments from second-level and deeper origins, because their removal is a heavy performance operation.\r\n\r\nOther changes:\r\n* `EEntity` was fixed. Now, it removes only enrichments from an event.\r\n* `GivenEnrichment` utility was introduced.\r\n* The framework version was increased to `0.9.78-SNAPSHOT`.\r\n","created_at":"2017-10-13T12:50:00Z","updated_at":"2017-10-17T06:51:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4c56d69c942e1b985c0fa21c5494d7b62a8cb1f3","assignee":{"login":"dmytro-grankin","id":25301769,"avatar_url":"https://avatars2.githubusercontent.com/u/25301769?v=4","gravatar_id":"","url":"https://api.github.com/users/dmytro-grankin","html_url":"https://github.com/dmytro-grankin","followers_url":"https://api.github.com/users/dmytro-grankin/followers","following_url":"https://api.github.com/users/dmytro-grankin/following{/other_user}","gists_url":"https://api.github.com/users/dmytro-grankin/gists{/gist_id}","starred_url":"https://api.github.com/users/dmytro-grankin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmytro-grankin/subscriptions","organizations_url":"https://api.github.com/users/dmytro-grankin/orgs","repos_url":"https://api.github.com/users/dmytro-grankin/repos","events_url":"https://api.github.com/users/dmytro-grankin/events{/privacy}","received_events_url":"https://api.github.com/users/dmytro-grankin/received_events","type":"User","site_admin":false},"assignees":[{"login":"dmytro-grankin","id":25301769,"avatar_url":"https://avatars2.githubusercontent.com/u/25301769?v=4","gravatar_id":"","url":"https://api.github.com/users/dmytro-grankin","html_url":"https://github.com/dmytro-grankin","followers_url":"https://api.github.com/users/dmytro-grankin/followers","following_url":"https://api.github.com/users/dmytro-grankin/following{/other_user}","gists_url":"https://api.github.com/users/dmytro-grankin/gists{/gist_id}","starred_url":"https://api.github.com/users/dmytro-grankin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmytro-grankin/subscriptions","organizations_url":"https://api.github.com/users/dmytro-grankin/orgs","repos_url":"https://api.github.com/users/dmytro-grankin/repos","events_url":"https://api.github.com/users/dmytro-grankin/events{/privacy}","received_events_url":"https://api.github.com/users/dmytro-grankin/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/SpineEventEngine/core-java/pulls/602/commits","review_comments_url":"https://api.github.com/repos/SpineEventEngine/core-java/pulls/602/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/602/comments","statuses_url":"https://api.github.com/repos/SpineEventEngine/core-java/statuses/dc085c3dd063fb7e9cbc48505b6f7a466957604b","head":{"label":"SpineEventEngine:aggregate-storage-events-compacting","ref":"aggregate-storage-events-compacting","sha":"dc085c3dd063fb7e9cbc48505b6f7a466957604b","user":{"login":"SpineEventEngine","id":12821626,"avatar_url":"https://avatars3.githubusercontent.com/u/12821626?v=4","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://avatars3.githubusercontent.com/u/12821626?v=4","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":"2017-04-03T10:55:50Z","pushed_at":"2017-10-16T16:36:44Z","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":17719,"stargazers_count":5,"watchers_count":5,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":44,"forks":3,"open_issues":44,"watchers":5,"default_branch":"master"}},"base":{"label":"SpineEventEngine:master","ref":"master","sha":"d2028370f773dab94c46a8ea089036540a6fa74e","user":{"login":"SpineEventEngine","id":12821626,"avatar_url":"https://avatars3.githubusercontent.com/u/12821626?v=4","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://avatars3.githubusercontent.com/u/12821626?v=4","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":"2017-04-03T10:55:50Z","pushed_at":"2017-10-16T16:36:44Z","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":17719,"stargazers_count":5,"watchers_count":5,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":44,"forks":3,"open_issues":44,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/SpineEventEngine/core-java/pulls/602"},"html":{"href":"https://github.com/SpineEventEngine/core-java/pull/602"},"issue":{"href":"https://api.github.com/repos/SpineEventEngine/core-java/issues/602"},"comments":{"href":"https://api.github.com/repos/SpineEventEngine/core-java/issues/602/comments"},"review_comments":{"href":"https://api.github.com/repos/SpineEventEngine/core-java/pulls/602/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/602/commits"},"statuses":{"href":"https://api.github.com/repos/SpineEventEngine/core-java/statuses/dc085c3dd063fb7e9cbc48505b6f7a466957604b"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"armiol"}}