static public List <RData> getObject(RProjectDetails details, List <String> objectNames, Boolean encodeDataFramePrimitiveAsVector, RClient client, String uri) { StringBuilder data = new StringBuilder(); //create the input String data.Append(Constants.FORMAT_JSON); data.Append("&project=" + HttpUtility.UrlEncode(details.id)); if (!(objectNames == null)) { if (objectNames.Count > 0) { data.Append("&name="); foreach (var s in objectNames) { data.Append(HttpUtility.UrlEncode(s) + ","); } data.Remove(data.Length - 1, 1); } } data.Append("&encodeDataFramePrimitiveAsVector=" + encodeDataFramePrimitiveAsVector.ToString()); //call the server JSONResponse jresponse = HTTPUtilities.callRESTGet(uri, data.ToString(), ref client); List <RData> returnValue = new List <RData>(); returnValue = JSONUtilities.parseRObjects(jresponse.JSONMarkup); return(returnValue); }
static public List <RData> listObjects(RProjectDetails details, ProjectWorkspaceOptions options, RClient client, String uri) { StringBuilder data = new StringBuilder(); //create the input String data.Append(Constants.FORMAT_JSON); data.Append("&project=" + HttpUtility.UrlEncode(details.id)); if (!(options == null)) { data.Append("&root=" + HttpUtility.UrlEncode(options.alternateRoot)); data.Append("&filter=" + HttpUtility.UrlEncode(options.startsWithFilter)); data.Append("&clazz=" + HttpUtility.UrlEncode(options.classFilter)); data.Append("&pagesize=" + options.pagesize.ToString()); data.Append("&pageoffset=" + options.pageoffset.ToString()); } //call the server JSONResponse jresponse = HTTPUtilities.callRESTGet(uri, data.ToString(), ref client); List <RData> returnValue = JSONUtilities.parseRObjects(jresponse.JSONMarkup); return(returnValue); }
static public void parseProjectExecution(JSONResponse jresponse, ref RProjectExecutionDetails executionDetails, ref RProjectDetails projectDetails, RClient client) { List <RProjectFile> projectfiles = new List <RProjectFile>(); List <RRepositoryFile> repositoryFiles = new List <RRepositoryFile>(); List <RProjectResult> results = new List <RProjectResult>(); List <String> warnings = new List <String>(); List <RData> workspaceObjects = new List <RData>(); JArray jvalues; JObject jrepo; if (!(jresponse.JSONMarkup["execution"] == null)) { JObject jscriptexec = jresponse.JSONMarkup["execution"].Value <JObject>(); String code = JSONUtilities.trimXtraQuotes(jscriptexec["code"].Value <string>()); long timeStart = jscriptexec["timeStart"].Value <long>(); long timeCode = jscriptexec["timeCode"].Value <long>(); long timeTotal = jscriptexec["timeTotal"].Value <long>(); String tag = JSONUtilities.trimXtraQuotes(jscriptexec["tag"].Value <string>()); String console = JSONUtilities.trimXtraQuotes(jscriptexec["console"].Value <string>()); String errorDescr = jresponse.ErrorMsg; int errorCode = jresponse.ErrorCode; String id = JSONUtilities.trimXtraQuotes(jscriptexec["execution"].Value <string>()); Boolean interrupted = Convert.ToBoolean(jscriptexec["interrupted"].Value <string>()); if (!(jscriptexec["results"] == null)) { jvalues = jscriptexec["results"].Value <JArray>(); foreach (var j in jvalues) { if (j.Type != JTokenType.Null) { results.Add(new RProjectResult(new JSONResponse(j.Value <JObject>(), true, "", 0), client)); } } } if (!(jscriptexec["artifacts"] == null)) { jvalues = jscriptexec["artifacts"].Value <JArray>(); foreach (var j in jvalues) { if (j.Type != JTokenType.Null) { projectfiles.Add(new RProjectFile(new JSONResponse(j.Value <JObject>(), true, "", 0), client, id)); } } } if (!(jscriptexec["warnings"] == null)) { jvalues = jscriptexec["warnings"].Value <JArray>(); foreach (var j in jvalues) { if (j.Type != JTokenType.Null) { warnings.Add(j.Value <string>()); } } } if (!(jscriptexec["repository"] == null)) { jrepo = jscriptexec["repository"].Value <JObject>(); if (!(jrepo["files"] == null)) { jvalues = jrepo["files"].Value <JArray>(); foreach (var j in jvalues) { if (j.Type != JTokenType.Null) { repositoryFiles.Add(new RRepositoryFile(new JSONResponse(j.Value <JObject>(), true, "", 0), client)); } } } } workspaceObjects = JSONUtilities.parseRObjects(jresponse.JSONMarkup); parseProject(jresponse, ref projectDetails); executionDetails = new RProjectExecutionDetails(projectfiles, code, timeStart, timeCode, timeTotal, tag, console, errorDescr, errorCode, id, interrupted, null, results, warnings, workspaceObjects); } }