{"action":"created","comment":{"url":"https://api.github.com/repos/wso2/carbon-device-mgt/pulls/comments/36942562","id":36942562,"diff_hunk":"@@ -1343,4 +1343,32 @@ private int readHighestPriorityOfPolicies() throws PolicyManagerDAOException {\n         return priority;\n     }\n \n+    @Override\n+    public int getPolicyCount() throws PolicyManagerDAOException {\n+\n+        Connection conn;\n+        PreparedStatement stmt = null;\n+        ResultSet resultSet = null;\n+        int policyCount = 0;\n+        try {\n+            conn = this.getConnection();\n+            String query = \"SELECT COUNT(DM_POLICY.ID) FROM DM_POLICY\";\n+            stmt = conn.prepareStatement(query);\n+            resultSet = stmt.executeQuery();\n+\n+            while (resultSet.next()) {\n+                policyCount = resultSet.getInt(0);\n+            }\n+            return policyCount;\n+\n+        } catch (SQLException e) {\n+            String msg = \"Error occurred while reading the policies from the database.\";\n+            log.error(msg, e);","path":"components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/dao/impl/PolicyDAOImpl.java","position":24,"original_position":24,"commit_id":"ffaccbe371c9899f4a17ac2cdb7a922b45a1544f","original_commit_id":"ffaccbe371c9899f4a17ac2cdb7a922b45a1544f","user":{"login":"prabathabey","id":6664125,"avatar_url":"https://avatars.githubusercontent.com/u/6664125?v=3","gravatar_id":"","url":"https://api.github.com/users/prabathabey","html_url":"https://github.com/prabathabey","followers_url":"https://api.github.com/users/prabathabey/followers","following_url":"https://api.github.com/users/prabathabey/following{/other_user}","gists_url":"https://api.github.com/users/prabathabey/gists{/gist_id}","starred_url":"https://api.github.com/users/prabathabey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prabathabey/subscriptions","organizations_url":"https://api.github.com/users/prabathabey/orgs","repos_url":"https://api.github.com/users/prabathabey/repos","events_url":"https://api.github.com/users/prabathabey/events{/privacy}","received_events_url":"https://api.github.com/users/prabathabey/received_events","type":"User","site_admin":false},"body":"Avoid log and throw unless specifically needed","created_at":"2015-08-13T05:48:11Z","updated_at":"2015-08-13T05:48:11Z","html_url":"https://github.com/wso2/carbon-device-mgt/pull/11#discussion_r36942562","pull_request_url":"https://api.github.com/repos/wso2/carbon-device-mgt/pulls/11","_links":{"self":{"href":"https://api.github.com/repos/wso2/carbon-device-mgt/pulls/comments/36942562"},"html":{"href":"https://github.com/wso2/carbon-device-mgt/pull/11#discussion_r36942562"},"pull_request":{"href":"https://api.github.com/repos/wso2/carbon-device-mgt/pulls/11"}}},"pull_request":{"url":"https://api.github.com/repos/wso2/carbon-device-mgt/pulls/11","id":35980361,"html_url":"https://github.com/wso2/carbon-device-mgt/pull/11","diff_url":"https://github.com/wso2/carbon-device-mgt/pull/11.diff","patch_url":"https://github.com/wso2/carbon-device-mgt/pull/11.patch","issue_url":"https://api.github.com/repos/wso2/carbon-device-mgt/issues/11","number":11,"state":"closed","locked":false,"title":"Policy integration","user":{"login":"milanperera","id":11870191,"avatar_url":"https://avatars.githubusercontent.com/u/11870191?v=3","gravatar_id":"","url":"https://api.github.com/users/milanperera","html_url":"https://github.com/milanperera","followers_url":"https://api.github.com/users/milanperera/followers","following_url":"https://api.github.com/users/milanperera/following{/other_user}","gists_url":"https://api.github.com/users/milanperera/gists{/gist_id}","starred_url":"https://api.github.com/users/milanperera/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/milanperera/subscriptions","organizations_url":"https://api.github.com/users/milanperera/orgs","repos_url":"https://api.github.com/users/milanperera/repos","events_url":"https://api.github.com/users/milanperera/events{/privacy}","received_events_url":"https://api.github.com/users/milanperera/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-05-21T21:37:29Z","updated_at":"2015-08-13T05:48:11Z","closed_at":"2015-05-21T21:39:02Z","merged_at":"2015-05-21T21:39:02Z","merge_commit_sha":"960fda42f4a1e27d7353cf728930047f66caa390","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/wso2/carbon-device-mgt/pulls/11/commits","review_comments_url":"https://api.github.com/repos/wso2/carbon-device-mgt/pulls/11/comments","review_comment_url":"https://api.github.com/repos/wso2/carbon-device-mgt/pulls/comments{/number}","comments_url":"https://api.github.com/repos/wso2/carbon-device-mgt/issues/11/comments","statuses_url":"https://api.github.com/repos/wso2/carbon-device-mgt/statuses/ffaccbe371c9899f4a17ac2cdb7a922b45a1544f","head":{"label":"milanperera:master","ref":"master","sha":"ffaccbe371c9899f4a17ac2cdb7a922b45a1544f","user":{"login":"milanperera","id":11870191,"avatar_url":"https://avatars.githubusercontent.com/u/11870191?v=3","gravatar_id":"","url":"https://api.github.com/users/milanperera","html_url":"https://github.com/milanperera","followers_url":"https://api.github.com/users/milanperera/followers","following_url":"https://api.github.com/users/milanperera/following{/other_user}","gists_url":"https://api.github.com/users/milanperera/gists{/gist_id}","starred_url":"https://api.github.com/users/milanperera/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/milanperera/subscriptions","organizations_url":"https://api.github.com/users/milanperera/orgs","repos_url":"https://api.github.com/users/milanperera/repos","events_url":"https://api.github.com/users/milanperera/events{/privacy}","received_events_url":"https://api.github.com/users/milanperera/received_events","type":"User","site_admin":false},"repo":{"id":34834971,"name":"carbon-device-mgt","full_name":"milanperera/carbon-device-mgt","owner":{"login":"milanperera","id":11870191,"avatar_url":"https://avatars.githubusercontent.com/u/11870191?v=3","gravatar_id":"","url":"https://api.github.com/users/milanperera","html_url":"https://github.com/milanperera","followers_url":"https://api.github.com/users/milanperera/followers","following_url":"https://api.github.com/users/milanperera/following{/other_user}","gists_url":"https://api.github.com/users/milanperera/gists{/gist_id}","starred_url":"https://api.github.com/users/milanperera/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/milanperera/subscriptions","organizations_url":"https://api.github.com/users/milanperera/orgs","repos_url":"https://api.github.com/users/milanperera/repos","events_url":"https://api.github.com/users/milanperera/events{/privacy}","received_events_url":"https://api.github.com/users/milanperera/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/milanperera/carbon-device-mgt","description":"","fork":true,"url":"https://api.github.com/repos/milanperera/carbon-device-mgt","forks_url":"https://api.github.com/repos/milanperera/carbon-device-mgt/forks","keys_url":"https://api.github.com/repos/milanperera/carbon-device-mgt/keys{/key_id}","collaborators_url":"https://api.github.com/repos/milanperera/carbon-device-mgt/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/milanperera/carbon-device-mgt/teams","hooks_url":"https://api.github.com/repos/milanperera/carbon-device-mgt/hooks","issue_events_url":"https://api.github.com/repos/milanperera/carbon-device-mgt/issues/events{/number}","events_url":"https://api.github.com/repos/milanperera/carbon-device-mgt/events","assignees_url":"https://api.github.com/repos/milanperera/carbon-device-mgt/assignees{/user}","branches_url":"https://api.github.com/repos/milanperera/carbon-device-mgt/branches{/branch}","tags_url":"https://api.github.com/repos/milanperera/carbon-device-mgt/tags","blobs_url":"https://api.github.com/repos/milanperera/carbon-device-mgt/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/milanperera/carbon-device-mgt/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/milanperera/carbon-device-mgt/git/refs{/sha}","trees_url":"https://api.github.com/repos/milanperera/carbon-device-mgt/git/trees{/sha}","statuses_url":"https://api.github.com/repos/milanperera/carbon-device-mgt/statuses/{sha}","languages_url":"https://api.github.com/repos/milanperera/carbon-device-mgt/languages","stargazers_url":"https://api.github.com/repos/milanperera/carbon-device-mgt/stargazers","contributors_url":"https://api.github.com/repos/milanperera/carbon-device-mgt/contributors","subscribers_url":"https://api.github.com/repos/milanperera/carbon-device-mgt/subscribers","subscription_url":"https://api.github.com/repos/milanperera/carbon-device-mgt/subscription","commits_url":"https://api.github.com/repos/milanperera/carbon-device-mgt/commits{/sha}","git_commits_url":"https://api.github.com/repos/milanperera/carbon-device-mgt/git/commits{/sha}","comments_url":"https://api.github.com/repos/milanperera/carbon-device-mgt/comments{/number}","issue_comment_url":"https://api.github.com/repos/milanperera/carbon-device-mgt/issues/comments{/number}","contents_url":"https://api.github.com/repos/milanperera/carbon-device-mgt/contents/{+path}","compare_url":"https://api.github.com/repos/milanperera/carbon-device-mgt/compare/{base}...{head}","merges_url":"https://api.github.com/repos/milanperera/carbon-device-mgt/merges","archive_url":"https://api.github.com/repos/milanperera/carbon-device-mgt/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/milanperera/carbon-device-mgt/downloads","issues_url":"https://api.github.com/repos/milanperera/carbon-device-mgt/issues{/number}","pulls_url":"https://api.github.com/repos/milanperera/carbon-device-mgt/pulls{/number}","milestones_url":"https://api.github.com/repos/milanperera/carbon-device-mgt/milestones{/number}","notifications_url":"https://api.github.com/repos/milanperera/carbon-device-mgt/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/milanperera/carbon-device-mgt/labels{/name}","releases_url":"https://api.github.com/repos/milanperera/carbon-device-mgt/releases{/id}","created_at":"2015-04-30T04:56:20Z","updated_at":"2015-05-08T12:45:12Z","pushed_at":"2015-07-30T13:05:16Z","git_url":"git://github.com/milanperera/carbon-device-mgt.git","ssh_url":"git@github.com:milanperera/carbon-device-mgt.git","clone_url":"https://github.com/milanperera/carbon-device-mgt.git","svn_url":"https://github.com/milanperera/carbon-device-mgt","homepage":null,"size":8178,"stargazers_count":0,"watchers_count":0,"language":"Java","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":"wso2:master","ref":"master","sha":"48a2062f64be0feb002b3d28b32ce6a97dd445d9","user":{"login":"wso2","id":533043,"avatar_url":"https://avatars.githubusercontent.com/u/533043?v=3","gravatar_id":"","url":"https://api.github.com/users/wso2","html_url":"https://github.com/wso2","followers_url":"https://api.github.com/users/wso2/followers","following_url":"https://api.github.com/users/wso2/following{/other_user}","gists_url":"https://api.github.com/users/wso2/gists{/gist_id}","starred_url":"https://api.github.com/users/wso2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wso2/subscriptions","organizations_url":"https://api.github.com/users/wso2/orgs","repos_url":"https://api.github.com/users/wso2/repos","events_url":"https://api.github.com/users/wso2/events{/privacy}","received_events_url":"https://api.github.com/users/wso2/received_events","type":"Organization","site_admin":false},"repo":{"id":30521489,"name":"carbon-device-mgt","full_name":"wso2/carbon-device-mgt","owner":{"login":"wso2","id":533043,"avatar_url":"https://avatars.githubusercontent.com/u/533043?v=3","gravatar_id":"","url":"https://api.github.com/users/wso2","html_url":"https://github.com/wso2","followers_url":"https://api.github.com/users/wso2/followers","following_url":"https://api.github.com/users/wso2/following{/other_user}","gists_url":"https://api.github.com/users/wso2/gists{/gist_id}","starred_url":"https://api.github.com/users/wso2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wso2/subscriptions","organizations_url":"https://api.github.com/users/wso2/orgs","repos_url":"https://api.github.com/users/wso2/repos","events_url":"https://api.github.com/users/wso2/events{/privacy}","received_events_url":"https://api.github.com/users/wso2/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/wso2/carbon-device-mgt","description":"","fork":false,"url":"https://api.github.com/repos/wso2/carbon-device-mgt","forks_url":"https://api.github.com/repos/wso2/carbon-device-mgt/forks","keys_url":"https://api.github.com/repos/wso2/carbon-device-mgt/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wso2/carbon-device-mgt/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wso2/carbon-device-mgt/teams","hooks_url":"https://api.github.com/repos/wso2/carbon-device-mgt/hooks","issue_events_url":"https://api.github.com/repos/wso2/carbon-device-mgt/issues/events{/number}","events_url":"https://api.github.com/repos/wso2/carbon-device-mgt/events","assignees_url":"https://api.github.com/repos/wso2/carbon-device-mgt/assignees{/user}","branches_url":"https://api.github.com/repos/wso2/carbon-device-mgt/branches{/branch}","tags_url":"https://api.github.com/repos/wso2/carbon-device-mgt/tags","blobs_url":"https://api.github.com/repos/wso2/carbon-device-mgt/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wso2/carbon-device-mgt/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wso2/carbon-device-mgt/git/refs{/sha}","trees_url":"https://api.github.com/repos/wso2/carbon-device-mgt/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wso2/carbon-device-mgt/statuses/{sha}","languages_url":"https://api.github.com/repos/wso2/carbon-device-mgt/languages","stargazers_url":"https://api.github.com/repos/wso2/carbon-device-mgt/stargazers","contributors_url":"https://api.github.com/repos/wso2/carbon-device-mgt/contributors","subscribers_url":"https://api.github.com/repos/wso2/carbon-device-mgt/subscribers","subscription_url":"https://api.github.com/repos/wso2/carbon-device-mgt/subscription","commits_url":"https://api.github.com/repos/wso2/carbon-device-mgt/commits{/sha}","git_commits_url":"https://api.github.com/repos/wso2/carbon-device-mgt/git/commits{/sha}","comments_url":"https://api.github.com/repos/wso2/carbon-device-mgt/comments{/number}","issue_comment_url":"https://api.github.com/repos/wso2/carbon-device-mgt/issues/comments{/number}","contents_url":"https://api.github.com/repos/wso2/carbon-device-mgt/contents/{+path}","compare_url":"https://api.github.com/repos/wso2/carbon-device-mgt/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wso2/carbon-device-mgt/merges","archive_url":"https://api.github.com/repos/wso2/carbon-device-mgt/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wso2/carbon-device-mgt/downloads","issues_url":"https://api.github.com/repos/wso2/carbon-device-mgt/issues{/number}","pulls_url":"https://api.github.com/repos/wso2/carbon-device-mgt/pulls{/number}","milestones_url":"https://api.github.com/repos/wso2/carbon-device-mgt/milestones{/number}","notifications_url":"https://api.github.com/repos/wso2/carbon-device-mgt/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wso2/carbon-device-mgt/labels{/name}","releases_url":"https://api.github.com/repos/wso2/carbon-device-mgt/releases{/id}","created_at":"2015-02-09T06:11:38Z","updated_at":"2015-05-07T11:02:45Z","pushed_at":"2015-08-07T16:40:05Z","git_url":"git://github.com/wso2/carbon-device-mgt.git","ssh_url":"git@github.com:wso2/carbon-device-mgt.git","clone_url":"https://github.com/wso2/carbon-device-mgt.git","svn_url":"https://github.com/wso2/carbon-device-mgt","homepage":null,"size":8697,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":7,"mirror_url":null,"open_issues_count":0,"forks":7,"open_issues":0,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/wso2/carbon-device-mgt/pulls/11"},"html":{"href":"https://github.com/wso2/carbon-device-mgt/pull/11"},"issue":{"href":"https://api.github.com/repos/wso2/carbon-device-mgt/issues/11"},"comments":{"href":"https://api.github.com/repos/wso2/carbon-device-mgt/issues/11/comments"},"review_comments":{"href":"https://api.github.com/repos/wso2/carbon-device-mgt/pulls/11/comments"},"review_comment":{"href":"https://api.github.com/repos/wso2/carbon-device-mgt/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/wso2/carbon-device-mgt/pulls/11/commits"},"statuses":{"href":"https://api.github.com/repos/wso2/carbon-device-mgt/statuses/ffaccbe371c9899f4a17ac2cdb7a922b45a1544f"}}}}