{"action":"created","comment":{"url":"https://api.github.com/repos/jenkinsci/hipchat-plugin/pulls/comments/47432215","id":47432215,"diff_hunk":"@@ -0,0 +1,128 @@\n+package jenkins.plugins.hipchat.workflow;\n+\n+import hudson.AbortException;\n+import hudson.Extension;\n+import hudson.model.TaskListener;\n+import hudson.util.ListBoxModel;\n+import jenkins.model.Jenkins;\n+import jenkins.plugins.hipchat.HipChatNotifier;\n+import jenkins.plugins.hipchat.HipChatService;\n+import jenkins.plugins.hipchat.Messages;\n+import jenkins.plugins.hipchat.impl.HipChatV1Service;\n+import jenkins.plugins.hipchat.impl.HipChatV2Service;\n+import jenkins.plugins.hipchat.model.Color;\n+import org.apache.commons.lang.StringUtils;\n+import org.jenkinsci.plugins.workflow.steps.AbstractStepDescriptorImpl;\n+import org.jenkinsci.plugins.workflow.steps.AbstractStepImpl;\n+import org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution;\n+import org.jenkinsci.plugins.workflow.steps.StepContextParameter;\n+import org.kohsuke.stapler.DataBoundConstructor;\n+import org.kohsuke.stapler.DataBoundSetter;\n+\n+import javax.annotation.Nonnull;\n+import javax.inject.Inject;\n+import java.util.logging.Level;\n+import java.util.logging.Logger;\n+\n+public class HipChatStep extends AbstractStepImpl {\n+\n+    private static final Logger logger = Logger.getLogger(HipChatStep.class.getName());\n+\n+    public final String message;\n+\n+    @DataBoundSetter\n+    public String color;\n+\n+    @DataBoundSetter\n+    public String token;\n+\n+    @DataBoundSetter\n+    public String room;\n+\n+    @DataBoundSetter\n+    public String server;\n+\n+    @DataBoundSetter\n+    public boolean notify;\n+\n+    @DataBoundSetter\n+    public Boolean v2enabled;\n+\n+    @DataBoundSetter\n+    public String sendAs;\n+\n+    @DataBoundConstructor\n+    public HipChatStep(@Nonnull String message) {\n+        this.message = message;\n+    }\n+\n+    @Extension\n+    public static class DescriptorImpl extends AbstractStepDescriptorImpl {\n+\n+        public DescriptorImpl() {\n+            super(HipChatStepExecution.class);\n+        }\n+\n+        @Override\n+        public String getFunctionName() {\n+            return \"hipchat\";\n+        }\n+\n+        @Override\n+        public String getDisplayName() {\n+            return \"Publish HipChat Message\";\n+        }\n+\n+        public ListBoxModel doFillColorItems(){\n+            ListBoxModel listBoxModel = new ListBoxModel();\n+            for(Color color : Color.values()) {\n+                listBoxModel.add(new ListBoxModel.Option(color.toString(), color.toString(), false));\n+            }\n+\n+           return listBoxModel;\n+        }\n+\n+    }\n+\n+    public static class HipChatStepExecution extends AbstractSynchronousNonBlockingStepExecution<Void> {\n+\n+        private static final long serialVersionUID = 1L;\n+\n+        @Inject\n+        private transient HipChatStep step;\n+        @StepContextParameter\n+        transient TaskListener listener;\n+\n+\n+        @Override\n+        protected Void run() throws Exception {\n+\n+            if (StringUtils.isBlank(step.message)) {\n+                throw new AbortException(Messages.MessageRequiredError());\n+            }\n+\n+            //default to global config values if not set in step, but allow step to override all global settings\n+            HipChatNotifier.DescriptorImpl hipChatDesc = (HipChatNotifier.DescriptorImpl) Jenkins.getInstance().getDescriptor(HipChatNotifier.class);","path":"src/main/java/jenkins/plugins/hipchat/workflow/HipChatStep.java","position":105,"original_position":105,"commit_id":"80357c66e8025a89ddf5276a105097e843e027b9","original_commit_id":"80357c66e8025a89ddf5276a105097e843e027b9","user":{"login":"aldaris","id":206692,"avatar_url":"https://avatars.githubusercontent.com/u/206692?v=3","gravatar_id":"","url":"https://api.github.com/users/aldaris","html_url":"https://github.com/aldaris","followers_url":"https://api.github.com/users/aldaris/followers","following_url":"https://api.github.com/users/aldaris/following{/other_user}","gists_url":"https://api.github.com/users/aldaris/gists{/gist_id}","starred_url":"https://api.github.com/users/aldaris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aldaris/subscriptions","organizations_url":"https://api.github.com/users/aldaris/orgs","repos_url":"https://api.github.com/users/aldaris/repos","events_url":"https://api.github.com/users/aldaris/events{/privacy}","received_events_url":"https://api.github.com/users/aldaris/received_events","type":"User","site_admin":false},"body":"wouldn't it be better to just call getDescriptorByType instead?","created_at":"2015-12-12T14:30:53Z","updated_at":"2015-12-12T14:30:53Z","html_url":"https://github.com/jenkinsci/hipchat-plugin/pull/60#discussion_r47432215","pull_request_url":"https://api.github.com/repos/jenkinsci/hipchat-plugin/pulls/60","_links":{"self":{"href":"https://api.github.com/repos/jenkinsci/hipchat-plugin/pulls/comments/47432215"},"html":{"href":"https://github.com/jenkinsci/hipchat-plugin/pull/60#discussion_r47432215"},"pull_request":{"href":"https://api.github.com/repos/jenkinsci/hipchat-plugin/pulls/60"}}},"pull_request":{"url":"https://api.github.com/repos/jenkinsci/hipchat-plugin/pulls/60","id":53439843,"html_url":"https://github.com/jenkinsci/hipchat-plugin/pull/60","diff_url":"https://github.com/jenkinsci/hipchat-plugin/pull/60.diff","patch_url":"https://github.com/jenkinsci/hipchat-plugin/pull/60.patch","issue_url":"https://api.github.com/repos/jenkinsci/hipchat-plugin/issues/60","number":60,"state":"open","locked":false,"title":"[JENKINS-27202] Add basic workflow step","user":{"login":"kmadel","id":983526,"avatar_url":"https://avatars.githubusercontent.com/u/983526?v=3","gravatar_id":"","url":"https://api.github.com/users/kmadel","html_url":"https://github.com/kmadel","followers_url":"https://api.github.com/users/kmadel/followers","following_url":"https://api.github.com/users/kmadel/following{/other_user}","gists_url":"https://api.github.com/users/kmadel/gists{/gist_id}","starred_url":"https://api.github.com/users/kmadel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kmadel/subscriptions","organizations_url":"https://api.github.com/users/kmadel/orgs","repos_url":"https://api.github.com/users/kmadel/repos","events_url":"https://api.github.com/users/kmadel/events{/privacy}","received_events_url":"https://api.github.com/users/kmadel/received_events","type":"User","site_admin":false},"body":"Adding a basic workflow step that defaults to use global plugin configuration, but also allows overriding all global configuration.\r\n\r\n[JENKINS-27202](https://issues.jenkins-ci.org/browse/JENKINS-27202)\r\n\r\nUpdated to ```org.jenkins-ci.plugins:plugin:1.609.2``` to support Workflow related test for ```HipChatStep.java```\r\n\r\n@reviewbybees\r\n","created_at":"2015-12-11T20:24:52Z","updated_at":"2015-12-12T14:30:53Z","closed_at":null,"merged_at":null,"merge_commit_sha":"12b42b187e646d113171b50aae6af793264da3b9","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/jenkinsci/hipchat-plugin/pulls/60/commits","review_comments_url":"https://api.github.com/repos/jenkinsci/hipchat-plugin/pulls/60/comments","review_comment_url":"https://api.github.com/repos/jenkinsci/hipchat-plugin/pulls/comments{/number}","comments_url":"https://api.github.com/repos/jenkinsci/hipchat-plugin/issues/60/comments","statuses_url":"https://api.github.com/repos/jenkinsci/hipchat-plugin/statuses/80357c66e8025a89ddf5276a105097e843e027b9","head":{"label":"kmadel:workflow-step","ref":"workflow-step","sha":"80357c66e8025a89ddf5276a105097e843e027b9","user":{"login":"kmadel","id":983526,"avatar_url":"https://avatars.githubusercontent.com/u/983526?v=3","gravatar_id":"","url":"https://api.github.com/users/kmadel","html_url":"https://github.com/kmadel","followers_url":"https://api.github.com/users/kmadel/followers","following_url":"https://api.github.com/users/kmadel/following{/other_user}","gists_url":"https://api.github.com/users/kmadel/gists{/gist_id}","starred_url":"https://api.github.com/users/kmadel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kmadel/subscriptions","organizations_url":"https://api.github.com/users/kmadel/orgs","repos_url":"https://api.github.com/users/kmadel/repos","events_url":"https://api.github.com/users/kmadel/events{/privacy}","received_events_url":"https://api.github.com/users/kmadel/received_events","type":"User","site_admin":false},"repo":{"id":47713321,"name":"hipchat-plugin","full_name":"kmadel/hipchat-plugin","owner":{"login":"kmadel","id":983526,"avatar_url":"https://avatars.githubusercontent.com/u/983526?v=3","gravatar_id":"","url":"https://api.github.com/users/kmadel","html_url":"https://github.com/kmadel","followers_url":"https://api.github.com/users/kmadel/followers","following_url":"https://api.github.com/users/kmadel/following{/other_user}","gists_url":"https://api.github.com/users/kmadel/gists{/gist_id}","starred_url":"https://api.github.com/users/kmadel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kmadel/subscriptions","organizations_url":"https://api.github.com/users/kmadel/orgs","repos_url":"https://api.github.com/users/kmadel/repos","events_url":"https://api.github.com/users/kmadel/events{/privacy}","received_events_url":"https://api.github.com/users/kmadel/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kmadel/hipchat-plugin","description":"HipChat notification plugin for Jenkins","fork":true,"url":"https://api.github.com/repos/kmadel/hipchat-plugin","forks_url":"https://api.github.com/repos/kmadel/hipchat-plugin/forks","keys_url":"https://api.github.com/repos/kmadel/hipchat-plugin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kmadel/hipchat-plugin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kmadel/hipchat-plugin/teams","hooks_url":"https://api.github.com/repos/kmadel/hipchat-plugin/hooks","issue_events_url":"https://api.github.com/repos/kmadel/hipchat-plugin/issues/events{/number}","events_url":"https://api.github.com/repos/kmadel/hipchat-plugin/events","assignees_url":"https://api.github.com/repos/kmadel/hipchat-plugin/assignees{/user}","branches_url":"https://api.github.com/repos/kmadel/hipchat-plugin/branches{/branch}","tags_url":"https://api.github.com/repos/kmadel/hipchat-plugin/tags","blobs_url":"https://api.github.com/repos/kmadel/hipchat-plugin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kmadel/hipchat-plugin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kmadel/hipchat-plugin/git/refs{/sha}","trees_url":"https://api.github.com/repos/kmadel/hipchat-plugin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kmadel/hipchat-plugin/statuses/{sha}","languages_url":"https://api.github.com/repos/kmadel/hipchat-plugin/languages","stargazers_url":"https://api.github.com/repos/kmadel/hipchat-plugin/stargazers","contributors_url":"https://api.github.com/repos/kmadel/hipchat-plugin/contributors","subscribers_url":"https://api.github.com/repos/kmadel/hipchat-plugin/subscribers","subscription_url":"https://api.github.com/repos/kmadel/hipchat-plugin/subscription","commits_url":"https://api.github.com/repos/kmadel/hipchat-plugin/commits{/sha}","git_commits_url":"https://api.github.com/repos/kmadel/hipchat-plugin/git/commits{/sha}","comments_url":"https://api.github.com/repos/kmadel/hipchat-plugin/comments{/number}","issue_comment_url":"https://api.github.com/repos/kmadel/hipchat-plugin/issues/comments{/number}","contents_url":"https://api.github.com/repos/kmadel/hipchat-plugin/contents/{+path}","compare_url":"https://api.github.com/repos/kmadel/hipchat-plugin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kmadel/hipchat-plugin/merges","archive_url":"https://api.github.com/repos/kmadel/hipchat-plugin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kmadel/hipchat-plugin/downloads","issues_url":"https://api.github.com/repos/kmadel/hipchat-plugin/issues{/number}","pulls_url":"https://api.github.com/repos/kmadel/hipchat-plugin/pulls{/number}","milestones_url":"https://api.github.com/repos/kmadel/hipchat-plugin/milestones{/number}","notifications_url":"https://api.github.com/repos/kmadel/hipchat-plugin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kmadel/hipchat-plugin/labels{/name}","releases_url":"https://api.github.com/repos/kmadel/hipchat-plugin/releases{/id}","created_at":"2015-12-09T19:18:34Z","updated_at":"2015-12-09T19:18:35Z","pushed_at":"2015-12-12T13:41:54Z","git_url":"git://github.com/kmadel/hipchat-plugin.git","ssh_url":"git@github.com:kmadel/hipchat-plugin.git","clone_url":"https://github.com/kmadel/hipchat-plugin.git","svn_url":"https://github.com/kmadel/hipchat-plugin","homepage":"http://wiki.jenkins-ci.org/display/JENKINS/HipChat+Plugin","size":228,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"jenkinsci:master","ref":"master","sha":"1f50de5f00cc5860854fad40abaf3ba8e8e55597","user":{"login":"jenkinsci","id":107424,"avatar_url":"https://avatars.githubusercontent.com/u/107424?v=3","gravatar_id":"","url":"https://api.github.com/users/jenkinsci","html_url":"https://github.com/jenkinsci","followers_url":"https://api.github.com/users/jenkinsci/followers","following_url":"https://api.github.com/users/jenkinsci/following{/other_user}","gists_url":"https://api.github.com/users/jenkinsci/gists{/gist_id}","starred_url":"https://api.github.com/users/jenkinsci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jenkinsci/subscriptions","organizations_url":"https://api.github.com/users/jenkinsci/orgs","repos_url":"https://api.github.com/users/jenkinsci/repos","events_url":"https://api.github.com/users/jenkinsci/events{/privacy}","received_events_url":"https://api.github.com/users/jenkinsci/received_events","type":"Organization","site_admin":false},"repo":{"id":3234671,"name":"hipchat-plugin","full_name":"jenkinsci/hipchat-plugin","owner":{"login":"jenkinsci","id":107424,"avatar_url":"https://avatars.githubusercontent.com/u/107424?v=3","gravatar_id":"","url":"https://api.github.com/users/jenkinsci","html_url":"https://github.com/jenkinsci","followers_url":"https://api.github.com/users/jenkinsci/followers","following_url":"https://api.github.com/users/jenkinsci/following{/other_user}","gists_url":"https://api.github.com/users/jenkinsci/gists{/gist_id}","starred_url":"https://api.github.com/users/jenkinsci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jenkinsci/subscriptions","organizations_url":"https://api.github.com/users/jenkinsci/orgs","repos_url":"https://api.github.com/users/jenkinsci/repos","events_url":"https://api.github.com/users/jenkinsci/events{/privacy}","received_events_url":"https://api.github.com/users/jenkinsci/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/jenkinsci/hipchat-plugin","description":"HipChat notification plugin for Jenkins","fork":true,"url":"https://api.github.com/repos/jenkinsci/hipchat-plugin","forks_url":"https://api.github.com/repos/jenkinsci/hipchat-plugin/forks","keys_url":"https://api.github.com/repos/jenkinsci/hipchat-plugin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jenkinsci/hipchat-plugin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jenkinsci/hipchat-plugin/teams","hooks_url":"https://api.github.com/repos/jenkinsci/hipchat-plugin/hooks","issue_events_url":"https://api.github.com/repos/jenkinsci/hipchat-plugin/issues/events{/number}","events_url":"https://api.github.com/repos/jenkinsci/hipchat-plugin/events","assignees_url":"https://api.github.com/repos/jenkinsci/hipchat-plugin/assignees{/user}","branches_url":"https://api.github.com/repos/jenkinsci/hipchat-plugin/branches{/branch}","tags_url":"https://api.github.com/repos/jenkinsci/hipchat-plugin/tags","blobs_url":"https://api.github.com/repos/jenkinsci/hipchat-plugin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jenkinsci/hipchat-plugin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jenkinsci/hipchat-plugin/git/refs{/sha}","trees_url":"https://api.github.com/repos/jenkinsci/hipchat-plugin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jenkinsci/hipchat-plugin/statuses/{sha}","languages_url":"https://api.github.com/repos/jenkinsci/hipchat-plugin/languages","stargazers_url":"https://api.github.com/repos/jenkinsci/hipchat-plugin/stargazers","contributors_url":"https://api.github.com/repos/jenkinsci/hipchat-plugin/contributors","subscribers_url":"https://api.github.com/repos/jenkinsci/hipchat-plugin/subscribers","subscription_url":"https://api.github.com/repos/jenkinsci/hipchat-plugin/subscription","commits_url":"https://api.github.com/repos/jenkinsci/hipchat-plugin/commits{/sha}","git_commits_url":"https://api.github.com/repos/jenkinsci/hipchat-plugin/git/commits{/sha}","comments_url":"https://api.github.com/repos/jenkinsci/hipchat-plugin/comments{/number}","issue_comment_url":"https://api.github.com/repos/jenkinsci/hipchat-plugin/issues/comments{/number}","contents_url":"https://api.github.com/repos/jenkinsci/hipchat-plugin/contents/{+path}","compare_url":"https://api.github.com/repos/jenkinsci/hipchat-plugin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jenkinsci/hipchat-plugin/merges","archive_url":"https://api.github.com/repos/jenkinsci/hipchat-plugin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jenkinsci/hipchat-plugin/downloads","issues_url":"https://api.github.com/repos/jenkinsci/hipchat-plugin/issues{/number}","pulls_url":"https://api.github.com/repos/jenkinsci/hipchat-plugin/pulls{/number}","milestones_url":"https://api.github.com/repos/jenkinsci/hipchat-plugin/milestones{/number}","notifications_url":"https://api.github.com/repos/jenkinsci/hipchat-plugin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jenkinsci/hipchat-plugin/labels{/name}","releases_url":"https://api.github.com/repos/jenkinsci/hipchat-plugin/releases{/id}","created_at":"2012-01-21T16:29:07Z","updated_at":"2015-12-11T21:06:20Z","pushed_at":"2015-12-12T13:41:55Z","git_url":"git://github.com/jenkinsci/hipchat-plugin.git","ssh_url":"git@github.com:jenkinsci/hipchat-plugin.git","clone_url":"https://github.com/jenkinsci/hipchat-plugin.git","svn_url":"https://github.com/jenkinsci/hipchat-plugin","homepage":"http://wiki.jenkins-ci.org/display/JENKINS/HipChat+Plugin","size":618,"stargazers_count":46,"watchers_count":46,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":69,"mirror_url":null,"open_issues_count":6,"forks":69,"open_issues":6,"watchers":46,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jenkinsci/hipchat-plugin/pulls/60"},"html":{"href":"https://github.com/jenkinsci/hipchat-plugin/pull/60"},"issue":{"href":"https://api.github.com/repos/jenkinsci/hipchat-plugin/issues/60"},"comments":{"href":"https://api.github.com/repos/jenkinsci/hipchat-plugin/issues/60/comments"},"review_comments":{"href":"https://api.github.com/repos/jenkinsci/hipchat-plugin/pulls/60/comments"},"review_comment":{"href":"https://api.github.com/repos/jenkinsci/hipchat-plugin/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/jenkinsci/hipchat-plugin/pulls/60/commits"},"statuses":{"href":"https://api.github.com/repos/jenkinsci/hipchat-plugin/statuses/80357c66e8025a89ddf5276a105097e843e027b9"}}}}