问题
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
回答1:
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
来源:https://stackoverflow.com/questions/1507241/atlassian-jira-plugin-development-how-to-make-variables-available-to-velocity-t