{"action":"created","comment":{"url":"https://api.github.com/repos/katharsis-project/katharsis-framework/pulls/comments/93822546","pull_request_review_id":14358349,"id":93822546,"diff_hunk":"@@ -84,61 +77,53 @@ private Serializable getSourceId(T source) {\n \t@Override\n \tpublic D findOneTarget(I sourceId, String fieldName, QueryParams queryParams) {\n \t\tString url = urlBuilder.buildUrl(sourceClass, sourceId, queryParams, fieldName);\n-\t\tBaseResponseContext responseContext = executeGet(url);\n-\t\treturn (D) responseContext.getResponse().getEntity();\n+\t\treturn (D) executeGet(url, ResponseType.RESOURCE);\n \t}\n \n \t@Override\n \tpublic DefaultResourceList<D> findManyTargets(I sourceId, String fieldName, QueryParams queryParams) {\n \t\tString url = urlBuilder.buildUrl(sourceClass, sourceId, queryParams, fieldName);\n-\t\tBaseResponseContext responseContext = executeGet(url);\n-\t\treturn toList(responseContext.getResponse());\n+\t\treturn (DefaultResourceList<D>) executeGet(url, ResponseType.RESOURCES);\n \t}\n \n \t@SuppressWarnings(\"unchecked\")\n \t@Override\n \tpublic D findOneTarget(I sourceId, String fieldName, QuerySpec querySpec) {\n \t\tString url = urlBuilder.buildUrl(sourceClass, sourceId, querySpec, fieldName);\n-\t\tBaseResponseContext responseContext = executeGet(url);\n-\t\treturn (D) responseContext.getResponse().getEntity();\n+\t\treturn (D) executeGet(url, ResponseType.RESOURCE);\n \t}\n \n \t@Override\n \tpublic DefaultResourceList<D> findManyTargets(I sourceId, String fieldName, QuerySpec querySpec) {\n \t\tString url = urlBuilder.buildUrl(sourceClass, sourceId, querySpec, fieldName);\n-\t\tBaseResponseContext responseContext = executeGet(url);\n-\t\treturn toList(responseContext.getResponse());\n+\t\treturn (DefaultResourceList<D>) executeGet(url, ResponseType.RESOURCES);\n \t}\n \n \tprivate void execute(String requestUrl, HttpMethod method, Object targetIds) {\n-\t\tJsonPath fieldPath = new ResourcePath(resourceInformation.getResourceType());\n+\t\tDocument document = new Document();\n \n-\t\tJsonApiResponse response = new JsonApiResponse();\n-\t\tBaseResponseContext context;\n \t\tif (targetIds instanceof Iterable) {\n-\t\t\tArrayList<LinkageContainer> containers = new ArrayList<>();\n+\t\t\tArrayList<ResourceIdentifier> resourceIdentifiers = new ArrayList<>();\n \t\t\tfor (Object targetId : (Iterable<?>) targetIds) {\n-\t\t\t\tcontainers.add(new LinkageContainer(targetId, targetClass, relationshipEntry));\n+\t\t\t\tString strTargetId = resourceInformation.toIdString(targetId);\n+\t\t\t\tresourceIdentifiers.add(new ResourceIdentifier(strTargetId, resourceInformation.getResourceType()));\n \t\t\t}\n-\t\t\tresponse.setEntity(containers);\n-\t\t\tcontext = new CollectionResponseContext(response, fieldPath, null);\n-\t\t}\n-\t\telse {\n-\t\t\tObject targetId = targetIds;\n-\t\t\tresponse.setEntity(new LinkageContainer(targetId, targetClass, relationshipEntry));\n-\t\t\tcontext = new ResourceResponseContext(response, fieldPath, (QueryAdapter) null);\n+\t\t\tdocument.setData(Nullable.of((Object) resourceIdentifiers));\n+\t\t} else {\n+\t\t\tString strTargetId = resourceInformation.toIdString(targetIds);","path":"katharsis-client/src/main/java/io/katharsis/client/internal/RelationshipRepositoryStubImpl.java","position":95,"original_position":95,"commit_id":"20bd2486db18f3a97ed96e4340aac71f1e87c30d","original_commit_id":"20bd2486db18f3a97ed96e4340aac71f1e87c30d","user":{"login":"chb0github","id":1476816,"avatar_url":"https://avatars.githubusercontent.com/u/1476816?v=3","gravatar_id":"","url":"https://api.github.com/users/chb0github","html_url":"https://github.com/chb0github","followers_url":"https://api.github.com/users/chb0github/followers","following_url":"https://api.github.com/users/chb0github/following{/other_user}","gists_url":"https://api.github.com/users/chb0github/gists{/gist_id}","starred_url":"https://api.github.com/users/chb0github/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chb0github/subscriptions","organizations_url":"https://api.github.com/users/chb0github/orgs","repos_url":"https://api.github.com/users/chb0github/repos","events_url":"https://api.github.com/users/chb0github/events{/privacy}","received_events_url":"https://api.github.com/users/chb0github/received_events","type":"User","site_admin":false},"body":"This code is flawed. If it's not `Iterable` then just do this thing. That is literally every other type in the world.","created_at":"2016-12-25T00:08:55Z","updated_at":"2016-12-25T00:08:55Z","html_url":"https://github.com/katharsis-project/katharsis-framework/pull/271#discussion_r93822546","pull_request_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/pulls/271","_links":{"self":{"href":"https://api.github.com/repos/katharsis-project/katharsis-framework/pulls/comments/93822546"},"html":{"href":"https://github.com/katharsis-project/katharsis-framework/pull/271#discussion_r93822546"},"pull_request":{"href":"https://api.github.com/repos/katharsis-project/katharsis-framework/pulls/271"}}},"pull_request":{"url":"https://api.github.com/repos/katharsis-project/katharsis-framework/pulls/271","id":99002358,"html_url":"https://github.com/katharsis-project/katharsis-framework/pull/271","diff_url":"https://github.com/katharsis-project/katharsis-framework/pull/271.diff","patch_url":"https://github.com/katharsis-project/katharsis-framework/pull/271.patch","issue_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/issues/271","number":271,"state":"open","locked":false,"title":"#269 Serialization refactoring","user":{"login":"remmeier","id":8008853,"avatar_url":"https://avatars.githubusercontent.com/u/8008853?v=3","gravatar_id":"","url":"https://api.github.com/users/remmeier","html_url":"https://github.com/remmeier","followers_url":"https://api.github.com/users/remmeier/followers","following_url":"https://api.github.com/users/remmeier/following{/other_user}","gists_url":"https://api.github.com/users/remmeier/gists{/gist_id}","starred_url":"https://api.github.com/users/remmeier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/remmeier/subscriptions","organizations_url":"https://api.github.com/users/remmeier/orgs","repos_url":"https://api.github.com/users/remmeier/repos","events_url":"https://api.github.com/users/remmeier/events{/privacy}","received_events_url":"https://api.github.com/users/remmeier/received_events","type":"User","site_admin":false},"body":"fixes the broken PATCH supper in JPA repositories. The original problem was caused due to the fairly fragile use of managed/detached entities. This was necessary since the Katharsis inclusion mechanism updated the entities (IncludeLookupSetter). There was no reasonable solutation besides changing that.  Which in turn made a cleanup up the serialization handling necessary (which was long overdue anyway).\r\n\r\nPlenty of classes changed due to the large impact of the serialization. Most of it just some api in changes to the test cases. The important part (for the review) are the new Document, Resource, ResourceIdentifier, Relationship classes and the DocumentMapper class. They make up the new serialization mechanism. The controllers use the DocumentMapper to setup a Document, representing a response. This is then serialized with Jackson.\r\n\r\nActual serialization with Jackson is now trivial. Mostly the plain Document and related classes with some annotations are sufficient to handle the serialization. All the previous logic has moved into the more readable DocumentMapper.  \r\n\r\nThe inclusion is updated accordingly. All the logic contained in IncludeLookupSetter. It is now longer spread between the IncludeLookupSetter, the Extractor and the serializers, which in turn should make it more understandable.\r\n\r\nThe only breaking change is in the Filter API which is now able to modify the Document instead of the JSON API response. Nevertheless to do the size of the change, the next version should be 3.0 together with the cleaned up packaging structure.\r\n\r\nIn general the refactoring makes the controller and serialization layer easier, more understandable. and testable. It should also ease future extensions. All existing tests pass. Some more should be written. ","created_at":"2016-12-21T20:50:03Z","updated_at":"2016-12-25T00:08:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"abc09040b5f980ee5fef74de120d742f6e91afb8","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/pulls/271/commits","review_comments_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/pulls/271/comments","review_comment_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/pulls/comments{/number}","comments_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/issues/271/comments","statuses_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/statuses/20bd2486db18f3a97ed96e4340aac71f1e87c30d","head":{"label":"katharsis-project:serializer_refactor","ref":"serializer_refactor","sha":"20bd2486db18f3a97ed96e4340aac71f1e87c30d","user":{"login":"katharsis-project","id":12221293,"avatar_url":"https://avatars.githubusercontent.com/u/12221293?v=3","gravatar_id":"","url":"https://api.github.com/users/katharsis-project","html_url":"https://github.com/katharsis-project","followers_url":"https://api.github.com/users/katharsis-project/followers","following_url":"https://api.github.com/users/katharsis-project/following{/other_user}","gists_url":"https://api.github.com/users/katharsis-project/gists{/gist_id}","starred_url":"https://api.github.com/users/katharsis-project/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/katharsis-project/subscriptions","organizations_url":"https://api.github.com/users/katharsis-project/orgs","repos_url":"https://api.github.com/users/katharsis-project/repos","events_url":"https://api.github.com/users/katharsis-project/events{/privacy}","received_events_url":"https://api.github.com/users/katharsis-project/received_events","type":"Organization","site_admin":false},"repo":{"id":64340716,"name":"katharsis-framework","full_name":"katharsis-project/katharsis-framework","owner":{"login":"katharsis-project","id":12221293,"avatar_url":"https://avatars.githubusercontent.com/u/12221293?v=3","gravatar_id":"","url":"https://api.github.com/users/katharsis-project","html_url":"https://github.com/katharsis-project","followers_url":"https://api.github.com/users/katharsis-project/followers","following_url":"https://api.github.com/users/katharsis-project/following{/other_user}","gists_url":"https://api.github.com/users/katharsis-project/gists{/gist_id}","starred_url":"https://api.github.com/users/katharsis-project/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/katharsis-project/subscriptions","organizations_url":"https://api.github.com/users/katharsis-project/orgs","repos_url":"https://api.github.com/users/katharsis-project/repos","events_url":"https://api.github.com/users/katharsis-project/events{/privacy}","received_events_url":"https://api.github.com/users/katharsis-project/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/katharsis-project/katharsis-framework","description":"Katharsis adds powerful layer for RESTful endpoints providing implementenation of JSON:API standard","fork":false,"url":"https://api.github.com/repos/katharsis-project/katharsis-framework","forks_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/forks","keys_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/keys{/key_id}","collaborators_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/teams","hooks_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/hooks","issue_events_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/issues/events{/number}","events_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/events","assignees_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/assignees{/user}","branches_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/branches{/branch}","tags_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/tags","blobs_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/git/refs{/sha}","trees_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/git/trees{/sha}","statuses_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/statuses/{sha}","languages_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/languages","stargazers_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/stargazers","contributors_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/contributors","subscribers_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/subscribers","subscription_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/subscription","commits_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/commits{/sha}","git_commits_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/git/commits{/sha}","comments_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/comments{/number}","issue_comment_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/issues/comments{/number}","contents_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/contents/{+path}","compare_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/compare/{base}...{head}","merges_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/merges","archive_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/downloads","issues_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/issues{/number}","pulls_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/pulls{/number}","milestones_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/milestones{/number}","notifications_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/labels{/name}","releases_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/releases{/id}","deployments_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/deployments","created_at":"2016-07-27T20:46:27Z","updated_at":"2016-12-16T23:03:11Z","pushed_at":"2016-12-24T09:44:35Z","git_url":"git://github.com/katharsis-project/katharsis-framework.git","ssh_url":"git@github.com:katharsis-project/katharsis-framework.git","clone_url":"https://github.com/katharsis-project/katharsis-framework.git","svn_url":"https://github.com/katharsis-project/katharsis-framework","homepage":"http://katharsis.io","size":3459,"stargazers_count":46,"watchers_count":46,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":19,"mirror_url":null,"open_issues_count":61,"forks":19,"open_issues":61,"watchers":46,"default_branch":"master"}},"base":{"label":"katharsis-project:develop","ref":"develop","sha":"d1c96105f811b0578e1ca86e079ab95518812982","user":{"login":"katharsis-project","id":12221293,"avatar_url":"https://avatars.githubusercontent.com/u/12221293?v=3","gravatar_id":"","url":"https://api.github.com/users/katharsis-project","html_url":"https://github.com/katharsis-project","followers_url":"https://api.github.com/users/katharsis-project/followers","following_url":"https://api.github.com/users/katharsis-project/following{/other_user}","gists_url":"https://api.github.com/users/katharsis-project/gists{/gist_id}","starred_url":"https://api.github.com/users/katharsis-project/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/katharsis-project/subscriptions","organizations_url":"https://api.github.com/users/katharsis-project/orgs","repos_url":"https://api.github.com/users/katharsis-project/repos","events_url":"https://api.github.com/users/katharsis-project/events{/privacy}","received_events_url":"https://api.github.com/users/katharsis-project/received_events","type":"Organization","site_admin":false},"repo":{"id":64340716,"name":"katharsis-framework","full_name":"katharsis-project/katharsis-framework","owner":{"login":"katharsis-project","id":12221293,"avatar_url":"https://avatars.githubusercontent.com/u/12221293?v=3","gravatar_id":"","url":"https://api.github.com/users/katharsis-project","html_url":"https://github.com/katharsis-project","followers_url":"https://api.github.com/users/katharsis-project/followers","following_url":"https://api.github.com/users/katharsis-project/following{/other_user}","gists_url":"https://api.github.com/users/katharsis-project/gists{/gist_id}","starred_url":"https://api.github.com/users/katharsis-project/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/katharsis-project/subscriptions","organizations_url":"https://api.github.com/users/katharsis-project/orgs","repos_url":"https://api.github.com/users/katharsis-project/repos","events_url":"https://api.github.com/users/katharsis-project/events{/privacy}","received_events_url":"https://api.github.com/users/katharsis-project/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/katharsis-project/katharsis-framework","description":"Katharsis adds powerful layer for RESTful endpoints providing implementenation of JSON:API standard","fork":false,"url":"https://api.github.com/repos/katharsis-project/katharsis-framework","forks_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/forks","keys_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/keys{/key_id}","collaborators_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/teams","hooks_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/hooks","issue_events_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/issues/events{/number}","events_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/events","assignees_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/assignees{/user}","branches_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/branches{/branch}","tags_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/tags","blobs_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/git/refs{/sha}","trees_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/git/trees{/sha}","statuses_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/statuses/{sha}","languages_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/languages","stargazers_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/stargazers","contributors_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/contributors","subscribers_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/subscribers","subscription_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/subscription","commits_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/commits{/sha}","git_commits_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/git/commits{/sha}","comments_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/comments{/number}","issue_comment_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/issues/comments{/number}","contents_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/contents/{+path}","compare_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/compare/{base}...{head}","merges_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/merges","archive_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/downloads","issues_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/issues{/number}","pulls_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/pulls{/number}","milestones_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/milestones{/number}","notifications_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/labels{/name}","releases_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/releases{/id}","deployments_url":"https://api.github.com/repos/katharsis-project/katharsis-framework/deployments","created_at":"2016-07-27T20:46:27Z","updated_at":"2016-12-16T23:03:11Z","pushed_at":"2016-12-24T09:44:35Z","git_url":"git://github.com/katharsis-project/katharsis-framework.git","ssh_url":"git@github.com:katharsis-project/katharsis-framework.git","clone_url":"https://github.com/katharsis-project/katharsis-framework.git","svn_url":"https://github.com/katharsis-project/katharsis-framework","homepage":"http://katharsis.io","size":3459,"stargazers_count":46,"watchers_count":46,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":19,"mirror_url":null,"open_issues_count":61,"forks":19,"open_issues":61,"watchers":46,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/katharsis-project/katharsis-framework/pulls/271"},"html":{"href":"https://github.com/katharsis-project/katharsis-framework/pull/271"},"issue":{"href":"https://api.github.com/repos/katharsis-project/katharsis-framework/issues/271"},"comments":{"href":"https://api.github.com/repos/katharsis-project/katharsis-framework/issues/271/comments"},"review_comments":{"href":"https://api.github.com/repos/katharsis-project/katharsis-framework/pulls/271/comments"},"review_comment":{"href":"https://api.github.com/repos/katharsis-project/katharsis-framework/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/katharsis-project/katharsis-framework/pulls/271/commits"},"statuses":{"href":"https://api.github.com/repos/katharsis-project/katharsis-framework/statuses/20bd2486db18f3a97ed96e4340aac71f1e87c30d"}}}}
{"actor":{"display_login":"chb0github"}}