{"action":"created","comment":{"url":"https://api.github.com/repos/hmcts/cmc-claim-store/pulls/comments/196897478","pull_request_review_id":130534553,"id":196897478,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5Njg5NzQ3OA==","diff_hunk":"@@ -0,0 +1,52 @@\n+package uk.gov.hmcts.cmc.rpa.mapper;\n+\n+import org.springframework.beans.factory.annotation.Autowired;\n+import org.springframework.stereotype.Component;\n+import uk.gov.hmcts.cmc.domain.models.Claim;\n+import uk.gov.hmcts.cmc.domain.models.party.Individual;\n+import uk.gov.hmcts.cmc.domain.models.party.Party;\n+import uk.gov.hmcts.cmc.domain.models.response.DefenceType;\n+import uk.gov.hmcts.cmc.domain.models.response.FullDefenceResponse;\n+import uk.gov.hmcts.cmc.domain.models.response.Response;\n+import uk.gov.hmcts.cmc.domain.models.response.YesNoOption;\n+import uk.gov.hmcts.cmc.rpa.DateFormatter;\n+import uk.gov.hmcts.cmc.rpa.mapper.json.NullAwareJsonObjectBuilder;\n+import javax.json.JsonObject;\n+\n+import static uk.gov.hmcts.cmc.rpa.mapper.helper.Extractor.extractFromSubclass;\n+\n+@Component\n+@SuppressWarnings({\"LineLength\"})\n+public class DefenceResponseJsonMapper {\n+\n+    @Autowired\n+    private final DefendantJsonMapper defendantMapper;\n+\n+    public DefenceResponseJsonMapper(DefendantJsonMapper defendantMapper) {\n+        this.defendantMapper = defendantMapper;\n+    }\n+\n+    public JsonObject map(Claim claim) {\n+        Response response = claim.getResponse().orElseThrow(IllegalStateException::new);\n+        String defendantsEmail = claim.getDefendantEmail();\n+        return new NullAwareJsonObjectBuilder()\n+            .add(\"caseNumber\", claim.getReferenceNumber())\n+            .add(\"defenceSubmittedOn\", DateFormatter.format(claim.getRespondedAt()))\n+            .add(\"defenceResponse\", extractFromSubclass(response, FullDefenceResponse.class, fullDefenceResponse -> fullDefenceResponse.getDefenceType().getDescription()))\n+            .add(\"defendants\", defendantMapper.map(response.getDefendant(), claim.getClaimData().getDefendant(), defendantsEmail))\n+            .add(\"dateOfBirth\", extractFromSubclass(response.getDefendant(),","path":"rpa-mapper/src/main/java/uk/gov/hmcts/cmc/rpa/mapper/DefenceResponseJsonMapper.java","position":null,"original_position":37,"commit_id":"2d668ce71ee153ecac240e19b1597522ddee7480","original_commit_id":"1d870c0906e2e1c0596708260a9d13db36347e3a","user":{"login":"singh-surjeet","id":13645812,"node_id":"MDQ6VXNlcjEzNjQ1ODEy","avatar_url":"https://avatars3.githubusercontent.com/u/13645812?v=4","gravatar_id":"","url":"https://api.github.com/users/singh-surjeet","html_url":"https://github.com/singh-surjeet","followers_url":"https://api.github.com/users/singh-surjeet/followers","following_url":"https://api.github.com/users/singh-surjeet/following{/other_user}","gists_url":"https://api.github.com/users/singh-surjeet/gists{/gist_id}","starred_url":"https://api.github.com/users/singh-surjeet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/singh-surjeet/subscriptions","organizations_url":"https://api.github.com/users/singh-surjeet/orgs","repos_url":"https://api.github.com/users/singh-surjeet/repos","events_url":"https://api.github.com/users/singh-surjeet/events{/privacy}","received_events_url":"https://api.github.com/users/singh-surjeet/received_events","type":"User","site_admin":false},"body":"Moved into Def block","created_at":"2018-06-20T18:30:20Z","updated_at":"2018-06-20T18:30:20Z","html_url":"https://github.com/hmcts/cmc-claim-store/pull/379#discussion_r196897478","pull_request_url":"https://api.github.com/repos/hmcts/cmc-claim-store/pulls/379","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/hmcts/cmc-claim-store/pulls/comments/196897478"},"html":{"href":"https://github.com/hmcts/cmc-claim-store/pull/379#discussion_r196897478"},"pull_request":{"href":"https://api.github.com/repos/hmcts/cmc-claim-store/pulls/379"}},"in_reply_to_id":196380177},"pull_request":{"url":"https://api.github.com/repos/hmcts/cmc-claim-store/pulls/379","id":193248430,"node_id":"MDExOlB1bGxSZXF1ZXN0MTkzMjQ4NDMw","html_url":"https://github.com/hmcts/cmc-claim-store/pull/379","diff_url":"https://github.com/hmcts/cmc-claim-store/pull/379.diff","patch_url":"https://github.com/hmcts/cmc-claim-store/pull/379.patch","issue_url":"https://api.github.com/repos/hmcts/cmc-claim-store/issues/379","number":379,"state":"open","locked":false,"title":"ROC-3571: JSON output for RPA ","user":{"login":"singh-surjeet","id":13645812,"node_id":"MDQ6VXNlcjEzNjQ1ODEy","avatar_url":"https://avatars3.githubusercontent.com/u/13645812?v=4","gravatar_id":"","url":"https://api.github.com/users/singh-surjeet","html_url":"https://github.com/singh-surjeet","followers_url":"https://api.github.com/users/singh-surjeet/followers","following_url":"https://api.github.com/users/singh-surjeet/following{/other_user}","gists_url":"https://api.github.com/users/singh-surjeet/gists{/gist_id}","starred_url":"https://api.github.com/users/singh-surjeet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/singh-surjeet/subscriptions","organizations_url":"https://api.github.com/users/singh-surjeet/orgs","repos_url":"https://api.github.com/users/singh-surjeet/repos","events_url":"https://api.github.com/users/singh-surjeet/events{/privacy}","received_events_url":"https://api.github.com/users/singh-surjeet/received_events","type":"User","site_admin":false},"body":"### JIRA link (if applicable) ###\r\n\r\nhttps://tools.hmcts.net/jira/browse/ROC-3571\r\n\r\n### Change description ###\r\n\r\nGenerate JSON file for RPA\r\n\r\n[X] Defence Response\r\n[X] Addition time to respond \r\n[X] Request for Judgement\r\n\r\n**Does this PR introduce a breaking change?** (check one with \"x\")\r\n\r\n```\r\n[ ] Yes\r\n[X] No\r\n```\r\n","created_at":"2018-06-07T08:57:19Z","updated_at":"2018-06-20T18:30:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"068da3f1ef5e2dc2409e1a3a244b82060b0aaac4","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/hmcts/cmc-claim-store/pulls/379/commits","review_comments_url":"https://api.github.com/repos/hmcts/cmc-claim-store/pulls/379/comments","review_comment_url":"https://api.github.com/repos/hmcts/cmc-claim-store/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hmcts/cmc-claim-store/issues/379/comments","statuses_url":"https://api.github.com/repos/hmcts/cmc-claim-store/statuses/2d668ce71ee153ecac240e19b1597522ddee7480","head":{"label":"hmcts:feature/ROC-3571-Json-output-for-rpa","ref":"feature/ROC-3571-Json-output-for-rpa","sha":"2d668ce71ee153ecac240e19b1597522ddee7480","user":{"login":"hmcts","id":22817111,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIyODE3MTEx","avatar_url":"https://avatars1.githubusercontent.com/u/22817111?v=4","gravatar_id":"","url":"https://api.github.com/users/hmcts","html_url":"https://github.com/hmcts","followers_url":"https://api.github.com/users/hmcts/followers","following_url":"https://api.github.com/users/hmcts/following{/other_user}","gists_url":"https://api.github.com/users/hmcts/gists{/gist_id}","starred_url":"https://api.github.com/users/hmcts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hmcts/subscriptions","organizations_url":"https://api.github.com/users/hmcts/orgs","repos_url":"https://api.github.com/users/hmcts/repos","events_url":"https://api.github.com/users/hmcts/events{/privacy}","received_events_url":"https://api.github.com/users/hmcts/received_events","type":"Organization","site_admin":false},"repo":{"id":101856095,"node_id":"MDEwOlJlcG9zaXRvcnkxMDE4NTYwOTU=","name":"cmc-claim-store","full_name":"hmcts/cmc-claim-store","owner":{"login":"hmcts","id":22817111,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIyODE3MTEx","avatar_url":"https://avatars1.githubusercontent.com/u/22817111?v=4","gravatar_id":"","url":"https://api.github.com/users/hmcts","html_url":"https://github.com/hmcts","followers_url":"https://api.github.com/users/hmcts/followers","following_url":"https://api.github.com/users/hmcts/following{/other_user}","gists_url":"https://api.github.com/users/hmcts/gists{/gist_id}","starred_url":"https://api.github.com/users/hmcts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hmcts/subscriptions","organizations_url":"https://api.github.com/users/hmcts/orgs","repos_url":"https://api.github.com/users/hmcts/repos","events_url":"https://api.github.com/users/hmcts/events{/privacy}","received_events_url":"https://api.github.com/users/hmcts/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hmcts/cmc-claim-store","description":"Backend service for Civil Money Claims","fork":false,"url":"https://api.github.com/repos/hmcts/cmc-claim-store","forks_url":"https://api.github.com/repos/hmcts/cmc-claim-store/forks","keys_url":"https://api.github.com/repos/hmcts/cmc-claim-store/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hmcts/cmc-claim-store/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hmcts/cmc-claim-store/teams","hooks_url":"https://api.github.com/repos/hmcts/cmc-claim-store/hooks","issue_events_url":"https://api.github.com/repos/hmcts/cmc-claim-store/issues/events{/number}","events_url":"https://api.github.com/repos/hmcts/cmc-claim-store/events","assignees_url":"https://api.github.com/repos/hmcts/cmc-claim-store/assignees{/user}","branches_url":"https://api.github.com/repos/hmcts/cmc-claim-store/branches{/branch}","tags_url":"https://api.github.com/repos/hmcts/cmc-claim-store/tags","blobs_url":"https://api.github.com/repos/hmcts/cmc-claim-store/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hmcts/cmc-claim-store/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hmcts/cmc-claim-store/git/refs{/sha}","trees_url":"https://api.github.com/repos/hmcts/cmc-claim-store/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hmcts/cmc-claim-store/statuses/{sha}","languages_url":"https://api.github.com/repos/hmcts/cmc-claim-store/languages","stargazers_url":"https://api.github.com/repos/hmcts/cmc-claim-store/stargazers","contributors_url":"https://api.github.com/repos/hmcts/cmc-claim-store/contributors","subscribers_url":"https://api.github.com/repos/hmcts/cmc-claim-store/subscribers","subscription_url":"https://api.github.com/repos/hmcts/cmc-claim-store/subscription","commits_url":"https://api.github.com/repos/hmcts/cmc-claim-store/commits{/sha}","git_commits_url":"https://api.github.com/repos/hmcts/cmc-claim-store/git/commits{/sha}","comments_url":"https://api.github.com/repos/hmcts/cmc-claim-store/comments{/number}","issue_comment_url":"https://api.github.com/repos/hmcts/cmc-claim-store/issues/comments{/number}","contents_url":"https://api.github.com/repos/hmcts/cmc-claim-store/contents/{+path}","compare_url":"https://api.github.com/repos/hmcts/cmc-claim-store/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hmcts/cmc-claim-store/merges","archive_url":"https://api.github.com/repos/hmcts/cmc-claim-store/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hmcts/cmc-claim-store/downloads","issues_url":"https://api.github.com/repos/hmcts/cmc-claim-store/issues{/number}","pulls_url":"https://api.github.com/repos/hmcts/cmc-claim-store/pulls{/number}","milestones_url":"https://api.github.com/repos/hmcts/cmc-claim-store/milestones{/number}","notifications_url":"https://api.github.com/repos/hmcts/cmc-claim-store/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hmcts/cmc-claim-store/labels{/name}","releases_url":"https://api.github.com/repos/hmcts/cmc-claim-store/releases{/id}","deployments_url":"https://api.github.com/repos/hmcts/cmc-claim-store/deployments","created_at":"2017-08-30T08:17:34Z","updated_at":"2018-06-20T12:59:24Z","pushed_at":"2018-06-20T18:27:20Z","git_url":"git://github.com/hmcts/cmc-claim-store.git","ssh_url":"git@github.com:hmcts/cmc-claim-store.git","clone_url":"https://github.com/hmcts/cmc-claim-store.git","svn_url":"https://github.com/hmcts/cmc-claim-store","homepage":"","size":4088,"stargazers_count":2,"watchers_count":2,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"archived":false,"open_issues_count":9,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":3,"open_issues":9,"watchers":2,"default_branch":"master"}},"base":{"label":"hmcts:master","ref":"master","sha":"d45bd581e29af03579cc0164790e7cbd081a8bae","user":{"login":"hmcts","id":22817111,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIyODE3MTEx","avatar_url":"https://avatars1.githubusercontent.com/u/22817111?v=4","gravatar_id":"","url":"https://api.github.com/users/hmcts","html_url":"https://github.com/hmcts","followers_url":"https://api.github.com/users/hmcts/followers","following_url":"https://api.github.com/users/hmcts/following{/other_user}","gists_url":"https://api.github.com/users/hmcts/gists{/gist_id}","starred_url":"https://api.github.com/users/hmcts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hmcts/subscriptions","organizations_url":"https://api.github.com/users/hmcts/orgs","repos_url":"https://api.github.com/users/hmcts/repos","events_url":"https://api.github.com/users/hmcts/events{/privacy}","received_events_url":"https://api.github.com/users/hmcts/received_events","type":"Organization","site_admin":false},"repo":{"id":101856095,"node_id":"MDEwOlJlcG9zaXRvcnkxMDE4NTYwOTU=","name":"cmc-claim-store","full_name":"hmcts/cmc-claim-store","owner":{"login":"hmcts","id":22817111,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIyODE3MTEx","avatar_url":"https://avatars1.githubusercontent.com/u/22817111?v=4","gravatar_id":"","url":"https://api.github.com/users/hmcts","html_url":"https://github.com/hmcts","followers_url":"https://api.github.com/users/hmcts/followers","following_url":"https://api.github.com/users/hmcts/following{/other_user}","gists_url":"https://api.github.com/users/hmcts/gists{/gist_id}","starred_url":"https://api.github.com/users/hmcts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hmcts/subscriptions","organizations_url":"https://api.github.com/users/hmcts/orgs","repos_url":"https://api.github.com/users/hmcts/repos","events_url":"https://api.github.com/users/hmcts/events{/privacy}","received_events_url":"https://api.github.com/users/hmcts/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hmcts/cmc-claim-store","description":"Backend service for Civil Money Claims","fork":false,"url":"https://api.github.com/repos/hmcts/cmc-claim-store","forks_url":"https://api.github.com/repos/hmcts/cmc-claim-store/forks","keys_url":"https://api.github.com/repos/hmcts/cmc-claim-store/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hmcts/cmc-claim-store/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hmcts/cmc-claim-store/teams","hooks_url":"https://api.github.com/repos/hmcts/cmc-claim-store/hooks","issue_events_url":"https://api.github.com/repos/hmcts/cmc-claim-store/issues/events{/number}","events_url":"https://api.github.com/repos/hmcts/cmc-claim-store/events","assignees_url":"https://api.github.com/repos/hmcts/cmc-claim-store/assignees{/user}","branches_url":"https://api.github.com/repos/hmcts/cmc-claim-store/branches{/branch}","tags_url":"https://api.github.com/repos/hmcts/cmc-claim-store/tags","blobs_url":"https://api.github.com/repos/hmcts/cmc-claim-store/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hmcts/cmc-claim-store/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hmcts/cmc-claim-store/git/refs{/sha}","trees_url":"https://api.github.com/repos/hmcts/cmc-claim-store/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hmcts/cmc-claim-store/statuses/{sha}","languages_url":"https://api.github.com/repos/hmcts/cmc-claim-store/languages","stargazers_url":"https://api.github.com/repos/hmcts/cmc-claim-store/stargazers","contributors_url":"https://api.github.com/repos/hmcts/cmc-claim-store/contributors","subscribers_url":"https://api.github.com/repos/hmcts/cmc-claim-store/subscribers","subscription_url":"https://api.github.com/repos/hmcts/cmc-claim-store/subscription","commits_url":"https://api.github.com/repos/hmcts/cmc-claim-store/commits{/sha}","git_commits_url":"https://api.github.com/repos/hmcts/cmc-claim-store/git/commits{/sha}","comments_url":"https://api.github.com/repos/hmcts/cmc-claim-store/comments{/number}","issue_comment_url":"https://api.github.com/repos/hmcts/cmc-claim-store/issues/comments{/number}","contents_url":"https://api.github.com/repos/hmcts/cmc-claim-store/contents/{+path}","compare_url":"https://api.github.com/repos/hmcts/cmc-claim-store/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hmcts/cmc-claim-store/merges","archive_url":"https://api.github.com/repos/hmcts/cmc-claim-store/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hmcts/cmc-claim-store/downloads","issues_url":"https://api.github.com/repos/hmcts/cmc-claim-store/issues{/number}","pulls_url":"https://api.github.com/repos/hmcts/cmc-claim-store/pulls{/number}","milestones_url":"https://api.github.com/repos/hmcts/cmc-claim-store/milestones{/number}","notifications_url":"https://api.github.com/repos/hmcts/cmc-claim-store/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hmcts/cmc-claim-store/labels{/name}","releases_url":"https://api.github.com/repos/hmcts/cmc-claim-store/releases{/id}","deployments_url":"https://api.github.com/repos/hmcts/cmc-claim-store/deployments","created_at":"2017-08-30T08:17:34Z","updated_at":"2018-06-20T12:59:24Z","pushed_at":"2018-06-20T18:27:20Z","git_url":"git://github.com/hmcts/cmc-claim-store.git","ssh_url":"git@github.com:hmcts/cmc-claim-store.git","clone_url":"https://github.com/hmcts/cmc-claim-store.git","svn_url":"https://github.com/hmcts/cmc-claim-store","homepage":"","size":4088,"stargazers_count":2,"watchers_count":2,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"archived":false,"open_issues_count":9,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":3,"open_issues":9,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hmcts/cmc-claim-store/pulls/379"},"html":{"href":"https://github.com/hmcts/cmc-claim-store/pull/379"},"issue":{"href":"https://api.github.com/repos/hmcts/cmc-claim-store/issues/379"},"comments":{"href":"https://api.github.com/repos/hmcts/cmc-claim-store/issues/379/comments"},"review_comments":{"href":"https://api.github.com/repos/hmcts/cmc-claim-store/pulls/379/comments"},"review_comment":{"href":"https://api.github.com/repos/hmcts/cmc-claim-store/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hmcts/cmc-claim-store/pulls/379/commits"},"statuses":{"href":"https://api.github.com/repos/hmcts/cmc-claim-store/statuses/2d668ce71ee153ecac240e19b1597522ddee7480"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"singh-surjeet"}}