Atlassian JIRA 插件开发:如何使变量可用于速度模板

发布于 2024-08-06 22:38:27 字数 1219 浏览 10 评论 0原文

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

大家好,

我正在编写一个扩展 AbstractIssueSelectAction 的插件。我注意到 ${issue.summary} 等都可以从我的速度模板中获得,但是,我还希望公开其他内容。我不知道如何将其他东西添加到速度参数图中。我什至使用远程调试器来尝试单步调试堆栈并找出正在发生的情况 - 但由于堆栈很深以及我无法正确附加所有源代码这一事实,我对此非常不清楚(很多网络工作的东西似乎都被混淆了)。

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

示例操作代码:

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}

谢谢! -卡尔

FAIR WARNING: this question is going to be pretty tough to answer unless you have experience with JIRA and have access to their source (enterprise users).

Greetings all,

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).

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

Example action code:

public class MyOperation extends AbstractIssueSelectAction {

    // ...
    private final Issue myIssue;

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

Example plugin config:

  <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>

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}.

Thanks!
-Carl

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

九局 2024-08-13 22:38:27

如何使用 $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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文