【发布时间】:2011-01-27 18:51:53
【问题描述】:
我的场景是:我的 jira 工作流程中的一个步骤应该能够取消计划任务,即将修复版本设置为“无”。
我注意到我无法在工作流发布功能中更新修复版本 - 我不知道具体原因,但无论如何我确实实现了一个 jira 插件来帮助我解决我的问题,但我知道我正在反对 jira 结构(即使是 java 良好的编码实践:))。我不确定我的实现是否会导致问题,但它确实在我的 jira 实例 4.1.x 中运行。
我如何实现一个插件来更新发布功能中的修复版本,两种非常相似的方式:
public class BrandsclubPostFunctionUnschedule extends AbstractJiraFunctionProvider {
// Here I create an empty Collection to be the new value of FixVersion (empty because I need no version in Fix Version)
public void execute(Map transientVars, Map args, PropertySet ps) throws WorkflowException {
MutableIssue issue = this.getIssue(transientVars);
Collection<Version> newFixVersion = new ArrayList<Version>();
issue.setFixVersions(newFixVersion);
issue.store();
}
}
public class BrandsclubPostFunctionUnschedule extends AbstractJiraFunctionProvider {
// here I clear the Collection I got from "old" Fix Version and I have to set it again to make it work.
public void execute(Map transientVars, Map args, PropertySet ps) throws WorkflowException {
MutableIssue issue = this.getIssue(transientVars);
Collection fixVersions = issue.getFixVersions();
fixVersions.clear();
issue.setFixVersions(fixVersions);
issue.store();
}
}
我认为真正的解决方案应该使用以下类:ChangeItemBean、ModifiedValue、IssueChangeHolder - 以 CustomFieldImpl 中的 updateValue 方法为例(来自 jira 源代码,项目:jira,包:com.atlassian.jira.issue.fields) .
我在这里发表这篇文章的目的是:
- 有谁知道如何实现一个包含 post 功能的 jira 插件来正确更改修复版本?
【问题讨论】: