[英]Is it possible to manage jira webhooks from plugin via Java API?
I'm writing plugin for Jira and i need to manage webhooks from plugin code (read, add, edit and delete actions). 我正在为Jira编写插件,我需要从插件代码管理webhooks(读取,添加,编辑和删除操作)。 I have found only one way to manage webhooks - REST API... So, question is simple: can i manage webhooks via java API from my plugin?
我发现只有一种方法来管理webhooks - REST API ......所以,问题很简单:我可以通过我的插件中的Java API管理webhooks吗? And if i can, how?
如果可以,怎么样?
I've found this artifacts: https://maven-repository.com/artifact/com.atlassian.webhooks , but when i try to component-import some interfaces like com.atlassian.webhooks.spi.provider.WebHookRegistry my plugin does not start... 我发现了这个工件: https ://maven-repository.com/artifact/com.atlassian.webhooks,但当我尝试组件导入一些接口,比如com.atlassian.webhooks.spi.provider.WebHookRegistry我的插件没开始......
As I understand, you need to fire your code on issue create/update/delete. 据我了解,您需要在问题创建/更新/删除时触发代码。 Then you need to write JIRA Event Listeners for appropriate issue events.
然后,您需要为适当的问题事件编写JIRA事件监听器。 Here is tutorial: https://developer.atlassian.com/display/JIRADEV/Writing+JIRA+Event+Listeners+with+the+atlassian-event+Library
这是教程: https : //developer.atlassian.com/display/JIRADEV/Writing+JIRA+Event+Listeners+with+the+atlassian-event+Library
================== ==================
Sorry, missed the point. 对不起,错过了这一点。 I am looking through the sources of jira-webhooks-plugin which is part of JIRA sources (and you get access to them when you buy any JIRA license) and do not see neither com.atlassian.webhooks.spi.provider.WebHookRegistry interface nor implementation.
我正在查看jira-webhooks-plugin的源代码,它是JIRA源代码的一部分(当你购买任何JIRA许可证时,你可以访问它们)并且既没有看到com.atlassian.webhooks.spi.provider.WebHookRegistry接口也没有实现。
I see that webhooks are created like this: 我看到webhooks是这样创建的:
final WebhookDao webHookDao = ao.create(WebhookDao.class,
new DBParam("LAST_UPDATED_USER", userManager.getRemoteUsername()),
new DBParam("URL", targetUrl),
new DBParam("LAST_UPDATED", new Date()),
new DBParam("NAME", name),
new DBParam("FILTER", filter.isPresent() ? filter.get() : ""),
new DBParam("REGISTRATION_METHOD", registrationMethod),
new DBParam("ENABLED", true),
new DBParam("EXCLUDE_ISSUE_DETAILS", JiraWebHookListenerParameters.ParametersParser.getExcludeIssueDetails(params)),
new DBParam("PARAMETERS", JiraWebHookListenerParameters.ParametersParser.getRemainingParameters(params))
);
webHookDao.setEvents(Iterables.toArray(events, String.class));
webHookDao.save();
But probably you will not be able to execute this code in your plugin. 但是,您可能无法在插件中执行此代码。 Anyway, I advise you to loook into sources.
不管怎么说,我建议你去看看消息来源。
Please update me with your results. 请告诉我你的结果。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.