{"action":"created","comment":{"url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/pulls/comments/25536091","id":25536091,"diff_hunk":"@@ -150,4 +167,57 @@ private void ok(StaplerResponse rsp) throws IOException {\n         w.close();\n     }\n \n+    // --- adapter methods for Job type which do follow AbstractProject semantic but don't inherit AbstractProject.\n+\n+    private BuildAuthorizationToken getAuthToken(Job<?, ?> p) {\n+        if (p instanceof AbstractProject) return ((AbstractProject) p).getAuthToken();\n+\n+        try {\n+            Method m = p.getClass().getMethod(\"getAuthToken\");\n+            return (BuildAuthorizationToken) m.invoke(p);\n+        } catch (Exception e) {\n+            // Job does not support BuildAuthorizationToken\n+        }\n+        return null;\n+    }\n+\n+    private boolean isDisabled(Job<?, ?> p) {\n+        if (p instanceof AbstractProject) return ((AbstractProject) p).isDisabled();\n+\n+        try {\n+            Method m = p.getClass().getMethod(\"isDisabled\");\n+            return (Boolean) m.invoke(p);\n+        } catch (Exception e) {\n+            // Job can't be disabled\n+        }\n+        return false;\n+    }\n+\n+    private int getDelay(Job<?, ?> p, StaplerRequest req) throws ServletException {\n+        if (p instanceof AbstractProject) return ((AbstractProject) p).getDelay(req);\n+\n+        try {\n+            Method m = p.getClass().getMethod(\"getDelay\", int.class);","path":"src/main/java/org/jenkinsci/plugins/build_token_root/BuildRootAction.java","position":156,"original_position":156,"commit_id":"fa0d5cdea4dc86f1b8d4a659260252e02cd00321","original_commit_id":"fa0d5cdea4dc86f1b8d4a659260252e02cd00321","user":{"login":"jglick","id":154109,"avatar_url":"https://avatars.githubusercontent.com/u/154109?v=3","gravatar_id":"","url":"https://api.github.com/users/jglick","html_url":"https://github.com/jglick","followers_url":"https://api.github.com/users/jglick/followers","following_url":"https://api.github.com/users/jglick/following{/other_user}","gists_url":"https://api.github.com/users/jglick/gists{/gist_id}","starred_url":"https://api.github.com/users/jglick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jglick/subscriptions","organizations_url":"https://api.github.com/users/jglick/orgs","repos_url":"https://api.github.com/users/jglick/repos","events_url":"https://api.github.com/users/jglick/events{/privacy}","received_events_url":"https://api.github.com/users/jglick/received_events","type":"User","site_admin":false},"body":"There is no such method, so this will always throw an exception. I guess you meant `getDelay(StaplerRequest)`, but anyway this is deprecated. Use `TimeDuration` instead.","created_at":"2015-02-27T20:24:11Z","updated_at":"2015-02-27T20:24:11Z","html_url":"https://github.com/jenkinsci/build-token-root-plugin/pull/5#discussion_r25536091","pull_request_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/pulls/5","_links":{"self":{"href":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/pulls/comments/25536091"},"html":{"href":"https://github.com/jenkinsci/build-token-root-plugin/pull/5#discussion_r25536091"},"pull_request":{"href":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/pulls/5"}}},"pull_request":{"url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/pulls/5","id":30171136,"html_url":"https://github.com/jenkinsci/build-token-root-plugin/pull/5","diff_url":"https://github.com/jenkinsci/build-token-root-plugin/pull/5.diff","patch_url":"https://github.com/jenkinsci/build-token-root-plugin/pull/5.patch","issue_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/issues/5","number":5,"state":"open","locked":false,"title":"[FIXED JENKINS-26693] adapt to Jobs which are not AbstractProjects","user":{"login":"ndeloof","id":132757,"avatar_url":"https://avatars.githubusercontent.com/u/132757?v=3","gravatar_id":"","url":"https://api.github.com/users/ndeloof","html_url":"https://github.com/ndeloof","followers_url":"https://api.github.com/users/ndeloof/followers","following_url":"https://api.github.com/users/ndeloof/following{/other_user}","gists_url":"https://api.github.com/users/ndeloof/gists{/gist_id}","starred_url":"https://api.github.com/users/ndeloof/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ndeloof/subscriptions","organizations_url":"https://api.github.com/users/ndeloof/orgs","repos_url":"https://api.github.com/users/ndeloof/repos","events_url":"https://api.github.com/users/ndeloof/events{/privacy}","received_events_url":"https://api.github.com/users/ndeloof/received_events","type":"User","site_admin":false},"body":"[JENKINS-26693](https://issues.jenkins-ci.org/browse/JENKINS-26693)\r\n\r\nrequired to trigger a workflow using buildtoken (TASK #723)\r\n@reviewbybees","created_at":"2015-02-27T14:48:31Z","updated_at":"2015-02-27T20:24:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1ec9f59904c77e863ea866d3f7065f72640a4acc","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/pulls/5/commits","review_comments_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/pulls/5/comments","review_comment_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/pulls/comments{/number}","comments_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/issues/5/comments","statuses_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/statuses/fa0d5cdea4dc86f1b8d4a659260252e02cd00321","head":{"label":"jenkinsci:JENKINS-26693","ref":"JENKINS-26693","sha":"fa0d5cdea4dc86f1b8d4a659260252e02cd00321","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":10055312,"name":"build-token-root-plugin","full_name":"jenkinsci/build-token-root-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/build-token-root-plugin","description":"","fork":false,"url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin","forks_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/forks","keys_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/teams","hooks_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/hooks","issue_events_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/issues/events{/number}","events_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/events","assignees_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/assignees{/user}","branches_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/branches{/branch}","tags_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/tags","blobs_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/git/refs{/sha}","trees_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/statuses/{sha}","languages_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/languages","stargazers_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/stargazers","contributors_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/contributors","subscribers_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/subscribers","subscription_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/subscription","commits_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/commits{/sha}","git_commits_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/git/commits{/sha}","comments_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/comments{/number}","issue_comment_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/issues/comments{/number}","contents_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/contents/{+path}","compare_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/merges","archive_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/downloads","issues_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/issues{/number}","pulls_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/pulls{/number}","milestones_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/milestones{/number}","notifications_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/labels{/name}","releases_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/releases{/id}","created_at":"2013-05-14T13:13:09Z","updated_at":"2015-01-29T16:46:07Z","pushed_at":"2015-02-27T19:56:33Z","git_url":"git://github.com/jenkinsci/build-token-root-plugin.git","ssh_url":"git@github.com:jenkinsci/build-token-root-plugin.git","clone_url":"https://github.com/jenkinsci/build-token-root-plugin.git","svn_url":"https://github.com/jenkinsci/build-token-root-plugin","homepage":"","size":165,"stargazers_count":1,"watchers_count":1,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":1,"forks":2,"open_issues":1,"watchers":1,"default_branch":"master"}},"base":{"label":"jenkinsci:master","ref":"master","sha":"52d8993385a2954fa71dcacf76d0ea6d5e268b23","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":10055312,"name":"build-token-root-plugin","full_name":"jenkinsci/build-token-root-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/build-token-root-plugin","description":"","fork":false,"url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin","forks_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/forks","keys_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/teams","hooks_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/hooks","issue_events_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/issues/events{/number}","events_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/events","assignees_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/assignees{/user}","branches_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/branches{/branch}","tags_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/tags","blobs_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/git/refs{/sha}","trees_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/statuses/{sha}","languages_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/languages","stargazers_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/stargazers","contributors_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/contributors","subscribers_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/subscribers","subscription_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/subscription","commits_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/commits{/sha}","git_commits_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/git/commits{/sha}","comments_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/comments{/number}","issue_comment_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/issues/comments{/number}","contents_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/contents/{+path}","compare_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/merges","archive_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/downloads","issues_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/issues{/number}","pulls_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/pulls{/number}","milestones_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/milestones{/number}","notifications_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/labels{/name}","releases_url":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/releases{/id}","created_at":"2013-05-14T13:13:09Z","updated_at":"2015-01-29T16:46:07Z","pushed_at":"2015-02-27T19:56:33Z","git_url":"git://github.com/jenkinsci/build-token-root-plugin.git","ssh_url":"git@github.com:jenkinsci/build-token-root-plugin.git","clone_url":"https://github.com/jenkinsci/build-token-root-plugin.git","svn_url":"https://github.com/jenkinsci/build-token-root-plugin","homepage":"","size":165,"stargazers_count":1,"watchers_count":1,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":1,"forks":2,"open_issues":1,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/pulls/5"},"html":{"href":"https://github.com/jenkinsci/build-token-root-plugin/pull/5"},"issue":{"href":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/issues/5"},"comments":{"href":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/issues/5/comments"},"review_comments":{"href":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/pulls/5/comments"},"review_comment":{"href":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/pulls/5/commits"},"statuses":{"href":"https://api.github.com/repos/jenkinsci/build-token-root-plugin/statuses/fa0d5cdea4dc86f1b8d4a659260252e02cd00321"}}}}