{"action":"created","comment":{"url":"https://api.github.com/repos/almighty/almighty-core/pulls/comments/80458405","id":80458405,"diff_hunk":"@@ -1,10 +1,69 @@\n package remoteworkitem\n \n-import \"github.com/jinzhu/gorm\"\n+import (\n+\t\"fmt\"\n \n-// upload imports the items into database\n+\t\"golang.org/x/net/context\"\n+\n+\t\"github.com/almighty/almighty-core/app\"\n+\t\"github.com/almighty/almighty-core/models\"\n+\tquery \"github.com/almighty/almighty-core/query/simple\"\n+\t\"github.com/jinzhu/gorm\"\n+)\n+\n+// Upload imports the items into database\n func upload(db *gorm.DB, tqID int, item map[string]string) error {\n \tti := TrackerItem{Item: item[\"content\"], RemoteItemID: item[\"id\"], BatchID: item[\"batch_id\"], TrackerQueryID: uint64(tqID)}\n \terr := db.Create(&ti).Error\n \treturn err\n }\n+\n+// Map a remote work item into an ALM work item and persist it into the database.\n+func convert(ts *models.GormTransactionSupport, tqID int, item map[string]string, provider string) (*app.WorkItem, error) {\n+\twitr := models.NewWorkItemTypeRepository(ts)\n+\twir := models.NewWorkItemRepository(ts, witr)\n+\tti := TrackerItem{Item: item[\"content\"], RemoteItemID: item[\"id\"], BatchID: item[\"batch_id\"], TrackerQueryID: uint64(tqID)}\n+\n+\t// Converting the remote item to a local work item\n+\tremoteTrackerItemMethodRef := RemoteWorkItemImplRegistry[provider]\n+\tremoteTrackerItem, err := remoteTrackerItemMethodRef(ti)\n+\tif err != nil {\n+\t\treturn nil, BadParameterError{parameter: provider, value: nil}\n+\t}\n+\tworkItem, err := Map(remoteTrackerItem, WorkItemKeyMaps[provider])","path":"remoteworkitem/trackeritem_repository.go","position":null,"original_position":35,"commit_id":"9aa358425b71134dd1b25174c75898e1075262e5","original_commit_id":"6189c106c2e44e7adf3b772c0b034a6a2d7b599d","user":{"login":"sbose78","id":545280,"avatar_url":"https://avatars.githubusercontent.com/u/545280?v=3","gravatar_id":"","url":"https://api.github.com/users/sbose78","html_url":"https://github.com/sbose78","followers_url":"https://api.github.com/users/sbose78/followers","following_url":"https://api.github.com/users/sbose78/following{/other_user}","gists_url":"https://api.github.com/users/sbose78/gists{/gist_id}","starred_url":"https://api.github.com/users/sbose78/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sbose78/subscriptions","organizations_url":"https://api.github.com/users/sbose78/orgs","repos_url":"https://api.github.com/users/sbose78/repos","events_url":"https://api.github.com/users/sbose78/events{/privacy}","received_events_url":"https://api.github.com/users/sbose78/received_events","type":"User","site_admin":false},"body":"Yes, to enable all packages to be able to map issue A from provider X using a map M into a local work item W . I am expecting this to be consumed by other micro-services in future.","created_at":"2016-09-26T11:51:33Z","updated_at":"2016-09-26T11:51:33Z","html_url":"https://github.com/almighty/almighty-core/pull/264#discussion_r80458405","pull_request_url":"https://api.github.com/repos/almighty/almighty-core/pulls/264","_links":{"self":{"href":"https://api.github.com/repos/almighty/almighty-core/pulls/comments/80458405"},"html":{"href":"https://github.com/almighty/almighty-core/pull/264#discussion_r80458405"},"pull_request":{"href":"https://api.github.com/repos/almighty/almighty-core/pulls/264"}}},"pull_request":{"url":"https://api.github.com/repos/almighty/almighty-core/pulls/264","id":86100202,"html_url":"https://github.com/almighty/almighty-core/pull/264","diff_url":"https://github.com/almighty/almighty-core/pull/264.diff","patch_url":"https://github.com/almighty/almighty-core/pull/264.patch","issue_url":"https://api.github.com/repos/almighty/almighty-core/issues/264","number":264,"state":"open","locked":false,"title":"Persistence of mapped remote work item","user":{"login":"sbose78","id":545280,"avatar_url":"https://avatars.githubusercontent.com/u/545280?v=3","gravatar_id":"","url":"https://api.github.com/users/sbose78","html_url":"https://github.com/sbose78","followers_url":"https://api.github.com/users/sbose78/followers","following_url":"https://api.github.com/users/sbose78/following{/other_user}","gists_url":"https://api.github.com/users/sbose78/gists{/gist_id}","starred_url":"https://api.github.com/users/sbose78/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sbose78/subscriptions","organizations_url":"https://api.github.com/users/sbose78/orgs","repos_url":"https://api.github.com/users/sbose78/repos","events_url":"https://api.github.com/users/sbose78/events{/privacy}","received_events_url":"https://api.github.com/users/sbose78/received_events","type":"User","site_admin":false},"body":"1. After the remote work item is persisted in the temporary table called 'TrackerItem'\r\n2. Convert the remote item into a local work item.\r\n3. Check if the work item exists. Use the remote_item_id in the json to check for existence of work item.\r\n4. If present, update it, else, create a new one.\r\n\r\nFixes https://github.com/almighty/almighty-core/issues/170\r\n","created_at":"2016-09-21T05:31:57Z","updated_at":"2016-09-26T11:51:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"edba621c6d0651ac9e8b8d0028b40363d4c042b6","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/almighty/almighty-core/pulls/264/commits","review_comments_url":"https://api.github.com/repos/almighty/almighty-core/pulls/264/comments","review_comment_url":"https://api.github.com/repos/almighty/almighty-core/pulls/comments{/number}","comments_url":"https://api.github.com/repos/almighty/almighty-core/issues/264/comments","statuses_url":"https://api.github.com/repos/almighty/almighty-core/statuses/9aa358425b71134dd1b25174c75898e1075262e5","head":{"label":"sbose78:peristance-rwi","ref":"peristance-rwi","sha":"9aa358425b71134dd1b25174c75898e1075262e5","user":{"login":"sbose78","id":545280,"avatar_url":"https://avatars.githubusercontent.com/u/545280?v=3","gravatar_id":"","url":"https://api.github.com/users/sbose78","html_url":"https://github.com/sbose78","followers_url":"https://api.github.com/users/sbose78/followers","following_url":"https://api.github.com/users/sbose78/following{/other_user}","gists_url":"https://api.github.com/users/sbose78/gists{/gist_id}","starred_url":"https://api.github.com/users/sbose78/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sbose78/subscriptions","organizations_url":"https://api.github.com/users/sbose78/orgs","repos_url":"https://api.github.com/users/sbose78/repos","events_url":"https://api.github.com/users/sbose78/events{/privacy}","received_events_url":"https://api.github.com/users/sbose78/received_events","type":"User","site_admin":false},"repo":{"id":64824078,"name":"almighty-core","full_name":"sbose78/almighty-core","owner":{"login":"sbose78","id":545280,"avatar_url":"https://avatars.githubusercontent.com/u/545280?v=3","gravatar_id":"","url":"https://api.github.com/users/sbose78","html_url":"https://github.com/sbose78","followers_url":"https://api.github.com/users/sbose78/followers","following_url":"https://api.github.com/users/sbose78/following{/other_user}","gists_url":"https://api.github.com/users/sbose78/gists{/gist_id}","starred_url":"https://api.github.com/users/sbose78/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sbose78/subscriptions","organizations_url":"https://api.github.com/users/sbose78/orgs","repos_url":"https://api.github.com/users/sbose78/repos","events_url":"https://api.github.com/users/sbose78/events{/privacy}","received_events_url":"https://api.github.com/users/sbose78/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sbose78/almighty-core","description":null,"fork":true,"url":"https://api.github.com/repos/sbose78/almighty-core","forks_url":"https://api.github.com/repos/sbose78/almighty-core/forks","keys_url":"https://api.github.com/repos/sbose78/almighty-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sbose78/almighty-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sbose78/almighty-core/teams","hooks_url":"https://api.github.com/repos/sbose78/almighty-core/hooks","issue_events_url":"https://api.github.com/repos/sbose78/almighty-core/issues/events{/number}","events_url":"https://api.github.com/repos/sbose78/almighty-core/events","assignees_url":"https://api.github.com/repos/sbose78/almighty-core/assignees{/user}","branches_url":"https://api.github.com/repos/sbose78/almighty-core/branches{/branch}","tags_url":"https://api.github.com/repos/sbose78/almighty-core/tags","blobs_url":"https://api.github.com/repos/sbose78/almighty-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sbose78/almighty-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sbose78/almighty-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/sbose78/almighty-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sbose78/almighty-core/statuses/{sha}","languages_url":"https://api.github.com/repos/sbose78/almighty-core/languages","stargazers_url":"https://api.github.com/repos/sbose78/almighty-core/stargazers","contributors_url":"https://api.github.com/repos/sbose78/almighty-core/contributors","subscribers_url":"https://api.github.com/repos/sbose78/almighty-core/subscribers","subscription_url":"https://api.github.com/repos/sbose78/almighty-core/subscription","commits_url":"https://api.github.com/repos/sbose78/almighty-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/sbose78/almighty-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/sbose78/almighty-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/sbose78/almighty-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/sbose78/almighty-core/contents/{+path}","compare_url":"https://api.github.com/repos/sbose78/almighty-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sbose78/almighty-core/merges","archive_url":"https://api.github.com/repos/sbose78/almighty-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sbose78/almighty-core/downloads","issues_url":"https://api.github.com/repos/sbose78/almighty-core/issues{/number}","pulls_url":"https://api.github.com/repos/sbose78/almighty-core/pulls{/number}","milestones_url":"https://api.github.com/repos/sbose78/almighty-core/milestones{/number}","notifications_url":"https://api.github.com/repos/sbose78/almighty-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sbose78/almighty-core/labels{/name}","releases_url":"https://api.github.com/repos/sbose78/almighty-core/releases{/id}","deployments_url":"https://api.github.com/repos/sbose78/almighty-core/deployments","created_at":"2016-08-03T07:12:02Z","updated_at":"2016-08-05T15:12:18Z","pushed_at":"2016-09-26T11:43:14Z","git_url":"git://github.com/sbose78/almighty-core.git","ssh_url":"git@github.com:sbose78/almighty-core.git","clone_url":"https://github.com/sbose78/almighty-core.git","svn_url":"https://github.com/sbose78/almighty-core","homepage":"http://devdoc.almighty.io","size":385,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"almighty:master","ref":"master","sha":"46c916122e2957867670c9cd9adc0e26194fef2a","user":{"login":"almighty","id":17783151,"avatar_url":"https://avatars.githubusercontent.com/u/17783151?v=3","gravatar_id":"","url":"https://api.github.com/users/almighty","html_url":"https://github.com/almighty","followers_url":"https://api.github.com/users/almighty/followers","following_url":"https://api.github.com/users/almighty/following{/other_user}","gists_url":"https://api.github.com/users/almighty/gists{/gist_id}","starred_url":"https://api.github.com/users/almighty/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/almighty/subscriptions","organizations_url":"https://api.github.com/users/almighty/orgs","repos_url":"https://api.github.com/users/almighty/repos","events_url":"https://api.github.com/users/almighty/events{/privacy}","received_events_url":"https://api.github.com/users/almighty/received_events","type":"Organization","site_admin":false},"repo":{"id":54260706,"name":"almighty-core","full_name":"almighty/almighty-core","owner":{"login":"almighty","id":17783151,"avatar_url":"https://avatars.githubusercontent.com/u/17783151?v=3","gravatar_id":"","url":"https://api.github.com/users/almighty","html_url":"https://github.com/almighty","followers_url":"https://api.github.com/users/almighty/followers","following_url":"https://api.github.com/users/almighty/following{/other_user}","gists_url":"https://api.github.com/users/almighty/gists{/gist_id}","starred_url":"https://api.github.com/users/almighty/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/almighty/subscriptions","organizations_url":"https://api.github.com/users/almighty/orgs","repos_url":"https://api.github.com/users/almighty/repos","events_url":"https://api.github.com/users/almighty/events{/privacy}","received_events_url":"https://api.github.com/users/almighty/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/almighty/almighty-core","description":"","fork":false,"url":"https://api.github.com/repos/almighty/almighty-core","forks_url":"https://api.github.com/repos/almighty/almighty-core/forks","keys_url":"https://api.github.com/repos/almighty/almighty-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/almighty/almighty-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/almighty/almighty-core/teams","hooks_url":"https://api.github.com/repos/almighty/almighty-core/hooks","issue_events_url":"https://api.github.com/repos/almighty/almighty-core/issues/events{/number}","events_url":"https://api.github.com/repos/almighty/almighty-core/events","assignees_url":"https://api.github.com/repos/almighty/almighty-core/assignees{/user}","branches_url":"https://api.github.com/repos/almighty/almighty-core/branches{/branch}","tags_url":"https://api.github.com/repos/almighty/almighty-core/tags","blobs_url":"https://api.github.com/repos/almighty/almighty-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/almighty/almighty-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/almighty/almighty-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/almighty/almighty-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/almighty/almighty-core/statuses/{sha}","languages_url":"https://api.github.com/repos/almighty/almighty-core/languages","stargazers_url":"https://api.github.com/repos/almighty/almighty-core/stargazers","contributors_url":"https://api.github.com/repos/almighty/almighty-core/contributors","subscribers_url":"https://api.github.com/repos/almighty/almighty-core/subscribers","subscription_url":"https://api.github.com/repos/almighty/almighty-core/subscription","commits_url":"https://api.github.com/repos/almighty/almighty-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/almighty/almighty-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/almighty/almighty-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/almighty/almighty-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/almighty/almighty-core/contents/{+path}","compare_url":"https://api.github.com/repos/almighty/almighty-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/almighty/almighty-core/merges","archive_url":"https://api.github.com/repos/almighty/almighty-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/almighty/almighty-core/downloads","issues_url":"https://api.github.com/repos/almighty/almighty-core/issues{/number}","pulls_url":"https://api.github.com/repos/almighty/almighty-core/pulls{/number}","milestones_url":"https://api.github.com/repos/almighty/almighty-core/milestones{/number}","notifications_url":"https://api.github.com/repos/almighty/almighty-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/almighty/almighty-core/labels{/name}","releases_url":"https://api.github.com/repos/almighty/almighty-core/releases{/id}","deployments_url":"https://api.github.com/repos/almighty/almighty-core/deployments","created_at":"2016-03-19T10:42:15Z","updated_at":"2016-09-21T20:02:55Z","pushed_at":"2016-09-26T11:43:14Z","git_url":"git://github.com/almighty/almighty-core.git","ssh_url":"git@github.com:almighty/almighty-core.git","clone_url":"https://github.com/almighty/almighty-core.git","svn_url":"https://github.com/almighty/almighty-core","homepage":"http://devdoc.almighty.io/","size":4680,"stargazers_count":12,"watchers_count":12,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":27,"mirror_url":null,"open_issues_count":77,"forks":27,"open_issues":77,"watchers":12,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/almighty/almighty-core/pulls/264"},"html":{"href":"https://github.com/almighty/almighty-core/pull/264"},"issue":{"href":"https://api.github.com/repos/almighty/almighty-core/issues/264"},"comments":{"href":"https://api.github.com/repos/almighty/almighty-core/issues/264/comments"},"review_comments":{"href":"https://api.github.com/repos/almighty/almighty-core/pulls/264/comments"},"review_comment":{"href":"https://api.github.com/repos/almighty/almighty-core/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/almighty/almighty-core/pulls/264/commits"},"statuses":{"href":"https://api.github.com/repos/almighty/almighty-core/statuses/9aa358425b71134dd1b25174c75898e1075262e5"}}}}
{"actor":{"display_login":"sbose78"}}