geg*_*ege 10 java plugins jira
我的方案是:我的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();
}
}
Run Code Online (Sandbox Code Playgroud)
我假设一个真正的解决方案应该使用类:ChangeItemBean,ModifiedValue,IssueChangeHolder - 以CustomFieldImpl中的updateValue方法为例(来自jira源代码,项目:jira,包:com.atlassian.jira.issue.fields).
我在这里发表这篇文章的意思是:
如果你想正确地做到这一点,请查看代码
./jira/src/java/com/atlassian/jira/workflow/function/issue/UpdateIssueFieldFunction.java processField()
接受输入参数的后函数似乎还没有记录。其他获取代码的地方是其他开源插件。
| 归档时间: |
|
| 查看次数: |
6662 次 |
| 最近记录: |