{"action":"created","comment":{"url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/pulls/comments/63223494","id":63223494,"diff_hunk":"@@ -0,0 +1,58 @@\n+package edu.softserve.zoo.service.impl;\n+\n+import edu.softserve.zoo.exceptions.ApplicationException;\n+import edu.softserve.zoo.exceptions.ExceptionReason;\n+import edu.softserve.zoo.model.BaseEntity;\n+import edu.softserve.zoo.persistence.repository.Repository;\n+import edu.softserve.zoo.persistence.specification.impl.GetAllSpecification;\n+import edu.softserve.zoo.persistence.specification.impl.GetByIdSpecification;\n+import edu.softserve.zoo.service.AbstractService;\n+import edu.softserve.zoo.service.exception.NotFoundException;\n+import edu.softserve.zoo.util.Validator;\n+import org.springframework.transaction.annotation.Transactional;\n+\n+import java.util.List;\n+\n+/**\n+ * @author Vadym Holub\n+ */\n+\n+public abstract class AbstractServiceImpl<T extends BaseEntity> implements AbstractService<T> {\n+\n+    private static final int FIRST_ELEM = 0;\n+\n+    @Transactional\n+    @Override\n+    public T findOne(Long id, Class<T> type) {\n+        List<T> result = getRepository().find(new GetByIdSpecification<>(type, id));\n+        Validator.notEmpty(result, ApplicationException.getBuilderFor(NotFoundException.class)\n+                .forReason(ExceptionReason.NOT_FOUND).build());\n+        return result.get(FIRST_ELEM);","path":"service/src/main/java/edu/softserve/zoo/service/impl/AbstractServiceImpl.java","position":30,"original_position":30,"commit_id":"61154ebeb57583f353709e916bb30d9ac149623e","original_commit_id":"61154ebeb57583f353709e916bb30d9ac149623e","user":{"login":"skyfenko","id":16687779,"avatar_url":"https://avatars.githubusercontent.com/u/16687779?v=3","gravatar_id":"","url":"https://api.github.com/users/skyfenko","html_url":"https://github.com/skyfenko","followers_url":"https://api.github.com/users/skyfenko/followers","following_url":"https://api.github.com/users/skyfenko/following{/other_user}","gists_url":"https://api.github.com/users/skyfenko/gists{/gist_id}","starred_url":"https://api.github.com/users/skyfenko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skyfenko/subscriptions","organizations_url":"https://api.github.com/users/skyfenko/orgs","repos_url":"https://api.github.com/users/skyfenko/repos","events_url":"https://api.github.com/users/skyfenko/events{/privacy}","received_events_url":"https://api.github.com/users/skyfenko/received_events","type":"User","site_admin":false},"body":"it's incorrect. don't use query.list() for single result","created_at":"2016-05-13T17:48:35Z","updated_at":"2016-05-13T17:48:35Z","html_url":"https://github.com/ITsvetkoFF/Kv-014/pull/95#discussion_r63223494","pull_request_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/pulls/95","_links":{"self":{"href":"https://api.github.com/repos/ITsvetkoFF/Kv-014/pulls/comments/63223494"},"html":{"href":"https://github.com/ITsvetkoFF/Kv-014/pull/95#discussion_r63223494"},"pull_request":{"href":"https://api.github.com/repos/ITsvetkoFF/Kv-014/pulls/95"}}},"pull_request":{"url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/pulls/95","id":70033031,"html_url":"https://github.com/ITsvetkoFF/Kv-014/pull/95","diff_url":"https://github.com/ITsvetkoFF/Kv-014/pull/95.diff","patch_url":"https://github.com/ITsvetkoFF/Kv-014/pull/95.patch","issue_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/issues/95","number":95,"state":"open","locked":false,"title":"added:","user":{"login":"onetwo1two","id":6643680,"avatar_url":"https://avatars.githubusercontent.com/u/6643680?v=3","gravatar_id":"","url":"https://api.github.com/users/onetwo1two","html_url":"https://github.com/onetwo1two","followers_url":"https://api.github.com/users/onetwo1two/followers","following_url":"https://api.github.com/users/onetwo1two/following{/other_user}","gists_url":"https://api.github.com/users/onetwo1two/gists{/gist_id}","starred_url":"https://api.github.com/users/onetwo1two/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/onetwo1two/subscriptions","organizations_url":"https://api.github.com/users/onetwo1two/orgs","repos_url":"https://api.github.com/users/onetwo1two/repos","events_url":"https://api.github.com/users/onetwo1two/events{/privacy}","received_events_url":"https://api.github.com/users/onetwo1two/received_events","type":"User","site_admin":false},"body":"- 2 modules (service, web)\r\n- abstract service with impl and geo_zone service\r\n- abstract controller with ExceptionHandler\r\n- converter for dto\r\n- dto\r\n- hibernate object mapper for lazy fields\r\n- spring configs","created_at":"2016-05-13T17:45:51Z","updated_at":"2016-05-13T17:48:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1829fd4cb0469659678addfd7b3ff831d90b2e45","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/pulls/95/commits","review_comments_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/pulls/95/comments","review_comment_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/issues/95/comments","statuses_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/statuses/61154ebeb57583f353709e916bb30d9ac149623e","head":{"label":"ITsvetkoFF:feature/abstract-service-web-layers","ref":"feature/abstract-service-web-layers","sha":"61154ebeb57583f353709e916bb30d9ac149623e","user":{"login":"ITsvetkoFF","id":7273003,"avatar_url":"https://avatars.githubusercontent.com/u/7273003?v=3","gravatar_id":"","url":"https://api.github.com/users/ITsvetkoFF","html_url":"https://github.com/ITsvetkoFF","followers_url":"https://api.github.com/users/ITsvetkoFF/followers","following_url":"https://api.github.com/users/ITsvetkoFF/following{/other_user}","gists_url":"https://api.github.com/users/ITsvetkoFF/gists{/gist_id}","starred_url":"https://api.github.com/users/ITsvetkoFF/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ITsvetkoFF/subscriptions","organizations_url":"https://api.github.com/users/ITsvetkoFF/orgs","repos_url":"https://api.github.com/users/ITsvetkoFF/repos","events_url":"https://api.github.com/users/ITsvetkoFF/events{/privacy}","received_events_url":"https://api.github.com/users/ITsvetkoFF/received_events","type":"User","site_admin":false},"repo":{"id":55958203,"name":"Kv-014","full_name":"ITsvetkoFF/Kv-014","owner":{"login":"ITsvetkoFF","id":7273003,"avatar_url":"https://avatars.githubusercontent.com/u/7273003?v=3","gravatar_id":"","url":"https://api.github.com/users/ITsvetkoFF","html_url":"https://github.com/ITsvetkoFF","followers_url":"https://api.github.com/users/ITsvetkoFF/followers","following_url":"https://api.github.com/users/ITsvetkoFF/following{/other_user}","gists_url":"https://api.github.com/users/ITsvetkoFF/gists{/gist_id}","starred_url":"https://api.github.com/users/ITsvetkoFF/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ITsvetkoFF/subscriptions","organizations_url":"https://api.github.com/users/ITsvetkoFF/orgs","repos_url":"https://api.github.com/users/ITsvetkoFF/repos","events_url":"https://api.github.com/users/ITsvetkoFF/events{/privacy}","received_events_url":"https://api.github.com/users/ITsvetkoFF/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ITsvetkoFF/Kv-014","description":"","fork":false,"url":"https://api.github.com/repos/ITsvetkoFF/Kv-014","forks_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/forks","keys_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/teams","hooks_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/hooks","issue_events_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/issues/events{/number}","events_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/events","assignees_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/assignees{/user}","branches_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/branches{/branch}","tags_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/tags","blobs_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/git/refs{/sha}","trees_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/statuses/{sha}","languages_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/languages","stargazers_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/stargazers","contributors_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/contributors","subscribers_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/subscribers","subscription_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/subscription","commits_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/commits{/sha}","git_commits_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/git/commits{/sha}","comments_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/comments{/number}","issue_comment_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/issues/comments{/number}","contents_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/contents/{+path}","compare_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/merges","archive_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/downloads","issues_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/issues{/number}","pulls_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/pulls{/number}","milestones_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/milestones{/number}","notifications_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/labels{/name}","releases_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/releases{/id}","deployments_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/deployments","created_at":"2016-04-11T09:16:21Z","updated_at":"2016-04-22T09:38:11Z","pushed_at":"2016-05-13T17:45:52Z","git_url":"git://github.com/ITsvetkoFF/Kv-014.git","ssh_url":"git@github.com:ITsvetkoFF/Kv-014.git","clone_url":"https://github.com/ITsvetkoFF/Kv-014.git","svn_url":"https://github.com/ITsvetkoFF/Kv-014","homepage":null,"size":1039,"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":22,"forks":0,"open_issues":22,"watchers":0,"default_branch":"develop"}},"base":{"label":"ITsvetkoFF:develop","ref":"develop","sha":"11bf700ee11ebb4cf8de71dd52fe786bcbc2a428","user":{"login":"ITsvetkoFF","id":7273003,"avatar_url":"https://avatars.githubusercontent.com/u/7273003?v=3","gravatar_id":"","url":"https://api.github.com/users/ITsvetkoFF","html_url":"https://github.com/ITsvetkoFF","followers_url":"https://api.github.com/users/ITsvetkoFF/followers","following_url":"https://api.github.com/users/ITsvetkoFF/following{/other_user}","gists_url":"https://api.github.com/users/ITsvetkoFF/gists{/gist_id}","starred_url":"https://api.github.com/users/ITsvetkoFF/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ITsvetkoFF/subscriptions","organizations_url":"https://api.github.com/users/ITsvetkoFF/orgs","repos_url":"https://api.github.com/users/ITsvetkoFF/repos","events_url":"https://api.github.com/users/ITsvetkoFF/events{/privacy}","received_events_url":"https://api.github.com/users/ITsvetkoFF/received_events","type":"User","site_admin":false},"repo":{"id":55958203,"name":"Kv-014","full_name":"ITsvetkoFF/Kv-014","owner":{"login":"ITsvetkoFF","id":7273003,"avatar_url":"https://avatars.githubusercontent.com/u/7273003?v=3","gravatar_id":"","url":"https://api.github.com/users/ITsvetkoFF","html_url":"https://github.com/ITsvetkoFF","followers_url":"https://api.github.com/users/ITsvetkoFF/followers","following_url":"https://api.github.com/users/ITsvetkoFF/following{/other_user}","gists_url":"https://api.github.com/users/ITsvetkoFF/gists{/gist_id}","starred_url":"https://api.github.com/users/ITsvetkoFF/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ITsvetkoFF/subscriptions","organizations_url":"https://api.github.com/users/ITsvetkoFF/orgs","repos_url":"https://api.github.com/users/ITsvetkoFF/repos","events_url":"https://api.github.com/users/ITsvetkoFF/events{/privacy}","received_events_url":"https://api.github.com/users/ITsvetkoFF/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ITsvetkoFF/Kv-014","description":"","fork":false,"url":"https://api.github.com/repos/ITsvetkoFF/Kv-014","forks_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/forks","keys_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/teams","hooks_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/hooks","issue_events_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/issues/events{/number}","events_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/events","assignees_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/assignees{/user}","branches_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/branches{/branch}","tags_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/tags","blobs_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/git/refs{/sha}","trees_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/statuses/{sha}","languages_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/languages","stargazers_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/stargazers","contributors_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/contributors","subscribers_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/subscribers","subscription_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/subscription","commits_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/commits{/sha}","git_commits_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/git/commits{/sha}","comments_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/comments{/number}","issue_comment_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/issues/comments{/number}","contents_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/contents/{+path}","compare_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/merges","archive_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/downloads","issues_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/issues{/number}","pulls_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/pulls{/number}","milestones_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/milestones{/number}","notifications_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/labels{/name}","releases_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/releases{/id}","deployments_url":"https://api.github.com/repos/ITsvetkoFF/Kv-014/deployments","created_at":"2016-04-11T09:16:21Z","updated_at":"2016-04-22T09:38:11Z","pushed_at":"2016-05-13T17:45:52Z","git_url":"git://github.com/ITsvetkoFF/Kv-014.git","ssh_url":"git@github.com:ITsvetkoFF/Kv-014.git","clone_url":"https://github.com/ITsvetkoFF/Kv-014.git","svn_url":"https://github.com/ITsvetkoFF/Kv-014","homepage":null,"size":1039,"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":22,"forks":0,"open_issues":22,"watchers":0,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/ITsvetkoFF/Kv-014/pulls/95"},"html":{"href":"https://github.com/ITsvetkoFF/Kv-014/pull/95"},"issue":{"href":"https://api.github.com/repos/ITsvetkoFF/Kv-014/issues/95"},"comments":{"href":"https://api.github.com/repos/ITsvetkoFF/Kv-014/issues/95/comments"},"review_comments":{"href":"https://api.github.com/repos/ITsvetkoFF/Kv-014/pulls/95/comments"},"review_comment":{"href":"https://api.github.com/repos/ITsvetkoFF/Kv-014/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ITsvetkoFF/Kv-014/pulls/95/commits"},"statuses":{"href":"https://api.github.com/repos/ITsvetkoFF/Kv-014/statuses/61154ebeb57583f353709e916bb30d9ac149623e"}}}}