{"action":"created","comment":{"url":"https://api.github.com/repos/NEU-2016/NEUban/pulls/comments/91464413","pull_request_review_id":11968615,"id":91464413,"diff_hunk":"@@ -0,0 +1,114 @@\n+package hu.unideb.inf.rft.neuban.service.impl;\n+\n+import static hu.unideb.inf.rft.neuban.service.provider.beanname.SingleDataGetServiceBeanNameProvider.SINGLE_BOARD_DATA_GET_SERVICE;\n+import static hu.unideb.inf.rft.neuban.service.provider.beanname.SingleDataUpdateServiceBeanNameProvider.SINGLE_BOARD_DATA_UPDATE_SERVICE;\n+\n+import java.time.LocalDateTime;\n+import java.util.List;\n+import java.util.Optional;\n+\n+import org.modelmapper.ModelMapper;\n+import org.springframework.beans.factory.annotation.Autowired;\n+import org.springframework.beans.factory.annotation.Qualifier;\n+import org.springframework.stereotype.Service;\n+import org.springframework.transaction.annotation.Transactional;\n+import org.springframework.util.Assert;\n+\n+import com.google.common.collect.Lists;\n+\n+import hu.unideb.inf.rft.neuban.persistence.repositories.CommentRepository;\n+import hu.unideb.inf.rft.neuban.service.domain.CardDto;\n+import hu.unideb.inf.rft.neuban.service.domain.CommentDto;\n+import hu.unideb.inf.rft.neuban.service.domain.UserDto;\n+import hu.unideb.inf.rft.neuban.service.exceptions.CommentNotFoundException;\n+import hu.unideb.inf.rft.neuban.service.exceptions.data.CardNotFoundException;\n+import hu.unideb.inf.rft.neuban.service.exceptions.data.DataNotFoundException;\n+import hu.unideb.inf.rft.neuban.service.exceptions.data.UserNotFoundException;\n+import hu.unideb.inf.rft.neuban.service.interfaces.CardService;\n+import hu.unideb.inf.rft.neuban.service.interfaces.CommentService;\n+import hu.unideb.inf.rft.neuban.service.interfaces.UserService;\n+import hu.unideb.inf.rft.neuban.service.interfaces.shared.SingleDataGetService;\n+import hu.unideb.inf.rft.neuban.service.interfaces.shared.SingleDataUpdateService;\n+\n+@Service\n+public class CommentServiceImpl implements CommentService {\n+\n+\t@Autowired\n+\tprivate UserService userService;\n+\n+\t@Autowired\n+\tprivate CommentRepository commentRepository;\n+\n+\t@Autowired\n+\tprivate CardService cardService;\n+\n+\t@Autowired\n+\tprivate ModelMapper modelMapper;\n+\n+\t@Autowired\n+\t@Qualifier(SINGLE_BOARD_DATA_GET_SERVICE)\n+\tprivate SingleDataGetService<CommentDto, Long> singleCommentDataGetService;\n+\n+\t@Autowired\n+\t@Qualifier(SINGLE_BOARD_DATA_UPDATE_SERVICE)\n+\tprivate SingleDataUpdateService<CommentDto> singleCommentDataUpdateService;\n+\n+\t@Override\n+\tpublic Optional<CommentDto> get(Long commentId) {\n+\t\treturn this.singleCommentDataGetService.get(commentId);\n+\t}\n+\n+\t@Transactional(readOnly = true)\n+\t@Override\n+\tpublic List<CommentDto> getAll(final Long cardId) {\n+\n+\t\tAssert.notNull(cardId);\n+\n+\t\tfinal Optional<CardDto> cardDtoOptional = this.cardService.get(cardId);\n+\n+\t\tif (cardDtoOptional.isPresent()) {\n+\t\t\treturn cardDtoOptional.get().getComments();\n+\t\t}\n+\t\treturn Lists.newArrayList();\n+\t}\n+\n+\t@Override\n+\tpublic void update(CommentDto commentDto) throws DataNotFoundException {\n+\t\tsingleCommentDataUpdateService.update(commentDto);\n+\n+\t}\n+\n+\t@Transactional\n+\t@Override\n+\tpublic void remove(final Long commentId) throws CommentNotFoundException {\n+\n+\t\tAssert.notNull(commentId);\n+\n+\t\tOptional.ofNullable(this.commentRepository.findOne(commentId))\n+\t\t\t\t.orElseThrow(() -> new CommentNotFoundException(String.valueOf(commentId)));\n+\n+\t\tthis.commentRepository.delete(commentId);\n+\n+\t}\n+\n+\t@Transactional\n+\t@Override\n+\tpublic void addComment(final Long userId, final Long cardId, final String content) throws DataNotFoundException {\n+\n+\t\tAssert.notNull(userId);\n+\t\tAssert.notNull(cardId);\n+\t\tAssert.notNull(content);\n+\n+\t\tfinal Optional<CardDto> cardDto = Optional\n+\t\t\t\t.of(cardService.get(cardId).orElseThrow(() -> new CardNotFoundException(String.valueOf(cardId))));\n+\t\tfinal Optional<UserDto> userDto = Optional","path":"service/src/main/java/hu/unideb/inf/rft/neuban/service/impl/CommentServiceImpl.java","position":104,"original_position":104,"commit_id":"3c7a8ec976aa901b189d4e6968fbbe5b6036ca2b","original_commit_id":"3c7a8ec976aa901b189d4e6968fbbe5b6036ca2b","user":{"login":"gabichelsea","id":11255072,"avatar_url":"https://avatars.githubusercontent.com/u/11255072?v=3","gravatar_id":"","url":"https://api.github.com/users/gabichelsea","html_url":"https://github.com/gabichelsea","followers_url":"https://api.github.com/users/gabichelsea/followers","following_url":"https://api.github.com/users/gabichelsea/following{/other_user}","gists_url":"https://api.github.com/users/gabichelsea/gists{/gist_id}","starred_url":"https://api.github.com/users/gabichelsea/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gabichelsea/subscriptions","organizations_url":"https://api.github.com/users/gabichelsea/orgs","repos_url":"https://api.github.com/users/gabichelsea/repos","events_url":"https://api.github.com/users/gabichelsea/events{/privacy}","received_events_url":"https://api.github.com/users/gabichelsea/received_events","type":"User","site_admin":false},"body":"The same as the previous comment.","created_at":"2016-12-08T08:18:03Z","updated_at":"2016-12-08T08:23:28Z","html_url":"https://github.com/NEU-2016/NEUban/pull/51#discussion_r91464413","pull_request_url":"https://api.github.com/repos/NEU-2016/NEUban/pulls/51","_links":{"self":{"href":"https://api.github.com/repos/NEU-2016/NEUban/pulls/comments/91464413"},"html":{"href":"https://github.com/NEU-2016/NEUban/pull/51#discussion_r91464413"},"pull_request":{"href":"https://api.github.com/repos/NEU-2016/NEUban/pulls/51"}}},"pull_request":{"url":"https://api.github.com/repos/NEU-2016/NEUban/pulls/51","id":96809457,"html_url":"https://github.com/NEU-2016/NEUban/pull/51","diff_url":"https://github.com/NEU-2016/NEUban/pull/51.diff","patch_url":"https://github.com/NEU-2016/NEUban/pull/51.patch","issue_url":"https://api.github.com/repos/NEU-2016/NEUban/issues/51","number":51,"state":"open","locked":false,"title":"Comment master merge","user":{"login":"Headswitcher","id":16292021,"avatar_url":"https://avatars.githubusercontent.com/u/16292021?v=3","gravatar_id":"","url":"https://api.github.com/users/Headswitcher","html_url":"https://github.com/Headswitcher","followers_url":"https://api.github.com/users/Headswitcher/followers","following_url":"https://api.github.com/users/Headswitcher/following{/other_user}","gists_url":"https://api.github.com/users/Headswitcher/gists{/gist_id}","starred_url":"https://api.github.com/users/Headswitcher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Headswitcher/subscriptions","organizations_url":"https://api.github.com/users/Headswitcher/orgs","repos_url":"https://api.github.com/users/Headswitcher/repos","events_url":"https://api.github.com/users/Headswitcher/events{/privacy}","received_events_url":"https://api.github.com/users/Headswitcher/received_events","type":"User","site_admin":false},"body":"trello card: https://trello.com/c/HQmuOWYK/47-introduce-comments-for-cards-part-1","created_at":"2016-12-06T21:29:21Z","updated_at":"2016-12-08T08:23:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4c617bfb2fb207cf21cbb14c9af92bf5dd661750","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/NEU-2016/NEUban/pulls/51/commits","review_comments_url":"https://api.github.com/repos/NEU-2016/NEUban/pulls/51/comments","review_comment_url":"https://api.github.com/repos/NEU-2016/NEUban/pulls/comments{/number}","comments_url":"https://api.github.com/repos/NEU-2016/NEUban/issues/51/comments","statuses_url":"https://api.github.com/repos/NEU-2016/NEUban/statuses/3c7a8ec976aa901b189d4e6968fbbe5b6036ca2b","head":{"label":"NEU-2016:comment_master_merge","ref":"comment_master_merge","sha":"3c7a8ec976aa901b189d4e6968fbbe5b6036ca2b","user":{"login":"NEU-2016","id":22430135,"avatar_url":"https://avatars.githubusercontent.com/u/22430135?v=3","gravatar_id":"","url":"https://api.github.com/users/NEU-2016","html_url":"https://github.com/NEU-2016","followers_url":"https://api.github.com/users/NEU-2016/followers","following_url":"https://api.github.com/users/NEU-2016/following{/other_user}","gists_url":"https://api.github.com/users/NEU-2016/gists{/gist_id}","starred_url":"https://api.github.com/users/NEU-2016/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NEU-2016/subscriptions","organizations_url":"https://api.github.com/users/NEU-2016/orgs","repos_url":"https://api.github.com/users/NEU-2016/repos","events_url":"https://api.github.com/users/NEU-2016/events{/privacy}","received_events_url":"https://api.github.com/users/NEU-2016/received_events","type":"Organization","site_admin":false},"repo":{"id":69170568,"name":"NEUban","full_name":"NEU-2016/NEUban","owner":{"login":"NEU-2016","id":22430135,"avatar_url":"https://avatars.githubusercontent.com/u/22430135?v=3","gravatar_id":"","url":"https://api.github.com/users/NEU-2016","html_url":"https://github.com/NEU-2016","followers_url":"https://api.github.com/users/NEU-2016/followers","following_url":"https://api.github.com/users/NEU-2016/following{/other_user}","gists_url":"https://api.github.com/users/NEU-2016/gists{/gist_id}","starred_url":"https://api.github.com/users/NEU-2016/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NEU-2016/subscriptions","organizations_url":"https://api.github.com/users/NEU-2016/orgs","repos_url":"https://api.github.com/users/NEU-2016/repos","events_url":"https://api.github.com/users/NEU-2016/events{/privacy}","received_events_url":"https://api.github.com/users/NEU-2016/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/NEU-2016/NEUban","description":null,"fork":false,"url":"https://api.github.com/repos/NEU-2016/NEUban","forks_url":"https://api.github.com/repos/NEU-2016/NEUban/forks","keys_url":"https://api.github.com/repos/NEU-2016/NEUban/keys{/key_id}","collaborators_url":"https://api.github.com/repos/NEU-2016/NEUban/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/NEU-2016/NEUban/teams","hooks_url":"https://api.github.com/repos/NEU-2016/NEUban/hooks","issue_events_url":"https://api.github.com/repos/NEU-2016/NEUban/issues/events{/number}","events_url":"https://api.github.com/repos/NEU-2016/NEUban/events","assignees_url":"https://api.github.com/repos/NEU-2016/NEUban/assignees{/user}","branches_url":"https://api.github.com/repos/NEU-2016/NEUban/branches{/branch}","tags_url":"https://api.github.com/repos/NEU-2016/NEUban/tags","blobs_url":"https://api.github.com/repos/NEU-2016/NEUban/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/NEU-2016/NEUban/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/NEU-2016/NEUban/git/refs{/sha}","trees_url":"https://api.github.com/repos/NEU-2016/NEUban/git/trees{/sha}","statuses_url":"https://api.github.com/repos/NEU-2016/NEUban/statuses/{sha}","languages_url":"https://api.github.com/repos/NEU-2016/NEUban/languages","stargazers_url":"https://api.github.com/repos/NEU-2016/NEUban/stargazers","contributors_url":"https://api.github.com/repos/NEU-2016/NEUban/contributors","subscribers_url":"https://api.github.com/repos/NEU-2016/NEUban/subscribers","subscription_url":"https://api.github.com/repos/NEU-2016/NEUban/subscription","commits_url":"https://api.github.com/repos/NEU-2016/NEUban/commits{/sha}","git_commits_url":"https://api.github.com/repos/NEU-2016/NEUban/git/commits{/sha}","comments_url":"https://api.github.com/repos/NEU-2016/NEUban/comments{/number}","issue_comment_url":"https://api.github.com/repos/NEU-2016/NEUban/issues/comments{/number}","contents_url":"https://api.github.com/repos/NEU-2016/NEUban/contents/{+path}","compare_url":"https://api.github.com/repos/NEU-2016/NEUban/compare/{base}...{head}","merges_url":"https://api.github.com/repos/NEU-2016/NEUban/merges","archive_url":"https://api.github.com/repos/NEU-2016/NEUban/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/NEU-2016/NEUban/downloads","issues_url":"https://api.github.com/repos/NEU-2016/NEUban/issues{/number}","pulls_url":"https://api.github.com/repos/NEU-2016/NEUban/pulls{/number}","milestones_url":"https://api.github.com/repos/NEU-2016/NEUban/milestones{/number}","notifications_url":"https://api.github.com/repos/NEU-2016/NEUban/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/NEU-2016/NEUban/labels{/name}","releases_url":"https://api.github.com/repos/NEU-2016/NEUban/releases{/id}","deployments_url":"https://api.github.com/repos/NEU-2016/NEUban/deployments","created_at":"2016-09-25T14:50:47Z","updated_at":"2016-10-02T12:37:30Z","pushed_at":"2016-12-06T21:29:21Z","git_url":"git://github.com/NEU-2016/NEUban.git","ssh_url":"git@github.com:NEU-2016/NEUban.git","clone_url":"https://github.com/NEU-2016/NEUban.git","svn_url":"https://github.com/NEU-2016/NEUban","homepage":null,"size":732,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"NEU-2016:master","ref":"master","sha":"d434562c427aab894d81d2f60e6da4b561bb1b76","user":{"login":"NEU-2016","id":22430135,"avatar_url":"https://avatars.githubusercontent.com/u/22430135?v=3","gravatar_id":"","url":"https://api.github.com/users/NEU-2016","html_url":"https://github.com/NEU-2016","followers_url":"https://api.github.com/users/NEU-2016/followers","following_url":"https://api.github.com/users/NEU-2016/following{/other_user}","gists_url":"https://api.github.com/users/NEU-2016/gists{/gist_id}","starred_url":"https://api.github.com/users/NEU-2016/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NEU-2016/subscriptions","organizations_url":"https://api.github.com/users/NEU-2016/orgs","repos_url":"https://api.github.com/users/NEU-2016/repos","events_url":"https://api.github.com/users/NEU-2016/events{/privacy}","received_events_url":"https://api.github.com/users/NEU-2016/received_events","type":"Organization","site_admin":false},"repo":{"id":69170568,"name":"NEUban","full_name":"NEU-2016/NEUban","owner":{"login":"NEU-2016","id":22430135,"avatar_url":"https://avatars.githubusercontent.com/u/22430135?v=3","gravatar_id":"","url":"https://api.github.com/users/NEU-2016","html_url":"https://github.com/NEU-2016","followers_url":"https://api.github.com/users/NEU-2016/followers","following_url":"https://api.github.com/users/NEU-2016/following{/other_user}","gists_url":"https://api.github.com/users/NEU-2016/gists{/gist_id}","starred_url":"https://api.github.com/users/NEU-2016/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NEU-2016/subscriptions","organizations_url":"https://api.github.com/users/NEU-2016/orgs","repos_url":"https://api.github.com/users/NEU-2016/repos","events_url":"https://api.github.com/users/NEU-2016/events{/privacy}","received_events_url":"https://api.github.com/users/NEU-2016/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/NEU-2016/NEUban","description":null,"fork":false,"url":"https://api.github.com/repos/NEU-2016/NEUban","forks_url":"https://api.github.com/repos/NEU-2016/NEUban/forks","keys_url":"https://api.github.com/repos/NEU-2016/NEUban/keys{/key_id}","collaborators_url":"https://api.github.com/repos/NEU-2016/NEUban/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/NEU-2016/NEUban/teams","hooks_url":"https://api.github.com/repos/NEU-2016/NEUban/hooks","issue_events_url":"https://api.github.com/repos/NEU-2016/NEUban/issues/events{/number}","events_url":"https://api.github.com/repos/NEU-2016/NEUban/events","assignees_url":"https://api.github.com/repos/NEU-2016/NEUban/assignees{/user}","branches_url":"https://api.github.com/repos/NEU-2016/NEUban/branches{/branch}","tags_url":"https://api.github.com/repos/NEU-2016/NEUban/tags","blobs_url":"https://api.github.com/repos/NEU-2016/NEUban/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/NEU-2016/NEUban/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/NEU-2016/NEUban/git/refs{/sha}","trees_url":"https://api.github.com/repos/NEU-2016/NEUban/git/trees{/sha}","statuses_url":"https://api.github.com/repos/NEU-2016/NEUban/statuses/{sha}","languages_url":"https://api.github.com/repos/NEU-2016/NEUban/languages","stargazers_url":"https://api.github.com/repos/NEU-2016/NEUban/stargazers","contributors_url":"https://api.github.com/repos/NEU-2016/NEUban/contributors","subscribers_url":"https://api.github.com/repos/NEU-2016/NEUban/subscribers","subscription_url":"https://api.github.com/repos/NEU-2016/NEUban/subscription","commits_url":"https://api.github.com/repos/NEU-2016/NEUban/commits{/sha}","git_commits_url":"https://api.github.com/repos/NEU-2016/NEUban/git/commits{/sha}","comments_url":"https://api.github.com/repos/NEU-2016/NEUban/comments{/number}","issue_comment_url":"https://api.github.com/repos/NEU-2016/NEUban/issues/comments{/number}","contents_url":"https://api.github.com/repos/NEU-2016/NEUban/contents/{+path}","compare_url":"https://api.github.com/repos/NEU-2016/NEUban/compare/{base}...{head}","merges_url":"https://api.github.com/repos/NEU-2016/NEUban/merges","archive_url":"https://api.github.com/repos/NEU-2016/NEUban/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/NEU-2016/NEUban/downloads","issues_url":"https://api.github.com/repos/NEU-2016/NEUban/issues{/number}","pulls_url":"https://api.github.com/repos/NEU-2016/NEUban/pulls{/number}","milestones_url":"https://api.github.com/repos/NEU-2016/NEUban/milestones{/number}","notifications_url":"https://api.github.com/repos/NEU-2016/NEUban/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/NEU-2016/NEUban/labels{/name}","releases_url":"https://api.github.com/repos/NEU-2016/NEUban/releases{/id}","deployments_url":"https://api.github.com/repos/NEU-2016/NEUban/deployments","created_at":"2016-09-25T14:50:47Z","updated_at":"2016-10-02T12:37:30Z","pushed_at":"2016-12-06T21:29:21Z","git_url":"git://github.com/NEU-2016/NEUban.git","ssh_url":"git@github.com:NEU-2016/NEUban.git","clone_url":"https://github.com/NEU-2016/NEUban.git","svn_url":"https://github.com/NEU-2016/NEUban","homepage":null,"size":732,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/NEU-2016/NEUban/pulls/51"},"html":{"href":"https://github.com/NEU-2016/NEUban/pull/51"},"issue":{"href":"https://api.github.com/repos/NEU-2016/NEUban/issues/51"},"comments":{"href":"https://api.github.com/repos/NEU-2016/NEUban/issues/51/comments"},"review_comments":{"href":"https://api.github.com/repos/NEU-2016/NEUban/pulls/51/comments"},"review_comment":{"href":"https://api.github.com/repos/NEU-2016/NEUban/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/NEU-2016/NEUban/pulls/51/commits"},"statuses":{"href":"https://api.github.com/repos/NEU-2016/NEUban/statuses/3c7a8ec976aa901b189d4e6968fbbe5b6036ca2b"}}}}
{"actor":{"display_login":"gabichelsea"}}