{"action":"created","comment":{"url":"https://api.github.com/repos/bhuwang/java_training/pulls/comments/39483301","id":39483301,"diff_hunk":"@@ -0,0 +1,507 @@\n+package com.lftechnology.java.training.niraj.ems.services.implementations;\n+\n+import java.io.Console;\n+import java.sql.SQLException;\n+import java.util.LinkedHashMap;\n+import java.util.List;\n+import java.util.Map;\n+import java.util.Scanner;\n+import java.util.logging.Logger;\n+\n+import com.lftechnology.java.training.niraj.ems.domains.Employee;\n+import com.lftechnology.java.training.niraj.ems.enums.Operators;\n+import com.lftechnology.java.training.niraj.ems.enums.Roles;\n+import com.lftechnology.java.training.niraj.ems.enums.Status;\n+import com.lftechnology.java.training.niraj.ems.exceptions.CustomException;\n+import com.lftechnology.java.training.niraj.ems.services.CrudService;\n+import com.lftechnology.java.training.niraj.ems.utils.Constants;\n+import com.lftechnology.java.training.niraj.ems.utils.UserNumInputImpl;\n+import com.lftechnology.java.training.niraj.ems.utils.UserStringInputImpl;\n+import com.lftechnology.java.training.niraj.ems.utils.Utils;\n+\n+public class UserServiceImpl implements CrudService<Employee, String> {\n+\n+    private static final Logger LOGGER = Logger.getLogger(UserServiceImpl.class.getName());\n+    private EmployeeDaoImpl employeeDao;\n+    private UserStringInputImpl userInput;\n+    private UserNumInputImpl userNumInput;\n+\n+    public UserServiceImpl() {\n+        employeeDao = new EmployeeDaoImpl();\n+        userInput = new UserStringInputImpl();\n+        userNumInput = new UserNumInputImpl();\n+    }\n+\n+    @Override\n+    public Employee save(Employee t) throws SQLException {\n+        return employeeDao.save(t);\n+    }\n+\n+    @Override\n+    public Employee find(String s) throws SQLException {\n+        return employeeDao.find(s);\n+    }\n+\n+    @Override\n+    public boolean update(Employee t) throws Exception {\n+        return employeeDao.update(t);\n+\n+    }\n+\n+    /**\n+     * Logs a user in\n+     * \n+     * @author Niraj Rajbhandari <nirajrajbhandari@lftechnology.com>\n+     * @param username\n+     * @param password\n+     * @return\n+     * @throws SQLException\n+     */\n+    public Employee login(String username, String password) throws SQLException {\n+        Map<String, String> credentials = new LinkedHashMap<String, String>();\n+        credentials.put(\"username\", username);\n+        credentials.put(\"password\", password);","path":"src/com/lftechnology/java/training/niraj/ems/services/implementations/UserServiceImpl.java","position":63,"original_position":63,"commit_id":"791725cc9d43c239bc4476a6448cf2c89dbed229","original_commit_id":"791725cc9d43c239bc4476a6448cf2c89dbed229","user":{"login":"bhuwang","id":3335673,"avatar_url":"https://avatars.githubusercontent.com/u/3335673?v=3","gravatar_id":"","url":"https://api.github.com/users/bhuwang","html_url":"https://github.com/bhuwang","followers_url":"https://api.github.com/users/bhuwang/followers","following_url":"https://api.github.com/users/bhuwang/following{/other_user}","gists_url":"https://api.github.com/users/bhuwang/gists{/gist_id}","starred_url":"https://api.github.com/users/bhuwang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bhuwang/subscriptions","organizations_url":"https://api.github.com/users/bhuwang/orgs","repos_url":"https://api.github.com/users/bhuwang/repos","events_url":"https://api.github.com/users/bhuwang/events{/privacy}","received_events_url":"https://api.github.com/users/bhuwang/received_events","type":"User","site_admin":false},"body":"![MINOR](https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-minor.png) Define a constant instead of duplicating this literal \"password\" 4 times. [![rule](https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/rule.png)](http://nemo.sonarqube.org/coding_rules#rule_key=squid%3AS1192)\n","created_at":"2015-09-15T07:56:29Z","updated_at":"2015-09-15T07:56:29Z","html_url":"https://github.com/bhuwang/java_training/pull/122#discussion_r39483301","pull_request_url":"https://api.github.com/repos/bhuwang/java_training/pulls/122","_links":{"self":{"href":"https://api.github.com/repos/bhuwang/java_training/pulls/comments/39483301"},"html":{"href":"https://github.com/bhuwang/java_training/pull/122#discussion_r39483301"},"pull_request":{"href":"https://api.github.com/repos/bhuwang/java_training/pulls/122"}}},"pull_request":{"url":"https://api.github.com/repos/bhuwang/java_training/pulls/122","id":45018713,"html_url":"https://github.com/bhuwang/java_training/pull/122","diff_url":"https://github.com/bhuwang/java_training/pull/122.diff","patch_url":"https://github.com/bhuwang/java_training/pull/122.patch","issue_url":"https://api.github.com/repos/bhuwang/java_training/issues/122","number":122,"state":"open","locked":false,"title":"#32 Creates a small employee management application","user":{"login":"niraj-rajbhandari","id":3805341,"avatar_url":"https://avatars.githubusercontent.com/u/3805341?v=3","gravatar_id":"","url":"https://api.github.com/users/niraj-rajbhandari","html_url":"https://github.com/niraj-rajbhandari","followers_url":"https://api.github.com/users/niraj-rajbhandari/followers","following_url":"https://api.github.com/users/niraj-rajbhandari/following{/other_user}","gists_url":"https://api.github.com/users/niraj-rajbhandari/gists{/gist_id}","starred_url":"https://api.github.com/users/niraj-rajbhandari/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/niraj-rajbhandari/subscriptions","organizations_url":"https://api.github.com/users/niraj-rajbhandari/orgs","repos_url":"https://api.github.com/users/niraj-rajbhandari/repos","events_url":"https://api.github.com/users/niraj-rajbhandari/events{/privacy}","received_events_url":"https://api.github.com/users/niraj-rajbhandari/received_events","type":"User","site_admin":false},"body":"This pull request consists of functionality to\r\n - register/login a user\r\n - add a user\r\n - search user by  username,full name,department and address\r\n - edit personal information\r\n - terminate/ delete user as per the role given to the user\r\n\r\nPlease review this code.","created_at":"2015-09-15T07:54:02Z","updated_at":"2015-09-15T07:56:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4136d3db504d86424c2f09a1989ce8e8458c8e50","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/bhuwang/java_training/pulls/122/commits","review_comments_url":"https://api.github.com/repos/bhuwang/java_training/pulls/122/comments","review_comment_url":"https://api.github.com/repos/bhuwang/java_training/pulls/comments{/number}","comments_url":"https://api.github.com/repos/bhuwang/java_training/issues/122/comments","statuses_url":"https://api.github.com/repos/bhuwang/java_training/statuses/791725cc9d43c239bc4476a6448cf2c89dbed229","head":{"label":"bhuwang:32_niraj","ref":"32_niraj","sha":"791725cc9d43c239bc4476a6448cf2c89dbed229","user":{"login":"bhuwang","id":3335673,"avatar_url":"https://avatars.githubusercontent.com/u/3335673?v=3","gravatar_id":"","url":"https://api.github.com/users/bhuwang","html_url":"https://github.com/bhuwang","followers_url":"https://api.github.com/users/bhuwang/followers","following_url":"https://api.github.com/users/bhuwang/following{/other_user}","gists_url":"https://api.github.com/users/bhuwang/gists{/gist_id}","starred_url":"https://api.github.com/users/bhuwang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bhuwang/subscriptions","organizations_url":"https://api.github.com/users/bhuwang/orgs","repos_url":"https://api.github.com/users/bhuwang/repos","events_url":"https://api.github.com/users/bhuwang/events{/privacy}","received_events_url":"https://api.github.com/users/bhuwang/received_events","type":"User","site_admin":false},"repo":{"id":40284843,"name":"java_training","full_name":"bhuwang/java_training","owner":{"login":"bhuwang","id":3335673,"avatar_url":"https://avatars.githubusercontent.com/u/3335673?v=3","gravatar_id":"","url":"https://api.github.com/users/bhuwang","html_url":"https://github.com/bhuwang","followers_url":"https://api.github.com/users/bhuwang/followers","following_url":"https://api.github.com/users/bhuwang/following{/other_user}","gists_url":"https://api.github.com/users/bhuwang/gists{/gist_id}","starred_url":"https://api.github.com/users/bhuwang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bhuwang/subscriptions","organizations_url":"https://api.github.com/users/bhuwang/orgs","repos_url":"https://api.github.com/users/bhuwang/repos","events_url":"https://api.github.com/users/bhuwang/events{/privacy}","received_events_url":"https://api.github.com/users/bhuwang/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bhuwang/java_training","description":"","fork":false,"url":"https://api.github.com/repos/bhuwang/java_training","forks_url":"https://api.github.com/repos/bhuwang/java_training/forks","keys_url":"https://api.github.com/repos/bhuwang/java_training/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bhuwang/java_training/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bhuwang/java_training/teams","hooks_url":"https://api.github.com/repos/bhuwang/java_training/hooks","issue_events_url":"https://api.github.com/repos/bhuwang/java_training/issues/events{/number}","events_url":"https://api.github.com/repos/bhuwang/java_training/events","assignees_url":"https://api.github.com/repos/bhuwang/java_training/assignees{/user}","branches_url":"https://api.github.com/repos/bhuwang/java_training/branches{/branch}","tags_url":"https://api.github.com/repos/bhuwang/java_training/tags","blobs_url":"https://api.github.com/repos/bhuwang/java_training/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bhuwang/java_training/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bhuwang/java_training/git/refs{/sha}","trees_url":"https://api.github.com/repos/bhuwang/java_training/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bhuwang/java_training/statuses/{sha}","languages_url":"https://api.github.com/repos/bhuwang/java_training/languages","stargazers_url":"https://api.github.com/repos/bhuwang/java_training/stargazers","contributors_url":"https://api.github.com/repos/bhuwang/java_training/contributors","subscribers_url":"https://api.github.com/repos/bhuwang/java_training/subscribers","subscription_url":"https://api.github.com/repos/bhuwang/java_training/subscription","commits_url":"https://api.github.com/repos/bhuwang/java_training/commits{/sha}","git_commits_url":"https://api.github.com/repos/bhuwang/java_training/git/commits{/sha}","comments_url":"https://api.github.com/repos/bhuwang/java_training/comments{/number}","issue_comment_url":"https://api.github.com/repos/bhuwang/java_training/issues/comments{/number}","contents_url":"https://api.github.com/repos/bhuwang/java_training/contents/{+path}","compare_url":"https://api.github.com/repos/bhuwang/java_training/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bhuwang/java_training/merges","archive_url":"https://api.github.com/repos/bhuwang/java_training/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bhuwang/java_training/downloads","issues_url":"https://api.github.com/repos/bhuwang/java_training/issues{/number}","pulls_url":"https://api.github.com/repos/bhuwang/java_training/pulls{/number}","milestones_url":"https://api.github.com/repos/bhuwang/java_training/milestones{/number}","notifications_url":"https://api.github.com/repos/bhuwang/java_training/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bhuwang/java_training/labels{/name}","releases_url":"https://api.github.com/repos/bhuwang/java_training/releases{/id}","created_at":"2015-08-06T04:45:13Z","updated_at":"2015-08-31T05:46:12Z","pushed_at":"2015-09-15T07:54:03Z","git_url":"git://github.com/bhuwang/java_training.git","ssh_url":"git@github.com:bhuwang/java_training.git","clone_url":"https://github.com/bhuwang/java_training.git","svn_url":"https://github.com/bhuwang/java_training","homepage":null,"size":4236,"stargazers_count":0,"watchers_count":0,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":33,"forks":3,"open_issues":33,"watchers":0,"default_branch":"dev"}},"base":{"label":"bhuwang:dev","ref":"dev","sha":"e2c751d7847db0c90d2726011e880bb45321dc73","user":{"login":"bhuwang","id":3335673,"avatar_url":"https://avatars.githubusercontent.com/u/3335673?v=3","gravatar_id":"","url":"https://api.github.com/users/bhuwang","html_url":"https://github.com/bhuwang","followers_url":"https://api.github.com/users/bhuwang/followers","following_url":"https://api.github.com/users/bhuwang/following{/other_user}","gists_url":"https://api.github.com/users/bhuwang/gists{/gist_id}","starred_url":"https://api.github.com/users/bhuwang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bhuwang/subscriptions","organizations_url":"https://api.github.com/users/bhuwang/orgs","repos_url":"https://api.github.com/users/bhuwang/repos","events_url":"https://api.github.com/users/bhuwang/events{/privacy}","received_events_url":"https://api.github.com/users/bhuwang/received_events","type":"User","site_admin":false},"repo":{"id":40284843,"name":"java_training","full_name":"bhuwang/java_training","owner":{"login":"bhuwang","id":3335673,"avatar_url":"https://avatars.githubusercontent.com/u/3335673?v=3","gravatar_id":"","url":"https://api.github.com/users/bhuwang","html_url":"https://github.com/bhuwang","followers_url":"https://api.github.com/users/bhuwang/followers","following_url":"https://api.github.com/users/bhuwang/following{/other_user}","gists_url":"https://api.github.com/users/bhuwang/gists{/gist_id}","starred_url":"https://api.github.com/users/bhuwang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bhuwang/subscriptions","organizations_url":"https://api.github.com/users/bhuwang/orgs","repos_url":"https://api.github.com/users/bhuwang/repos","events_url":"https://api.github.com/users/bhuwang/events{/privacy}","received_events_url":"https://api.github.com/users/bhuwang/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bhuwang/java_training","description":"","fork":false,"url":"https://api.github.com/repos/bhuwang/java_training","forks_url":"https://api.github.com/repos/bhuwang/java_training/forks","keys_url":"https://api.github.com/repos/bhuwang/java_training/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bhuwang/java_training/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bhuwang/java_training/teams","hooks_url":"https://api.github.com/repos/bhuwang/java_training/hooks","issue_events_url":"https://api.github.com/repos/bhuwang/java_training/issues/events{/number}","events_url":"https://api.github.com/repos/bhuwang/java_training/events","assignees_url":"https://api.github.com/repos/bhuwang/java_training/assignees{/user}","branches_url":"https://api.github.com/repos/bhuwang/java_training/branches{/branch}","tags_url":"https://api.github.com/repos/bhuwang/java_training/tags","blobs_url":"https://api.github.com/repos/bhuwang/java_training/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bhuwang/java_training/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bhuwang/java_training/git/refs{/sha}","trees_url":"https://api.github.com/repos/bhuwang/java_training/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bhuwang/java_training/statuses/{sha}","languages_url":"https://api.github.com/repos/bhuwang/java_training/languages","stargazers_url":"https://api.github.com/repos/bhuwang/java_training/stargazers","contributors_url":"https://api.github.com/repos/bhuwang/java_training/contributors","subscribers_url":"https://api.github.com/repos/bhuwang/java_training/subscribers","subscription_url":"https://api.github.com/repos/bhuwang/java_training/subscription","commits_url":"https://api.github.com/repos/bhuwang/java_training/commits{/sha}","git_commits_url":"https://api.github.com/repos/bhuwang/java_training/git/commits{/sha}","comments_url":"https://api.github.com/repos/bhuwang/java_training/comments{/number}","issue_comment_url":"https://api.github.com/repos/bhuwang/java_training/issues/comments{/number}","contents_url":"https://api.github.com/repos/bhuwang/java_training/contents/{+path}","compare_url":"https://api.github.com/repos/bhuwang/java_training/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bhuwang/java_training/merges","archive_url":"https://api.github.com/repos/bhuwang/java_training/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bhuwang/java_training/downloads","issues_url":"https://api.github.com/repos/bhuwang/java_training/issues{/number}","pulls_url":"https://api.github.com/repos/bhuwang/java_training/pulls{/number}","milestones_url":"https://api.github.com/repos/bhuwang/java_training/milestones{/number}","notifications_url":"https://api.github.com/repos/bhuwang/java_training/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bhuwang/java_training/labels{/name}","releases_url":"https://api.github.com/repos/bhuwang/java_training/releases{/id}","created_at":"2015-08-06T04:45:13Z","updated_at":"2015-08-31T05:46:12Z","pushed_at":"2015-09-15T07:54:03Z","git_url":"git://github.com/bhuwang/java_training.git","ssh_url":"git@github.com:bhuwang/java_training.git","clone_url":"https://github.com/bhuwang/java_training.git","svn_url":"https://github.com/bhuwang/java_training","homepage":null,"size":4236,"stargazers_count":0,"watchers_count":0,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":33,"forks":3,"open_issues":33,"watchers":0,"default_branch":"dev"}},"_links":{"self":{"href":"https://api.github.com/repos/bhuwang/java_training/pulls/122"},"html":{"href":"https://github.com/bhuwang/java_training/pull/122"},"issue":{"href":"https://api.github.com/repos/bhuwang/java_training/issues/122"},"comments":{"href":"https://api.github.com/repos/bhuwang/java_training/issues/122/comments"},"review_comments":{"href":"https://api.github.com/repos/bhuwang/java_training/pulls/122/comments"},"review_comment":{"href":"https://api.github.com/repos/bhuwang/java_training/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/bhuwang/java_training/pulls/122/commits"},"statuses":{"href":"https://api.github.com/repos/bhuwang/java_training/statuses/791725cc9d43c239bc4476a6448cf2c89dbed229"}}}}