{"action":"created","comment":{"url":"https://api.github.com/repos/kbakaras/e2-jpa/pulls/comments/240165409","pull_request_review_id":183129487,"id":240165409,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI0MDE2NTQwOQ==","diff_hunk":"@@ -0,0 +1,95 @@\n+package ru.kbakaras.e2.jpa;\n+\n+import ru.kbakaras.e2.message.E2Attribute;\n+import ru.kbakaras.e2.message.E2Attributes;\n+import ru.kbakaras.e2.message.E2Element;\n+import ru.kbakaras.e2.message.E2Entity;\n+import ru.kbakaras.e2.message.E2Payload;\n+import ru.kbakaras.e2.message.E2Reference;\n+\n+import java.lang.reflect.Constructor;\n+import java.util.HashMap;\n+import java.util.List;\n+import java.util.Map;\n+import java.util.Optional;\n+import java.util.UUID;\n+\n+/**\n+ * project: e2-jpa\n+ * author:  kostrovik\n+ * date:    2018-12-06\n+ * github:  https://github.com/kostrovik/e2-jpa\n+ */\n+public class E2Deserializer {\n+    private E2Metamodel metamodel;\n+    private E2Payload payload;\n+    private Map<UUID, Object> instances = new HashMap<>();\n+\n+    public E2Deserializer(E2Metamodel metamodel, E2Payload payload) {\n+        this.metamodel = metamodel;\n+        this.payload = payload;\n+    }\n+\n+    public Map<UUID, Object> deserialize() throws ReflectiveOperationException {\n+        List<E2Entity> entities = payload.entities();\n+        for (E2Entity entity : entities) {\n+            List<E2Element> elements = entity.elementsChanged();\n+            for (E2Element element : elements) {\n+                deserializeElement(element);\n+            }\n+        }\n+\n+        return instances;\n+    }\n+\n+    private Object deserializeElement(E2Element element) throws ReflectiveOperationException {\n+        String uid = element.getUid();\n+\n+        Object itemInstance = instances.get(UUID.fromString(uid));\n+        if (itemInstance == null) {\n+            E2Attributes attributes = element.attributes;\n+            itemInstance = createInstance(element.entityName());\n+            instances.put(UUID.fromString(uid), itemInstance);","path":"src/main/java/ru/kbakaras/e2/jpa/E2Deserializer.java","position":null,"original_position":52,"commit_id":"455646ece32b92d8d3698a9435ed3bfe6ba34467","original_commit_id":"639f1c51e43c490cc8c255c2432a1b0dcba119dd","user":{"login":"kostrovik","id":39333994,"node_id":"MDQ6VXNlcjM5MzMzOTk0","avatar_url":"https://avatars3.githubusercontent.com/u/39333994?v=4","gravatar_id":"","url":"https://api.github.com/users/kostrovik","html_url":"https://github.com/kostrovik","followers_url":"https://api.github.com/users/kostrovik/followers","following_url":"https://api.github.com/users/kostrovik/following{/other_user}","gists_url":"https://api.github.com/users/kostrovik/gists{/gist_id}","starred_url":"https://api.github.com/users/kostrovik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kostrovik/subscriptions","organizations_url":"https://api.github.com/users/kostrovik/orgs","repos_url":"https://api.github.com/users/kostrovik/repos","events_url":"https://api.github.com/users/kostrovik/events{/privacy}","received_events_url":"https://api.github.com/users/kostrovik/received_events","type":"User","site_admin":false},"body":"Добавил поиск сущности. В случае если uid сущности синтетический то пробую искать по значению в атрибуте id.","created_at":"2018-12-10T10:56:34Z","updated_at":"2018-12-10T10:56:34Z","html_url":"https://github.com/kbakaras/e2-jpa/pull/7#discussion_r240165409","pull_request_url":"https://api.github.com/repos/kbakaras/e2-jpa/pulls/7","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/kbakaras/e2-jpa/pulls/comments/240165409"},"html":{"href":"https://github.com/kbakaras/e2-jpa/pull/7#discussion_r240165409"},"pull_request":{"href":"https://api.github.com/repos/kbakaras/e2-jpa/pulls/7"}},"in_reply_to_id":239402853},"pull_request":{"url":"https://api.github.com/repos/kbakaras/e2-jpa/pulls/7","id":236458343,"node_id":"MDExOlB1bGxSZXF1ZXN0MjM2NDU4MzQz","html_url":"https://github.com/kbakaras/e2-jpa/pull/7","diff_url":"https://github.com/kbakaras/e2-jpa/pull/7.diff","patch_url":"https://github.com/kbakaras/e2-jpa/pull/7.patch","issue_url":"https://api.github.com/repos/kbakaras/e2-jpa/issues/7","number":7,"state":"open","locked":false,"title":"Необходимо реализовать десериализатор","user":{"login":"kostrovik","id":39333994,"node_id":"MDQ6VXNlcjM5MzMzOTk0","avatar_url":"https://avatars3.githubusercontent.com/u/39333994?v=4","gravatar_id":"","url":"https://api.github.com/users/kostrovik","html_url":"https://github.com/kostrovik","followers_url":"https://api.github.com/users/kostrovik/followers","following_url":"https://api.github.com/users/kostrovik/following{/other_user}","gists_url":"https://api.github.com/users/kostrovik/gists{/gist_id}","starred_url":"https://api.github.com/users/kostrovik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kostrovik/subscriptions","organizations_url":"https://api.github.com/users/kostrovik/orgs","repos_url":"https://api.github.com/users/kostrovik/repos","events_url":"https://api.github.com/users/kostrovik/events{/privacy}","received_events_url":"https://api.github.com/users/kostrovik/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-12-06T09:21:53Z","updated_at":"2018-12-10T10:56:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"55fdddbaa620436f1b90fa58631e1b625c16a23d","assignee":{"login":"kostrovik","id":39333994,"node_id":"MDQ6VXNlcjM5MzMzOTk0","avatar_url":"https://avatars3.githubusercontent.com/u/39333994?v=4","gravatar_id":"","url":"https://api.github.com/users/kostrovik","html_url":"https://github.com/kostrovik","followers_url":"https://api.github.com/users/kostrovik/followers","following_url":"https://api.github.com/users/kostrovik/following{/other_user}","gists_url":"https://api.github.com/users/kostrovik/gists{/gist_id}","starred_url":"https://api.github.com/users/kostrovik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kostrovik/subscriptions","organizations_url":"https://api.github.com/users/kostrovik/orgs","repos_url":"https://api.github.com/users/kostrovik/repos","events_url":"https://api.github.com/users/kostrovik/events{/privacy}","received_events_url":"https://api.github.com/users/kostrovik/received_events","type":"User","site_admin":false},"assignees":[{"login":"kostrovik","id":39333994,"node_id":"MDQ6VXNlcjM5MzMzOTk0","avatar_url":"https://avatars3.githubusercontent.com/u/39333994?v=4","gravatar_id":"","url":"https://api.github.com/users/kostrovik","html_url":"https://github.com/kostrovik","followers_url":"https://api.github.com/users/kostrovik/followers","following_url":"https://api.github.com/users/kostrovik/following{/other_user}","gists_url":"https://api.github.com/users/kostrovik/gists{/gist_id}","starred_url":"https://api.github.com/users/kostrovik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kostrovik/subscriptions","organizations_url":"https://api.github.com/users/kostrovik/orgs","repos_url":"https://api.github.com/users/kostrovik/repos","events_url":"https://api.github.com/users/kostrovik/events{/privacy}","received_events_url":"https://api.github.com/users/kostrovik/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/kbakaras/e2-jpa/pulls/7/commits","review_comments_url":"https://api.github.com/repos/kbakaras/e2-jpa/pulls/7/comments","review_comment_url":"https://api.github.com/repos/kbakaras/e2-jpa/pulls/comments{/number}","comments_url":"https://api.github.com/repos/kbakaras/e2-jpa/issues/7/comments","statuses_url":"https://api.github.com/repos/kbakaras/e2-jpa/statuses/455646ece32b92d8d3698a9435ed3bfe6ba34467","head":{"label":"kbakaras:deserializer","ref":"deserializer","sha":"455646ece32b92d8d3698a9435ed3bfe6ba34467","user":{"login":"kbakaras","id":22593724,"node_id":"MDQ6VXNlcjIyNTkzNzI0","avatar_url":"https://avatars3.githubusercontent.com/u/22593724?v=4","gravatar_id":"","url":"https://api.github.com/users/kbakaras","html_url":"https://github.com/kbakaras","followers_url":"https://api.github.com/users/kbakaras/followers","following_url":"https://api.github.com/users/kbakaras/following{/other_user}","gists_url":"https://api.github.com/users/kbakaras/gists{/gist_id}","starred_url":"https://api.github.com/users/kbakaras/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kbakaras/subscriptions","organizations_url":"https://api.github.com/users/kbakaras/orgs","repos_url":"https://api.github.com/users/kbakaras/repos","events_url":"https://api.github.com/users/kbakaras/events{/privacy}","received_events_url":"https://api.github.com/users/kbakaras/received_events","type":"User","site_admin":false},"repo":{"id":160346879,"node_id":"MDEwOlJlcG9zaXRvcnkxNjAzNDY4Nzk=","name":"e2-jpa","full_name":"kbakaras/e2-jpa","private":false,"owner":{"login":"kbakaras","id":22593724,"node_id":"MDQ6VXNlcjIyNTkzNzI0","avatar_url":"https://avatars3.githubusercontent.com/u/22593724?v=4","gravatar_id":"","url":"https://api.github.com/users/kbakaras","html_url":"https://github.com/kbakaras","followers_url":"https://api.github.com/users/kbakaras/followers","following_url":"https://api.github.com/users/kbakaras/following{/other_user}","gists_url":"https://api.github.com/users/kbakaras/gists{/gist_id}","starred_url":"https://api.github.com/users/kbakaras/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kbakaras/subscriptions","organizations_url":"https://api.github.com/users/kbakaras/orgs","repos_url":"https://api.github.com/users/kbakaras/repos","events_url":"https://api.github.com/users/kbakaras/events{/privacy}","received_events_url":"https://api.github.com/users/kbakaras/received_events","type":"User","site_admin":false},"html_url":"https://github.com/kbakaras/e2-jpa","description":"Serializer, deserializer and request processor for jpa-based points","fork":false,"url":"https://api.github.com/repos/kbakaras/e2-jpa","forks_url":"https://api.github.com/repos/kbakaras/e2-jpa/forks","keys_url":"https://api.github.com/repos/kbakaras/e2-jpa/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kbakaras/e2-jpa/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kbakaras/e2-jpa/teams","hooks_url":"https://api.github.com/repos/kbakaras/e2-jpa/hooks","issue_events_url":"https://api.github.com/repos/kbakaras/e2-jpa/issues/events{/number}","events_url":"https://api.github.com/repos/kbakaras/e2-jpa/events","assignees_url":"https://api.github.com/repos/kbakaras/e2-jpa/assignees{/user}","branches_url":"https://api.github.com/repos/kbakaras/e2-jpa/branches{/branch}","tags_url":"https://api.github.com/repos/kbakaras/e2-jpa/tags","blobs_url":"https://api.github.com/repos/kbakaras/e2-jpa/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kbakaras/e2-jpa/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kbakaras/e2-jpa/git/refs{/sha}","trees_url":"https://api.github.com/repos/kbakaras/e2-jpa/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kbakaras/e2-jpa/statuses/{sha}","languages_url":"https://api.github.com/repos/kbakaras/e2-jpa/languages","stargazers_url":"https://api.github.com/repos/kbakaras/e2-jpa/stargazers","contributors_url":"https://api.github.com/repos/kbakaras/e2-jpa/contributors","subscribers_url":"https://api.github.com/repos/kbakaras/e2-jpa/subscribers","subscription_url":"https://api.github.com/repos/kbakaras/e2-jpa/subscription","commits_url":"https://api.github.com/repos/kbakaras/e2-jpa/commits{/sha}","git_commits_url":"https://api.github.com/repos/kbakaras/e2-jpa/git/commits{/sha}","comments_url":"https://api.github.com/repos/kbakaras/e2-jpa/comments{/number}","issue_comment_url":"https://api.github.com/repos/kbakaras/e2-jpa/issues/comments{/number}","contents_url":"https://api.github.com/repos/kbakaras/e2-jpa/contents/{+path}","compare_url":"https://api.github.com/repos/kbakaras/e2-jpa/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kbakaras/e2-jpa/merges","archive_url":"https://api.github.com/repos/kbakaras/e2-jpa/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kbakaras/e2-jpa/downloads","issues_url":"https://api.github.com/repos/kbakaras/e2-jpa/issues{/number}","pulls_url":"https://api.github.com/repos/kbakaras/e2-jpa/pulls{/number}","milestones_url":"https://api.github.com/repos/kbakaras/e2-jpa/milestones{/number}","notifications_url":"https://api.github.com/repos/kbakaras/e2-jpa/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kbakaras/e2-jpa/labels{/name}","releases_url":"https://api.github.com/repos/kbakaras/e2-jpa/releases{/id}","deployments_url":"https://api.github.com/repos/kbakaras/e2-jpa/deployments","created_at":"2018-12-04T11:27:47Z","updated_at":"2018-12-07T11:59:23Z","pushed_at":"2018-12-10T10:53:14Z","git_url":"git://github.com/kbakaras/e2-jpa.git","ssh_url":"git@github.com:kbakaras/e2-jpa.git","clone_url":"https://github.com/kbakaras/e2-jpa.git","svn_url":"https://github.com/kbakaras/e2-jpa","homepage":null,"size":67,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":7,"license":null,"forks":0,"open_issues":7,"watchers":0,"default_branch":"master"}},"base":{"label":"kbakaras:master","ref":"master","sha":"3cbc5308c546223410d75a5bef8bb11515766660","user":{"login":"kbakaras","id":22593724,"node_id":"MDQ6VXNlcjIyNTkzNzI0","avatar_url":"https://avatars3.githubusercontent.com/u/22593724?v=4","gravatar_id":"","url":"https://api.github.com/users/kbakaras","html_url":"https://github.com/kbakaras","followers_url":"https://api.github.com/users/kbakaras/followers","following_url":"https://api.github.com/users/kbakaras/following{/other_user}","gists_url":"https://api.github.com/users/kbakaras/gists{/gist_id}","starred_url":"https://api.github.com/users/kbakaras/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kbakaras/subscriptions","organizations_url":"https://api.github.com/users/kbakaras/orgs","repos_url":"https://api.github.com/users/kbakaras/repos","events_url":"https://api.github.com/users/kbakaras/events{/privacy}","received_events_url":"https://api.github.com/users/kbakaras/received_events","type":"User","site_admin":false},"repo":{"id":160346879,"node_id":"MDEwOlJlcG9zaXRvcnkxNjAzNDY4Nzk=","name":"e2-jpa","full_name":"kbakaras/e2-jpa","private":false,"owner":{"login":"kbakaras","id":22593724,"node_id":"MDQ6VXNlcjIyNTkzNzI0","avatar_url":"https://avatars3.githubusercontent.com/u/22593724?v=4","gravatar_id":"","url":"https://api.github.com/users/kbakaras","html_url":"https://github.com/kbakaras","followers_url":"https://api.github.com/users/kbakaras/followers","following_url":"https://api.github.com/users/kbakaras/following{/other_user}","gists_url":"https://api.github.com/users/kbakaras/gists{/gist_id}","starred_url":"https://api.github.com/users/kbakaras/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kbakaras/subscriptions","organizations_url":"https://api.github.com/users/kbakaras/orgs","repos_url":"https://api.github.com/users/kbakaras/repos","events_url":"https://api.github.com/users/kbakaras/events{/privacy}","received_events_url":"https://api.github.com/users/kbakaras/received_events","type":"User","site_admin":false},"html_url":"https://github.com/kbakaras/e2-jpa","description":"Serializer, deserializer and request processor for jpa-based points","fork":false,"url":"https://api.github.com/repos/kbakaras/e2-jpa","forks_url":"https://api.github.com/repos/kbakaras/e2-jpa/forks","keys_url":"https://api.github.com/repos/kbakaras/e2-jpa/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kbakaras/e2-jpa/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kbakaras/e2-jpa/teams","hooks_url":"https://api.github.com/repos/kbakaras/e2-jpa/hooks","issue_events_url":"https://api.github.com/repos/kbakaras/e2-jpa/issues/events{/number}","events_url":"https://api.github.com/repos/kbakaras/e2-jpa/events","assignees_url":"https://api.github.com/repos/kbakaras/e2-jpa/assignees{/user}","branches_url":"https://api.github.com/repos/kbakaras/e2-jpa/branches{/branch}","tags_url":"https://api.github.com/repos/kbakaras/e2-jpa/tags","blobs_url":"https://api.github.com/repos/kbakaras/e2-jpa/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kbakaras/e2-jpa/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kbakaras/e2-jpa/git/refs{/sha}","trees_url":"https://api.github.com/repos/kbakaras/e2-jpa/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kbakaras/e2-jpa/statuses/{sha}","languages_url":"https://api.github.com/repos/kbakaras/e2-jpa/languages","stargazers_url":"https://api.github.com/repos/kbakaras/e2-jpa/stargazers","contributors_url":"https://api.github.com/repos/kbakaras/e2-jpa/contributors","subscribers_url":"https://api.github.com/repos/kbakaras/e2-jpa/subscribers","subscription_url":"https://api.github.com/repos/kbakaras/e2-jpa/subscription","commits_url":"https://api.github.com/repos/kbakaras/e2-jpa/commits{/sha}","git_commits_url":"https://api.github.com/repos/kbakaras/e2-jpa/git/commits{/sha}","comments_url":"https://api.github.com/repos/kbakaras/e2-jpa/comments{/number}","issue_comment_url":"https://api.github.com/repos/kbakaras/e2-jpa/issues/comments{/number}","contents_url":"https://api.github.com/repos/kbakaras/e2-jpa/contents/{+path}","compare_url":"https://api.github.com/repos/kbakaras/e2-jpa/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kbakaras/e2-jpa/merges","archive_url":"https://api.github.com/repos/kbakaras/e2-jpa/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kbakaras/e2-jpa/downloads","issues_url":"https://api.github.com/repos/kbakaras/e2-jpa/issues{/number}","pulls_url":"https://api.github.com/repos/kbakaras/e2-jpa/pulls{/number}","milestones_url":"https://api.github.com/repos/kbakaras/e2-jpa/milestones{/number}","notifications_url":"https://api.github.com/repos/kbakaras/e2-jpa/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kbakaras/e2-jpa/labels{/name}","releases_url":"https://api.github.com/repos/kbakaras/e2-jpa/releases{/id}","deployments_url":"https://api.github.com/repos/kbakaras/e2-jpa/deployments","created_at":"2018-12-04T11:27:47Z","updated_at":"2018-12-07T11:59:23Z","pushed_at":"2018-12-10T10:53:14Z","git_url":"git://github.com/kbakaras/e2-jpa.git","ssh_url":"git@github.com:kbakaras/e2-jpa.git","clone_url":"https://github.com/kbakaras/e2-jpa.git","svn_url":"https://github.com/kbakaras/e2-jpa","homepage":null,"size":67,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":7,"license":null,"forks":0,"open_issues":7,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/kbakaras/e2-jpa/pulls/7"},"html":{"href":"https://github.com/kbakaras/e2-jpa/pull/7"},"issue":{"href":"https://api.github.com/repos/kbakaras/e2-jpa/issues/7"},"comments":{"href":"https://api.github.com/repos/kbakaras/e2-jpa/issues/7/comments"},"review_comments":{"href":"https://api.github.com/repos/kbakaras/e2-jpa/pulls/7/comments"},"review_comment":{"href":"https://api.github.com/repos/kbakaras/e2-jpa/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/kbakaras/e2-jpa/pulls/7/commits"},"statuses":{"href":"https://api.github.com/repos/kbakaras/e2-jpa/statuses/455646ece32b92d8d3698a9435ed3bfe6ba34467"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"kostrovik"}}