{"action":"created","comment":{"url":"https://api.github.com/repos/wso2/carbon-apimgt/pulls/comments/54554606","id":54554606,"diff_hunk":"@@ -3587,4 +3585,33 @@ public void appendPolicy(String eligibilityQuery, String decisionQuery, String t\n     public String getCondition(Policy policy) {\n         return null;\n     }\n+\n+    public String[] getPolicyNames(String username, String level) throws APIManagementException{\n+        String[] policyNamesAPI = apiMgtDAO.getPolicyNames(level, username);\n+        return policyNamesAPI;\n+    }\n+\n+    public Policy[] getPolicies(String username, String level) throws APIManagementException{\n+        Policy[] policies = apiMgtDAO.getPolicies(level, username);\n+        return policies;\n+    }\n+\n+    public void writeToFile(String content, String fileName) throws IOException {\n+        File file =new File(\"repository/deployment/server/throttle-conf\");\n+        if(!file.exists()){\n+            file.mkdir();\n+        }\n+        File writeFile = new File(\"repository/deployment/server/throttle-conf/\"+fileName);\n+        FileOutputStream fos = null;\n+        fos = new FileOutputStream(file);\n+        if (!writeFile.exists()) {\n+            writeFile.createNewFile();\n+        }\n+\n+        byte[] contentInBytes = content.getBytes();\n+\n+        fos.write(contentInBytes);","path":"components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIProviderImpl.java","position":49,"original_position":49,"commit_id":"d89f672241f38ac1adf42db5ea6a404f054a882c","original_commit_id":"d89f672241f38ac1adf42db5ea6a404f054a882c","user":{"login":"harsha89","id":1561366,"avatar_url":"https://avatars.githubusercontent.com/u/1561366?v=3","gravatar_id":"","url":"https://api.github.com/users/harsha89","html_url":"https://github.com/harsha89","followers_url":"https://api.github.com/users/harsha89/followers","following_url":"https://api.github.com/users/harsha89/following{/other_user}","gists_url":"https://api.github.com/users/harsha89/gists{/gist_id}","starred_url":"https://api.github.com/users/harsha89/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/harsha89/subscriptions","organizations_url":"https://api.github.com/users/harsha89/orgs","repos_url":"https://api.github.com/users/harsha89/repos","events_url":"https://api.github.com/users/harsha89/events{/privacy}","received_events_url":"https://api.github.com/users/harsha89/received_events","type":"User","site_admin":false},"body":"Use finally method to close the streams if exception occurred the stream wont be  closed","created_at":"2016-03-01T11:30:02Z","updated_at":"2016-03-01T11:30:02Z","html_url":"https://github.com/wso2/carbon-apimgt/pull/1651#discussion_r54554606","pull_request_url":"https://api.github.com/repos/wso2/carbon-apimgt/pulls/1651","_links":{"self":{"href":"https://api.github.com/repos/wso2/carbon-apimgt/pulls/comments/54554606"},"html":{"href":"https://github.com/wso2/carbon-apimgt/pull/1651#discussion_r54554606"},"pull_request":{"href":"https://api.github.com/repos/wso2/carbon-apimgt/pulls/1651"}}},"pull_request":{"url":"https://api.github.com/repos/wso2/carbon-apimgt/pulls/1651","id":61227763,"html_url":"https://github.com/wso2/carbon-apimgt/pull/1651","diff_url":"https://github.com/wso2/carbon-apimgt/pull/1651.diff","patch_url":"https://github.com/wso2/carbon-apimgt/pull/1651.patch","issue_url":"https://api.github.com/repos/wso2/carbon-apimgt/issues/1651","number":1651,"state":"open","locked":false,"title":"Adding write method to APIProviderimpl, DB read methods in APIMgtDao","user":{"login":"dinusha92","id":8377610,"avatar_url":"https://avatars.githubusercontent.com/u/8377610?v=3","gravatar_id":"","url":"https://api.github.com/users/dinusha92","html_url":"https://github.com/dinusha92","followers_url":"https://api.github.com/users/dinusha92/followers","following_url":"https://api.github.com/users/dinusha92/following{/other_user}","gists_url":"https://api.github.com/users/dinusha92/gists{/gist_id}","starred_url":"https://api.github.com/users/dinusha92/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dinusha92/subscriptions","organizations_url":"https://api.github.com/users/dinusha92/orgs","repos_url":"https://api.github.com/users/dinusha92/repos","events_url":"https://api.github.com/users/dinusha92/events{/privacy}","received_events_url":"https://api.github.com/users/dinusha92/received_events","type":"User","site_admin":false},"body":"Adding write method, db read methods","created_at":"2016-03-01T11:21:33Z","updated_at":"2016-03-01T11:30:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"91062d3bf59ee9d9649b032bc555e99de8762da3","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/wso2/carbon-apimgt/pulls/1651/commits","review_comments_url":"https://api.github.com/repos/wso2/carbon-apimgt/pulls/1651/comments","review_comment_url":"https://api.github.com/repos/wso2/carbon-apimgt/pulls/comments{/number}","comments_url":"https://api.github.com/repos/wso2/carbon-apimgt/issues/1651/comments","statuses_url":"https://api.github.com/repos/wso2/carbon-apimgt/statuses/d89f672241f38ac1adf42db5ea6a404f054a882c","head":{"label":"dinusha92:throttle_engine_poc","ref":"throttle_engine_poc","sha":"d89f672241f38ac1adf42db5ea6a404f054a882c","user":{"login":"dinusha92","id":8377610,"avatar_url":"https://avatars.githubusercontent.com/u/8377610?v=3","gravatar_id":"","url":"https://api.github.com/users/dinusha92","html_url":"https://github.com/dinusha92","followers_url":"https://api.github.com/users/dinusha92/followers","following_url":"https://api.github.com/users/dinusha92/following{/other_user}","gists_url":"https://api.github.com/users/dinusha92/gists{/gist_id}","starred_url":"https://api.github.com/users/dinusha92/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dinusha92/subscriptions","organizations_url":"https://api.github.com/users/dinusha92/orgs","repos_url":"https://api.github.com/users/dinusha92/repos","events_url":"https://api.github.com/users/dinusha92/events{/privacy}","received_events_url":"https://api.github.com/users/dinusha92/received_events","type":"User","site_admin":false},"repo":{"id":49263946,"name":"carbon-apimgt","full_name":"dinusha92/carbon-apimgt","owner":{"login":"dinusha92","id":8377610,"avatar_url":"https://avatars.githubusercontent.com/u/8377610?v=3","gravatar_id":"","url":"https://api.github.com/users/dinusha92","html_url":"https://github.com/dinusha92","followers_url":"https://api.github.com/users/dinusha92/followers","following_url":"https://api.github.com/users/dinusha92/following{/other_user}","gists_url":"https://api.github.com/users/dinusha92/gists{/gist_id}","starred_url":"https://api.github.com/users/dinusha92/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dinusha92/subscriptions","organizations_url":"https://api.github.com/users/dinusha92/orgs","repos_url":"https://api.github.com/users/dinusha92/repos","events_url":"https://api.github.com/users/dinusha92/events{/privacy}","received_events_url":"https://api.github.com/users/dinusha92/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dinusha92/carbon-apimgt","description":"","fork":true,"url":"https://api.github.com/repos/dinusha92/carbon-apimgt","forks_url":"https://api.github.com/repos/dinusha92/carbon-apimgt/forks","keys_url":"https://api.github.com/repos/dinusha92/carbon-apimgt/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dinusha92/carbon-apimgt/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dinusha92/carbon-apimgt/teams","hooks_url":"https://api.github.com/repos/dinusha92/carbon-apimgt/hooks","issue_events_url":"https://api.github.com/repos/dinusha92/carbon-apimgt/issues/events{/number}","events_url":"https://api.github.com/repos/dinusha92/carbon-apimgt/events","assignees_url":"https://api.github.com/repos/dinusha92/carbon-apimgt/assignees{/user}","branches_url":"https://api.github.com/repos/dinusha92/carbon-apimgt/branches{/branch}","tags_url":"https://api.github.com/repos/dinusha92/carbon-apimgt/tags","blobs_url":"https://api.github.com/repos/dinusha92/carbon-apimgt/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dinusha92/carbon-apimgt/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dinusha92/carbon-apimgt/git/refs{/sha}","trees_url":"https://api.github.com/repos/dinusha92/carbon-apimgt/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dinusha92/carbon-apimgt/statuses/{sha}","languages_url":"https://api.github.com/repos/dinusha92/carbon-apimgt/languages","stargazers_url":"https://api.github.com/repos/dinusha92/carbon-apimgt/stargazers","contributors_url":"https://api.github.com/repos/dinusha92/carbon-apimgt/contributors","subscribers_url":"https://api.github.com/repos/dinusha92/carbon-apimgt/subscribers","subscription_url":"https://api.github.com/repos/dinusha92/carbon-apimgt/subscription","commits_url":"https://api.github.com/repos/dinusha92/carbon-apimgt/commits{/sha}","git_commits_url":"https://api.github.com/repos/dinusha92/carbon-apimgt/git/commits{/sha}","comments_url":"https://api.github.com/repos/dinusha92/carbon-apimgt/comments{/number}","issue_comment_url":"https://api.github.com/repos/dinusha92/carbon-apimgt/issues/comments{/number}","contents_url":"https://api.github.com/repos/dinusha92/carbon-apimgt/contents/{+path}","compare_url":"https://api.github.com/repos/dinusha92/carbon-apimgt/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dinusha92/carbon-apimgt/merges","archive_url":"https://api.github.com/repos/dinusha92/carbon-apimgt/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dinusha92/carbon-apimgt/downloads","issues_url":"https://api.github.com/repos/dinusha92/carbon-apimgt/issues{/number}","pulls_url":"https://api.github.com/repos/dinusha92/carbon-apimgt/pulls{/number}","milestones_url":"https://api.github.com/repos/dinusha92/carbon-apimgt/milestones{/number}","notifications_url":"https://api.github.com/repos/dinusha92/carbon-apimgt/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dinusha92/carbon-apimgt/labels{/name}","releases_url":"https://api.github.com/repos/dinusha92/carbon-apimgt/releases{/id}","deployments_url":"https://api.github.com/repos/dinusha92/carbon-apimgt/deployments","created_at":"2016-01-08T09:47:39Z","updated_at":"2016-01-13T06:58:34Z","pushed_at":"2016-03-01T11:14:59Z","git_url":"git://github.com/dinusha92/carbon-apimgt.git","ssh_url":"git@github.com:dinusha92/carbon-apimgt.git","clone_url":"https://github.com/dinusha92/carbon-apimgt.git","svn_url":"https://github.com/dinusha92/carbon-apimgt","homepage":null,"size":77043,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","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:throttle_feature","ref":"throttle_feature","sha":"6991dc78525f24189d06df5d1e2330c41f977563","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":17201744,"name":"carbon-apimgt","full_name":"wso2/carbon-apimgt","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-apimgt","description":"","fork":false,"url":"https://api.github.com/repos/wso2/carbon-apimgt","forks_url":"https://api.github.com/repos/wso2/carbon-apimgt/forks","keys_url":"https://api.github.com/repos/wso2/carbon-apimgt/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wso2/carbon-apimgt/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wso2/carbon-apimgt/teams","hooks_url":"https://api.github.com/repos/wso2/carbon-apimgt/hooks","issue_events_url":"https://api.github.com/repos/wso2/carbon-apimgt/issues/events{/number}","events_url":"https://api.github.com/repos/wso2/carbon-apimgt/events","assignees_url":"https://api.github.com/repos/wso2/carbon-apimgt/assignees{/user}","branches_url":"https://api.github.com/repos/wso2/carbon-apimgt/branches{/branch}","tags_url":"https://api.github.com/repos/wso2/carbon-apimgt/tags","blobs_url":"https://api.github.com/repos/wso2/carbon-apimgt/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wso2/carbon-apimgt/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wso2/carbon-apimgt/git/refs{/sha}","trees_url":"https://api.github.com/repos/wso2/carbon-apimgt/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wso2/carbon-apimgt/statuses/{sha}","languages_url":"https://api.github.com/repos/wso2/carbon-apimgt/languages","stargazers_url":"https://api.github.com/repos/wso2/carbon-apimgt/stargazers","contributors_url":"https://api.github.com/repos/wso2/carbon-apimgt/contributors","subscribers_url":"https://api.github.com/repos/wso2/carbon-apimgt/subscribers","subscription_url":"https://api.github.com/repos/wso2/carbon-apimgt/subscription","commits_url":"https://api.github.com/repos/wso2/carbon-apimgt/commits{/sha}","git_commits_url":"https://api.github.com/repos/wso2/carbon-apimgt/git/commits{/sha}","comments_url":"https://api.github.com/repos/wso2/carbon-apimgt/comments{/number}","issue_comment_url":"https://api.github.com/repos/wso2/carbon-apimgt/issues/comments{/number}","contents_url":"https://api.github.com/repos/wso2/carbon-apimgt/contents/{+path}","compare_url":"https://api.github.com/repos/wso2/carbon-apimgt/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wso2/carbon-apimgt/merges","archive_url":"https://api.github.com/repos/wso2/carbon-apimgt/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wso2/carbon-apimgt/downloads","issues_url":"https://api.github.com/repos/wso2/carbon-apimgt/issues{/number}","pulls_url":"https://api.github.com/repos/wso2/carbon-apimgt/pulls{/number}","milestones_url":"https://api.github.com/repos/wso2/carbon-apimgt/milestones{/number}","notifications_url":"https://api.github.com/repos/wso2/carbon-apimgt/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wso2/carbon-apimgt/labels{/name}","releases_url":"https://api.github.com/repos/wso2/carbon-apimgt/releases{/id}","deployments_url":"https://api.github.com/repos/wso2/carbon-apimgt/deployments","created_at":"2014-02-26T06:46:48Z","updated_at":"2016-01-11T04:46:27Z","pushed_at":"2016-03-01T11:21:34Z","git_url":"git://github.com/wso2/carbon-apimgt.git","ssh_url":"git@github.com:wso2/carbon-apimgt.git","clone_url":"https://github.com/wso2/carbon-apimgt.git","svn_url":"https://github.com/wso2/carbon-apimgt","homepage":null,"size":91869,"stargazers_count":14,"watchers_count":14,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":128,"mirror_url":null,"open_issues_count":5,"forks":128,"open_issues":5,"watchers":14,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/wso2/carbon-apimgt/pulls/1651"},"html":{"href":"https://github.com/wso2/carbon-apimgt/pull/1651"},"issue":{"href":"https://api.github.com/repos/wso2/carbon-apimgt/issues/1651"},"comments":{"href":"https://api.github.com/repos/wso2/carbon-apimgt/issues/1651/comments"},"review_comments":{"href":"https://api.github.com/repos/wso2/carbon-apimgt/pulls/1651/comments"},"review_comment":{"href":"https://api.github.com/repos/wso2/carbon-apimgt/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/wso2/carbon-apimgt/pulls/1651/commits"},"statuses":{"href":"https://api.github.com/repos/wso2/carbon-apimgt/statuses/d89f672241f38ac1adf42db5ea6a404f054a882c"}}}}