{"action":"created","comment":{"url":"https://api.github.com/repos/killbill/killbill-email-notifications-plugin/pulls/comments/149035634","pull_request_review_id":74363906,"id":149035634,"diff_hunk":"@@ -17,25 +17,87 @@\n \n package org.killbill.billing.plugin.notification.http;\n \n-import org.osgi.service.log.LogService;\n+import java.sql.SQLException;\n+import java.util.List;\n+import java.util.Optional;\n+import java.util.UUID;\n \n-import javax.servlet.ServletException;\n-import javax.servlet.http.HttpServlet;\n-import javax.servlet.http.HttpServletRequest;\n-import javax.servlet.http.HttpServletResponse;\n-import java.io.IOException;\n+import javax.inject.Inject;\n+import javax.inject.Singleton;\n \n-public class EmailNotificationServlet extends HttpServlet {\n+import org.jooby.Results;\n+import org.jooby.Result;\n+import org.jooby.mvc.GET;\n+import org.jooby.mvc.POST;\n+import org.jooby.mvc.Path;\n+import org.killbill.billing.notification.plugin.api.ExtBusEventType;\n+import org.killbill.billing.osgi.libs.killbill.OSGIKillbillClock;\n+import org.killbill.billing.osgi.libs.killbill.OSGIKillbillDataSource;\n+import org.killbill.billing.plugin.notification.dao.ConfigurationDao;\n+import org.slf4j.Logger;\n+import org.slf4j.LoggerFactory;\n \n-    private final LogService logService;\n+@Singleton\n+@Path(\"/\")\n+public class EmailNotificationServlet {\n \n-    public EmailNotificationServlet(final LogService logService) {\n-        this.logService = logService;\n+    private static final Logger logger = LoggerFactory.getLogger(EmailNotificationServlet.class);\n+\n+    private OSGIKillbillDataSource dataSource;\n+    private ConfigurationDao dao;\n+    private OSGIKillbillClock clock;\n+\n+    @Inject\n+    public EmailNotificationServlet(OSGIKillbillDataSource dataSource, OSGIKillbillClock clock)\n+    {\n+        this.dataSource = dataSource;\n+        this.clock = clock;\n+\n+        try {\n+            this.dao = new ConfigurationDao(this.dataSource.getDataSource());\n+        } catch (SQLException e) {\n+            e.printStackTrace();\n+        }\n     }\n \n-    @Override\n-    protected void doGet(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException {\n+    @GET\n+    public Result hello() {\n         // Find me on http://127.0.0.1:8080/plugins/killbill-email-notifications\n-        logService.log(LogService.LOG_INFO, \"HI!\");\n+        logger.info(\"Hello from email notification plugin!!!\");\n+        return Results.ok();\n+    }\n+\n+    @GET\n+    @Path(\"/tenant/:kbTenantId/account/:kbAccountId\")\n+    public Result getEventTypes(final UUID kbAccountId, final UUID kbTenantId, Optional<ExtBusEventType> eventType) {","path":"src/main/java/org/killbill/billing/plugin/notification/http/EmailNotificationServlet.java","position":78,"original_position":78,"commit_id":"c8b0e49e137ddc4cfb597cd1147cce55ab07c10d","original_commit_id":"c8b0e49e137ddc4cfb597cd1147cce55ab07c10d","user":{"login":"pierre","id":51940,"avatar_url":"https://avatars2.githubusercontent.com/u/51940?v=4","gravatar_id":"","url":"https://api.github.com/users/pierre","html_url":"https://github.com/pierre","followers_url":"https://api.github.com/users/pierre/followers","following_url":"https://api.github.com/users/pierre/following{/other_user}","gists_url":"https://api.github.com/users/pierre/gists{/gist_id}","starred_url":"https://api.github.com/users/pierre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pierre/subscriptions","organizations_url":"https://api.github.com/users/pierre/orgs","repos_url":"https://api.github.com/users/pierre/repos","events_url":"https://api.github.com/users/pierre/events{/privacy}","received_events_url":"https://api.github.com/users/pierre/received_events","type":"User","site_admin":false},"body":"You actually don't need the `kbTenantId` in the path. You can get the tenant directly as such:\r\n\r\n```\r\npublic Result getEventTypes(@Named(\"kbAccountId\") final UUID kbAccountId, @Local @Named(\"killbill_tenant\") final Tenant tenant, @Body Optional<ExtBusEventType> eventType)\r\n```","created_at":"2017-11-06T10:00:55Z","updated_at":"2017-11-06T10:13:25Z","html_url":"https://github.com/killbill/killbill-email-notifications-plugin/pull/16#discussion_r149035634","pull_request_url":"https://api.github.com/repos/killbill/killbill-email-notifications-plugin/pulls/16","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/killbill/killbill-email-notifications-plugin/pulls/comments/149035634"},"html":{"href":"https://github.com/killbill/killbill-email-notifications-plugin/pull/16#discussion_r149035634"},"pull_request":{"href":"https://api.github.com/repos/killbill/killbill-email-notifications-plugin/pulls/16"}}},"pull_request":{"url":"https://api.github.com/repos/killbill/killbill-email-notifications-plugin/pulls/16","id":150632820,"html_url":"https://github.com/killbill/killbill-email-notifications-plugin/pull/16","diff_url":"https://github.com/killbill/killbill-email-notifications-plugin/pull/16.diff","patch_url":"https://github.com/killbill/killbill-email-notifications-plugin/pull/16.patch","issue_url":"https://api.github.com/repos/killbill/killbill-email-notifications-plugin/issues/16","number":16,"state":"open","locked":false,"title":"Enhance configuration options #8","user":{"login":"wwjbatista","id":10049037,"avatar_url":"https://avatars2.githubusercontent.com/u/10049037?v=4","gravatar_id":"","url":"https://api.github.com/users/wwjbatista","html_url":"https://github.com/wwjbatista","followers_url":"https://api.github.com/users/wwjbatista/followers","following_url":"https://api.github.com/users/wwjbatista/following{/other_user}","gists_url":"https://api.github.com/users/wwjbatista/gists{/gist_id}","starred_url":"https://api.github.com/users/wwjbatista/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wwjbatista/subscriptions","organizations_url":"https://api.github.com/users/wwjbatista/orgs","repos_url":"https://api.github.com/users/wwjbatista/repos","events_url":"https://api.github.com/users/wwjbatista/events{/privacy}","received_events_url":"https://api.github.com/users/wwjbatista/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-11-03T21:30:47Z","updated_at":"2017-11-06T10:13:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a8566737870ef58d206852b29351a952e59e6670","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/killbill/killbill-email-notifications-plugin/pulls/16/commits","review_comments_url":"https://api.github.com/repos/killbill/killbill-email-notifications-plugin/pulls/16/comments","review_comment_url":"https://api.github.com/repos/killbill/killbill-email-notifications-plugin/pulls/comments{/number}","comments_url":"https://api.github.com/repos/killbill/killbill-email-notifications-plugin/issues/16/comments","statuses_url":"https://api.github.com/repos/killbill/killbill-email-notifications-plugin/statuses/c8b0e49e137ddc4cfb597cd1147cce55ab07c10d","head":{"label":"wwjbatista:master","ref":"master","sha":"c8b0e49e137ddc4cfb597cd1147cce55ab07c10d","user":{"login":"wwjbatista","id":10049037,"avatar_url":"https://avatars2.githubusercontent.com/u/10049037?v=4","gravatar_id":"","url":"https://api.github.com/users/wwjbatista","html_url":"https://github.com/wwjbatista","followers_url":"https://api.github.com/users/wwjbatista/followers","following_url":"https://api.github.com/users/wwjbatista/following{/other_user}","gists_url":"https://api.github.com/users/wwjbatista/gists{/gist_id}","starred_url":"https://api.github.com/users/wwjbatista/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wwjbatista/subscriptions","organizations_url":"https://api.github.com/users/wwjbatista/orgs","repos_url":"https://api.github.com/users/wwjbatista/repos","events_url":"https://api.github.com/users/wwjbatista/events{/privacy}","received_events_url":"https://api.github.com/users/wwjbatista/received_events","type":"User","site_admin":false},"repo":{"id":108276365,"name":"killbill-email-notifications-plugin","full_name":"wwjbatista/killbill-email-notifications-plugin","owner":{"login":"wwjbatista","id":10049037,"avatar_url":"https://avatars2.githubusercontent.com/u/10049037?v=4","gravatar_id":"","url":"https://api.github.com/users/wwjbatista","html_url":"https://github.com/wwjbatista","followers_url":"https://api.github.com/users/wwjbatista/followers","following_url":"https://api.github.com/users/wwjbatista/following{/other_user}","gists_url":"https://api.github.com/users/wwjbatista/gists{/gist_id}","starred_url":"https://api.github.com/users/wwjbatista/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wwjbatista/subscriptions","organizations_url":"https://api.github.com/users/wwjbatista/orgs","repos_url":"https://api.github.com/users/wwjbatista/repos","events_url":"https://api.github.com/users/wwjbatista/events{/privacy}","received_events_url":"https://api.github.com/users/wwjbatista/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/wwjbatista/killbill-email-notifications-plugin","description":"Kill Bill Email notification plugin","fork":true,"url":"https://api.github.com/repos/wwjbatista/killbill-email-notifications-plugin","forks_url":"https://api.github.com/repos/wwjbatista/killbill-email-notifications-plugin/forks","keys_url":"https://api.github.com/repos/wwjbatista/killbill-email-notifications-plugin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wwjbatista/killbill-email-notifications-plugin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wwjbatista/killbill-email-notifications-plugin/teams","hooks_url":"https://api.github.com/repos/wwjbatista/killbill-email-notifications-plugin/hooks","issue_events_url":"https://api.github.com/repos/wwjbatista/killbill-email-notifications-plugin/issues/events{/number}","events_url":"https://api.github.com/repos/wwjbatista/killbill-email-notifications-plugin/events","assignees_url":"https://api.github.com/repos/wwjbatista/killbill-email-notifications-plugin/assignees{/user}","branches_url":"https://api.github.com/repos/wwjbatista/killbill-email-notifications-plugin/branches{/branch}","tags_url":"https://api.github.com/repos/wwjbatista/killbill-email-notifications-plugin/tags","blobs_url":"https://api.github.com/repos/wwjbatista/killbill-email-notifications-plugin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wwjbatista/killbill-email-notifications-plugin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wwjbatista/killbill-email-notifications-plugin/git/refs{/sha}","trees_url":"https://api.github.com/repos/wwjbatista/killbill-email-notifications-plugin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wwjbatista/killbill-email-notifications-plugin/statuses/{sha}","languages_url":"https://api.github.com/repos/wwjbatista/killbill-email-notifications-plugin/languages","stargazers_url":"https://api.github.com/repos/wwjbatista/killbill-email-notifications-plugin/stargazers","contributors_url":"https://api.github.com/repos/wwjbatista/killbill-email-notifications-plugin/contributors","subscribers_url":"https://api.github.com/repos/wwjbatista/killbill-email-notifications-plugin/subscribers","subscription_url":"https://api.github.com/repos/wwjbatista/killbill-email-notifications-plugin/subscription","commits_url":"https://api.github.com/repos/wwjbatista/killbill-email-notifications-plugin/commits{/sha}","git_commits_url":"https://api.github.com/repos/wwjbatista/killbill-email-notifications-plugin/git/commits{/sha}","comments_url":"https://api.github.com/repos/wwjbatista/killbill-email-notifications-plugin/comments{/number}","issue_comment_url":"https://api.github.com/repos/wwjbatista/killbill-email-notifications-plugin/issues/comments{/number}","contents_url":"https://api.github.com/repos/wwjbatista/killbill-email-notifications-plugin/contents/{+path}","compare_url":"https://api.github.com/repos/wwjbatista/killbill-email-notifications-plugin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wwjbatista/killbill-email-notifications-plugin/merges","archive_url":"https://api.github.com/repos/wwjbatista/killbill-email-notifications-plugin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wwjbatista/killbill-email-notifications-plugin/downloads","issues_url":"https://api.github.com/repos/wwjbatista/killbill-email-notifications-plugin/issues{/number}","pulls_url":"https://api.github.com/repos/wwjbatista/killbill-email-notifications-plugin/pulls{/number}","milestones_url":"https://api.github.com/repos/wwjbatista/killbill-email-notifications-plugin/milestones{/number}","notifications_url":"https://api.github.com/repos/wwjbatista/killbill-email-notifications-plugin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wwjbatista/killbill-email-notifications-plugin/labels{/name}","releases_url":"https://api.github.com/repos/wwjbatista/killbill-email-notifications-plugin/releases{/id}","deployments_url":"https://api.github.com/repos/wwjbatista/killbill-email-notifications-plugin/deployments","created_at":"2017-10-25T13:45:57Z","updated_at":"2017-10-25T13:45:59Z","pushed_at":"2017-11-03T21:30:23Z","git_url":"git://github.com/wwjbatista/killbill-email-notifications-plugin.git","ssh_url":"git@github.com:wwjbatista/killbill-email-notifications-plugin.git","clone_url":"https://github.com/wwjbatista/killbill-email-notifications-plugin.git","svn_url":"https://github.com/wwjbatista/killbill-email-notifications-plugin","homepage":"http://killbill.io","size":119,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"killbill:master","ref":"master","sha":"5ce5cbf9b6816d9933bcd42444ad278aa6bd7330","user":{"login":"killbill","id":2446739,"avatar_url":"https://avatars2.githubusercontent.com/u/2446739?v=4","gravatar_id":"","url":"https://api.github.com/users/killbill","html_url":"https://github.com/killbill","followers_url":"https://api.github.com/users/killbill/followers","following_url":"https://api.github.com/users/killbill/following{/other_user}","gists_url":"https://api.github.com/users/killbill/gists{/gist_id}","starred_url":"https://api.github.com/users/killbill/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/killbill/subscriptions","organizations_url":"https://api.github.com/users/killbill/orgs","repos_url":"https://api.github.com/users/killbill/repos","events_url":"https://api.github.com/users/killbill/events{/privacy}","received_events_url":"https://api.github.com/users/killbill/received_events","type":"Organization","site_admin":false},"repo":{"id":33377663,"name":"killbill-email-notifications-plugin","full_name":"killbill/killbill-email-notifications-plugin","owner":{"login":"killbill","id":2446739,"avatar_url":"https://avatars2.githubusercontent.com/u/2446739?v=4","gravatar_id":"","url":"https://api.github.com/users/killbill","html_url":"https://github.com/killbill","followers_url":"https://api.github.com/users/killbill/followers","following_url":"https://api.github.com/users/killbill/following{/other_user}","gists_url":"https://api.github.com/users/killbill/gists{/gist_id}","starred_url":"https://api.github.com/users/killbill/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/killbill/subscriptions","organizations_url":"https://api.github.com/users/killbill/orgs","repos_url":"https://api.github.com/users/killbill/repos","events_url":"https://api.github.com/users/killbill/events{/privacy}","received_events_url":"https://api.github.com/users/killbill/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/killbill/killbill-email-notifications-plugin","description":"Kill Bill Email notification plugin","fork":false,"url":"https://api.github.com/repos/killbill/killbill-email-notifications-plugin","forks_url":"https://api.github.com/repos/killbill/killbill-email-notifications-plugin/forks","keys_url":"https://api.github.com/repos/killbill/killbill-email-notifications-plugin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/killbill/killbill-email-notifications-plugin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/killbill/killbill-email-notifications-plugin/teams","hooks_url":"https://api.github.com/repos/killbill/killbill-email-notifications-plugin/hooks","issue_events_url":"https://api.github.com/repos/killbill/killbill-email-notifications-plugin/issues/events{/number}","events_url":"https://api.github.com/repos/killbill/killbill-email-notifications-plugin/events","assignees_url":"https://api.github.com/repos/killbill/killbill-email-notifications-plugin/assignees{/user}","branches_url":"https://api.github.com/repos/killbill/killbill-email-notifications-plugin/branches{/branch}","tags_url":"https://api.github.com/repos/killbill/killbill-email-notifications-plugin/tags","blobs_url":"https://api.github.com/repos/killbill/killbill-email-notifications-plugin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/killbill/killbill-email-notifications-plugin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/killbill/killbill-email-notifications-plugin/git/refs{/sha}","trees_url":"https://api.github.com/repos/killbill/killbill-email-notifications-plugin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/killbill/killbill-email-notifications-plugin/statuses/{sha}","languages_url":"https://api.github.com/repos/killbill/killbill-email-notifications-plugin/languages","stargazers_url":"https://api.github.com/repos/killbill/killbill-email-notifications-plugin/stargazers","contributors_url":"https://api.github.com/repos/killbill/killbill-email-notifications-plugin/contributors","subscribers_url":"https://api.github.com/repos/killbill/killbill-email-notifications-plugin/subscribers","subscription_url":"https://api.github.com/repos/killbill/killbill-email-notifications-plugin/subscription","commits_url":"https://api.github.com/repos/killbill/killbill-email-notifications-plugin/commits{/sha}","git_commits_url":"https://api.github.com/repos/killbill/killbill-email-notifications-plugin/git/commits{/sha}","comments_url":"https://api.github.com/repos/killbill/killbill-email-notifications-plugin/comments{/number}","issue_comment_url":"https://api.github.com/repos/killbill/killbill-email-notifications-plugin/issues/comments{/number}","contents_url":"https://api.github.com/repos/killbill/killbill-email-notifications-plugin/contents/{+path}","compare_url":"https://api.github.com/repos/killbill/killbill-email-notifications-plugin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/killbill/killbill-email-notifications-plugin/merges","archive_url":"https://api.github.com/repos/killbill/killbill-email-notifications-plugin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/killbill/killbill-email-notifications-plugin/downloads","issues_url":"https://api.github.com/repos/killbill/killbill-email-notifications-plugin/issues{/number}","pulls_url":"https://api.github.com/repos/killbill/killbill-email-notifications-plugin/pulls{/number}","milestones_url":"https://api.github.com/repos/killbill/killbill-email-notifications-plugin/milestones{/number}","notifications_url":"https://api.github.com/repos/killbill/killbill-email-notifications-plugin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/killbill/killbill-email-notifications-plugin/labels{/name}","releases_url":"https://api.github.com/repos/killbill/killbill-email-notifications-plugin/releases{/id}","deployments_url":"https://api.github.com/repos/killbill/killbill-email-notifications-plugin/deployments","created_at":"2015-04-03T18:51:29Z","updated_at":"2017-06-12T04:11:10Z","pushed_at":"2017-11-03T21:30:48Z","git_url":"git://github.com/killbill/killbill-email-notifications-plugin.git","ssh_url":"git@github.com:killbill/killbill-email-notifications-plugin.git","clone_url":"https://github.com/killbill/killbill-email-notifications-plugin.git","svn_url":"https://github.com/killbill/killbill-email-notifications-plugin","homepage":"http://killbill.io","size":98,"stargazers_count":1,"watchers_count":1,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":7,"mirror_url":null,"archived":false,"open_issues_count":13,"forks":7,"open_issues":13,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/killbill/killbill-email-notifications-plugin/pulls/16"},"html":{"href":"https://github.com/killbill/killbill-email-notifications-plugin/pull/16"},"issue":{"href":"https://api.github.com/repos/killbill/killbill-email-notifications-plugin/issues/16"},"comments":{"href":"https://api.github.com/repos/killbill/killbill-email-notifications-plugin/issues/16/comments"},"review_comments":{"href":"https://api.github.com/repos/killbill/killbill-email-notifications-plugin/pulls/16/comments"},"review_comment":{"href":"https://api.github.com/repos/killbill/killbill-email-notifications-plugin/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/killbill/killbill-email-notifications-plugin/pulls/16/commits"},"statuses":{"href":"https://api.github.com/repos/killbill/killbill-email-notifications-plugin/statuses/c8b0e49e137ddc4cfb597cd1147cce55ab07c10d"}},"author_association":"NONE"}}
{"actor":{"display_login":"pierre"}}