Jira:如何获取自定义 IssueEventListener 中自定义字段的先前值
那么如何获取自定义字段的前一个值 在 Jira IssueEventListener 中?我正在为 issuesUpdated(IssueEvent) 事件编写一个自定义处理程序,如果某个自定义字段发生更改,我想更改处理程序的行为。为了检测变化的类型,我想比较之前的值和当前的值。
(我不是在问如何获取其当前值 - 我知道如何从相关问题中获取该值)
我正在 Windows 上针对 Jira 4.0.2 进行开发。
扫描更改历史记录以获取最后一个已知值的最佳方法是吗?
List changes = changeHistoryManager.getChangeHistoriesForUser(issue, user);
So how does one obtain the previous value of a custom field in a Jira IssueEventListener? I am writing a custom handler for the issueUpdated(IssueEvent) event and I would like to alter the handler's behavior if a certain custom field has changed. To detect the type of change I would like to compare the previous and current values.
(I'm am not asking about how to obtain its current value - I know how to get that from the related Issue)
I am developing against Jira 4.0.2 on Windows.
Is the best way to scan the change history for the last known value?
List changes = changeHistoryManager.getChangeHistoriesForUser(issue, user);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我假设原始发布者正在使用 Java 编写 JIRA 插件。我无法确定如何在 JIRA v4.0.2 中完成此任务,但以下是我如何使用 JIRA v5.0.2 完成此任务(解决方案很可能是相同的):
changeItem 的一些可能的关键值是:
对于许多自定义字段类型,Object oldValue 可能只是一个字符串。但我认为并非所有情况都如此。
I'm assuming the original poster is writing a JIRA plugin with Java. I cannot be certain of how to accomplish this task in JIRA v4.0.2, but here is how I managed to do so with JIRA v5.0.2 (the solutions may very well be the same):
Some possible key values for changeItem are:
For many of the custom field types Object oldValue is probably just a String. But I don't think that's true for every case.
试试这个例子:
注意:champCodeProjet 是自定义字段的名称。
Try this example :
Note that : champCodeProjet is the name of customfield.