简体   繁体   English

Rally为变更集添加更改列表。 使用Java Toolkit for Rally REST API

[英]Rally add a list of Changes to a Changeset. Using Java Toolkit for Rally REST API

I have a list of Changes (in String format) and i now need to add this to a Changeset. 我有一个更改列表(以String格式),我现在需要将其添加到Changeset。 The Changeset is already attached to the Artifact, but i am having trouble adding the Changes to the Changeset. Changeset已附加到Artifact,但我无法将更改添加到Changeset。

Any help would be great! 任何帮助都会很棒! Many Thanks! 非常感谢!

Since Changes is a field on Changeset, it seems reasonable to be able to update a Changeset object and set Changes to collection of Change refs. 由于Changes是Changeset上的一个字段,因此能够更新Changeset对象并将更改设置为Change refs集合似乎是合理的。 However, the Rally web service API wants things a little differently. 但是,Rally Web服务API希望事情略有不同。

Changeset is a required field on a Change object, so you can't create the Change object in Rally without giving it a Changeset ref. Changeset是Change对象上的必填字段,因此您无法在Rally中创建Change对象而不为其提供Changeset引用。 And that's exactly how you add Changes to a Changeset. 而这正是您向Changeset添加更改的方式。

Assuming you have a Changeset ref in a String called csRef (eg "https://rally.rallydev.com/slm/webservice/1.33/changeset/223534.js"), the following code will create a Change object (Changeset and PathAndFilename are the required fields) in Rally and attach it to that Changeset: 假设您在名为csRef的String中有一个Changeset引用(例如“https://rally.rallydev.com/slm/webservice/1.33/changeset/223534.js”),以下代码将创建一个Change对象(Changeset和PathAndFilename)在Rally中是必填字段并将其附加到该Changeset:

JsonObject newChange = new JsonObject();
newChange.addProperty("Changeset", csRef);
newChange.addProperty("PathAndFilename", "a/b/c");  

CreateRequest cRequest = new CreateRequest("change", newChange);
CreateResponse cResponse = restApi.create(cRequest);
String cRef = cResponse.getObject().get("_ref").getAsString();
System.out.println(String.format("Created %s", cRef));

You probably already know this, but the web service api docs, which specify which fields are required to create objects, are here: https://rally1.rallydev.com/slm/doc/webservice 您可能已经知道这一点,但是Web服务api文档指定了创建对象所需的字段,请访问: https//rally1.rallydev.com/slm/doc/webservice

Hope that helps. 希望有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM