Atlassian JIRA插件开发:如何使变量可用于速度模板 [英] Atlassian JIRA Plugin Development: How to make variables available to velocity templates

查看:165
本文介绍了Atlassian JIRA插件开发:如何使变量可用于速度模板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

公平警告:除非您有使用JIRA的经验并且可以访问其来源(企业用户),否则这个问题将很难回答。

问候所有,

我正在编写一个扩展AbstractIssueSelectAction的插件。我注意到 $ {issue.summary} 等都可以从我的力度模板中获得,但是,还有其他我希望公开的内容。我无法弄清楚如何将其他东西添加到速度参数图中。我甚至使用了一个远程调试器来尝试逐步完成堆栈并弄清楚发生了什么 - 但由于深度堆栈以及我无法正确附加所有源的事实,我很不清楚(并且很多网页内容似乎都被混淆了)。

I am writing a plugin which extends AbstractIssueSelectAction. I noticed that ${issue.summary}, etc are all available from within my velocity template, however, there are other things I wish to expose. I can't figure out how to add other things to the velocity parameter map. I even used a remote debugger to try to step through the stack and figure out what is going on - but it was pretty unclear to me both due to a deep stack and the fact that I wasn't able to correctly attach all of the source (and lots of the webwork stuff seems to be obfuscated).

我也在Atlassian支持论坛上发布了这个问题,我只是在这里交叉发布以获得更多注意问题。

I have posted this question on the Atlassian support forums also, I am just cross-posting here to get more eyes on the problem.

示例动作代码:

public class MyOperation extends AbstractIssueSelectAction {

    // ...
    private final Issue myIssue;

    public String doCollect() throws Exception {
      log.debug("Running doCollect()");
      return "collectinfo";
    }
 }

示例插件配置:

  <webwork1 key="unique_key" name="My Name" class="java.lang.Object">
   <actions>
    <action name="com.mycompany.jira.extensions.MyOperation" alias="MyOperation">
     <view name="collectinfo">/templates/myoperation-collectinfo.vm</view>
     <view name="success">/templates/myoperation-success.vm</view>
    </action>
   </actions>
  </webwork1>

在力度模板中, $ {issue.summary} 正确解析当前问题的摘要,但如果myIssue是其他问题,例如,我希望能够使用 $ {myIssue.summary}

In the velocity template, ${issue.summary} correctly resolves to the current issue's summary, but if myIssue was some other issue, for example, I want to be able to use ${myIssue.summary}.

谢谢!
-Carl

Thanks! -Carl

推荐答案

如何使用$ action.mymethod()获取信息,其中mymethod是一个您在Action类MyOperation中定义的方法?速度参数非常精确,以了解它们是如何填充的。

How about using $action.mymethod() to get at the information, where mymethod is a method you define in the Action class "MyOperation"? The velocity parameters are fiddly to find out how they get populated.

~Matt

这篇关于Atlassian JIRA插件开发:如何使变量可用于速度模板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆