{"action":"created","comment":{"url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/pulls/comments/188313227","pull_request_review_id":120262547,"id":188313227,"diff_hunk":"@@ -0,0 +1,82 @@\n+package org.opentestsystem.ap.imrt.iis.service;\n+\n+import org.opentestsystem.ap.imrt.common.model.BaseItem;\n+import org.opentestsystem.ap.imrt.common.model.ItemGitInformation;\n+import org.opentestsystem.ap.imrt.common.model.Stimulus;\n+import org.opentestsystem.ap.imrt.common.repository.ImrtItemRepository;\n+import org.opentestsystem.ap.imrt.common.repository.StimulusLinkRepository;\n+import org.opentestsystem.ap.imrt.common.repository.StimulusRepository;\n+import org.opentestsystem.ap.imrt.common.service.OperationalEventService;\n+import org.opentestsystem.ap.imrt.iis.repository.ItemGitInformationRepository;\n+import org.opentestsystem.ap.imrt.iis.repository.ItemLogRepository;\n+import org.slf4j.Logger;\n+import org.slf4j.LoggerFactory;\n+import org.springframework.stereotype.Component;\n+import org.springframework.transaction.annotation.Transactional;\n+\n+@Component\n+public class ItemDeleteNotificationHandler {\n+    private static final Logger logger = LoggerFactory.getLogger(ItemDeleteNotificationHandler.class);\n+    private final OperationalEventService operationalEventService;\n+    private final ProjectLockService projectLockService;\n+    private final ImrtItemRepository imrtItemRepository;\n+    private final ItemGitInformationRepository itemGitInformationRepository;\n+    private final ItemLogRepository itemLogRepository;\n+    private final StimulusLinkRepository stimulusLinkRepository;\n+    private final StimulusRepository stimulusRepository;\n+\n+    public ItemDeleteNotificationHandler(final OperationalEventService operationalEventService,\n+                                         final ProjectLockService projectLockService,\n+                                         final ImrtItemRepository imrtItemRepository,\n+                                         final ItemGitInformationRepository itemGitInformationRepository,\n+                                         final ItemLogRepository itemLogRepository,\n+                                         final StimulusLinkRepository stimulusLinkRepository,\n+                                         final StimulusRepository stimulusRepository) {\n+        this.operationalEventService = operationalEventService;\n+        this.projectLockService = projectLockService;\n+        this.imrtItemRepository = imrtItemRepository;\n+        this.itemGitInformationRepository = itemGitInformationRepository;\n+        this.itemLogRepository = itemLogRepository;\n+        this.stimulusLinkRepository = stimulusLinkRepository;\n+        this.stimulusRepository = stimulusRepository;\n+    }\n+\n+    @Transactional\n+    public void processItemMessage(final Integer itemBankId) {\n+        logger.info(\"Received item delete message for {}\", itemBankId);\n+\n+        // get a lock on the project - a project should not be deleted if someone is actively working on it\n+        final long projectLockId = projectLockService.lockProject(itemBankId);\n+        logger.info(\"Acquired lock for item id {}\", itemBankId);\n+        try {\n+            final ItemGitInformation itemGitInformation = itemGitInformationRepository.findOneByProjectId(itemBankId)","path":"src/main/java/org/opentestsystem/ap/imrt/iis/service/ItemDeleteNotificationHandler.java","position":52,"original_position":52,"commit_id":"3ca6d1335fd8b44db77f5cce5fcaf88574937150","original_commit_id":"3ca6d1335fd8b44db77f5cce5fcaf88574937150","user":{"login":"millerts","id":726145,"avatar_url":"https://avatars1.githubusercontent.com/u/726145?v=4","gravatar_id":"","url":"https://api.github.com/users/millerts","html_url":"https://github.com/millerts","followers_url":"https://api.github.com/users/millerts/followers","following_url":"https://api.github.com/users/millerts/following{/other_user}","gists_url":"https://api.github.com/users/millerts/gists{/gist_id}","starred_url":"https://api.github.com/users/millerts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/millerts/subscriptions","organizations_url":"https://api.github.com/users/millerts/orgs","repos_url":"https://api.github.com/users/millerts/repos","events_url":"https://api.github.com/users/millerts/events{/privacy}","received_events_url":"https://api.github.com/users/millerts/received_events","type":"User","site_admin":false},"body":"Is this really an error?  For example, if we get a delete message for an item we never had do we care?  I don't think it'll happen often but what if we missed an item for whatever reason then they delete it before sync runs later that day.  Is that exceptional or can we just consider it deleted?","created_at":"2018-05-15T14:40:39Z","updated_at":"2018-05-15T14:45:10Z","html_url":"https://github.com/SmarterApp/AP_IMRT_ItemIngestService/pull/57#discussion_r188313227","pull_request_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/pulls/57","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/pulls/comments/188313227"},"html":{"href":"https://github.com/SmarterApp/AP_IMRT_ItemIngestService/pull/57#discussion_r188313227"},"pull_request":{"href":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/pulls/57"}}},"pull_request":{"url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/pulls/57","id":187999479,"html_url":"https://github.com/SmarterApp/AP_IMRT_ItemIngestService/pull/57","diff_url":"https://github.com/SmarterApp/AP_IMRT_ItemIngestService/pull/57.diff","patch_url":"https://github.com/SmarterApp/AP_IMRT_ItemIngestService/pull/57.patch","issue_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/issues/57","number":57,"state":"open","locked":false,"title":"IMRT-366: Feature/handle delete item","user":{"login":"jeffjohnson9046","id":1435800,"avatar_url":"https://avatars3.githubusercontent.com/u/1435800?v=4","gravatar_id":"","url":"https://api.github.com/users/jeffjohnson9046","html_url":"https://github.com/jeffjohnson9046","followers_url":"https://api.github.com/users/jeffjohnson9046/followers","following_url":"https://api.github.com/users/jeffjohnson9046/following{/other_user}","gists_url":"https://api.github.com/users/jeffjohnson9046/gists{/gist_id}","starred_url":"https://api.github.com/users/jeffjohnson9046/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeffjohnson9046/subscriptions","organizations_url":"https://api.github.com/users/jeffjohnson9046/orgs","repos_url":"https://api.github.com/users/jeffjohnson9046/repos","events_url":"https://api.github.com/users/jeffjohnson9046/events{/privacy}","received_events_url":"https://api.github.com/users/jeffjohnson9046/received_events","type":"User","site_admin":false},"body":"[IMRT-366](https://jira.fairwaytech.com/browse/IMRT-366):  Delete an item from the IMRT database when it is removed from GitLab (either via canceling item creation in IAT or removing the project from GitLab)\r\n\r\n**NOTE:** Where possible, the code in this PR followed the existing coding conventions.  For example, it'd be possible to create a common interface for `ItemDeleteNotificationHandler` and `ItemUpdateNotificationHandler`.  However, to keep the changes minimal, I did not create a common interface for these two classes.","created_at":"2018-05-15T02:39:42Z","updated_at":"2018-05-15T14:45:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c2f615713ce2dbc5a1e9d69ba2282232dcc6f43c","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/pulls/57/commits","review_comments_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/pulls/57/comments","review_comment_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/pulls/comments{/number}","comments_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/issues/57/comments","statuses_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/statuses/3ca6d1335fd8b44db77f5cce5fcaf88574937150","head":{"label":"SmarterApp:feature/handle-delete-item","ref":"feature/handle-delete-item","sha":"3ca6d1335fd8b44db77f5cce5fcaf88574937150","user":{"login":"SmarterApp","id":7026395,"avatar_url":"https://avatars0.githubusercontent.com/u/7026395?v=4","gravatar_id":"","url":"https://api.github.com/users/SmarterApp","html_url":"https://github.com/SmarterApp","followers_url":"https://api.github.com/users/SmarterApp/followers","following_url":"https://api.github.com/users/SmarterApp/following{/other_user}","gists_url":"https://api.github.com/users/SmarterApp/gists{/gist_id}","starred_url":"https://api.github.com/users/SmarterApp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SmarterApp/subscriptions","organizations_url":"https://api.github.com/users/SmarterApp/orgs","repos_url":"https://api.github.com/users/SmarterApp/repos","events_url":"https://api.github.com/users/SmarterApp/events{/privacy}","received_events_url":"https://api.github.com/users/SmarterApp/received_events","type":"Organization","site_admin":false},"repo":{"id":118049028,"name":"AP_IMRT_ItemIngestService","full_name":"SmarterApp/AP_IMRT_ItemIngestService","owner":{"login":"SmarterApp","id":7026395,"avatar_url":"https://avatars0.githubusercontent.com/u/7026395?v=4","gravatar_id":"","url":"https://api.github.com/users/SmarterApp","html_url":"https://github.com/SmarterApp","followers_url":"https://api.github.com/users/SmarterApp/followers","following_url":"https://api.github.com/users/SmarterApp/following{/other_user}","gists_url":"https://api.github.com/users/SmarterApp/gists{/gist_id}","starred_url":"https://api.github.com/users/SmarterApp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SmarterApp/subscriptions","organizations_url":"https://api.github.com/users/SmarterApp/orgs","repos_url":"https://api.github.com/users/SmarterApp/repos","events_url":"https://api.github.com/users/SmarterApp/events{/privacy}","received_events_url":"https://api.github.com/users/SmarterApp/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/SmarterApp/AP_IMRT_ItemIngestService","description":null,"fork":false,"url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService","forks_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/forks","keys_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/teams","hooks_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/hooks","issue_events_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/issues/events{/number}","events_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/events","assignees_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/assignees{/user}","branches_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/branches{/branch}","tags_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/tags","blobs_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/git/refs{/sha}","trees_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/statuses/{sha}","languages_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/languages","stargazers_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/stargazers","contributors_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/contributors","subscribers_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/subscribers","subscription_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/subscription","commits_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/commits{/sha}","git_commits_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/git/commits{/sha}","comments_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/comments{/number}","issue_comment_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/issues/comments{/number}","contents_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/contents/{+path}","compare_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/merges","archive_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/downloads","issues_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/issues{/number}","pulls_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/pulls{/number}","milestones_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/milestones{/number}","notifications_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/labels{/name}","releases_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/releases{/id}","deployments_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/deployments","created_at":"2018-01-18T23:05:48Z","updated_at":"2018-05-09T20:40:17Z","pushed_at":"2018-05-15T02:39:42Z","git_url":"git://github.com/SmarterApp/AP_IMRT_ItemIngestService.git","ssh_url":"git@github.com:SmarterApp/AP_IMRT_ItemIngestService.git","clone_url":"https://github.com/SmarterApp/AP_IMRT_ItemIngestService.git","svn_url":"https://github.com/SmarterApp/AP_IMRT_ItemIngestService","homepage":null,"size":563,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":0,"open_issues":1,"watchers":0,"default_branch":"develop"}},"base":{"label":"SmarterApp:develop","ref":"develop","sha":"b3db59747ec0a55d51c029d08891989fe68c8623","user":{"login":"SmarterApp","id":7026395,"avatar_url":"https://avatars0.githubusercontent.com/u/7026395?v=4","gravatar_id":"","url":"https://api.github.com/users/SmarterApp","html_url":"https://github.com/SmarterApp","followers_url":"https://api.github.com/users/SmarterApp/followers","following_url":"https://api.github.com/users/SmarterApp/following{/other_user}","gists_url":"https://api.github.com/users/SmarterApp/gists{/gist_id}","starred_url":"https://api.github.com/users/SmarterApp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SmarterApp/subscriptions","organizations_url":"https://api.github.com/users/SmarterApp/orgs","repos_url":"https://api.github.com/users/SmarterApp/repos","events_url":"https://api.github.com/users/SmarterApp/events{/privacy}","received_events_url":"https://api.github.com/users/SmarterApp/received_events","type":"Organization","site_admin":false},"repo":{"id":118049028,"name":"AP_IMRT_ItemIngestService","full_name":"SmarterApp/AP_IMRT_ItemIngestService","owner":{"login":"SmarterApp","id":7026395,"avatar_url":"https://avatars0.githubusercontent.com/u/7026395?v=4","gravatar_id":"","url":"https://api.github.com/users/SmarterApp","html_url":"https://github.com/SmarterApp","followers_url":"https://api.github.com/users/SmarterApp/followers","following_url":"https://api.github.com/users/SmarterApp/following{/other_user}","gists_url":"https://api.github.com/users/SmarterApp/gists{/gist_id}","starred_url":"https://api.github.com/users/SmarterApp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SmarterApp/subscriptions","organizations_url":"https://api.github.com/users/SmarterApp/orgs","repos_url":"https://api.github.com/users/SmarterApp/repos","events_url":"https://api.github.com/users/SmarterApp/events{/privacy}","received_events_url":"https://api.github.com/users/SmarterApp/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/SmarterApp/AP_IMRT_ItemIngestService","description":null,"fork":false,"url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService","forks_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/forks","keys_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/teams","hooks_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/hooks","issue_events_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/issues/events{/number}","events_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/events","assignees_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/assignees{/user}","branches_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/branches{/branch}","tags_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/tags","blobs_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/git/refs{/sha}","trees_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/statuses/{sha}","languages_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/languages","stargazers_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/stargazers","contributors_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/contributors","subscribers_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/subscribers","subscription_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/subscription","commits_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/commits{/sha}","git_commits_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/git/commits{/sha}","comments_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/comments{/number}","issue_comment_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/issues/comments{/number}","contents_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/contents/{+path}","compare_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/merges","archive_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/downloads","issues_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/issues{/number}","pulls_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/pulls{/number}","milestones_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/milestones{/number}","notifications_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/labels{/name}","releases_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/releases{/id}","deployments_url":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/deployments","created_at":"2018-01-18T23:05:48Z","updated_at":"2018-05-09T20:40:17Z","pushed_at":"2018-05-15T02:39:42Z","git_url":"git://github.com/SmarterApp/AP_IMRT_ItemIngestService.git","ssh_url":"git@github.com:SmarterApp/AP_IMRT_ItemIngestService.git","clone_url":"https://github.com/SmarterApp/AP_IMRT_ItemIngestService.git","svn_url":"https://github.com/SmarterApp/AP_IMRT_ItemIngestService","homepage":null,"size":563,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":0,"open_issues":1,"watchers":0,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/pulls/57"},"html":{"href":"https://github.com/SmarterApp/AP_IMRT_ItemIngestService/pull/57"},"issue":{"href":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/issues/57"},"comments":{"href":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/issues/57/comments"},"review_comments":{"href":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/pulls/57/comments"},"review_comment":{"href":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/pulls/57/commits"},"statuses":{"href":"https://api.github.com/repos/SmarterApp/AP_IMRT_ItemIngestService/statuses/3ca6d1335fd8b44db77f5cce5fcaf88574937150"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"millerts"}}