Uh oh!
There was an error while loading. Please reload this page.
forked from nmusaelian-rally/rally-java-rest-apps
- Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathPiTypes.java
More file actions
Latest commit
51 lines (41 loc) · 1.87 KB
/
Copy pathPiTypes.java
File metadata and controls
51 lines (41 loc) · 1.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
importjava.io.IOException;
importjava.net.URI;
importjava.net.URISyntaxException;
importcom.google.gson.JsonArray;
importcom.google.gson.JsonElement;
importcom.google.gson.JsonObject;
importcom.rallydev.rest.RallyRestApi;
importcom.rallydev.rest.util.Fetch;
importcom.rallydev.rest.request.QueryRequest;
importcom.rallydev.rest.request.UpdateRequest;
importcom.rallydev.rest.response.UpdateResponse;
importcom.rallydev.rest.response.QueryResponse;
importcom.rallydev.rest.util.QueryFilter;
importjava.util.Date;
publicclassPiTypes{
publicstaticvoidmain(String[] args) throwsURISyntaxException, IOException {
Stringhost = "https://rally1.rallydev.com";
StringapiKey = "_abc123"; //use your ApiKey
StringapplicationName = "Nick:PiTypes";
RallyRestApirestApi = newRallyRestApi(newURI(host),apiKey);
restApi.setApplicationName(applicationName);
StringworkspaceRef = "/workspace/12345";
try {
QueryRequesttypedefRequest = newQueryRequest("TypeDefinition");
typedefRequest.setFetch(newFetch("ElementName","Ordinal"));
typedefRequest.setOrder("Ordinal DESC");
typedefRequest.setQueryFilter(newQueryFilter("Parent.Name", "=", "Portfolio Item"));
typedefRequest.setWorkspace(workspaceRef);
QueryResponsetypedefResponse = restApi.query(typedefRequest);
for (inti=0; i<typedefResponse.getTotalResultCount();i++){
JsonObjecttypedefObj = typedefResponse.getResults().get(i).getAsJsonObject();
if(typedefObj.get("Ordinal").getAsInt() > -1){
System.out.println("ElementName: " + typedefObj.get("ElementName") + ", " +
"Ordinal: " + typedefObj.get("Ordinal"));
}
}
} finally {
restApi.close();
}
}
}