如何添加另一个批量操作?

How to add another bulk operation?

Jira 允许在 different locations.

上添加网页片段

我想编写一个插件来添加另一个批量操作,但既找不到位置(如果这完全是通过网络碎片完成的),也无法在 Jira Plugin Module Types 中提示如何添加这样的操作手术。从现有的插件(例如出口商)我得到的印象是一定有办法。

感谢任何帮助。谢谢

这是可以做到的,我是这样做的:

我扩展了 AbstractBulkOperation class 并使用 EventListener 的方法在 afterPropertiesSet 中添加了这个操作,如下所示:

ComponentAccessor.getBulkOperationManager().addBulkOperation(MyOperationClass.NAME_KEY, MyOperationClass.class);

需要执行canPerformperform(实际操作)、getOperationNamegetCannotPerformMessageKeygetNameKeygetDescriptionKey

我扩展了 AbstractBulkOperationDetailsAction,但是 BulkEditBeanSessionHelper 无法自动装配,所以我引入了受保护的构造函数并将其安装到那里:

protected MyActionClass()
{
super(null, ComponentManager.getComponentInstanceOfType(BulkEditBeanSessionHelper.class));

genericBulkWatchOperation = ComponentAccessor.getBulkOperationManager().getOperation(NAME_KEY);
}

您需要在此 class.

中实现 getOperationDetailsActionNamedoDetailsdoDetailsValidationdoPerform 方法

我在 atlassian-plugin.xml 中创建了 Webwork 元素,如下所示:

<webwork1 key="key" name="name" class="java.lang.Object">
<actions>
<action name="path to action class" alias="Action">
<command name="details" alias="ActionDetails">
<view name="success">/secure/views/bulkedit/bulkchooseoperation.jsp</view>
<view name="input">/secure/views/bulkedit/bulkActiondetails.jsp</view>
<view name="error">/secure/views/bulkedit/bulkchooseoperation.jsp</view>
</command>
<command name="detailsValidation" alias="ActionDetailsValidation">
<view name="input">/secure/views/bulkedit/bulkActionconfirmation.jsp</view>
<view name="error">/secure/views/bulkedit/bulkActionconfirmation.jsp</view>
</command>
<command name="perform" alias="ActionPerform">
<view name="error">/secure/views/bulkedit/bulkActionerror.jsp</view>
</command>
</action>
</actions>
</webwork1>

JSP 文件无法嵌入到插件中,我将它们部署到 /secure/views/bulkedit

总结一下——你需要 3 个 classes(OperationActionEventListener),webwork 在 atlassian 中的定义-plugin.xml 和 Event Listener 定义也在 atlassian-plugin.xml 中。然后你需要 JSP 个文件。你可以拿现有的作为例子。 基本上我拿了WatchIssue个操作文件,类比做了。

我强烈建议看一下 JIRA 代码,看看他们是怎么做到的。