public TaggedPatientArrays match(string target) { TaggedPatientArrays result = new TaggedPatientArrays(); if (!mySession.ConnectionSet.IsAuthorized) { result.fault = new FaultTO("Connections not ready for operation", "Need to login?"); } else if (String.IsNullOrEmpty(target)) { result.fault = new FaultTO("Missing target"); } if (result.fault != null) { return(result); } try { PatientApi api = new PatientApi(); IndexedHashtable t = api.match(mySession.ConnectionSet, target); return(new TaggedPatientArrays(t)); } catch (Exception e) { result.fault = new FaultTO(e.Message); } return(result); }
// DON'T SEE A USERLOOKUPBYNAME FUNCTION ON USERAPI public TaggedUserArrays lookupMS(string target, string maxRex) { TaggedUserArrays result = new TaggedUserArrays(); string msg = MdwsUtils.isAuthorizedConnection(mySession); if (msg != "OK") { result.fault = new FaultTO(msg); } else if (target == "") { result.fault = new FaultTO("Missing target"); } //else if (!StringUtils.isNumeric(maxRex)) //{ // result.fault = new FaultTO("Non-numeric maxRex"); //} if (result.fault != null) { return(result); } try { KeyValuePair <string, string> kvp = new KeyValuePair <string, string>("NAME", target); UserApi api = new UserApi(); IndexedHashtable t = api.userLookup(mySession.ConnectionSet, kvp, maxRex); result = new TaggedUserArrays(t); } catch (Exception e) { result.fault = new FaultTO(e.Message); } return(result); }
public TaggedVisitArrays getMentalHealthVisits() { TaggedVisitArrays result = new TaggedVisitArrays(); if (!mySession.ConnectionSet.IsAuthorized) { result.fault = new FaultTO("Connections not ready for operation", "Need to login?"); } if (result.fault != null) { return(result); } try { EncounterApi api = new EncounterApi(); IndexedHashtable t = api.getMentalHealthVisits(mySession.ConnectionSet); return(new TaggedVisitArrays(t)); } catch (Exception e) { result.fault = new FaultTO(e); return(result); } return(null); }
public TaggedClaimArrays(IndexedHashtable t) { if (t.Count == 0) { return; } arrays = new TaggedClaimArray[t.Count]; for (int i = 0; i < t.Count; i++) { if (t.GetValue(i) == null) { arrays[i] = new TaggedClaimArray((string)t.GetKey(i)); } else if (t.GetValue(i).GetType().IsAssignableFrom(typeof(Exception))) { arrays[i] = new TaggedClaimArray((string)t.GetKey(i), (Exception)t.GetValue(i)); } else if (t.GetValue(i).GetType().IsArray) { arrays[i] = new TaggedClaimArray((string)t.GetKey(i), (Claim[])t.GetValue(i)); } else { arrays[i] = new TaggedClaimArray((string)t.GetKey(i), (Claim)t.GetValue(i)); } } count = t.Count; }
public TaggedCytologyRptArrays(IndexedHashtable t) { if (t.Count == 0) { return; } arrays = new TaggedCytologyRptArray[t.Count]; for (int i = 0; i < t.Count; i++) { if (t.GetValue(i) == null) { arrays[i] = new TaggedCytologyRptArray((string)t.GetKey(i)); } else if (MdwsUtils.isException(t.GetValue(i))) { arrays[i] = new TaggedCytologyRptArray((string)t.GetKey(i), (Exception)t.GetValue(i)); } else if (t.GetValue(i).GetType().IsArray) { arrays[i] = new TaggedCytologyRptArray((string)t.GetKey(i), (CytologyReport[])t.GetValue(i)); } else { arrays[i] = new TaggedCytologyRptArray((string)t.GetKey(i), (CytologyReport)t.GetValue(i)); } } count = t.Count; }
public TaggedFaultArray(IndexedHashtable ihs) { if (ihs == null || ihs.Count == 0) { return; } IList <TaggedFault> temp = new List <TaggedFault>(); for (int i = 0; i < ihs.Count; i++) { if (MdwsUtils.isException(ihs.GetValue(i))) { temp.Add(new TaggedFault((string)ihs.GetKey(i), (Exception)ihs.GetValue(i))); } } if (temp.Count > 0) { // we want to remove the exceptions from the hashtable because, in container objects, the constructors // for each of the property objects handle exception info. we need to keep the tag though so results collections are consistent foreach (TaggedFault tf in temp) { ihs.Remove(tf.tag); ihs.Add(tf.tag, null); } faults = new TaggedFault[temp.Count]; temp.CopyTo(faults, 0); } }
public TaggedOefOifArrays(IndexedHashtable t) { if (t.Count == 0) { return; } arrays = new TaggedOefOifArray[t.Count]; for (int i = 0; i < t.Count; i++) { if (MdwsUtils.isException(t.GetValue(i))) { fault = new FaultTO((Exception)t.GetValue(i)); } else if (t.GetValue(i) == null) { arrays[i] = new TaggedOefOifArray((string)t.GetKey(i)); } else if (t.GetValue(i).GetType().IsArray) { arrays[i] = new TaggedOefOifArray((string)t.GetKey(i), (OEF_OIF[])t.GetValue(i)); } else { arrays[i] = new TaggedOefOifArray((string)t.GetKey(i), (OEF_OIF)t.GetValue(i)); } } count = t.Count; }
public TaggedTextArray getDiscontinueReasons() { TaggedTextArray result = new TaggedTextArray(); if (MdwsUtils.isAuthorizedConnection(mySession) == "OK") { result.fault = new FaultTO("Connections not ready for operation", "Need to login?"); } if (result.fault != null) { return(result); } try { MedsApi medsApi = new MedsApi(); IndexedHashtable ht = medsApi.getDiscontinueReasons(mySession.ConnectionSet); return(new TaggedTextArray(ht)); } catch (Exception exc) { result.fault = new FaultTO(exc); } return(result); }
public TaggedIcdRptArrays getIcdSurgeryReports(string fromDate, string toDate, int nrpts) { TaggedIcdRptArrays result = new TaggedIcdRptArrays(); if (!mySession.ConnectionSet.IsAuthorized) { result.fault = new FaultTO("Connections not ready for operation", "Need to login?"); } else if (fromDate == "") { result.fault = new FaultTO("Missing fromDate"); } else if (toDate == "") { result.fault = new FaultTO("Missing toDate"); } if (result.fault != null) { return(result); } try { EncounterApi api = new EncounterApi(); IndexedHashtable t = api.getIcdSurgeryReports(mySession.ConnectionSet, fromDate, toDate, nrpts); result = new TaggedIcdRptArrays(t); } catch (Exception e) { result.fault = new FaultTO(e); } return(result); }
public TaggedInpatientStayArrays getStayMovementsByDateRange(string fromDate, string toDate) { TaggedInpatientStayArrays result = new TaggedInpatientStayArrays(); if (!mySession.ConnectionSet.IsAuthorized) { result.fault = new FaultTO("Connections not ready for operation", "Need to login?"); } else if (fromDate == "") { result.fault = new FaultTO("Missing fromDate"); } else if (toDate == "") { result.fault = new FaultTO("Missing toDate"); } if (result.fault != null) { return(result); } try { EncounterApi api = new EncounterApi(); IndexedHashtable t = api.getStayMovementsByDateRange(mySession.ConnectionSet, fromDate, toDate); result = new TaggedInpatientStayArrays(t); } catch (Exception e) { result.fault = new FaultTO(e); } return(result); }
public TaggedTextArray getCareTeamReports() { TaggedTextArray result = new TaggedTextArray(); if (!mySession.ConnectionSet.IsAuthorized) { result.fault = new FaultTO("Connections not ready for operation", "Need to login?"); } if (result.fault != null) { return(result); } try { EncounterApi api = new EncounterApi(); IndexedHashtable t = api.getCareTeamReports(mySession.ConnectionSet); result = new TaggedTextArray(t); } catch (Exception e) { result.fault = new FaultTO(e); } return(result); }
public TaggedTextArray getNoteTitles(string sitecode, string target, string direction) { TaggedTextArray result = new TaggedTextArray(); string msg = MdwsUtils.isAuthorizedConnection(_mySession, sitecode); if (msg != "OK") { result.fault = new FaultTO(msg); } if (sitecode == null) { sitecode = _mySession.ConnectionSet.BaseSiteId; } if (direction == "") { direction = "1"; } try { AbstractConnection cxn = _mySession.ConnectionSet.getConnection(sitecode); Dictionary <string, ArrayList> x = _api.getNoteTitles(cxn, target, direction); IndexedHashtable t = new IndexedHashtable(); t.Add(sitecode, x); result = new TaggedTextArray(t); } catch (Exception e) { result.fault = new FaultTO(e.Message); } return(result); }
public IndexedHashtable disconnect() { int lth = cxnTable.Count; QueryThread[] queries = new QueryThread[lth]; Thread[] threads = new Thread[lth]; for (int i = 0; i < lth; i++) { queries[i] = new QueryThread(cxnTable.GetValue(i), "disconnect", new Object[0]); threads[i] = new Thread(new ThreadStart(queries[i].execute)); threads[i].Start(); } IndexedHashtable result = new IndexedHashtable(lth); for (int i = 0; i < lth; i++) { string key = (string)cxnTable.GetKey(i); threads[i].Join(); if (queries[i].isExceptionResult()) { result.Add(key, queries[i].Result); } else { result.Add(key, "OK"); } } cxnTable.Clear(); return(result); }
public TaggedNoteArrays getNotesWithText(string fromDate, string toDate, int nNotes) { TaggedNoteArrays result = new TaggedNoteArrays(); if (!_mySession.ConnectionSet.IsAuthorized) { result.fault = new FaultTO("Connections not ready for operation", "Need to login?"); } else if (fromDate == "") { result.fault = new FaultTO("Missing fromDate"); } else if (toDate == "") { result.fault = new FaultTO("Missing toDate"); } if (result.fault != null) { return(result); } try { NoteApi api = new NoteApi(); IndexedHashtable t = api.getNotes(_mySession.ConnectionSet, fromDate, toDate, nNotes); result = new TaggedNoteArrays(t); } catch (Exception e) { result.fault = new FaultTO(e); } return(result); }
public TaggedTextArray getMedsAdminLog(string fromDate, string toDate, int nrpts) { TaggedTextArray result = new TaggedTextArray(); if (!mySession.ConnectionSet.IsAuthorized) { result.fault = new FaultTO("Connections not ready for operation", "Need to login?"); } else if (fromDate == "") { result.fault = new FaultTO("Missing fromDate"); } else if (toDate == "") { result.fault = new FaultTO("Missing toDate"); } if (result.fault != null) { return(result); } try { IndexedHashtable t = Medication.getMedsAdminLog(mySession.ConnectionSet, fromDate, toDate, nrpts); result = new TaggedTextArray(t); } catch (Exception e) { result.fault = new FaultTO(e); } return(result); }
public TaggedTextArray disconnectAll() { TaggedTextArray result = new TaggedTextArray(); if (mySession.ConnectionSet == null || mySession.ConnectionSet.Count == 0) { result.fault = new FaultTO(NO_CONNECTIONS); } if (result.fault != null) { return(result); } try { IndexedHashtable t = mySession.ConnectionSet.disconnectAll(); result = new TaggedTextArray(t); mySession.ConnectionSet.Clear(); } catch (Exception e) { result.fault = new FaultTO(e.Message); } return(result); }
public TaggedTextArray ddrListerMS( string file, string iens, string fields, string flags, string maxrex, string from, string part, string xref, string screen, string identifier) { TaggedTextArray result = new TaggedTextArray(); try { ToolsApi api = new ToolsApi(); IndexedHashtable s = api.ddrLister(mySession.ConnectionSet, file, iens, fields, flags, maxrex, from, part, xref, screen, identifier); result = new TaggedTextArray(s); } catch (Exception e) { result.fault = new FaultTO(e.Message); } return(result); }
public TaggedLabTestArrays(IndexedHashtable labTests) { if (labTests == null || labTests.Count == 0) { return; } arrays = new TaggedLabTestArray[labTests.Count]; for (int i = 0; i < labTests.Count; i++) { string tag = (string)labTests.GetKey(i); if (labTests.GetValue(i) == null) { arrays[i] = new TaggedLabTestArray(tag); } if (labTests.GetValue(i) is IList <LabTest> ) { arrays[i] = new TaggedLabTestArray(tag, (IList <LabTest>)labTests.GetValue(i)); } else if (labTests.GetValue(i) is LabTest[]) { arrays[i] = new TaggedLabTestArray(tag); } else if (labTests.GetValue(i) is LabTest) { arrays[i] = new TaggedLabTestArray(tag); } else { return; } } }
public TaggedMentalHealthInstrumentAdministrationArrays(IndexedHashtable t) { if (t.Count == 0) { return; } arrays = new TaggedMentalHealthInstrumentAdministrationArray[t.Count]; for (int i = 0; i < t.Count; i++) { if (t.GetValue(i) == null) { arrays[i] = new TaggedMentalHealthInstrumentAdministrationArray((string)t.GetKey(i)); } else if (t.GetValue(i).GetType().IsArray) { arrays[i] = new TaggedMentalHealthInstrumentAdministrationArray((string)t.GetKey(i), (MentalHealthInstrumentAdministration[])t.GetValue(i)); } else if (MdwsUtils.isException(t.GetValue(i))) { fault = new FaultTO((Exception)t.GetValue(i)); } else { arrays[i] = new TaggedMentalHealthInstrumentAdministrationArray((string)t.GetKey(i), (List <MentalHealthInstrumentAdministration>)t.GetValue(i)); } } count = t.Count; }
public TaggedHealthSummaryArray getHealthSummary(string healthSummaryId, string healthSummaryName) { TaggedHealthSummaryArray result = new TaggedHealthSummaryArray(); string msg = MdwsUtils.isAuthorizedConnection(mySession); if (msg != "OK") { result.fault = new FaultTO(msg); return(result); } if ((mySession.Patient == null) || (string.IsNullOrEmpty(mySession.Patient.LocalPid))) { result.fault = new FaultTO("Need to select a patient before calling this method."); return(result); } if (string.IsNullOrEmpty(healthSummaryId) && string.IsNullOrEmpty(healthSummaryName)) { result.fault = new FaultTO("Missing health summary Id OR health summary name. Please provide one of the parameters."); return(result); } try { IndexedHashtable hs = ClinicalApi.getHealthSummary(mySession.ConnectionSet, new MdoDocument(healthSummaryId, healthSummaryName)); result.Init(hs); } catch (Exception e) { result.fault = new FaultTO(e.Message); } return(result); }
public TaggedUserArrays getStaffByCriteria(string siteCode, string searchTerm, string firstName, string lastName, string type) { TaggedUserArrays result = new TaggedUserArrays(); if (!mySession.ConnectionSet.IsAuthorized) { result.fault = new FaultTO("Connection not established or authorized"); } else if (String.IsNullOrEmpty(type)) { result.fault = new FaultTO("Missing type of search {email, phone, firstAndLast, firstOrLast}"); } else if (String.IsNullOrEmpty(siteCode)) { result.fault = new FaultTO("Missing siteCode"); } if (result.fault != null) { return(result); } try { IndexedHashtable ht = ClinicalApi.getStaffByCriteria(mySession.ConnectionSet, siteCode, searchTerm, firstName, lastName, type); result = new TaggedUserArrays(ht); } catch (Exception e) { result.fault = new FaultTO(e); } return(result); }
public TaggedTextArray getNhinData(string types) { TaggedTextArray result = new TaggedTextArray(); if (!mySession.ConnectionSet.IsAuthorized) { result.fault = new FaultTO("Connections not ready for operation", "Need to login?"); } if (result.fault != null) { return(result); } try { IndexedHashtable t = ClinicalApi.getNhinData(mySession.ConnectionSet, types, mySession.MdwsConfiguration.AllConfigs[conf.MdwsConfigConstants.MDWS_CONFIG_SECTION][conf.MdwsConfigConstants.NHIN_TYPES]); result = new TaggedTextArray(t); } catch (Exception e) { result.fault = new FaultTO(e); } return(result); }
public TaggedTextArray getCrisisNotes(string fromDate, string toDate, int nrpts) { TaggedTextArray result = new TaggedTextArray(); string msg = MdwsUtils.isAuthorizedConnection(_mySession); if (msg != "OK") { result.fault = new FaultTO(msg); } else if (fromDate == "") { result.fault = new FaultTO("Missing fromDate"); } else if (toDate == "") { result.fault = new FaultTO("Missing toDate"); } if (result.fault != null) { return(result); } try { NoteApi api = new NoteApi(); IndexedHashtable t = api.getCrisisNotes(_mySession.ConnectionSet, fromDate, toDate, nrpts); return(new TaggedTextArray(t)); } catch (Exception e) { result.fault = new FaultTO(e); return(result); } }
public IndexedHashtable connect(AbstractCredentials credentials, AbstractPermission permission, DataSource validationDataSource) { permission.IsPrimary = true; QueryTemplate qt = new ConnectQuery(this); if (validationDataSource == null) { validationDataSource = new DataSource(); } qt.QueryMethod("AbstractConnection", "authorizedConnect", new object[] { credentials, permission, validationDataSource }); IndexedHashtable t = buildResults(); // KLUGE: This is here to make the number of connections come out right. // Note that the first element in the table will be a connection, but // the rest either User or Exception. if (HasBaseConnection && myResults.Count < myCxns.Count) { IndexedHashtable t2 = new IndexedHashtable(myCxns.Count); t2.Add(BaseConnection.DataSource.SiteId.Id, BaseConnection); for (int i = 0; i < t.Count; i++) { t2.Add(t.GetKey(i), t.GetValue(i)); } t = t2; } return(t); }
public TaggedNoteArrays getDischargeSummaries(String fromDate, String toDate, int nNotes) { TaggedNoteArrays result = new TaggedNoteArrays(); string msg = MdwsUtils.isAuthorizedConnection(_mySession); if (msg != "OK") { result.fault = new FaultTO(msg); } else if (fromDate == "") { result.fault = new FaultTO("Missing fromDate"); } else if (toDate == "") { result.fault = new FaultTO("Missing toDate"); } if (result.fault != null) { return(result); } try { NoteApi api = new NoteApi(); IndexedHashtable t = api.getDischargeSummaries(_mySession.ConnectionSet, fromDate, toDate, nNotes); result = new TaggedNoteArrays(t); } catch (Exception e) { result.fault = new FaultTO(e); } return(result); }
/// <summary> /// Use this contructor for results from the VPR so only the correct note type is built for a request. "documents" for all notes, "dischargeSummaries" for that specific note type /// </summary> /// <param name="t"></param> /// <param name="noteType"></param> public TaggedNoteArrays(IndexedHashtable t, string noteType) { if (t == null || t.Count == 0) { return; } count = t.Count; arrays = new TaggedNoteArray[t.Count]; for (int i = 0; i < t.Count; i++) { if (t.GetValue(i) == null) { arrays[i] = new TaggedNoteArray((string)t.GetKey(i)); } else if (MdwsUtils.isException(t.GetValue(i))) { arrays[i] = new TaggedNoteArray((string)t.GetKey(i), (Exception)t.GetValue(i)); } else if (t.GetValue(i).GetType() == typeof(System.Collections.Hashtable)) { if (noteType.Equals("documents")) { buildAllNotes(t, i); } else if (noteType.Equals("dischargeSummaries")) { buildDischargeSummaries(t, i); } } } }
public IndexedHashtable connect() { int lth = cxnTbl.Count; QueryThread[] queries = new QueryThread[lth]; Thread[] threads = new Thread[lth]; for (int i = 0; i < lth; i++) { queries[i] = new QueryThread(cxnTbl.GetValue(i), "connect", new Object[0]); threads[i] = new Thread(new ThreadStart(queries[i].execute)); threads[i].Start(); } IndexedHashtable result = new IndexedHashtable(lth); for (int i = 0; i < lth; i++) { string key = (string)cxnTbl.GetKey(i); threads[i].Join(); //Need to report result whether it's a connection or an exception. if (queries[i].isExceptionResult()) { result.Add(key, queries[i].Result); Connection cxn = (Connection)cxnTbl.GetValue(i); cxn.ErrorMessage = ((Exception)queries[i].Result).Message; cxn.IsConnected = false; } else { result.Add(key, ((Connection)cxnTbl.GetValue(key)).DataSource); } } return(result); }
public TaggedImagingExamArrays(IndexedHashtable ihs) { if (ihs == null || ihs.Count <= 0) { return; } this.count = ihs.Count; arrays = new TaggedImagingExamArray[ihs.Count]; for (int i = 0; i < ihs.Count; i++) { if (ihs.GetValue(i) == null) { arrays[i] = new TaggedImagingExamArray((string)ihs.GetKey(i)); } else if (MdwsUtils.isException(ihs.GetValue(i))) { arrays[i] = new TaggedImagingExamArray((string)ihs.GetKey(i), ihs.GetValue(i) as Exception); } else if (ihs.GetValue(i).GetType() == typeof(Hashtable)) { arrays[i] = new TaggedImagingExamArray((string)ihs.GetKey(i), ((Hashtable)ihs.GetValue(i))["radiologyExams"] as IList <ImagingExam>); } } }
private IndexedHashtable mergeNotesAndDischargeSummaries(IndexedHashtable tNotes, IndexedHashtable tSummaries) { if (tNotes == null) { return(tSummaries); } if (tSummaries == null) { return(tNotes); } IndexedHashtable result = new IndexedHashtable(tNotes.Count + tSummaries.Count); for (int i = 0; i < tNotes.Count; i++) { Note[] notes = (Note[])tNotes.GetValue(i); int notesLength = (notes == null ? 0 : notes.Length); string key = (string)tNotes.GetKey(i); Note[] summaries = (Note[])tSummaries.GetValue(key); int summariesLength = (summaries == null ? 0 : summaries.Length); ArrayList lst = new ArrayList(notesLength + summariesLength); for (int j = 0; j < notesLength; j++) { lst.Add(notes[j]); } for (int j = 0; j < summariesLength; j++) { lst.Add(summaries[j]); } result.Add(key, (Note[])lst.ToArray(typeof(Note))); } return(result); }
public TaggedOrderArrays getOrdersForPatient() { TaggedOrderArrays result = new TaggedOrderArrays(); if (!(MdwsUtils.isAuthorizedConnection(mySession) == "OK")) { result.fault = new FaultTO("Connections not ready for operation", "Need to login?"); } else if (mySession.Patient == null) { result.fault = new FaultTO("No patient selected", "Need to select patient"); } if (result.fault != null) { return(result); } try { IndexedHashtable t = Order.getOrdersForPatient(mySession.ConnectionSet); result = new TaggedOrderArrays(t); } catch (Exception exc) { result.fault = new FaultTO(exc); } return(result); }
public ConnectionManager(DataSource src) { this.modality = src.Modality; DaoFactory df = DaoFactory.getDaoFactory(DaoFactory.getConstant(src.Protocol)); Connection cxn = df.getConnection(src); cxnTbl = new IndexedHashtable(); addConnection(cxn); }
public static IndexedHashtable execute2(IndexedHashtable cxnTable, string daoName, string methodName, Object[] args) { if (cxnTable == null || cxnTable.Count == 0) { throw new Exception("No connections!"); } int lth = cxnTable.Count; QueryThread[] queries = new QueryThread[lth]; Thread[] threads = new Thread[lth]; for (int i = 0; i < lth; i++) { if (cxnTable.GetValue(i).GetType().IsAssignableFrom(typeof(Exception))) { continue; } Connection cxn = (Connection)cxnTable.GetValue(i); if (!cxn.IsConnected) { continue; } Object dao = ((Connection)cxnTable.GetValue(i)).getDao(daoName); if (dao == null) { continue; } queries[i] = new QueryThread(dao, methodName, args); threads[i] = new Thread(new ThreadStart(queries[i].execute)); threads[i].Start(); } IndexedHashtable result = new IndexedHashtable(cxnTable.Count); for (int i = 0; i < threads.Length; i++) { if (cxnTable.GetValue(i).GetType().IsAssignableFrom(typeof(Exception))) { result.Add((string)cxnTable.GetKey(i), (Exception)cxnTable.GetValue(i)); continue; } Connection cxn = (Connection)cxnTable.GetValue(i); if (!cxn.IsConnected) { result.Add((string)cxnTable.GetKey(i), new Exception("Source is not connected")); continue; } Object dao = ((Connection)cxnTable.GetValue(i)).getDao(daoName); if (dao == null) { result.Add((string)cxnTable.GetKey(i), new Exception("Invalid dao: " + daoName)); continue; } threads[i].Join(); result.Add((String)cxnTable.GetKey(i), queries[i].Result); } return result; }
public IndexedHashtable connect(AbstractCredentials credentials, AbstractPermission permission, DataSource validationDataSource) { permission.IsPrimary = true; QueryTemplate qt = new ConnectQuery(this); if (validationDataSource == null) { validationDataSource = new DataSource(); } qt.QueryMethod("AbstractConnection", "authorizedConnect", new object[] { credentials, permission, validationDataSource }); IndexedHashtable t = buildResults(); // KLUGE: This is here to make the number of connections come out right. // Note that the first element in the table will be a connection, but // the rest either User or Exception. if (HasBaseConnection && myResults.Count < myCxns.Count) { IndexedHashtable t2 = new IndexedHashtable(myCxns.Count); t2.Add(BaseConnection.DataSource.SiteId.Id, BaseConnection); for (int i = 0; i < t.Count; i++) { t2.Add(t.GetKey(i), t.GetValue(i)); } t = t2; } return t; }
public IndexedHashtable connect() { int lth = cxnTable.Count; QueryThread[] queries = new QueryThread[lth]; Thread[] threads = new Thread[lth]; for (int i = 0; i < lth; i++) { queries[i] = new QueryThread(cxnTable.GetValue(i), "connect", new Object[0]); //queries[i].execute(); threads[i] = new Thread(new ThreadStart(queries[i].execute)); threads[i].Start(); } IndexedHashtable result = new IndexedHashtable(lth); for (int i = 0; i < lth; i++) { string key = (string)cxnTable.GetKey(i); threads[i].Join(); //Need to report result whether it's a connection or an exception. if (queries[i].isExceptionResult()) { result.Add(key,queries[i].Result); } else { result.Add(key,((Connection)cxnTable.GetValue(key)).DataSource); } } //Now for all the results that failed to connect, we remove them from the connection table. for (int i = 0; i < lth; i++) { if (queries[i].isExceptionResult()) { string key = (string)cxnTable.GetKey(i); cxnTable.Remove(key); cxnTable.Add(key, queries[i].Result); } } return result; }
public IndexedHashtable disconnectRemoteSites() { int lth = cxnTable.Count - 1; if (lth <= 0) { return null; } QueryThread[] queries = new QueryThread[lth]; Thread[] threads = new Thread[lth]; for (int i = 0; i < lth; i++) { queries[i] = new QueryThread(cxnTable.GetValue(i+1), "disconnect", new Object[0]); threads[i] = new Thread(new ThreadStart(queries[i].execute)); threads[i].Start(); } IndexedHashtable result = new IndexedHashtable(lth); for (int i = 0; i < lth; i++) { string key = (string)cxnTable.GetKey(i + 1); threads[i].Join(); if (queries[i].isExceptionResult()) { result.Add(key, queries[i].Result); } else { result.Add(key, "OK"); } } for (int i = 0; i < result.Count; i++) { cxnTable.Remove(result.GetKey(i)); } return result; }
public IndexedHashtable execute(String daoName, String methodName, Object[] args) { int lth = cxnTable.Count; QueryThread[] queries = new QueryThread[lth]; Thread[] threads = new Thread[lth]; for (int i = 0; i < lth; i++) { if (cxnTable.GetValue(i).GetType().IsAssignableFrom(typeof(Exception))) { continue; } Object dao = ((Connection)cxnTable.GetValue(i)).getDao(daoName); queries[i] = new QueryThread(dao, methodName, args); threads[i] = new Thread(new ThreadStart(queries[i].execute)); threads[i].Start(); } IndexedHashtable result = new IndexedHashtable(cxnTable.Count); for (int i=0; i<threads.Length; i++) { if (cxnTable.GetValue(i).GetType().IsAssignableFrom(typeof(Exception))) { result.Add((string)cxnTable.GetKey(i),(Exception)cxnTable.GetValue(i)); continue; } try { threads[i].Join(); result.Add((String)cxnTable.GetKey(i), queries[i].Result); } catch (Exception) { //throw new MdoException(e); } } return result; }
public MultiSourceQuery(IndexedHashtable cxnTable) { this.cxnTable = cxnTable; }
internal IndexedHashtable toChemHemSpecimens(string[] response, ref string fromDate, ref string toDate) { IndexedHashtable result = new IndexedHashtable(response.Length); for (int i = 0; i < response.Length; i++) { string[] flds = StringUtils.split(response[i], StringUtils.CARET); LabSpecimen specimen = new LabSpecimen(); specimen.Id = flds[0]; specimen.ReportDate = VistaTimestamp.toUtcString(flds[2]); specimen.CollectionDate = VistaTimestamp.toUtcString(flds[1]); if (i == 0) { fromDate = specimen.CollectionDate; } if (i == response.Length-1) { toDate = specimen.CollectionDate; } specimen.Name = flds[3]; specimen.AccessionNumber = flds[4]; if (flds.Length > 6) { specimen.Site = flds[5]; } if (flds.Length > 7) { specimen.Facility = new SiteId(flds[7], flds[6]); } string key = flds[1] + '^' + flds[4]; result.Add(key, specimen); } return result; }
internal IndexedHashtable buildResults() { IndexedHashtable result = new IndexedHashtable(); if (myResults != null) { for (int i = 0; i < myResults.Count; i++) { result.Add(myResults.GetKey(i), myResults.GetValue(i)); } } if (myExceptions != null) { for (int i = 0; i < myExceptions.Count; i++) { result.Add(myExceptions.GetKey(i), myExceptions.GetValue(i)); } } return result; }
internal IndexedHashtable toUniqueCheckinIds(string[] response) { if (response == null || response.Length == 0) { return null; } IndexedHashtable t = new IndexedHashtable(response.Length); for (int i = 0; i < response.Length; i++) { if (String.IsNullOrEmpty(response[i])) { continue; // per http://trac.medora.va.gov/web/ticket/2713 - found a blank record in a test site. can't do anything with stay since can't locate checkin id } if (t.ContainsKey(response[i])) { continue; } t.Add(response[i], null); } return t; }
public IndexedHashtable disconnect() { if (cxnTbl.Count == 0) { throw new Exception("No connections"); } // Only disconnect from the ones that are connected IndexedHashtable myCxns = getConnections(); int lth = myCxns.Count; QueryThread[] queries = new QueryThread[lth]; Thread[] threads = new Thread[lth]; for (int i = 0; i < lth; i++) { queries[i] = new QueryThread(myCxns.GetValue(i), "disconnect", new Object[0]); threads[i] = new Thread(new ThreadStart(queries[i].execute)); threads[i].Start(); } IndexedHashtable result = new IndexedHashtable(lth); for (int i = 0; i < lth; i++) { string key = (string)myCxns.GetKey(i); threads[i].Join(); if (queries[i].isExceptionResult()) { result.Add(key, queries[i].Result); } else { result.Add(key, "OK"); } } // We only disconnected from connected connections, but we want to clear // the entire table cxnTbl = new IndexedHashtable(); return result; }
IndexedHashtable getConnections() { IndexedHashtable result = new IndexedHashtable(); for (int i = 0; i < cxnTbl.Count; i++) { Connection cxn = (Connection)cxnTbl.GetValue(i); if (cxn.IsConnected) { result.Add(cxn.SiteId.Key, cxn); } } if (result.Count == 0) { return null; } return result; }
public ConnectionManager(Connection cxn) { this.modality = cxn.DataSource.Modality; cxnTbl = new IndexedHashtable(); addConnection(cxn); }
internal IndexedHashtable toOrderHashtable(string response) { if (StringUtils.isEmpty(response)) { return null; } string[] lines = StringUtils.split(response, StringUtils.CRLF); IndexedHashtable t = new IndexedHashtable(lines.Length - 1); for (int i = 1; i < lines.Length; i++) { if (StringUtils.isEmpty(lines[i])) { continue; } string[] flds = StringUtils.split(lines[i], StringUtils.CARET); Order order = new Order(); order.Id = flds[0]; order.Timestamp = VistaTimestamp.toDateTime(flds[2]); t.Add(order.Id, order); } return t; }
public ConnectionManager(string modality) { this.modality = modality; cxnTbl = new IndexedHashtable(); }
// From CPRS: //{ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 //{ Pieces: ~IFN^Grp^ActTm^StrtTm^StopTm^Sts^Sig^Nrs^Clk^PrvID^PrvNam^ActDA^Flag^DCType^ChrtRev^DEA#^VA#^DigSig} internal Order[] completeOrders(IndexedHashtable t, string response) { if (StringUtils.isEmpty(response)) { return new Order[0]; } Dictionary<string, OrderType> orderTypes = getOrderTypes(); string[] lines = StringUtils.split(response, StringUtils.CRLF); ArrayList lst = new ArrayList(); lines = StringUtils.trimArray(lines); Order currentOrder = null; for (int lineIdx = 0; lineIdx < lines.Length; lineIdx++) { if (String.IsNullOrEmpty(lines[lineIdx])) { continue; } if (lines[lineIdx].StartsWith("~")) { if (currentOrder != null) { lst.Add(currentOrder); } currentOrder = new Order(); string[] flds = StringUtils.split(lines[lineIdx], StringUtils.CARET); if (flds == null || flds.Length < 15) { continue; // TBD - should throw exception? data not in expected format } currentOrder.Id = flds[0].Substring(1); if(orderTypes.ContainsKey(flds[1])) { currentOrder.Type = orderTypes[flds[1]]; } currentOrder.Timestamp = VistaTimestamp.toDateTime(flds[2]); currentOrder.StartDate = VistaTimestamp.toDateTime(flds[3]); if (flds[4] != "") { currentOrder.StopDate = VistaTimestamp.toDateTime(flds[4]); } currentOrder.Status = decodeOrderStatus(flds[5]); currentOrder.SigStatus = decodeSignatureStatus(flds[6]); currentOrder.VerifyingNurse = flds[7]; currentOrder.VerifyingClerk = flds[8]; currentOrder.Provider = new User(); currentOrder.Provider.Uid = flds[9]; currentOrder.Provider.Name = new PersonName(flds[10]); currentOrder.Flag = flds[12] == "1"; currentOrder.ChartReviewer = flds[14]; if (flds.Length > 17) { //currentOrder. } } else if (lines[lineIdx].StartsWith("t")) { currentOrder.Text += (lines[lineIdx].Substring(1) + StringUtils.CRLF); } } if (currentOrder != null) { lst.Add(currentOrder); } return (Order[])lst.ToArray(typeof(Order)); }
public IndexedHashtable disconnectRemoteSites() { if (cxnTbl.Count < 2) { throw new Exception("No remote connections"); } // Only disconnect from the ones that are connected IndexedHashtable myCxns = getConnections(); int lth = myCxns.Count - 1; QueryThread[] queries = new QueryThread[lth]; Thread[] threads = new Thread[lth]; for (int threadIdx = 0, cxnIdx = 1; threadIdx < lth; threadIdx++, cxnIdx++) { queries[threadIdx] = new QueryThread(myCxns.GetValue(cxnIdx), "disconnect", new Object[0]); threads[threadIdx] = new Thread(new ThreadStart(queries[threadIdx].execute)); threads[threadIdx].Start(); } IndexedHashtable result = new IndexedHashtable(lth); for (int threadIdx = 0, cxnIdx = 1; threadIdx < lth; threadIdx++, cxnIdx++) { string key = (string)myCxns.GetKey(cxnIdx); threads[threadIdx].Join(); if (queries[threadIdx].isExceptionResult()) { result.Add(key, queries[threadIdx].Result); } else { result.Add(key, "OK"); } } // Now remove all but the logon connection from the table Connection loginCxn = LoginConnection; cxnTbl = new IndexedHashtable(); cxnTbl.Add(loginCxn.SiteId.Key, loginCxn); return result; }
internal MdoQuery buildGetOrdersRequest(IndexedHashtable t) { VistaQuery vq = new VistaQuery("ORWORR GET4LST"); vq.addParameter(vq.LITERAL, "2"); vq.addParameter(vq.LITERAL, VistaTimestamp.fromDateTime(DateTime.Now)); DictionaryHashList lst = new DictionaryHashList(); for (int i = 0; i < t.Count; i++) { lst.Add(Convert.ToString(i + 1), ((Order)t.GetValue(i)).Id); } vq.addParameter(vq.LIST, lst); return vq; }
public void addConnections(IndexedHashtable t) { for (int i = 0; i < t.Count; i++) { Connection cxn = (Connection)t.GetValue(i); addConnection(cxn); } }
public void addConnection(Connection cxn) { if (cxnTbl == null) { cxnTbl = new IndexedHashtable(); this.modality = cxn.DataSource.Modality; } checkModality(cxn); if (!cxnTbl.ContainsKey(cxn.DataSource.SiteId.Id)) { cxnTbl.Add(cxn.SiteId.Key,cxn); } }
public IndexedHashtable connect() { int lth = cxnTbl.Count; QueryThread[] queries = new QueryThread[lth]; Thread[] threads = new Thread[lth]; for (int i = 0; i < lth; i++) { queries[i] = new QueryThread(cxnTbl.GetValue(i), "connect", new Object[0]); threads[i] = new Thread(new ThreadStart(queries[i].execute)); threads[i].Start(); } IndexedHashtable result = new IndexedHashtable(lth); for (int i = 0; i < lth; i++) { string key = (string)cxnTbl.GetKey(i); threads[i].Join(); //Need to report result whether it's a connection or an exception. if (queries[i].isExceptionResult()) { result.Add(key, queries[i].Result); Connection cxn = (Connection)cxnTbl.GetValue(i); cxn.ErrorMessage = ((Exception)queries[i].Result).Message; cxn.IsConnected = false; } else { result.Add(key, ((Connection)cxnTbl.GetValue(key)).DataSource); } } return result; }