Pages

Saturday, March 15, 2014

How to fetch the Rally Folder List

public Map<String, Map<String, String>> getFolderList() throws IOException {
if (folderReferenceMap.isEmpty()) {
QueryRequest folderRequest = new QueryRequest("TestFolder");
// spaces
folderRequest.setFetch(new Fetch("FormattedID", "Name"));
LOGGER.info("Feting the folder list from Rally for project ["
+ ReadProperties.getInstance().getProperty("rallyProject")
+ "]");
folderRequest.setQueryFilter(new QueryFilter("Project.Name", "=",
ReadProperties.getInstance().getProperty("rallyProject")));
QueryResponse folderQueryResponse = restApi.query(folderRequest);
// JsonObject testSetJsonObject =
// testSetQueryResponse.getResults().get(0).getAsJsonObject();
JsonArray resultArray = folderQueryResponse.getResults();
for (JsonElement result : resultArray) {
String rallyFolderObjId = result.getAsJsonObject().get("_ref")
.getAsString();
LOGGER.debug(rallyFolderObjId);
String rallyFolderName = result.getAsJsonObject()
.get("_refObjectName").getAsString();
// System.out.println(rallyFolderName);

String formattedId = result.getAsJsonObject()
.get("FormattedID").getAsString();
// System.out.println(formattedId);

String testFolder = "testfolder";
int stringPosition = rallyFolderObjId.indexOf(testFolder)
+ testFolder.length() + 1;
rallyFolderObjId = rallyFolderObjId.substring(stringPosition,
rallyFolderObjId.length());
// System.out.println(rallyFolderObjId);
Map<String, String> folderMap = new HashMap<String, String>();
folderMap.put(rallyFolderObjId, rallyFolderName);
folderReferenceMap.put(formattedId, folderMap);
xAFTRallyScenarioDataMap.getInstance().setFolderReferenceMap(
folderReferenceMap);
}
LOGGER.debug("Folder list loading  from Rally is complete");
}

return folderReferenceMap;

}

1 comment:

  1. Casino Slots - JTHub
    Free 김포 출장안마 Play for 안성 출장샵 Casino 용인 출장마사지 Slots. If you 거제 출장마사지 are a fan of the best casino slots we recommend JTG's, check out the 세종특별자치 출장마사지 official site. Find all the great casino games you

    ReplyDelete