sách gpt4 ai đã đi

Đánh giá API Java của Rally

In lại 作者:行者123 更新时间:2023-12-02 06:10:00 28 4
mua khóa gpt4 Nike

Đây là mã của tôi:

import com.google.gson.JsonElement;
import com.rallydev.lookback.LookbackApi;
import com.rallydev.lookback.LookbackQuery;
import com.rallydev.lookback.LookbackResult;
import java.math.BigInteger;
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 java.io.*;
import java.net.URI;

import javax.management.Query;
import com.google.gson.JsonObject;

public class dIterationPsiAutomation {
public String rallyURI;
public String appName;
public String username;
public String password;
public RallyRestApi restApi;
public LookbackApi lookback;
public dIterationPsiAutomation(String rallyURL,String username,String password, String applicationName) {
// TODO Auto-generated constructor stub
this.rallyURI = rallyURL;
this.appName = applicationName;
this.username = username;
this.password = password;


this.connect(this.rallyURI, this.appName, this.username, this.password);
}
public void connect(String uri,String app,String username,String password){
try //Unhandled URI Exception occurs here
{

this.restApi = new RallyRestApi(new URI(uri),username,password);
this.restApi.setApplicationName("v2.0");
this.restApi.setApplicationName(app);
this.lookback = new LookbackApi();
this.lookback.setCredentials(username, password);
this.lookback.setWorkspace("Workspace 1");

}
catch(Exception e){
System.out.println("Exception occured "+e);
}
}
public void getFeatureInfo(String featureName) throws IOException {
QueryRequest feature = new QueryRequest("portfolioitem/feature");
feature.setFetch(new Fetch("FormattedID","ObjectID","Name"));
feature.setQueryFilter(new QueryFilter("Name","=",featureName));

QueryResponse queryResponse = this.restApi.query(feature);


}
public void get_formattedID(JsonElement ObjectID){

}
public void get_prefixed_stories(String prefix){
try{
QueryRequest stories = new QueryRequest("hierarchicalrequirement");
stories.setFetch(new Fetch("Children","Name","Iteration","FormattedID","ObjectID"));
stories.setQueryFilter(new QueryFilter("Name","contains",prefix));


QueryResponse response = this.restApi.query(stories);
if(response.wasSuccessful()){
System.out.println(String.format("Total result count %d", response.getTotalResultCount()));
for(JsonElement result: response.getResults()){
JsonObject story = result.getAsJsonObject();
System.out.println(String.format("%s - %s: ObjectID: %s", story.get("FormattedID").getAsString(), story.get("Name").getAsString(), story.get("ObjectID").getAsBigInteger()));
get_all_leaf_stories(story.get("ObjectID").getAsBigInteger());
}
}
}
catch(Exception e){
System.out.println("Caught an exception in get_prefixed_stories method");
System.out.println("More details "+e);
}
}
public void get_all_leaf_stories(BigInteger oID){
try{
LookbackQuery query = this.lookback.newSnapshotQuery();
query.addFindClause("_TypeHierarchy", "HierarchicalRequirement");
query.addFindClause("_ItemHierarchy", oID);
query.addFindClause("Children", null);
query.addFindClause("__At", "current");

query.requireFields("Iteration","ObjectID","Name");
query.sortBy("Iteration", -1);

LookbackResult resultSet = query.execute();
if(resultSet.hasWarnings()){
System.out.println("Errors in lookback "+resultSet.Errors);
}
int resultCount = resultSet.Results.size();

System.out.println("Lookback resultset is "+resultCount);
}
catch(Exception e){
System.out.println("Lookback Exception "+e);
}
}
}

当我尝试使用 LBAPI 时,出现 IllegalArgumentException。有人可以帮我解决这个问题吗?

1 Câu trả lời

Tôi nghĩ README for Rally-Lookback-Toolkit 中的示例通过名称指定工作区的方式具有误导性/错误:

lookbackApi.setWorkspace("myworkspace");

当我执行此操作时,我从 LBAPI 看到以下错误:

回顾异常 com.google.gson.JsonSyntaxException:java.lang.IllegalStateException:预期为 BEGIN_OBJECT,但在第 1 行第 1 列为 STRING

REST URL 中需要的实际上是 Workspace ObjectID 而不是名称。因此,如果您在代码中设置工作区 ObjectID:

this.lookback.setWorkspace("12345678910");

我认为该查询应该适合您。

关于java - Rally Java 回顾 API,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21976325/

28 4 0
Bài viết được đề xuất: Java ArrayList 帮助
Bài viết được đề xuất: vba - ThisWorkbook.Sheets(1).Select (False) 不起作用
Bài viết được đề xuất: 用于汇总 CSV 列的 Perl 脚本(或任何东西)
Bài viết được đề xuất: json - Delphi对象转json字符串如何忽略空字段和null字段
行者123
Hồ sơ cá nhân

Tôi là một lập trình viên xuất sắc, rất giỏi!

Nhận phiếu giảm giá Didi Taxi miễn phí
Mã giảm giá Didi Taxi
Giấy chứng nhận ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com