{"action":"created","comment":{"url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/pulls/comments/166092461","pull_request_review_id":94119846,"id":166092461,"diff_hunk":"@@ -233,4 +236,65 @@ public void addNewCategory(String category){\n         \n     }\n     \n+    private Folder getFolderById(int folderId){\n+        Folder folder = new Folder();\n+        try {\n+            PreparedStatement pst = connection.prepareStatement(getFolderByIdQuery);\n+            pst.setInt(1, folderId);\n+            ResultSet result = pst.executeQuery();\n+            while (result.next()) {\n+                int id = result.getInt(1);\n+                String name = result.getString(2);\n+                String desc = result.getString(3);\n+                folder.setId(id);\n+                folder.setName(name);\n+                folder.setDescription(desc);\n+            }\n+        } catch (Exception ex) {\n+            System.out.println(ex.getMessage());\n+        }\n+        return folder;\n+    }\n+    public void updateAndSaveFolder(Folder folder){\n+        String updateFolder = \"UPDATE folders SET name = ?, description = ? WHERE idfolders = ?\";\n+        try{\n+            PreparedStatement pst = connection.prepareStatement(updateFolder);\n+            \n+            pst.setString(1, folder.getName());\n+            pst.setString(2, folder.getDescription());\n+            pst.setInt(3, folder.getId());\n+            \n+            pst.execute();\n+        }catch(Exception e){\n+            System.out.println(e.getMessage());\n+        }\n+    }\n+\n+    public void addCategoryToFolder(Folder selectedFolder, Category selectedCategory) {\n+        String addFolderCategory = \"INSERT INTO FOLDERS_HAS_CATEGORYS (idcategory, idfolders) VALUES(?, ?)\";\n+        try{\n+            PreparedStatement pst = connection.prepareStatement(addFolderCategory);\n+            pst.setInt(1, selectedCategory.getId());\n+            pst.setInt(2, selectedFolder.getId());\n+            \n+            pst.executeUpdate();\n+            \n+        }catch(Exception e){\n+            System.out.println(e.getMessage());\n+        }\n+    }\n+\n+    public void removeCategoryRfomFolder(Folder selectedFolder, Category selectedCategory) {","path":"src/repository/DBConnection.java","position":null,"original_position":62,"commit_id":"704bc1182651cd85f5ebbf1eda78f553a3147d35","original_commit_id":"704bc1182651cd85f5ebbf1eda78f553a3147d35","user":{"login":"joelonilsson","id":22932715,"avatar_url":"https://avatars3.githubusercontent.com/u/22932715?v=4","gravatar_id":"","url":"https://api.github.com/users/joelonilsson","html_url":"https://github.com/joelonilsson","followers_url":"https://api.github.com/users/joelonilsson/followers","following_url":"https://api.github.com/users/joelonilsson/following{/other_user}","gists_url":"https://api.github.com/users/joelonilsson/gists{/gist_id}","starred_url":"https://api.github.com/users/joelonilsson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joelonilsson/subscriptions","organizations_url":"https://api.github.com/users/joelonilsson/orgs","repos_url":"https://api.github.com/users/joelonilsson/repos","events_url":"https://api.github.com/users/joelonilsson/events{/privacy}","received_events_url":"https://api.github.com/users/joelonilsson/received_events","type":"User","site_admin":false},"body":"removeCategoryFromFolder*","created_at":"2018-02-05T19:50:14Z","updated_at":"2018-02-05T19:50:14Z","html_url":"https://github.com/joelonilsson/DocumentKeeper/pull/32#discussion_r166092461","pull_request_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/pulls/32","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/joelonilsson/DocumentKeeper/pulls/comments/166092461"},"html":{"href":"https://github.com/joelonilsson/DocumentKeeper/pull/32#discussion_r166092461"},"pull_request":{"href":"https://api.github.com/repos/joelonilsson/DocumentKeeper/pulls/32"}}},"pull_request":{"url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/pulls/32","id":167232969,"html_url":"https://github.com/joelonilsson/DocumentKeeper/pull/32","diff_url":"https://github.com/joelonilsson/DocumentKeeper/pull/32.diff","patch_url":"https://github.com/joelonilsson/DocumentKeeper/pull/32.patch","issue_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/issues/32","number":32,"state":"open","locked":false,"title":"Feature add a new category","user":{"login":"andreasvettefors","id":23025115,"avatar_url":"https://avatars1.githubusercontent.com/u/23025115?v=4","gravatar_id":"","url":"https://api.github.com/users/andreasvettefors","html_url":"https://github.com/andreasvettefors","followers_url":"https://api.github.com/users/andreasvettefors/followers","following_url":"https://api.github.com/users/andreasvettefors/following{/other_user}","gists_url":"https://api.github.com/users/andreasvettefors/gists{/gist_id}","starred_url":"https://api.github.com/users/andreasvettefors/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andreasvettefors/subscriptions","organizations_url":"https://api.github.com/users/andreasvettefors/orgs","repos_url":"https://api.github.com/users/andreasvettefors/repos","events_url":"https://api.github.com/users/andreasvettefors/events{/privacy}","received_events_url":"https://api.github.com/users/andreasvettefors/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-02-05T19:26:59Z","updated_at":"2018-02-05T19:50:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"503ddf254beab25d8ef2fa088a0f6f607db9f210","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"milestone":null,"commits_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/pulls/32/commits","review_comments_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/pulls/32/comments","review_comment_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/pulls/comments{/number}","comments_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/issues/32/comments","statuses_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/statuses/704bc1182651cd85f5ebbf1eda78f553a3147d35","head":{"label":"joelonilsson:feature-add-a-new-category","ref":"feature-add-a-new-category","sha":"704bc1182651cd85f5ebbf1eda78f553a3147d35","user":{"login":"joelonilsson","id":22932715,"avatar_url":"https://avatars3.githubusercontent.com/u/22932715?v=4","gravatar_id":"","url":"https://api.github.com/users/joelonilsson","html_url":"https://github.com/joelonilsson","followers_url":"https://api.github.com/users/joelonilsson/followers","following_url":"https://api.github.com/users/joelonilsson/following{/other_user}","gists_url":"https://api.github.com/users/joelonilsson/gists{/gist_id}","starred_url":"https://api.github.com/users/joelonilsson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joelonilsson/subscriptions","organizations_url":"https://api.github.com/users/joelonilsson/orgs","repos_url":"https://api.github.com/users/joelonilsson/repos","events_url":"https://api.github.com/users/joelonilsson/events{/privacy}","received_events_url":"https://api.github.com/users/joelonilsson/received_events","type":"User","site_admin":false},"repo":{"id":119673598,"name":"DocumentKeeper","full_name":"joelonilsson/DocumentKeeper","owner":{"login":"joelonilsson","id":22932715,"avatar_url":"https://avatars3.githubusercontent.com/u/22932715?v=4","gravatar_id":"","url":"https://api.github.com/users/joelonilsson","html_url":"https://github.com/joelonilsson","followers_url":"https://api.github.com/users/joelonilsson/followers","following_url":"https://api.github.com/users/joelonilsson/following{/other_user}","gists_url":"https://api.github.com/users/joelonilsson/gists{/gist_id}","starred_url":"https://api.github.com/users/joelonilsson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joelonilsson/subscriptions","organizations_url":"https://api.github.com/users/joelonilsson/orgs","repos_url":"https://api.github.com/users/joelonilsson/repos","events_url":"https://api.github.com/users/joelonilsson/events{/privacy}","received_events_url":"https://api.github.com/users/joelonilsson/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/joelonilsson/DocumentKeeper","description":null,"fork":false,"url":"https://api.github.com/repos/joelonilsson/DocumentKeeper","forks_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/forks","keys_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/keys{/key_id}","collaborators_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/teams","hooks_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/hooks","issue_events_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/issues/events{/number}","events_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/events","assignees_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/assignees{/user}","branches_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/branches{/branch}","tags_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/tags","blobs_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/git/refs{/sha}","trees_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/git/trees{/sha}","statuses_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/statuses/{sha}","languages_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/languages","stargazers_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/stargazers","contributors_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/contributors","subscribers_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/subscribers","subscription_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/subscription","commits_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/commits{/sha}","git_commits_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/git/commits{/sha}","comments_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/comments{/number}","issue_comment_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/issues/comments{/number}","contents_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/contents/{+path}","compare_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/compare/{base}...{head}","merges_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/merges","archive_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/downloads","issues_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/issues{/number}","pulls_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/pulls{/number}","milestones_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/milestones{/number}","notifications_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/labels{/name}","releases_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/releases{/id}","deployments_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/deployments","created_at":"2018-01-31T10:40:07Z","updated_at":"2018-01-31T10:41:52Z","pushed_at":"2018-02-05T19:29:29Z","git_url":"git://github.com/joelonilsson/DocumentKeeper.git","ssh_url":"git@github.com:joelonilsson/DocumentKeeper.git","clone_url":"https://github.com/joelonilsson/DocumentKeeper.git","svn_url":"https://github.com/joelonilsson/DocumentKeeper","homepage":null,"size":1781,"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":1,"mirror_url":null,"archived":false,"open_issues_count":4,"license":null,"forks":1,"open_issues":4,"watchers":0,"default_branch":"master"}},"base":{"label":"joelonilsson:dev","ref":"dev","sha":"03a76ce2b0957a2f9c9c468bed13b07b0dcc22c2","user":{"login":"joelonilsson","id":22932715,"avatar_url":"https://avatars3.githubusercontent.com/u/22932715?v=4","gravatar_id":"","url":"https://api.github.com/users/joelonilsson","html_url":"https://github.com/joelonilsson","followers_url":"https://api.github.com/users/joelonilsson/followers","following_url":"https://api.github.com/users/joelonilsson/following{/other_user}","gists_url":"https://api.github.com/users/joelonilsson/gists{/gist_id}","starred_url":"https://api.github.com/users/joelonilsson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joelonilsson/subscriptions","organizations_url":"https://api.github.com/users/joelonilsson/orgs","repos_url":"https://api.github.com/users/joelonilsson/repos","events_url":"https://api.github.com/users/joelonilsson/events{/privacy}","received_events_url":"https://api.github.com/users/joelonilsson/received_events","type":"User","site_admin":false},"repo":{"id":119673598,"name":"DocumentKeeper","full_name":"joelonilsson/DocumentKeeper","owner":{"login":"joelonilsson","id":22932715,"avatar_url":"https://avatars3.githubusercontent.com/u/22932715?v=4","gravatar_id":"","url":"https://api.github.com/users/joelonilsson","html_url":"https://github.com/joelonilsson","followers_url":"https://api.github.com/users/joelonilsson/followers","following_url":"https://api.github.com/users/joelonilsson/following{/other_user}","gists_url":"https://api.github.com/users/joelonilsson/gists{/gist_id}","starred_url":"https://api.github.com/users/joelonilsson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joelonilsson/subscriptions","organizations_url":"https://api.github.com/users/joelonilsson/orgs","repos_url":"https://api.github.com/users/joelonilsson/repos","events_url":"https://api.github.com/users/joelonilsson/events{/privacy}","received_events_url":"https://api.github.com/users/joelonilsson/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/joelonilsson/DocumentKeeper","description":null,"fork":false,"url":"https://api.github.com/repos/joelonilsson/DocumentKeeper","forks_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/forks","keys_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/keys{/key_id}","collaborators_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/teams","hooks_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/hooks","issue_events_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/issues/events{/number}","events_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/events","assignees_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/assignees{/user}","branches_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/branches{/branch}","tags_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/tags","blobs_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/git/refs{/sha}","trees_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/git/trees{/sha}","statuses_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/statuses/{sha}","languages_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/languages","stargazers_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/stargazers","contributors_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/contributors","subscribers_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/subscribers","subscription_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/subscription","commits_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/commits{/sha}","git_commits_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/git/commits{/sha}","comments_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/comments{/number}","issue_comment_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/issues/comments{/number}","contents_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/contents/{+path}","compare_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/compare/{base}...{head}","merges_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/merges","archive_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/downloads","issues_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/issues{/number}","pulls_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/pulls{/number}","milestones_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/milestones{/number}","notifications_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/labels{/name}","releases_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/releases{/id}","deployments_url":"https://api.github.com/repos/joelonilsson/DocumentKeeper/deployments","created_at":"2018-01-31T10:40:07Z","updated_at":"2018-01-31T10:41:52Z","pushed_at":"2018-02-05T19:29:29Z","git_url":"git://github.com/joelonilsson/DocumentKeeper.git","ssh_url":"git@github.com:joelonilsson/DocumentKeeper.git","clone_url":"https://github.com/joelonilsson/DocumentKeeper.git","svn_url":"https://github.com/joelonilsson/DocumentKeeper","homepage":null,"size":1781,"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":1,"mirror_url":null,"archived":false,"open_issues_count":4,"license":null,"forks":1,"open_issues":4,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/joelonilsson/DocumentKeeper/pulls/32"},"html":{"href":"https://github.com/joelonilsson/DocumentKeeper/pull/32"},"issue":{"href":"https://api.github.com/repos/joelonilsson/DocumentKeeper/issues/32"},"comments":{"href":"https://api.github.com/repos/joelonilsson/DocumentKeeper/issues/32/comments"},"review_comments":{"href":"https://api.github.com/repos/joelonilsson/DocumentKeeper/pulls/32/comments"},"review_comment":{"href":"https://api.github.com/repos/joelonilsson/DocumentKeeper/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/joelonilsson/DocumentKeeper/pulls/32/commits"},"statuses":{"href":"https://api.github.com/repos/joelonilsson/DocumentKeeper/statuses/704bc1182651cd85f5ebbf1eda78f553a3147d35"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"joelonilsson"}}