{"action":"created","comment":{"url":"https://api.github.com/repos/bhuwang/java_training/pulls/comments/39471080","id":39471080,"diff_hunk":"@@ -0,0 +1,305 @@\n+package com.lftechnology.java.training.srijan.basics.coreapp.dao;\n+\n+import com.lftechnology.java.training.srijan.basics.coreapp.domain.Employee;\n+import com.lftechnology.java.training.srijan.basics.coreapp.domain.UserRole;\n+\n+import java.sql.Connection;\n+import java.sql.PreparedStatement;\n+import java.sql.ResultSet;\n+import java.sql.SQLException;\n+import java.sql.Statement;\n+import java.util.ArrayList;\n+import java.util.List;\n+import java.util.logging.Level;\n+import java.util.logging.Logger;\n+\n+public class EmployeeDaoImpl implements EmployeeDao {\n+\n+\tprivate static final Logger LOGGER = Logger.getLogger(EmployeeDaoImpl.class.getName());\n+\n+\tpublic void addEmployee(Employee e) {\n+\t\tConnection con = null;\n+\t\tcon = DbConnection.dbConnection();\n+\t\tPreparedStatement prepareStatementInsertEmployeeDetails = null;\n+\t\tPreparedStatement prepareStatementLoginDetails = null;\n+\t\ttry {\n+\t\t\tif (con != null) {\n+\t\t\t\tString queryEmployee = \"INSERT INTO employeeDetails (username,fullname,department,address,employee_role,is_terminated) VALUES(?,?,?,?,?,?)\";\n+\t\t\t\tString queryLogin = \"INSERT INTO userCredential(user_name,password,is_terminated,user_role) VALUES(?,?,?,?)\";\n+\t\t\t\tprepareStatementInsertEmployeeDetails = con.prepareStatement(queryEmployee);\n+\t\t\t\tprepareStatementLoginDetails = con.prepareStatement(queryLogin);\n+\t\t\t\tprepareStatementInsertEmployeeDetails.setString(1, e.getUserName());\n+\t\t\t\tprepareStatementInsertEmployeeDetails.setString(2, e.getFullName());\n+\t\t\t\tprepareStatementInsertEmployeeDetails.setString(3, e.getDepartment());\n+\t\t\t\tprepareStatementInsertEmployeeDetails.setString(4, e.getAddress());\n+\t\t\t\tprepareStatementInsertEmployeeDetails.setString(5, e.getUserRole().name());\n+\t\t\t\tprepareStatementInsertEmployeeDetails.setBoolean(6, e.getIsTerminated());\n+\t\t\t\tprepareStatementLoginDetails.setString(1, e.getUserName());\n+\t\t\t\tprepareStatementLoginDetails.setString(2, e.getPassword());\n+\t\t\t\tprepareStatementLoginDetails.setBoolean(3, e.getIsTerminated());\n+\t\t\t\tprepareStatementLoginDetails.setString(4, e.getUserRole().name());\n+\t\t\t\tprepareStatementInsertEmployeeDetails.executeUpdate();\n+\t\t\t\tprepareStatementLoginDetails.executeUpdate();\n+\t\t\t}\n+\t\t} catch (Exception ex) {\n+\t\t\tLOGGER.log(Level.INFO, \"Exception{0}\", ex);\n+\t\t} finally {\n+\t\t\ttry {\n+\t\t\t\tprepareStatementInsertEmployeeDetails.close();\n+\t\t\t\tprepareStatementLoginDetails.close();\n+\t\t\t\tcon.close();\n+\t\t\t} catch (SQLException e1) {\n+\t\t\t\tLOGGER.log(Level.INFO, \"SQL Exception{0}\", e1);\n+\t\t\t}\n+\t\t}\n+\t}\n+\n+\tpublic Employee findById(int employeeIdToUpdate) {\n+\t\tConnection con = null;\n+\t\tResultSet resultSet = null;\n+\t\tcon = DbConnection.dbConnection();\n+\t\tPreparedStatement prepareStatementUpdateInfo = null;\n+\t\tEmployee employee = new Employee();\n+\t\ttry {\n+\t\t\tif (con != null) {\n+\t\t\t\tString query = \"Select * from employeeDetails where id = ?\";\n+\t\t\t\tprepareStatementUpdateInfo = con.prepareStatement(query);\n+\t\t\t\tprepareStatementUpdateInfo.setInt(1, employeeIdToUpdate);\n+\t\t\t\tresultSet = prepareStatementUpdateInfo.executeQuery();\n+\t\t\t\twhile (resultSet.next()) {\n+\t\t\t\t\temployee.setId(resultSet.getInt(\"id\"));\n+\t\t\t\t\temployee.setUserName(resultSet.getString(\"username\"));","path":"src/com/lftechnology/java/training/srijan/basics/coreapp/dao/EmployeeDaoImpl.java","position":71,"original_position":71,"commit_id":"61c8f9b82105615c4f91e82ca6109f280f3f79a8","original_commit_id":"61c8f9b82105615c4f91e82ca6109f280f3f79a8","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 \"username\" 3 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-15T03:20:22Z","updated_at":"2015-09-15T03:20:22Z","html_url":"https://github.com/bhuwang/java_training/pull/118#discussion_r39471080","pull_request_url":"https://api.github.com/repos/bhuwang/java_training/pulls/118","_links":{"self":{"href":"https://api.github.com/repos/bhuwang/java_training/pulls/comments/39471080"},"html":{"href":"https://github.com/bhuwang/java_training/pull/118#discussion_r39471080"},"pull_request":{"href":"https://api.github.com/repos/bhuwang/java_training/pulls/118"}}},"pull_request":{"url":"https://api.github.com/repos/bhuwang/java_training/pulls/118","id":45004586,"html_url":"https://github.com/bhuwang/java_training/pull/118","diff_url":"https://github.com/bhuwang/java_training/pull/118.diff","patch_url":"https://github.com/bhuwang/java_training/pull/118.patch","issue_url":"https://api.github.com/repos/bhuwang/java_training/issues/118","number":118,"state":"open","locked":false,"title":"#32 core java app first attempt without documentation and few other r…","user":{"login":"SrijanBajracharya","id":13027817,"avatar_url":"https://avatars.githubusercontent.com/u/13027817?v=3","gravatar_id":"","url":"https://api.github.com/users/SrijanBajracharya","html_url":"https://github.com/SrijanBajracharya","followers_url":"https://api.github.com/users/SrijanBajracharya/followers","following_url":"https://api.github.com/users/SrijanBajracharya/following{/other_user}","gists_url":"https://api.github.com/users/SrijanBajracharya/gists{/gist_id}","starred_url":"https://api.github.com/users/SrijanBajracharya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SrijanBajracharya/subscriptions","organizations_url":"https://api.github.com/users/SrijanBajracharya/orgs","repos_url":"https://api.github.com/users/SrijanBajracharya/repos","events_url":"https://api.github.com/users/SrijanBajracharya/events{/privacy}","received_events_url":"https://api.github.com/users/SrijanBajracharya/received_events","type":"User","site_admin":false},"body":"core java app first attempt without documentation and few other requirements-multiple user with same name, isTerminated check before access,search user and edit by admit","created_at":"2015-09-15T03:09:42Z","updated_at":"2015-09-15T03:20:22Z","closed_at":null,"merged_at":null,"merge_commit_sha":"852696a0cff9622e2946fd8c3f3781d8f3155386","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/bhuwang/java_training/pulls/118/commits","review_comments_url":"https://api.github.com/repos/bhuwang/java_training/pulls/118/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/118/comments","statuses_url":"https://api.github.com/repos/bhuwang/java_training/statuses/61c8f9b82105615c4f91e82ca6109f280f3f79a8","head":{"label":"bhuwang:54_srijan","ref":"54_srijan","sha":"61c8f9b82105615c4f91e82ca6109f280f3f79a8","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-15T03:18:42Z","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":4242,"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":31,"forks":3,"open_issues":31,"watchers":0,"default_branch":"dev"}},"base":{"label":"bhuwang:dev","ref":"dev","sha":"6fb41a3dd7b652fb505f2a4aed4547ed368a9dab","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-15T03:18:42Z","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":4242,"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":31,"forks":3,"open_issues":31,"watchers":0,"default_branch":"dev"}},"_links":{"self":{"href":"https://api.github.com/repos/bhuwang/java_training/pulls/118"},"html":{"href":"https://github.com/bhuwang/java_training/pull/118"},"issue":{"href":"https://api.github.com/repos/bhuwang/java_training/issues/118"},"comments":{"href":"https://api.github.com/repos/bhuwang/java_training/issues/118/comments"},"review_comments":{"href":"https://api.github.com/repos/bhuwang/java_training/pulls/118/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/118/commits"},"statuses":{"href":"https://api.github.com/repos/bhuwang/java_training/statuses/61c8f9b82105615c4f91e82ca6109f280f3f79a8"}}}}