{"action":"created","comment":{"url":"https://api.github.com/repos/kbase/KBaseSearchEngine/pulls/comments/175328960","pull_request_review_id":104783827,"id":175328960,"diff_hunk":"@@ -649,4 +678,143 @@ private static String toWSRefPath(final List<GUID> objectRefPath) {\n         return String.join(\";\", refpath);\n     }\n \n+    @Override\n+    public StatusEvent updateEvent(final StatusEvent ev)\n+            throws IndexingException,\n+                   RetriableIndexingException {\n+\n+        // only object level events are updated below\n+        if (!ObjectEventQueue.OBJ_LVL_EVENTS.contains(ev.getEventType())) {\n+            return ev;\n+        }\n+\n+        // brute force get latest state and update event as event can be played\n+        // out of order in the case of failed events being replayed.\n+\n+        // states to update\n+        final StatusEventType latestEventType = ev.getEventType();\n+        Boolean latestIsPublic = null;\n+        String latestName = null;\n+\n+        if (ev.isPublic().isPresent()) {\n+            latestIsPublic = ev.isPublic().get().booleanValue();\n+        }\n+        if (ev.getNewName().isPresent()) {\n+            latestName = ev.getNewName().get().toString();\n+        }\n+\n+\n+        // wsid and objid of the object that the specified StatusEvent is an event for\n+        final int wsid = ev.getAccessGroupId().get();\n+        final long objid = Long.valueOf(ev.getAccessGroupObjectId().get().toString()).longValue();\n+\n+        Map<String, Object> command;\n+\n+        // check if workspace is permanently deleted or marked as deleted\n+        try {\n+            final Tuple9 tuple = getWorkspaceInfo(wsid);\n+        } catch(IOException ex) {\n+            throw new RetriableIndexingException(ErrorType.OTHER, ex.getMessage());\n+        } catch(JsonClientException ex) {\n+            // hacky: if exception message is changed, this logic will silently fail\n+            if (ex.getMessage().contains(\"No workspace with id \")) {\n+                return StatusEvent.\n+                        getBuilder(ev.getStorageObjectType().get(), ev.getTimestamp(),\n+                                StatusEventType.DELETE_ALL_VERSIONS).\n+                        withNullableAccessGroupID(wsid).\n+                        withNullableObjectID(Long.toString(objid)).build();\n+            }\n+        }\n+\n+        // check if object is permanently deleted or marked as deleted\n+        command = new HashMap<>();\n+        command.put(\"command\", \"listObjects\");\n+        command.put(\"params\", new ListObjectsParams().\n+                                         withIds(Arrays.asList((long)wsid)).\n+                                         withMinObjectID(objid-1).\n+                                         withMaxObjectID(objid+1));\n+        try {\n+            boolean objidExists = false;\n+\n+            final List<List> objList = ws.getClient().administer(new UObject(command))\n+                    .asClassInstance(List.class);\n+\n+            for (List obj : objList) {\n+                final long id = (long) ((Integer) obj.get(0)).intValue();\n+                if (id == objid) {\n+                    objidExists = true;\n+                    break;\n+                }\n+            }\n+\n+            if (!objidExists) {\n+                return StatusEvent.\n+                        getBuilder(ev.getStorageObjectType().get(), ev.getTimestamp(),\n+                                StatusEventType.DELETE_ALL_VERSIONS).\n+                        withNullableAccessGroupID(wsid).\n+                        withNullableObjectID(Long.toString(objid)).build();\n+            }\n+        } catch (IOException ex) {\n+            throw new RetriableIndexingException(ErrorType.OTHER, ex.getMessage());\n+        } catch (JsonClientException ex) {\n+            // really think it should be IndexingException here\n+            // but IndexingException has a protected constructor\n+            throw new RetriableIndexingException(ErrorType.OTHER, ex.getMessage());\n+        }\n+\n+        // check if name has changed and update state of lastestName\n+        ObjectSpecification os = new ObjectSpecification().withRef(\n+        ev.getAccessGroupId().get().toString() + \"/\" +\n+                        ev.getAccessGroupObjectId().get());\n+\n+        final List<ObjectSpecification> getInfoInput = new ArrayList<>();\n+        getInfoInput.add(os);\n+\n+        command = new HashMap<>();\n+        command.put(\"command\", \"getObjectInfo\");\n+        command.put(\"params\", new GetObjectInfo3Params().withObjects(getInfoInput));\n+\n+        final GetObjectInfo3Results objInfo;\n+        try {\n+            objInfo = ws.getClient().administer(new UObject(command))\n+                                        .asClassInstance(GetObjectInfo3Results.class);\n+            String name = objInfo.getInfos().get(0).getE2();\n+            if (!Utils.isNullOrEmpty(name)) {","path":"lib/src/kbasesearchengine/events/handler/WorkspaceEventHandler.java","position":177,"original_position":177,"commit_id":"3bc935286180194e94d5db21f6a9db6f64cd6b0c","original_commit_id":"3bc935286180194e94d5db21f6a9db6f64cd6b0c","user":{"login":"MrCreosote","id":1686141,"avatar_url":"https://avatars1.githubusercontent.com/u/1686141?v=4","gravatar_id":"","url":"https://api.github.com/users/MrCreosote","html_url":"https://github.com/MrCreosote","followers_url":"https://api.github.com/users/MrCreosote/followers","following_url":"https://api.github.com/users/MrCreosote/following{/other_user}","gists_url":"https://api.github.com/users/MrCreosote/gists{/gist_id}","starred_url":"https://api.github.com/users/MrCreosote/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MrCreosote/subscriptions","organizations_url":"https://api.github.com/users/MrCreosote/orgs","repos_url":"https://api.github.com/users/MrCreosote/repos","events_url":"https://api.github.com/users/MrCreosote/events{/privacy}","received_events_url":"https://api.github.com/users/MrCreosote/received_events","type":"User","site_admin":false},"body":"This is guaranteed to be true.","created_at":"2018-03-19T04:26:07Z","updated_at":"2018-03-19T04:28:42Z","html_url":"https://github.com/kbase/KBaseSearchEngine/pull/168#discussion_r175328960","pull_request_url":"https://api.github.com/repos/kbase/KBaseSearchEngine/pulls/168","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/kbase/KBaseSearchEngine/pulls/comments/175328960"},"html":{"href":"https://github.com/kbase/KBaseSearchEngine/pull/168#discussion_r175328960"},"pull_request":{"href":"https://api.github.com/repos/kbase/KBaseSearchEngine/pulls/168"}}},"pull_request":{"url":"https://api.github.com/repos/kbase/KBaseSearchEngine/pulls/168","id":168653444,"html_url":"https://github.com/kbase/KBaseSearchEngine/pull/168","diff_url":"https://github.com/kbase/KBaseSearchEngine/pull/168.diff","patch_url":"https://github.com/kbase/KBaseSearchEngine/pull/168.patch","issue_url":"https://api.github.com/repos/kbase/KBaseSearchEngine/issues/168","number":168,"state":"open","locked":false,"title":"SCT-398: rerun failed events","user":{"login":"arfathpasha","id":13394200,"avatar_url":"https://avatars1.githubusercontent.com/u/13394200?v=4","gravatar_id":"","url":"https://api.github.com/users/arfathpasha","html_url":"https://github.com/arfathpasha","followers_url":"https://api.github.com/users/arfathpasha/followers","following_url":"https://api.github.com/users/arfathpasha/following{/other_user}","gists_url":"https://api.github.com/users/arfathpasha/gists{/gist_id}","starred_url":"https://api.github.com/users/arfathpasha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arfathpasha/subscriptions","organizations_url":"https://api.github.com/users/arfathpasha/orgs","repos_url":"https://api.github.com/users/arfathpasha/repos","events_url":"https://api.github.com/users/arfathpasha/events{/privacy}","received_events_url":"https://api.github.com/users/arfathpasha/received_events","type":"User","site_admin":false},"body":"- Timestamps of events that are being reset and updated are left unchanged. \r\n- unit tests for updateEvents method will follow in a separate PR.","created_at":"2018-02-12T18:25:17Z","updated_at":"2018-03-19T04:28:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"709d6c700b7c04a2c31fb2a89f6d2ede3075fb9e","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/kbase/KBaseSearchEngine/pulls/168/commits","review_comments_url":"https://api.github.com/repos/kbase/KBaseSearchEngine/pulls/168/comments","review_comment_url":"https://api.github.com/repos/kbase/KBaseSearchEngine/pulls/comments{/number}","comments_url":"https://api.github.com/repos/kbase/KBaseSearchEngine/issues/168/comments","statuses_url":"https://api.github.com/repos/kbase/KBaseSearchEngine/statuses/3bc935286180194e94d5db21f6a9db6f64cd6b0c","head":{"label":"arfathpasha:develop","ref":"develop","sha":"3bc935286180194e94d5db21f6a9db6f64cd6b0c","user":{"login":"arfathpasha","id":13394200,"avatar_url":"https://avatars1.githubusercontent.com/u/13394200?v=4","gravatar_id":"","url":"https://api.github.com/users/arfathpasha","html_url":"https://github.com/arfathpasha","followers_url":"https://api.github.com/users/arfathpasha/followers","following_url":"https://api.github.com/users/arfathpasha/following{/other_user}","gists_url":"https://api.github.com/users/arfathpasha/gists{/gist_id}","starred_url":"https://api.github.com/users/arfathpasha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arfathpasha/subscriptions","organizations_url":"https://api.github.com/users/arfathpasha/orgs","repos_url":"https://api.github.com/users/arfathpasha/repos","events_url":"https://api.github.com/users/arfathpasha/events{/privacy}","received_events_url":"https://api.github.com/users/arfathpasha/received_events","type":"User","site_admin":false},"repo":{"id":113391788,"name":"KBaseSearchEngine","full_name":"arfathpasha/KBaseSearchEngine","owner":{"login":"arfathpasha","id":13394200,"avatar_url":"https://avatars1.githubusercontent.com/u/13394200?v=4","gravatar_id":"","url":"https://api.github.com/users/arfathpasha","html_url":"https://github.com/arfathpasha","followers_url":"https://api.github.com/users/arfathpasha/followers","following_url":"https://api.github.com/users/arfathpasha/following{/other_user}","gists_url":"https://api.github.com/users/arfathpasha/gists{/gist_id}","starred_url":"https://api.github.com/users/arfathpasha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arfathpasha/subscriptions","organizations_url":"https://api.github.com/users/arfathpasha/orgs","repos_url":"https://api.github.com/users/arfathpasha/repos","events_url":"https://api.github.com/users/arfathpasha/events{/privacy}","received_events_url":"https://api.github.com/users/arfathpasha/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/arfathpasha/KBaseSearchEngine","description":null,"fork":true,"url":"https://api.github.com/repos/arfathpasha/KBaseSearchEngine","forks_url":"https://api.github.com/repos/arfathpasha/KBaseSearchEngine/forks","keys_url":"https://api.github.com/repos/arfathpasha/KBaseSearchEngine/keys{/key_id}","collaborators_url":"https://api.github.com/repos/arfathpasha/KBaseSearchEngine/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/arfathpasha/KBaseSearchEngine/teams","hooks_url":"https://api.github.com/repos/arfathpasha/KBaseSearchEngine/hooks","issue_events_url":"https://api.github.com/repos/arfathpasha/KBaseSearchEngine/issues/events{/number}","events_url":"https://api.github.com/repos/arfathpasha/KBaseSearchEngine/events","assignees_url":"https://api.github.com/repos/arfathpasha/KBaseSearchEngine/assignees{/user}","branches_url":"https://api.github.com/repos/arfathpasha/KBaseSearchEngine/branches{/branch}","tags_url":"https://api.github.com/repos/arfathpasha/KBaseSearchEngine/tags","blobs_url":"https://api.github.com/repos/arfathpasha/KBaseSearchEngine/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/arfathpasha/KBaseSearchEngine/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/arfathpasha/KBaseSearchEngine/git/refs{/sha}","trees_url":"https://api.github.com/repos/arfathpasha/KBaseSearchEngine/git/trees{/sha}","statuses_url":"https://api.github.com/repos/arfathpasha/KBaseSearchEngine/statuses/{sha}","languages_url":"https://api.github.com/repos/arfathpasha/KBaseSearchEngine/languages","stargazers_url":"https://api.github.com/repos/arfathpasha/KBaseSearchEngine/stargazers","contributors_url":"https://api.github.com/repos/arfathpasha/KBaseSearchEngine/contributors","subscribers_url":"https://api.github.com/repos/arfathpasha/KBaseSearchEngine/subscribers","subscription_url":"https://api.github.com/repos/arfathpasha/KBaseSearchEngine/subscription","commits_url":"https://api.github.com/repos/arfathpasha/KBaseSearchEngine/commits{/sha}","git_commits_url":"https://api.github.com/repos/arfathpasha/KBaseSearchEngine/git/commits{/sha}","comments_url":"https://api.github.com/repos/arfathpasha/KBaseSearchEngine/comments{/number}","issue_comment_url":"https://api.github.com/repos/arfathpasha/KBaseSearchEngine/issues/comments{/number}","contents_url":"https://api.github.com/repos/arfathpasha/KBaseSearchEngine/contents/{+path}","compare_url":"https://api.github.com/repos/arfathpasha/KBaseSearchEngine/compare/{base}...{head}","merges_url":"https://api.github.com/repos/arfathpasha/KBaseSearchEngine/merges","archive_url":"https://api.github.com/repos/arfathpasha/KBaseSearchEngine/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/arfathpasha/KBaseSearchEngine/downloads","issues_url":"https://api.github.com/repos/arfathpasha/KBaseSearchEngine/issues{/number}","pulls_url":"https://api.github.com/repos/arfathpasha/KBaseSearchEngine/pulls{/number}","milestones_url":"https://api.github.com/repos/arfathpasha/KBaseSearchEngine/milestones{/number}","notifications_url":"https://api.github.com/repos/arfathpasha/KBaseSearchEngine/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/arfathpasha/KBaseSearchEngine/labels{/name}","releases_url":"https://api.github.com/repos/arfathpasha/KBaseSearchEngine/releases{/id}","deployments_url":"https://api.github.com/repos/arfathpasha/KBaseSearchEngine/deployments","created_at":"2017-12-07T02:23:23Z","updated_at":"2017-12-07T02:23:25Z","pushed_at":"2018-03-16T20:11:33Z","git_url":"git://github.com/arfathpasha/KBaseSearchEngine.git","ssh_url":"git@github.com:arfathpasha/KBaseSearchEngine.git","clone_url":"https://github.com/arfathpasha/KBaseSearchEngine.git","svn_url":"https://github.com/arfathpasha/KBaseSearchEngine","homepage":null,"size":6258,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"kbase:develop","ref":"develop","sha":"487764e611b70df4d9e96732e92c3ee63a6eeeb4","user":{"login":"kbase","id":1263946,"avatar_url":"https://avatars2.githubusercontent.com/u/1263946?v=4","gravatar_id":"","url":"https://api.github.com/users/kbase","html_url":"https://github.com/kbase","followers_url":"https://api.github.com/users/kbase/followers","following_url":"https://api.github.com/users/kbase/following{/other_user}","gists_url":"https://api.github.com/users/kbase/gists{/gist_id}","starred_url":"https://api.github.com/users/kbase/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kbase/subscriptions","organizations_url":"https://api.github.com/users/kbase/orgs","repos_url":"https://api.github.com/users/kbase/repos","events_url":"https://api.github.com/users/kbase/events{/privacy}","received_events_url":"https://api.github.com/users/kbase/received_events","type":"Organization","site_admin":false},"repo":{"id":87230036,"name":"KBaseSearchEngine","full_name":"kbase/KBaseSearchEngine","owner":{"login":"kbase","id":1263946,"avatar_url":"https://avatars2.githubusercontent.com/u/1263946?v=4","gravatar_id":"","url":"https://api.github.com/users/kbase","html_url":"https://github.com/kbase","followers_url":"https://api.github.com/users/kbase/followers","following_url":"https://api.github.com/users/kbase/following{/other_user}","gists_url":"https://api.github.com/users/kbase/gists{/gist_id}","starred_url":"https://api.github.com/users/kbase/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kbase/subscriptions","organizations_url":"https://api.github.com/users/kbase/orgs","repos_url":"https://api.github.com/users/kbase/repos","events_url":"https://api.github.com/users/kbase/events{/privacy}","received_events_url":"https://api.github.com/users/kbase/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/kbase/KBaseSearchEngine","description":null,"fork":false,"url":"https://api.github.com/repos/kbase/KBaseSearchEngine","forks_url":"https://api.github.com/repos/kbase/KBaseSearchEngine/forks","keys_url":"https://api.github.com/repos/kbase/KBaseSearchEngine/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kbase/KBaseSearchEngine/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kbase/KBaseSearchEngine/teams","hooks_url":"https://api.github.com/repos/kbase/KBaseSearchEngine/hooks","issue_events_url":"https://api.github.com/repos/kbase/KBaseSearchEngine/issues/events{/number}","events_url":"https://api.github.com/repos/kbase/KBaseSearchEngine/events","assignees_url":"https://api.github.com/repos/kbase/KBaseSearchEngine/assignees{/user}","branches_url":"https://api.github.com/repos/kbase/KBaseSearchEngine/branches{/branch}","tags_url":"https://api.github.com/repos/kbase/KBaseSearchEngine/tags","blobs_url":"https://api.github.com/repos/kbase/KBaseSearchEngine/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kbase/KBaseSearchEngine/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kbase/KBaseSearchEngine/git/refs{/sha}","trees_url":"https://api.github.com/repos/kbase/KBaseSearchEngine/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kbase/KBaseSearchEngine/statuses/{sha}","languages_url":"https://api.github.com/repos/kbase/KBaseSearchEngine/languages","stargazers_url":"https://api.github.com/repos/kbase/KBaseSearchEngine/stargazers","contributors_url":"https://api.github.com/repos/kbase/KBaseSearchEngine/contributors","subscribers_url":"https://api.github.com/repos/kbase/KBaseSearchEngine/subscribers","subscription_url":"https://api.github.com/repos/kbase/KBaseSearchEngine/subscription","commits_url":"https://api.github.com/repos/kbase/KBaseSearchEngine/commits{/sha}","git_commits_url":"https://api.github.com/repos/kbase/KBaseSearchEngine/git/commits{/sha}","comments_url":"https://api.github.com/repos/kbase/KBaseSearchEngine/comments{/number}","issue_comment_url":"https://api.github.com/repos/kbase/KBaseSearchEngine/issues/comments{/number}","contents_url":"https://api.github.com/repos/kbase/KBaseSearchEngine/contents/{+path}","compare_url":"https://api.github.com/repos/kbase/KBaseSearchEngine/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kbase/KBaseSearchEngine/merges","archive_url":"https://api.github.com/repos/kbase/KBaseSearchEngine/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kbase/KBaseSearchEngine/downloads","issues_url":"https://api.github.com/repos/kbase/KBaseSearchEngine/issues{/number}","pulls_url":"https://api.github.com/repos/kbase/KBaseSearchEngine/pulls{/number}","milestones_url":"https://api.github.com/repos/kbase/KBaseSearchEngine/milestones{/number}","notifications_url":"https://api.github.com/repos/kbase/KBaseSearchEngine/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kbase/KBaseSearchEngine/labels{/name}","releases_url":"https://api.github.com/repos/kbase/KBaseSearchEngine/releases{/id}","deployments_url":"https://api.github.com/repos/kbase/KBaseSearchEngine/deployments","created_at":"2017-04-04T20:07:10Z","updated_at":"2018-03-16T18:25:22Z","pushed_at":"2018-03-16T20:11:35Z","git_url":"git://github.com/kbase/KBaseSearchEngine.git","ssh_url":"git@github.com:kbase/KBaseSearchEngine.git","clone_url":"https://github.com/kbase/KBaseSearchEngine.git","svn_url":"https://github.com/kbase/KBaseSearchEngine","homepage":null,"size":6194,"stargazers_count":1,"watchers_count":1,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":9,"mirror_url":null,"archived":false,"open_issues_count":4,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":9,"open_issues":4,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/kbase/KBaseSearchEngine/pulls/168"},"html":{"href":"https://github.com/kbase/KBaseSearchEngine/pull/168"},"issue":{"href":"https://api.github.com/repos/kbase/KBaseSearchEngine/issues/168"},"comments":{"href":"https://api.github.com/repos/kbase/KBaseSearchEngine/issues/168/comments"},"review_comments":{"href":"https://api.github.com/repos/kbase/KBaseSearchEngine/pulls/168/comments"},"review_comment":{"href":"https://api.github.com/repos/kbase/KBaseSearchEngine/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/kbase/KBaseSearchEngine/pulls/168/commits"},"statuses":{"href":"https://api.github.com/repos/kbase/KBaseSearchEngine/statuses/3bc935286180194e94d5db21f6a9db6f64cd6b0c"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"MrCreosote"}}