{"action":"created","comment":{"url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/pulls/comments/91322056","pull_request_review_id":11823895,"id":91322056,"diff_hunk":"@@ -1,110 +1,145 @@\n package com.haniuchenko.dao;\n \n+import com.haniuchenko.exceptions.DAOException;\n import com.haniuchenko.model.Showroom;\n import com.haniuchenko.utilities.DBConnect;\n+import org.apache.log4j.Logger;\n \n import java.sql.*;\n import java.util.ArrayList;\n import java.util.List;\n \n-/**\n- * Created by Admin\n- */\n+import static com.haniuchenko.dao.Constants.*;\n+\n+\n public class ShowroomDaoImpl implements ShowroomDao {\n \n-    public List<Showroom> getList() {\n+    private static final Logger logger = Logger.getLogger(ShowroomDaoImpl.class);\n+\n+\n+    public List<Showroom> getList(String fieldName) throws DAOException {\n \n         Connection connection = DBConnect.getConnection();\n-        List<Showroom> result = new ArrayList<Showroom>();\n+        List<Showroom> result = new ArrayList<>();\n+        ResultSet resultSet;\n+        String query = (fieldName == null) ? QUERY_GET_ALL : QUERY_SEARCH;\n \n         try {\n-            Statement statement = connection.createStatement();\n-            ResultSet resultSet = statement.executeQuery(QUERY_GET_ALL);\n+            if (query.equals(QUERY_GET_ALL)) {\n+\n+                Statement statement = connection.createStatement();\n+                resultSet = statement.executeQuery(query);\n+                logger.debug(\"Initiating main page\");\n+            } else {\n+                PreparedStatement preparedStatement = connection.prepareStatement(query);","path":"src/main/java/com/haniuchenko/dao/ShowroomDaoImpl.java","position":41,"original_position":41,"commit_id":"9d2cc9f9b649cc4f5a2b70d3e6a03ce840b7fa8b","original_commit_id":"9d2cc9f9b649cc4f5a2b70d3e6a03ce840b7fa8b","user":{"login":"vladmaksimov","id":11949700,"avatar_url":"https://avatars.githubusercontent.com/u/11949700?v=3","gravatar_id":"","url":"https://api.github.com/users/vladmaksimov","html_url":"https://github.com/vladmaksimov","followers_url":"https://api.github.com/users/vladmaksimov/followers","following_url":"https://api.github.com/users/vladmaksimov/following{/other_user}","gists_url":"https://api.github.com/users/vladmaksimov/gists{/gist_id}","starred_url":"https://api.github.com/users/vladmaksimov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vladmaksimov/subscriptions","organizations_url":"https://api.github.com/users/vladmaksimov/orgs","repos_url":"https://api.github.com/users/vladmaksimov/repos","events_url":"https://api.github.com/users/vladmaksimov/events{/privacy}","received_events_url":"https://api.github.com/users/vladmaksimov/received_events","type":"User","site_admin":false},"body":"Bad idea to use String format in this case. Better to take already changed search string from service. ","created_at":"2016-12-07T15:53:04Z","updated_at":"2016-12-07T15:53:04Z","html_url":"https://github.com/vladmaksimov/education-haniuchenko/pull/6#discussion_r91322056","pull_request_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/pulls/6","_links":{"self":{"href":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/pulls/comments/91322056"},"html":{"href":"https://github.com/vladmaksimov/education-haniuchenko/pull/6#discussion_r91322056"},"pull_request":{"href":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/pulls/6"}}},"pull_request":{"url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/pulls/6","id":96943367,"html_url":"https://github.com/vladmaksimov/education-haniuchenko/pull/6","diff_url":"https://github.com/vladmaksimov/education-haniuchenko/pull/6.diff","patch_url":"https://github.com/vladmaksimov/education-haniuchenko/pull/6.patch","issue_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/issues/6","number":6,"state":"open","locked":false,"title":"Dev","user":{"login":"haniuchenko","id":21101280,"avatar_url":"https://avatars.githubusercontent.com/u/21101280?v=3","gravatar_id":"","url":"https://api.github.com/users/haniuchenko","html_url":"https://github.com/haniuchenko","followers_url":"https://api.github.com/users/haniuchenko/followers","following_url":"https://api.github.com/users/haniuchenko/following{/other_user}","gists_url":"https://api.github.com/users/haniuchenko/gists{/gist_id}","starred_url":"https://api.github.com/users/haniuchenko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/haniuchenko/subscriptions","organizations_url":"https://api.github.com/users/haniuchenko/orgs","repos_url":"https://api.github.com/users/haniuchenko/repos","events_url":"https://api.github.com/users/haniuchenko/events{/privacy}","received_events_url":"https://api.github.com/users/haniuchenko/received_events","type":"User","site_admin":false},"body":"Брат, смержи.","created_at":"2016-12-07T15:19:52Z","updated_at":"2016-12-07T15:55:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d5a673bdca82e42dcdc2ef71f1567dfc9301e1cf","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/pulls/6/commits","review_comments_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/pulls/6/comments","review_comment_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/pulls/comments{/number}","comments_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/issues/6/comments","statuses_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/statuses/9d2cc9f9b649cc4f5a2b70d3e6a03ce840b7fa8b","head":{"label":"vladmaksimov:dev","ref":"dev","sha":"9d2cc9f9b649cc4f5a2b70d3e6a03ce840b7fa8b","user":{"login":"vladmaksimov","id":11949700,"avatar_url":"https://avatars.githubusercontent.com/u/11949700?v=3","gravatar_id":"","url":"https://api.github.com/users/vladmaksimov","html_url":"https://github.com/vladmaksimov","followers_url":"https://api.github.com/users/vladmaksimov/followers","following_url":"https://api.github.com/users/vladmaksimov/following{/other_user}","gists_url":"https://api.github.com/users/vladmaksimov/gists{/gist_id}","starred_url":"https://api.github.com/users/vladmaksimov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vladmaksimov/subscriptions","organizations_url":"https://api.github.com/users/vladmaksimov/orgs","repos_url":"https://api.github.com/users/vladmaksimov/repos","events_url":"https://api.github.com/users/vladmaksimov/events{/privacy}","received_events_url":"https://api.github.com/users/vladmaksimov/received_events","type":"User","site_admin":false},"repo":{"id":72945970,"name":"education-haniuchenko","full_name":"vladmaksimov/education-haniuchenko","owner":{"login":"vladmaksimov","id":11949700,"avatar_url":"https://avatars.githubusercontent.com/u/11949700?v=3","gravatar_id":"","url":"https://api.github.com/users/vladmaksimov","html_url":"https://github.com/vladmaksimov","followers_url":"https://api.github.com/users/vladmaksimov/followers","following_url":"https://api.github.com/users/vladmaksimov/following{/other_user}","gists_url":"https://api.github.com/users/vladmaksimov/gists{/gist_id}","starred_url":"https://api.github.com/users/vladmaksimov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vladmaksimov/subscriptions","organizations_url":"https://api.github.com/users/vladmaksimov/orgs","repos_url":"https://api.github.com/users/vladmaksimov/repos","events_url":"https://api.github.com/users/vladmaksimov/events{/privacy}","received_events_url":"https://api.github.com/users/vladmaksimov/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/vladmaksimov/education-haniuchenko","description":null,"fork":false,"url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko","forks_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/forks","keys_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/teams","hooks_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/hooks","issue_events_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/issues/events{/number}","events_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/events","assignees_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/assignees{/user}","branches_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/branches{/branch}","tags_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/tags","blobs_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/git/refs{/sha}","trees_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/statuses/{sha}","languages_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/languages","stargazers_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/stargazers","contributors_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/contributors","subscribers_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/subscribers","subscription_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/subscription","commits_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/commits{/sha}","git_commits_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/git/commits{/sha}","comments_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/comments{/number}","issue_comment_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/issues/comments{/number}","contents_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/contents/{+path}","compare_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/merges","archive_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/downloads","issues_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/issues{/number}","pulls_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/pulls{/number}","milestones_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/milestones{/number}","notifications_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/labels{/name}","releases_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/releases{/id}","deployments_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/deployments","created_at":"2016-11-05T18:38:06Z","updated_at":"2016-11-05T18:38:17Z","pushed_at":"2016-12-07T15:37:46Z","git_url":"git://github.com/vladmaksimov/education-haniuchenko.git","ssh_url":"git@github.com:vladmaksimov/education-haniuchenko.git","clone_url":"https://github.com/vladmaksimov/education-haniuchenko.git","svn_url":"https://github.com/vladmaksimov/education-haniuchenko","homepage":null,"size":202,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"vladmaksimov:master","ref":"master","sha":"284b17e9ef5d7b78455f18d460fb49bebaa3f7e4","user":{"login":"vladmaksimov","id":11949700,"avatar_url":"https://avatars.githubusercontent.com/u/11949700?v=3","gravatar_id":"","url":"https://api.github.com/users/vladmaksimov","html_url":"https://github.com/vladmaksimov","followers_url":"https://api.github.com/users/vladmaksimov/followers","following_url":"https://api.github.com/users/vladmaksimov/following{/other_user}","gists_url":"https://api.github.com/users/vladmaksimov/gists{/gist_id}","starred_url":"https://api.github.com/users/vladmaksimov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vladmaksimov/subscriptions","organizations_url":"https://api.github.com/users/vladmaksimov/orgs","repos_url":"https://api.github.com/users/vladmaksimov/repos","events_url":"https://api.github.com/users/vladmaksimov/events{/privacy}","received_events_url":"https://api.github.com/users/vladmaksimov/received_events","type":"User","site_admin":false},"repo":{"id":72945970,"name":"education-haniuchenko","full_name":"vladmaksimov/education-haniuchenko","owner":{"login":"vladmaksimov","id":11949700,"avatar_url":"https://avatars.githubusercontent.com/u/11949700?v=3","gravatar_id":"","url":"https://api.github.com/users/vladmaksimov","html_url":"https://github.com/vladmaksimov","followers_url":"https://api.github.com/users/vladmaksimov/followers","following_url":"https://api.github.com/users/vladmaksimov/following{/other_user}","gists_url":"https://api.github.com/users/vladmaksimov/gists{/gist_id}","starred_url":"https://api.github.com/users/vladmaksimov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vladmaksimov/subscriptions","organizations_url":"https://api.github.com/users/vladmaksimov/orgs","repos_url":"https://api.github.com/users/vladmaksimov/repos","events_url":"https://api.github.com/users/vladmaksimov/events{/privacy}","received_events_url":"https://api.github.com/users/vladmaksimov/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/vladmaksimov/education-haniuchenko","description":null,"fork":false,"url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko","forks_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/forks","keys_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/teams","hooks_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/hooks","issue_events_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/issues/events{/number}","events_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/events","assignees_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/assignees{/user}","branches_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/branches{/branch}","tags_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/tags","blobs_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/git/refs{/sha}","trees_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/statuses/{sha}","languages_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/languages","stargazers_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/stargazers","contributors_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/contributors","subscribers_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/subscribers","subscription_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/subscription","commits_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/commits{/sha}","git_commits_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/git/commits{/sha}","comments_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/comments{/number}","issue_comment_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/issues/comments{/number}","contents_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/contents/{+path}","compare_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/merges","archive_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/downloads","issues_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/issues{/number}","pulls_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/pulls{/number}","milestones_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/milestones{/number}","notifications_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/labels{/name}","releases_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/releases{/id}","deployments_url":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/deployments","created_at":"2016-11-05T18:38:06Z","updated_at":"2016-11-05T18:38:17Z","pushed_at":"2016-12-07T15:37:46Z","git_url":"git://github.com/vladmaksimov/education-haniuchenko.git","ssh_url":"git@github.com:vladmaksimov/education-haniuchenko.git","clone_url":"https://github.com/vladmaksimov/education-haniuchenko.git","svn_url":"https://github.com/vladmaksimov/education-haniuchenko","homepage":null,"size":202,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/pulls/6"},"html":{"href":"https://github.com/vladmaksimov/education-haniuchenko/pull/6"},"issue":{"href":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/issues/6"},"comments":{"href":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/issues/6/comments"},"review_comments":{"href":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/pulls/6/comments"},"review_comment":{"href":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/pulls/6/commits"},"statuses":{"href":"https://api.github.com/repos/vladmaksimov/education-haniuchenko/statuses/9d2cc9f9b649cc4f5a2b70d3e6a03ce840b7fa8b"}}}}
{"actor":{"display_login":"vladmaksimov"}}