public String[] ddrGetsEntry(String siteId, String vistaFile, String iens, String flds, String flags) { HttpClient client = new HttpClient(this.BaseUri); String response = client.makeRequest(String.Format("/ddrGetsEntry?siteId={0}&vistaFile={1}&iens={2}&fields={3}&flags={4}", siteId, vistaFile, iens, flds, flags)); //TextArray obj = Deserialize<TextArray>(response); //return obj.text; return(VistaDaoUtils.stripInvalidChars(StringUtils.Deserialize <String[]>(response))); }
public String[] ddrLister(String siteId, String vistaFile, String iens, String fields, String flags, String maxRex, String from, String part, String xRef, String screen, String identifier) { if (String.IsNullOrEmpty(flags)) { flags = "IP"; } if (String.IsNullOrEmpty(xRef) || String.Equals("#", xRef)) { xRef = ""; // the '#' character causes the URL to be truncated by IIS - since we control the service, we pass nothing and let the service default to '#' } HttpClient client = new HttpClient(this.BaseUri); String response = client.makeRequest(String.Format("/ddrLister?siteId={0}&vistaFile={1}&iens={2}&fields={3}&flags={4}&maxRex={5}&from={6}&part={7}&xref={8}&screen={9}&identifier={10}", siteId, vistaFile, iens, fields, flags, maxRex, from, part, xRef, screen, identifier)); String[] result = StringUtils.Deserialize <String[]>(response); return(VistaDaoUtils.stripInvalidChars(result)); }
// currently this is only being used for file 63.3 - because the results are nested and 63.3 doesn't typically contain // a lot of records in the subfile path, i'm removing all the multithreading crap since it caused an issue with the extracted data internal DataTable getVerticalResultsForQueries(VistaQuery topLevelQuery, String[] ddrResults, String parentRecordIENS) { DataTable verticalResults = DataTableUtils.generateVerticalDataTable(topLevelQuery.VistaFile, topLevelQuery.IsSubFileQuery); if (ddrResults == null || ddrResults.Length == 0) { return(verticalResults); } // build queue of queries and prepare threadsafe placeholder for results // _verticalResults = new ConcurrentDictionary<string, Dictionary<string, string>>(); Dictionary <String, Dictionary <String, String> > resultsDict = new Dictionary <String, Dictionary <String, String> >(); ConcurrentQueue <VistaQuery> verticalQueries = new ConcurrentQueue <VistaQuery>(); foreach (String ddrResult in ddrResults) { String correctedIensString = parentRecordIENS; if (!String.IsNullOrEmpty(correctedIensString)) { if (correctedIensString.StartsWith(",")) { correctedIensString = correctedIensString.Substring(1, correctedIensString.Length - 1); // remove leading comma so IENS string below is builts correctly } } correctedIensString = String.Concat(ddrResult.Split(new char[] { '^' })[0], ",", correctedIensString);// IEN from current ddr result + , + IENS string from top level query VistaQuery vq = new VistaQuery() { Fields = topLevelQuery.WP_Or_Computed_Fields, Flags = "IN", IENS = correctedIensString, SiteCode = topLevelQuery.SiteCode, VistaFile = topLevelQuery.VistaFile, // same vista file as specified in top level query }; Dictionary <String, String> result = VistaDaoUtils.toDictFromDdrGetsEntry(_dao.ddrGetsEntry(vq.SiteCode, vq.VistaFile, vq.IENS, vq.Fields, vq.Flags)); resultsDict.Add(correctedIensString, result); // verticalQueries.Enqueue(vq); // _verticalResults.TryAdd(correctedIensString, new Dictionary<string, string>()); // we'll have multiple results per IENS } // multi-thread queries //IList<Task> verticalTasks = new List<Task>(); //for (int i = 0; i < _subQueryWorkers; i++) //{ // Task workerTask = new Task(() => queryKeyValue(verticalQueries)); // verticalTasks.Add(workerTask); // workerTask.Start(); //} //foreach (Task t in verticalTasks) //{ // t.Wait(); //} // put all our results in to a single data table DateTime batchTimestamp = DateTime.Now; // we give all our Key/Val the same timestamp foreach (String key in resultsDict.Keys) { // DataTableUtils.toKeyValTableFromDdrGetsEntry only needs the subfile info, IENS, sitecode, and timestamp VistaQuery reconstructedQuery = new VistaQuery() { IENS = key, SiteCode = topLevelQuery.SiteCode, IsSubFileQuery = topLevelQuery.IsSubFileQuery }; DataTable currentBatch = DataTableUtils.toKeyValTableFromDdrGetsEntry(reconstructedQuery, resultsDict[key], batchTimestamp); DataTableUtils.addResultsToTable(verticalResults, currentBatch); } // done! return vertical/key-val datatable return(verticalResults); }