{"action":"created","comment":{"url":"https://api.github.com/repos/clouway-incubator/guice/pulls/comments/29826534","id":29826534,"diff_hunk":"@@ -0,0 +1,84 @@\n+package adapter.db;\n+\n+import com.google.inject.Inject;\n+import core.AuthorizationResult;\n+import core.User;\n+import core.UserRepository;\n+import core.CurrentUser;\n+\n+import java.sql.ResultSet;\n+import java.sql.SQLException;\n+\n+/**\n+ * Created by Panayot Kulchev on 15-3-31.\n+ * e-mail: panayotkulchev@gmail.com\n+ * happy coding ...\n+ */\n+\n+public class PersistentUserRepository implements UserRepository {\n+\n+  private final DataStore dataStore;\n+\n+  @Inject\n+  public PersistentUserRepository(DataStore dataStore) {\n+\n+    this.dataStore = dataStore;\n+  }\n+\n+  @Override\n+  public boolean register(String email, String password) {\n+    if (!isExisting(email)){\n+      dataStore.executeQery(\"INSERT INTO user (user_email,user_password) values(?,?);\", email, password);\n+      return true;\n+    }\n+    return false;\n+  }\n+\n+  @Override\n+  public boolean isExisting(String email) {\n+    Integer count;\n+    count = dataStore.executeCount(\"SELECT count(*) FROM bank.user where user_email = '\" + email + \"';\");\n+    return count != 0;\n+  }\n+\n+  @Override\n+  public boolean isExisting(String email, String password) {\n+    Integer count;\n+    count = dataStore.executeCount(\"SELECT count(*) FROM bank.user where user_email = '\" + email + \"'\"+\"and user_password = '\"+password+\"' ;\");\n+    return count != 0;\n+  }\n+\n+  @Override\n+  public AuthorizationResult authorize(String email, String password) {\n+    if (isExisting(email,password)){\n+      return new AuthorizationResult(getByEmail(email),true);\n+    }\n+    else return new AuthorizationResult(null,false);","path":"src/main/java/adapter/db/PersistentUserRepository.java","position":56,"original_position":56,"commit_id":"dbd5257f7546f22ed89ef977f15e52c216bd05e8","original_commit_id":"dbd5257f7546f22ed89ef977f15e52c216bd05e8","user":{"login":"mgenov","id":209223,"avatar_url":"https://avatars.githubusercontent.com/u/209223?v=3","gravatar_id":"","url":"https://api.github.com/users/mgenov","html_url":"https://github.com/mgenov","followers_url":"https://api.github.com/users/mgenov/followers","following_url":"https://api.github.com/users/mgenov/following{/other_user}","gists_url":"https://api.github.com/users/mgenov/gists{/gist_id}","starred_url":"https://api.github.com/users/mgenov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mgenov/subscriptions","organizations_url":"https://api.github.com/users/mgenov/orgs","repos_url":"https://api.github.com/users/mgenov/repos","events_url":"https://api.github.com/users/mgenov/events{/privacy}","received_events_url":"https://api.github.com/users/mgenov/received_events","type":"User","site_admin":false},"body":"brackets are missed ","created_at":"2015-05-07T06:03:47Z","updated_at":"2015-05-07T06:03:47Z","html_url":"https://github.com/clouway-incubator/guice/pull/3#discussion_r29826534","pull_request_url":"https://api.github.com/repos/clouway-incubator/guice/pulls/3","_links":{"self":{"href":"https://api.github.com/repos/clouway-incubator/guice/pulls/comments/29826534"},"html":{"href":"https://github.com/clouway-incubator/guice/pull/3#discussion_r29826534"},"pull_request":{"href":"https://api.github.com/repos/clouway-incubator/guice/pulls/3"}}},"pull_request":{"url":"https://api.github.com/repos/clouway-incubator/guice/pulls/3","id":34829187,"html_url":"https://github.com/clouway-incubator/guice/pull/3","diff_url":"https://github.com/clouway-incubator/guice/pull/3.diff","patch_url":"https://github.com/clouway-incubator/guice/pull/3.patch","issue_url":"https://api.github.com/repos/clouway-incubator/guice/issues/3","number":3,"state":"open","locked":false,"title":"pkulchev: bank redesign with sitebricks","user":{"login":"panayotkulchev","id":8696264,"avatar_url":"https://avatars.githubusercontent.com/u/8696264?v=3","gravatar_id":"","url":"https://api.github.com/users/panayotkulchev","html_url":"https://github.com/panayotkulchev","followers_url":"https://api.github.com/users/panayotkulchev/followers","following_url":"https://api.github.com/users/panayotkulchev/following{/other_user}","gists_url":"https://api.github.com/users/panayotkulchev/gists{/gist_id}","starred_url":"https://api.github.com/users/panayotkulchev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/panayotkulchev/subscriptions","organizations_url":"https://api.github.com/users/panayotkulchev/orgs","repos_url":"https://api.github.com/users/panayotkulchev/repos","events_url":"https://api.github.com/users/panayotkulchev/events{/privacy}","received_events_url":"https://api.github.com/users/panayotkulchev/received_events","type":"User","site_admin":false},"body":"Bank with Guice and SeteBricks by Panayot Kulchev id done /05.05.2015/","created_at":"2015-05-06T15:33:54Z","updated_at":"2015-05-07T06:03:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"43fe92acb3a56b278d15696ffda2f653aeebdc7d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/clouway-incubator/guice/pulls/3/commits","review_comments_url":"https://api.github.com/repos/clouway-incubator/guice/pulls/3/comments","review_comment_url":"https://api.github.com/repos/clouway-incubator/guice/pulls/comments{/number}","comments_url":"https://api.github.com/repos/clouway-incubator/guice/issues/3/comments","statuses_url":"https://api.github.com/repos/clouway-incubator/guice/statuses/dbd5257f7546f22ed89ef977f15e52c216bd05e8","head":{"label":"panayotkulchev:p_kulchev_bank_","ref":"p_kulchev_bank_","sha":"dbd5257f7546f22ed89ef977f15e52c216bd05e8","user":{"login":"panayotkulchev","id":8696264,"avatar_url":"https://avatars.githubusercontent.com/u/8696264?v=3","gravatar_id":"","url":"https://api.github.com/users/panayotkulchev","html_url":"https://github.com/panayotkulchev","followers_url":"https://api.github.com/users/panayotkulchev/followers","following_url":"https://api.github.com/users/panayotkulchev/following{/other_user}","gists_url":"https://api.github.com/users/panayotkulchev/gists{/gist_id}","starred_url":"https://api.github.com/users/panayotkulchev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/panayotkulchev/subscriptions","organizations_url":"https://api.github.com/users/panayotkulchev/orgs","repos_url":"https://api.github.com/users/panayotkulchev/repos","events_url":"https://api.github.com/users/panayotkulchev/events{/privacy}","received_events_url":"https://api.github.com/users/panayotkulchev/received_events","type":"User","site_admin":false},"repo":{"id":35086117,"name":"guice","full_name":"panayotkulchev/guice","owner":{"login":"panayotkulchev","id":8696264,"avatar_url":"https://avatars.githubusercontent.com/u/8696264?v=3","gravatar_id":"","url":"https://api.github.com/users/panayotkulchev","html_url":"https://github.com/panayotkulchev","followers_url":"https://api.github.com/users/panayotkulchev/followers","following_url":"https://api.github.com/users/panayotkulchev/following{/other_user}","gists_url":"https://api.github.com/users/panayotkulchev/gists{/gist_id}","starred_url":"https://api.github.com/users/panayotkulchev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/panayotkulchev/subscriptions","organizations_url":"https://api.github.com/users/panayotkulchev/orgs","repos_url":"https://api.github.com/users/panayotkulchev/repos","events_url":"https://api.github.com/users/panayotkulchev/events{/privacy}","received_events_url":"https://api.github.com/users/panayotkulchev/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/panayotkulchev/guice","description":"Working with Guice","fork":true,"url":"https://api.github.com/repos/panayotkulchev/guice","forks_url":"https://api.github.com/repos/panayotkulchev/guice/forks","keys_url":"https://api.github.com/repos/panayotkulchev/guice/keys{/key_id}","collaborators_url":"https://api.github.com/repos/panayotkulchev/guice/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/panayotkulchev/guice/teams","hooks_url":"https://api.github.com/repos/panayotkulchev/guice/hooks","issue_events_url":"https://api.github.com/repos/panayotkulchev/guice/issues/events{/number}","events_url":"https://api.github.com/repos/panayotkulchev/guice/events","assignees_url":"https://api.github.com/repos/panayotkulchev/guice/assignees{/user}","branches_url":"https://api.github.com/repos/panayotkulchev/guice/branches{/branch}","tags_url":"https://api.github.com/repos/panayotkulchev/guice/tags","blobs_url":"https://api.github.com/repos/panayotkulchev/guice/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/panayotkulchev/guice/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/panayotkulchev/guice/git/refs{/sha}","trees_url":"https://api.github.com/repos/panayotkulchev/guice/git/trees{/sha}","statuses_url":"https://api.github.com/repos/panayotkulchev/guice/statuses/{sha}","languages_url":"https://api.github.com/repos/panayotkulchev/guice/languages","stargazers_url":"https://api.github.com/repos/panayotkulchev/guice/stargazers","contributors_url":"https://api.github.com/repos/panayotkulchev/guice/contributors","subscribers_url":"https://api.github.com/repos/panayotkulchev/guice/subscribers","subscription_url":"https://api.github.com/repos/panayotkulchev/guice/subscription","commits_url":"https://api.github.com/repos/panayotkulchev/guice/commits{/sha}","git_commits_url":"https://api.github.com/repos/panayotkulchev/guice/git/commits{/sha}","comments_url":"https://api.github.com/repos/panayotkulchev/guice/comments{/number}","issue_comment_url":"https://api.github.com/repos/panayotkulchev/guice/issues/comments{/number}","contents_url":"https://api.github.com/repos/panayotkulchev/guice/contents/{+path}","compare_url":"https://api.github.com/repos/panayotkulchev/guice/compare/{base}...{head}","merges_url":"https://api.github.com/repos/panayotkulchev/guice/merges","archive_url":"https://api.github.com/repos/panayotkulchev/guice/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/panayotkulchev/guice/downloads","issues_url":"https://api.github.com/repos/panayotkulchev/guice/issues{/number}","pulls_url":"https://api.github.com/repos/panayotkulchev/guice/pulls{/number}","milestones_url":"https://api.github.com/repos/panayotkulchev/guice/milestones{/number}","notifications_url":"https://api.github.com/repos/panayotkulchev/guice/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/panayotkulchev/guice/labels{/name}","releases_url":"https://api.github.com/repos/panayotkulchev/guice/releases{/id}","created_at":"2015-05-05T08:01:11Z","updated_at":"2014-12-13T04:22:03Z","pushed_at":"2015-05-06T15:30:50Z","git_url":"git://github.com/panayotkulchev/guice.git","ssh_url":"git@github.com:panayotkulchev/guice.git","clone_url":"https://github.com/panayotkulchev/guice.git","svn_url":"https://github.com/panayotkulchev/guice","homepage":null,"size":100,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"clouway-incubator:p_kulchev_bank","ref":"p_kulchev_bank","sha":"0d6d8c2c37cf1c7b5238417680c20f57411768a6","user":{"login":"clouway-incubator","id":10173098,"avatar_url":"https://avatars.githubusercontent.com/u/10173098?v=3","gravatar_id":"","url":"https://api.github.com/users/clouway-incubator","html_url":"https://github.com/clouway-incubator","followers_url":"https://api.github.com/users/clouway-incubator/followers","following_url":"https://api.github.com/users/clouway-incubator/following{/other_user}","gists_url":"https://api.github.com/users/clouway-incubator/gists{/gist_id}","starred_url":"https://api.github.com/users/clouway-incubator/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clouway-incubator/subscriptions","organizations_url":"https://api.github.com/users/clouway-incubator/orgs","repos_url":"https://api.github.com/users/clouway-incubator/repos","events_url":"https://api.github.com/users/clouway-incubator/events{/privacy}","received_events_url":"https://api.github.com/users/clouway-incubator/received_events","type":"Organization","site_admin":false},"repo":{"id":27949184,"name":"guice","full_name":"clouway-incubator/guice","owner":{"login":"clouway-incubator","id":10173098,"avatar_url":"https://avatars.githubusercontent.com/u/10173098?v=3","gravatar_id":"","url":"https://api.github.com/users/clouway-incubator","html_url":"https://github.com/clouway-incubator","followers_url":"https://api.github.com/users/clouway-incubator/followers","following_url":"https://api.github.com/users/clouway-incubator/following{/other_user}","gists_url":"https://api.github.com/users/clouway-incubator/gists{/gist_id}","starred_url":"https://api.github.com/users/clouway-incubator/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clouway-incubator/subscriptions","organizations_url":"https://api.github.com/users/clouway-incubator/orgs","repos_url":"https://api.github.com/users/clouway-incubator/repos","events_url":"https://api.github.com/users/clouway-incubator/events{/privacy}","received_events_url":"https://api.github.com/users/clouway-incubator/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/clouway-incubator/guice","description":"Working with Guice","fork":false,"url":"https://api.github.com/repos/clouway-incubator/guice","forks_url":"https://api.github.com/repos/clouway-incubator/guice/forks","keys_url":"https://api.github.com/repos/clouway-incubator/guice/keys{/key_id}","collaborators_url":"https://api.github.com/repos/clouway-incubator/guice/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/clouway-incubator/guice/teams","hooks_url":"https://api.github.com/repos/clouway-incubator/guice/hooks","issue_events_url":"https://api.github.com/repos/clouway-incubator/guice/issues/events{/number}","events_url":"https://api.github.com/repos/clouway-incubator/guice/events","assignees_url":"https://api.github.com/repos/clouway-incubator/guice/assignees{/user}","branches_url":"https://api.github.com/repos/clouway-incubator/guice/branches{/branch}","tags_url":"https://api.github.com/repos/clouway-incubator/guice/tags","blobs_url":"https://api.github.com/repos/clouway-incubator/guice/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/clouway-incubator/guice/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/clouway-incubator/guice/git/refs{/sha}","trees_url":"https://api.github.com/repos/clouway-incubator/guice/git/trees{/sha}","statuses_url":"https://api.github.com/repos/clouway-incubator/guice/statuses/{sha}","languages_url":"https://api.github.com/repos/clouway-incubator/guice/languages","stargazers_url":"https://api.github.com/repos/clouway-incubator/guice/stargazers","contributors_url":"https://api.github.com/repos/clouway-incubator/guice/contributors","subscribers_url":"https://api.github.com/repos/clouway-incubator/guice/subscribers","subscription_url":"https://api.github.com/repos/clouway-incubator/guice/subscription","commits_url":"https://api.github.com/repos/clouway-incubator/guice/commits{/sha}","git_commits_url":"https://api.github.com/repos/clouway-incubator/guice/git/commits{/sha}","comments_url":"https://api.github.com/repos/clouway-incubator/guice/comments{/number}","issue_comment_url":"https://api.github.com/repos/clouway-incubator/guice/issues/comments{/number}","contents_url":"https://api.github.com/repos/clouway-incubator/guice/contents/{+path}","compare_url":"https://api.github.com/repos/clouway-incubator/guice/compare/{base}...{head}","merges_url":"https://api.github.com/repos/clouway-incubator/guice/merges","archive_url":"https://api.github.com/repos/clouway-incubator/guice/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/clouway-incubator/guice/downloads","issues_url":"https://api.github.com/repos/clouway-incubator/guice/issues{/number}","pulls_url":"https://api.github.com/repos/clouway-incubator/guice/pulls{/number}","milestones_url":"https://api.github.com/repos/clouway-incubator/guice/milestones{/number}","notifications_url":"https://api.github.com/repos/clouway-incubator/guice/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/clouway-incubator/guice/labels{/name}","releases_url":"https://api.github.com/repos/clouway-incubator/guice/releases{/id}","created_at":"2014-12-13T04:22:03Z","updated_at":"2014-12-13T04:22:03Z","pushed_at":"2015-05-06T15:33:55Z","git_url":"git://github.com/clouway-incubator/guice.git","ssh_url":"git@github.com:clouway-incubator/guice.git","clone_url":"https://github.com/clouway-incubator/guice.git","svn_url":"https://github.com/clouway-incubator/guice","homepage":null,"size":100,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":2,"forks":3,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/clouway-incubator/guice/pulls/3"},"html":{"href":"https://github.com/clouway-incubator/guice/pull/3"},"issue":{"href":"https://api.github.com/repos/clouway-incubator/guice/issues/3"},"comments":{"href":"https://api.github.com/repos/clouway-incubator/guice/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/clouway-incubator/guice/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/clouway-incubator/guice/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/clouway-incubator/guice/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/clouway-incubator/guice/statuses/dbd5257f7546f22ed89ef977f15e52c216bd05e8"}}}}