从 jira soap api 迁移到 jira rest api:getCustomFieldValues 问题
migrating from jira soap api to jira rest api: issues with getCustomFieldValues
我正在努力将一些代码从 Jira Soap Api 迁移到 Jira Rest API。我有一行看起来像这样的遗留代码:
String estimationTypes = issue.getCustomFieldValues().find{it.customfieldId == SOME_STRING_VALUE_HERE}?.values.toString()
issue
变量的类型是com.atlassian.jira.rpc.soap.beans.RemoteIssue
,我正在尝试迁移它并使用新的Issue
接口(com.atlassian.jira.issue.Issue
)的实现,等等我正在寻找定义为
的 getCustomFieldValues()
方法的等价物
public RemoteCustomFieldValue[] getCustomFieldValues() {
return this.customFieldValues;
}
但是我没有找到。 Issue接口定义的Object getCustomFieldValue(CustomField customField)
不一样。那么我如何使用等同于 getCustomFieldValues
的方法?
我想如果我有像
这样的方法
List<CustomField> getCustomFields()
然后我就可以创建一个方法:类似于
public List<Object> getCustomFieldValues() {
List<Object> result = new ArrayList<>()
List<CustomField> customFields = getCustomFields()
for(CustomField cs: customFields) {
result.add(issue.getCustomFieldValue(cs))
}
return result
}
我的目标是使迁移对遗留代码的影响尽可能小。我希望能够尽可能地模仿遗留代码的行为。非常感谢任何帮助或指示。
在我使用过的最有趣的 API 之一进行大量研究和卷曲之后,我在 Atlassian 知识库 here 上找到了一些非常有用的信息。该文本针对多 select 自定义字段,但对其他类型的自定义字段也很有用。
它清楚地提到 JIRA 的 REST API 没有提供一种方法来简单地检索多选项自定义字段可用的所有选项。因此,此处使用的方法被视为一种变通方法。所以我们可以使用
在两个元 apis 链接之后,创建元 api 的参数很简单,但在编辑元 api 的情况下,有一个请求参数称为 overrideScreenSecurity
这与附加组件用户和从 Web 界面直接访问附加组件市场有关,但与我的情况无关,默认(假)值对我来说很好。
从这里我可以解析 json 以获取值
我正在努力将一些代码从 Jira Soap Api 迁移到 Jira Rest API。我有一行看起来像这样的遗留代码:
String estimationTypes = issue.getCustomFieldValues().find{it.customfieldId == SOME_STRING_VALUE_HERE}?.values.toString()
issue
变量的类型是com.atlassian.jira.rpc.soap.beans.RemoteIssue
,我正在尝试迁移它并使用新的Issue
接口(com.atlassian.jira.issue.Issue
)的实现,等等我正在寻找定义为
getCustomFieldValues()
方法的等价物
public RemoteCustomFieldValue[] getCustomFieldValues() {
return this.customFieldValues;
}
但是我没有找到。 Issue接口定义的Object getCustomFieldValue(CustomField customField)
不一样。那么我如何使用等同于 getCustomFieldValues
的方法?
我想如果我有像
这样的方法List<CustomField> getCustomFields()
然后我就可以创建一个方法:类似于
public List<Object> getCustomFieldValues() {
List<Object> result = new ArrayList<>()
List<CustomField> customFields = getCustomFields()
for(CustomField cs: customFields) {
result.add(issue.getCustomFieldValue(cs))
}
return result
}
我的目标是使迁移对遗留代码的影响尽可能小。我希望能够尽可能地模仿遗留代码的行为。非常感谢任何帮助或指示。
在我使用过的最有趣的 API 之一进行大量研究和卷曲之后,我在 Atlassian 知识库 here 上找到了一些非常有用的信息。该文本针对多 select 自定义字段,但对其他类型的自定义字段也很有用。
它清楚地提到 JIRA 的 REST API 没有提供一种方法来简单地检索多选项自定义字段可用的所有选项。因此,此处使用的方法被视为一种变通方法。所以我们可以使用
在两个元 apis 链接之后,创建元 api 的参数很简单,但在编辑元 api 的情况下,有一个请求参数称为 overrideScreenSecurity
这与附加组件用户和从 Web 界面直接访问附加组件市场有关,但与我的情况无关,默认(假)值对我来说很好。
从这里我可以解析 json 以获取值