{"action":"created","comment":{"url":"https://api.github.com/repos/codice/ddf/pulls/comments/67529780","id":67529780,"diff_hunk":"@@ -0,0 +1,445 @@\n+package ddf.catalog.history;\n+\n+import static com.google.common.base.Strings.isNullOrEmpty;\n+import static ddf.catalog.Constants.CONTENT_PATHS;\n+import static ddf.catalog.core.versioning.MetacardVersion.HISTORY_METACARDS_PROPERTY;\n+\n+import java.io.IOException;\n+import java.io.InputStream;\n+import java.io.Serializable;\n+import java.nio.file.Path;\n+import java.util.ArrayList;\n+import java.util.Collections;\n+import java.util.HashMap;\n+import java.util.List;\n+import java.util.Map;\n+import java.util.Optional;\n+import java.util.UUID;\n+import java.util.concurrent.Callable;\n+import java.util.concurrent.TimeUnit;\n+import java.util.stream.Collectors;\n+\n+import javax.annotation.Nullable;\n+\n+import org.apache.shiro.SecurityUtils;\n+import org.slf4j.Logger;\n+import org.slf4j.LoggerFactory;\n+\n+import com.google.common.cache.Cache;\n+import com.google.common.cache.CacheBuilder;\n+import com.google.common.io.ByteSource;\n+import com.google.common.io.Files;\n+\n+import ddf.catalog.CatalogFramework;\n+import ddf.catalog.content.StorageException;\n+import ddf.catalog.content.StorageProvider;\n+import ddf.catalog.content.data.ContentItem;\n+import ddf.catalog.content.data.impl.ContentItemImpl;\n+import ddf.catalog.content.operation.CreateStorageRequest;\n+import ddf.catalog.content.operation.CreateStorageResponse;\n+import ddf.catalog.content.operation.UpdateStorageRequest;\n+import ddf.catalog.content.operation.UpdateStorageResponse;\n+import ddf.catalog.content.operation.impl.CreateStorageRequestImpl;\n+import ddf.catalog.core.versioning.MetacardVersion;\n+import ddf.catalog.data.Metacard;\n+import ddf.catalog.data.impl.AttributeImpl;\n+import ddf.catalog.operation.CreateRequest;\n+import ddf.catalog.operation.CreateResponse;\n+import ddf.catalog.operation.Operation;\n+import ddf.catalog.operation.Update;\n+import ddf.catalog.operation.UpdateResponse;\n+import ddf.catalog.operation.impl.CreateRequestImpl;\n+import ddf.catalog.operation.impl.CreateResponseImpl;\n+import ddf.catalog.source.CatalogProvider;\n+import ddf.catalog.source.IngestException;\n+import ddf.catalog.source.SourceUnavailableException;\n+\n+public class Historian {\n+    public static final String ALREADY_VERSIONED = \"already-versioned\";\n+\n+    private static final Logger LOGGER = LoggerFactory.getLogger(Historian.class);\n+\n+    private static final String HISTORY_METACARDS = \"history-metacards\";\n+\n+    private boolean historyEnabled = true;\n+\n+    private List<StorageProvider> storageProviders;\n+\n+    private List<CatalogProvider> catalogProviders;\n+\n+    private CatalogFramework catalogFramework;\n+\n+    public Historian() {\n+    }\n+\n+    private final Map<String, List<Callable<Boolean>>> staged = new HashMap<>();\n+\n+    public CreateRequest versionCreate(CreateRequest createRequest) throws IngestException {\n+        if (doSkip(createRequest)) {\n+            return createRequest;\n+        }\n+\n+        List<Metacard> updatedMetacardList = createRequest.getMetacards()\n+                .stream()\n+                .filter(MetacardVersion::isNotVersion)\n+                .map(m -> new MetacardVersion(m,\n+                        MetacardVersion.Action.CREATED,\n+                        SecurityUtils.getSubject()))","path":"catalog/core/catalog-core-standardframework/src/main/java/ddf/catalog/history/Historian.java","position":87,"original_position":87,"commit_id":"7abcbd7af330127d92095c85c255cc9222bcf7af","original_commit_id":"7abcbd7af330127d92095c85c255cc9222bcf7af","user":{"login":"kcwire","id":4631300,"avatar_url":"https://avatars.githubusercontent.com/u/4631300?v=3","gravatar_id":"","url":"https://api.github.com/users/kcwire","html_url":"https://github.com/kcwire","followers_url":"https://api.github.com/users/kcwire/followers","following_url":"https://api.github.com/users/kcwire/following{/other_user}","gists_url":"https://api.github.com/users/kcwire/gists{/gist_id}","starred_url":"https://api.github.com/users/kcwire/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kcwire/subscriptions","organizations_url":"https://api.github.com/users/kcwire/orgs","repos_url":"https://api.github.com/users/kcwire/repos","events_url":"https://api.github.com/users/kcwire/events{/privacy}","received_events_url":"https://api.github.com/users/kcwire/received_events","type":"User","site_admin":false},"body":"are we versioning as the current user or as the system?","created_at":"2016-06-17T15:33:53Z","updated_at":"2016-06-17T15:33:53Z","html_url":"https://github.com/codice/ddf/pull/868#discussion_r67529780","pull_request_url":"https://api.github.com/repos/codice/ddf/pulls/868","_links":{"self":{"href":"https://api.github.com/repos/codice/ddf/pulls/comments/67529780"},"html":{"href":"https://github.com/codice/ddf/pull/868#discussion_r67529780"},"pull_request":{"href":"https://api.github.com/repos/codice/ddf/pulls/868"}}},"pull_request":{"url":"https://api.github.com/repos/codice/ddf/pulls/868","id":74168555,"html_url":"https://github.com/codice/ddf/pull/868","diff_url":"https://github.com/codice/ddf/pull/868.diff","patch_url":"https://github.com/codice/ddf/pull/868.patch","issue_url":"https://api.github.com/repos/codice/ddf/issues/868","number":868,"state":"open","locked":false,"title":"DDF-2131 Content Versioning V2","user":{"login":"rzwiefel","id":9013416,"avatar_url":"https://avatars.githubusercontent.com/u/9013416?v=3","gravatar_id":"","url":"https://api.github.com/users/rzwiefel","html_url":"https://github.com/rzwiefel","followers_url":"https://api.github.com/users/rzwiefel/followers","following_url":"https://api.github.com/users/rzwiefel/following{/other_user}","gists_url":"https://api.github.com/users/rzwiefel/gists{/gist_id}","starred_url":"https://api.github.com/users/rzwiefel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rzwiefel/subscriptions","organizations_url":"https://api.github.com/users/rzwiefel/orgs","repos_url":"https://api.github.com/users/rzwiefel/repos","events_url":"https://api.github.com/users/rzwiefel/events{/privacy}","received_events_url":"https://api.github.com/users/rzwiefel/received_events","type":"User","site_admin":false},"body":"#### What does this PR do?\r\nAdds the ability to version content in the Catalog Framework\r\n\r\n#### Who is reviewing it (please choose AT LEAST two reviewers that need to approve the PR before it can get merged; if a component team is listed, at least one of its members needs to approve)?\r\n\r\n@kcwire\r\n@stustison \r\n@coyotesqrl \r\n@jrnorth \r\n@glenhein \r\n@bdeining \r\n@dcruver \r\n\r\n\r\n#### Choose 2 committers to review/merge the PR (please choose ONLY two committers from below, delete the rest).\r\n\r\n@jlcsmith \r\n@pklinef\r\n\r\n","created_at":"2016-06-16T23:26:34Z","updated_at":"2016-06-17T15:33:53Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/codice/ddf/pulls/868/commits","review_comments_url":"https://api.github.com/repos/codice/ddf/pulls/868/comments","review_comment_url":"https://api.github.com/repos/codice/ddf/pulls/comments{/number}","comments_url":"https://api.github.com/repos/codice/ddf/issues/868/comments","statuses_url":"https://api.github.com/repos/codice/ddf/statuses/7abcbd7af330127d92095c85c255cc9222bcf7af","head":{"label":"rzwiefel:DDF-2131-Content-Versioning-v2","ref":"DDF-2131-Content-Versioning-v2","sha":"7abcbd7af330127d92095c85c255cc9222bcf7af","user":{"login":"rzwiefel","id":9013416,"avatar_url":"https://avatars.githubusercontent.com/u/9013416?v=3","gravatar_id":"","url":"https://api.github.com/users/rzwiefel","html_url":"https://github.com/rzwiefel","followers_url":"https://api.github.com/users/rzwiefel/followers","following_url":"https://api.github.com/users/rzwiefel/following{/other_user}","gists_url":"https://api.github.com/users/rzwiefel/gists{/gist_id}","starred_url":"https://api.github.com/users/rzwiefel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rzwiefel/subscriptions","organizations_url":"https://api.github.com/users/rzwiefel/orgs","repos_url":"https://api.github.com/users/rzwiefel/repos","events_url":"https://api.github.com/users/rzwiefel/events{/privacy}","received_events_url":"https://api.github.com/users/rzwiefel/received_events","type":"User","site_admin":false},"repo":{"id":37286795,"name":"ddf","full_name":"rzwiefel/ddf","owner":{"login":"rzwiefel","id":9013416,"avatar_url":"https://avatars.githubusercontent.com/u/9013416?v=3","gravatar_id":"","url":"https://api.github.com/users/rzwiefel","html_url":"https://github.com/rzwiefel","followers_url":"https://api.github.com/users/rzwiefel/followers","following_url":"https://api.github.com/users/rzwiefel/following{/other_user}","gists_url":"https://api.github.com/users/rzwiefel/gists{/gist_id}","starred_url":"https://api.github.com/users/rzwiefel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rzwiefel/subscriptions","organizations_url":"https://api.github.com/users/rzwiefel/orgs","repos_url":"https://api.github.com/users/rzwiefel/repos","events_url":"https://api.github.com/users/rzwiefel/events{/privacy}","received_events_url":"https://api.github.com/users/rzwiefel/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rzwiefel/ddf","description":"The Distributed Data Framework - Distribution, SDK, and Test","fork":true,"url":"https://api.github.com/repos/rzwiefel/ddf","forks_url":"https://api.github.com/repos/rzwiefel/ddf/forks","keys_url":"https://api.github.com/repos/rzwiefel/ddf/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rzwiefel/ddf/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rzwiefel/ddf/teams","hooks_url":"https://api.github.com/repos/rzwiefel/ddf/hooks","issue_events_url":"https://api.github.com/repos/rzwiefel/ddf/issues/events{/number}","events_url":"https://api.github.com/repos/rzwiefel/ddf/events","assignees_url":"https://api.github.com/repos/rzwiefel/ddf/assignees{/user}","branches_url":"https://api.github.com/repos/rzwiefel/ddf/branches{/branch}","tags_url":"https://api.github.com/repos/rzwiefel/ddf/tags","blobs_url":"https://api.github.com/repos/rzwiefel/ddf/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rzwiefel/ddf/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rzwiefel/ddf/git/refs{/sha}","trees_url":"https://api.github.com/repos/rzwiefel/ddf/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rzwiefel/ddf/statuses/{sha}","languages_url":"https://api.github.com/repos/rzwiefel/ddf/languages","stargazers_url":"https://api.github.com/repos/rzwiefel/ddf/stargazers","contributors_url":"https://api.github.com/repos/rzwiefel/ddf/contributors","subscribers_url":"https://api.github.com/repos/rzwiefel/ddf/subscribers","subscription_url":"https://api.github.com/repos/rzwiefel/ddf/subscription","commits_url":"https://api.github.com/repos/rzwiefel/ddf/commits{/sha}","git_commits_url":"https://api.github.com/repos/rzwiefel/ddf/git/commits{/sha}","comments_url":"https://api.github.com/repos/rzwiefel/ddf/comments{/number}","issue_comment_url":"https://api.github.com/repos/rzwiefel/ddf/issues/comments{/number}","contents_url":"https://api.github.com/repos/rzwiefel/ddf/contents/{+path}","compare_url":"https://api.github.com/repos/rzwiefel/ddf/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rzwiefel/ddf/merges","archive_url":"https://api.github.com/repos/rzwiefel/ddf/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rzwiefel/ddf/downloads","issues_url":"https://api.github.com/repos/rzwiefel/ddf/issues{/number}","pulls_url":"https://api.github.com/repos/rzwiefel/ddf/pulls{/number}","milestones_url":"https://api.github.com/repos/rzwiefel/ddf/milestones{/number}","notifications_url":"https://api.github.com/repos/rzwiefel/ddf/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rzwiefel/ddf/labels{/name}","releases_url":"https://api.github.com/repos/rzwiefel/ddf/releases{/id}","deployments_url":"https://api.github.com/repos/rzwiefel/ddf/deployments","created_at":"2015-06-11T21:19:40Z","updated_at":"2016-02-01T21:59:06Z","pushed_at":"2016-06-16T23:22:39Z","git_url":"git://github.com/rzwiefel/ddf.git","ssh_url":"git@github.com:rzwiefel/ddf.git","clone_url":"https://github.com/rzwiefel/ddf.git","svn_url":"https://github.com/rzwiefel/ddf","homepage":"","size":144535,"stargazers_count":0,"watchers_count":0,"language":"Java","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":"master"}},"base":{"label":"codice:master","ref":"master","sha":"59130844279c6d4e8c5adaff397719fab17130c4","user":{"login":"codice","id":2386734,"avatar_url":"https://avatars.githubusercontent.com/u/2386734?v=3","gravatar_id":"","url":"https://api.github.com/users/codice","html_url":"https://github.com/codice","followers_url":"https://api.github.com/users/codice/followers","following_url":"https://api.github.com/users/codice/following{/other_user}","gists_url":"https://api.github.com/users/codice/gists{/gist_id}","starred_url":"https://api.github.com/users/codice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codice/subscriptions","organizations_url":"https://api.github.com/users/codice/orgs","repos_url":"https://api.github.com/users/codice/repos","events_url":"https://api.github.com/users/codice/events{/privacy}","received_events_url":"https://api.github.com/users/codice/received_events","type":"Organization","site_admin":false},"repo":{"id":15173563,"name":"ddf","full_name":"codice/ddf","owner":{"login":"codice","id":2386734,"avatar_url":"https://avatars.githubusercontent.com/u/2386734?v=3","gravatar_id":"","url":"https://api.github.com/users/codice","html_url":"https://github.com/codice","followers_url":"https://api.github.com/users/codice/followers","following_url":"https://api.github.com/users/codice/following{/other_user}","gists_url":"https://api.github.com/users/codice/gists{/gist_id}","starred_url":"https://api.github.com/users/codice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codice/subscriptions","organizations_url":"https://api.github.com/users/codice/orgs","repos_url":"https://api.github.com/users/codice/repos","events_url":"https://api.github.com/users/codice/events{/privacy}","received_events_url":"https://api.github.com/users/codice/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/codice/ddf","description":"Distributed Data Framework - an open source, modular integration framework.","fork":false,"url":"https://api.github.com/repos/codice/ddf","forks_url":"https://api.github.com/repos/codice/ddf/forks","keys_url":"https://api.github.com/repos/codice/ddf/keys{/key_id}","collaborators_url":"https://api.github.com/repos/codice/ddf/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/codice/ddf/teams","hooks_url":"https://api.github.com/repos/codice/ddf/hooks","issue_events_url":"https://api.github.com/repos/codice/ddf/issues/events{/number}","events_url":"https://api.github.com/repos/codice/ddf/events","assignees_url":"https://api.github.com/repos/codice/ddf/assignees{/user}","branches_url":"https://api.github.com/repos/codice/ddf/branches{/branch}","tags_url":"https://api.github.com/repos/codice/ddf/tags","blobs_url":"https://api.github.com/repos/codice/ddf/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/codice/ddf/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/codice/ddf/git/refs{/sha}","trees_url":"https://api.github.com/repos/codice/ddf/git/trees{/sha}","statuses_url":"https://api.github.com/repos/codice/ddf/statuses/{sha}","languages_url":"https://api.github.com/repos/codice/ddf/languages","stargazers_url":"https://api.github.com/repos/codice/ddf/stargazers","contributors_url":"https://api.github.com/repos/codice/ddf/contributors","subscribers_url":"https://api.github.com/repos/codice/ddf/subscribers","subscription_url":"https://api.github.com/repos/codice/ddf/subscription","commits_url":"https://api.github.com/repos/codice/ddf/commits{/sha}","git_commits_url":"https://api.github.com/repos/codice/ddf/git/commits{/sha}","comments_url":"https://api.github.com/repos/codice/ddf/comments{/number}","issue_comment_url":"https://api.github.com/repos/codice/ddf/issues/comments{/number}","contents_url":"https://api.github.com/repos/codice/ddf/contents/{+path}","compare_url":"https://api.github.com/repos/codice/ddf/compare/{base}...{head}","merges_url":"https://api.github.com/repos/codice/ddf/merges","archive_url":"https://api.github.com/repos/codice/ddf/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/codice/ddf/downloads","issues_url":"https://api.github.com/repos/codice/ddf/issues{/number}","pulls_url":"https://api.github.com/repos/codice/ddf/pulls{/number}","milestones_url":"https://api.github.com/repos/codice/ddf/milestones{/number}","notifications_url":"https://api.github.com/repos/codice/ddf/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/codice/ddf/labels{/name}","releases_url":"https://api.github.com/repos/codice/ddf/releases{/id}","deployments_url":"https://api.github.com/repos/codice/ddf/deployments","created_at":"2013-12-13T20:38:28Z","updated_at":"2016-06-14T21:40:37Z","pushed_at":"2016-06-17T13:58:24Z","git_url":"git://github.com/codice/ddf.git","ssh_url":"git@github.com:codice/ddf.git","clone_url":"https://github.com/codice/ddf.git","svn_url":"https://github.com/codice/ddf","homepage":"http://ddf.codice.org","size":271611,"stargazers_count":39,"watchers_count":39,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":81,"mirror_url":null,"open_issues_count":18,"forks":81,"open_issues":18,"watchers":39,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/codice/ddf/pulls/868"},"html":{"href":"https://github.com/codice/ddf/pull/868"},"issue":{"href":"https://api.github.com/repos/codice/ddf/issues/868"},"comments":{"href":"https://api.github.com/repos/codice/ddf/issues/868/comments"},"review_comments":{"href":"https://api.github.com/repos/codice/ddf/pulls/868/comments"},"review_comment":{"href":"https://api.github.com/repos/codice/ddf/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/codice/ddf/pulls/868/commits"},"statuses":{"href":"https://api.github.com/repos/codice/ddf/statuses/7abcbd7af330127d92095c85c255cc9222bcf7af"}}}}
{"actor":{"display_login":"kcwire"}}