【问题标题】:How to set the components of a Jira sub-task using the script listener plug-in?如何使用脚本监听插件设置 Jira 子任务的组件?
【发布时间】:2012-08-16 21:11:37
【问题描述】:

我正在使用 Jira 插件 groovyrunner,它有几个内置脚本。其中之一是脚本侦听器,它在某个项目触发特定事件时运行内置脚本。在这种情况下,脚本是“创建子任务”。选择一些设置和可能的约束后,您可以运行其他代码。我有它,所以在创建子任务时设置受让人。现在我要做的是为子任务设置组件。目前,它使用了我不想要的父组件。

最初我试图使用:

issue.setComponentIds('idnum')

但现在我发现了这个:

setComponentObjects(Collection<ProjectComponent> components)

http://docs.atlassian.com/jira/latest/com/atlassian/jira/issue/MutableIssue.html

我只是在使用组件 ID 构建 ProjectComponent 并将其插入到集合中时遇到了麻烦。

【问题讨论】:

    标签: groovy components jira


    【解决方案1】:

    如果你唯一的问题是从它的 id 中获取 ProjectComponent 对象,而不是在你的 groovy 脚本中,你可以简单地获取它:

    ProjectComponentManager pcm = ComponentAccessor.getProjectComponentManager();
    ProjectComponent pc = pcm.find(long_id); 
    List<ProjectComponent> list = new ArrayList<ProjectComponent>();
    list.add(pc); 
    

    或者,如果您对选定的组件有其他标识符或条件,您应该检查 http://docs.atlassian.com/jira/5.1/com/atlassian/jira/bc/project/component/ProjectComponentManager.html 了解更多信息。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-04-30
      • 2015-05-07
      • 2017-01-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-08-04
      • 1970-01-01
      相关资源
      最近更新 更多