Looking to retreive a Workspace URL for a given workspace name. using the current workspace name in the parms. Problems is, the query fails when there are special characters (I think it is the special characters), in my case a dash '-' in the Workspace Name string. I've tryed delimiting by double-quote, but that gives me a parse error. Thoughts appreciated...
public static String getWorkspaceURL (RallyRestApi restApi, ParametersBean parms) {
String workspaceURL = new String();
try {
QueryRequest query = new QueryRequest("Workspace");
query.setFetch(new Fetch(new String[] {"_ref"}));
query.setPageSize(2);
query.setLimit(2);
query.setScopedDown(false);
query.setScopedUp(false);
query.setQueryFilter((new QueryFilter("Name", "=", parms.getCurrentWorkspace())));
QueryResponse response = restApi.query(query);
if (response.wasSuccessful()) {
JsonArray tempProject = response.getResults();
JsonObject obj1 = tempProject.get(0).getAsJsonObject();
workspaceURL = obj1.get("_ref").getAsString();
;
} else {
logger.info("The following errors occurred: ");
for (String err : response.getErrors()) {
logger.error("\t" + err);
}
logger.error("Rally API Call Error Occurred");
logger.error("REST Call: " + query.toString());
System.exit(1);
}
} catch (Exception e) {
logger.error("Rally: Error getting WorkspaceURL for " + parms.getCurrentWorkspace());
e.printStackTrace();
System.exit(1);
}
return (workspaceURL);
}