我的方案是:我的jira工作流程中的一步应该能够取消安排任务,即将修订版本设置为“无”。
我注意到我无法在工作流发布功能中更新修复版 - 我不确切知道原因,但无论如何我确实实现了一个jira插件来帮我解决我的问题,但我知道我反对jira结构(甚至java良好的编码实践:))。我不确定我的实现是否会导致问题,但实际上它在我的jira实例4.1.x中工作。
我如何实现一个插件来更新post函数中的修复版本,2种非常相似的方式:
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)
我在此发表此文章的目的是:
答案 0 :(得分:4)
如果你想正确地看一下
的代码./ jira / src / java / com / atlassian / jira / workflow / function / issue / UpdateIssueFieldFunction.java processField()
采用输入参数的后期功能尚未记录。其他代码去的地方是其他开源插件。
答案 1 :(得分:1)
Atlassian有一个关于完成你想做什么的教程,here:
答案 2 :(得分:0)
我喜欢这个片段:
List<GenericValue> genericValueList = issueManager.getIssues(issues);
versionManager.moveIssuesToNewVersion(genericValueList, lastVersion, newVersion);