gpt4 book ai didi

java - Rally Rest API 通过缺陷 FormattedID 获取对话帖子

转载 作者:行者123 更新时间:2023-12-02 03:33:15 27 4
gpt4 key购买 nike

我正在尝试针对给定的缺陷进行讨论。我从我之前提出的问题中了解到,不可能将讨论数据作为缺陷本身的属性来提取,而是我必须运行单独的获取请求。

问题是我无法识别提取对话帖子时要使用的任何查询过滤器。这让我相信我必须循环遍历每一个对话帖子,并尝试在返回的实际数据中找到匹配的缺陷编号,这将是非常低效的。

相反,我更愿意简单地为每个缺陷运行一次查询提取,该缺陷使用格式化 ID 的查询过滤器,该过滤器将仅返回适用于该缺陷的对话帖子。

import com.google.gson.JsonElement;
import com.rallydev.rest.RallyRestApi;
import com.rallydev.rest.request.QueryRequest;
import com.rallydev.rest.response.QueryResponse;
import com.rallydev.rest.util.Fetch;
import com.rallydev.rest.util.QueryFilter;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;

import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;

public class ExtractFull {

@SuppressWarnings("unchecked")
public static void main(String args[]) throws URISyntaxException, IOException {

RallyRestApi restApi = new RallyRestApi(new URI("https://rally1.rallydev.com"), "_myapikey");
restApi.setApplicationName("DANA Example");
restApi.setProxy(new URI("http://myproxy:8080"), "username", "pass");




System.out.println("Querying Rally for defects, this may take some time");

try {

QueryRequest defectRequest = new QueryRequest("ConversationPost");
defectRequest.setPageSize(2000);
defectRequest.setLimit(5000);
QueryFilter filter = new QueryFilter("FormattedID","=","DE10101");
defectRequest.setQueryFilter(filter);

defectRequest.setFetch(new Fetch());

QueryResponse queryResponse = restApi.query(defectRequest);


for(JsonElement result: queryResponse.getResults()){

System.out.println(result);


}
} finally {
restApi.close();
}

}

}

该代码不起作用。我认为因为“FormattedId”不是“ConversationPost”类型的有效对象。我不知道在查询对话帖子时是否可以过滤父缺陷 ID,但这正是我需要做的。

具体来说,我引用的代码在这里:

  QueryRequest defectRequest = new QueryRequest("ConversationPost");
defectRequest.setPageSize(2000);
defectRequest.setLimit(5000);
QueryFilter filter = new QueryFilter("FormattedID","=","DE10101");
defectRequest.setQueryFilter(filter);

最佳答案

使用标准的WSAPI,我可以这样查询:

(Artifact.FormattedID = "US123")

关于java - Rally Rest API 通过缺陷 FormattedID 获取对话帖子,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56874196/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com