public void Dispose() { if (_real == null) return; _real.Dispose(); _real = null; }
public void Dispose() { if (_real == null) { return; } _real.Dispose(); _real = null; }
public WcfStudyRootQuery( ) { var ae = new ApplicationEntity { AETitle = "UIHPACSSERVER", ScpParameters = new ScpParameters("localhost", 3333) }; _remoteServer = ae; _real = new DicomStudyRootQuery("lrf", _remoteServer); }
public RemoteStudyRootQuery(IApplicationEntity remoteServer) { _remoteServer = remoteServer; _real = new DicomStudyRootQuery(DicomServer.DicomServer.AETitle, remoteServer); }
public RemoteStudyRootQuery(IApplicationEntity remoteServer) { _remoteServer = remoteServer; _real = new DicomStudyRootQuery("lrf", remoteServer); }
public override PriorStudyFinderResult FindPriorStudies() { _cancel = false; var priorsServerQueries = new List <IStudyRootQuery>(); foreach (ServerPartition partition in ServerPartitionMonitor.Instance) { using (IReadContext ctx = PersistentStoreRegistry.GetDefaultStore().OpenReadContext()) { IDeviceEntityBroker broker = ctx.GetBroker <IDeviceEntityBroker>(); DeviceSelectCriteria criteria = new DeviceSelectCriteria(); criteria.DeviceTypeEnum.EqualTo(DeviceTypeEnum.PriorsServer); criteria.ServerPartitionKey.EqualTo(partition.Key); IList <Device> list = broker.Find(criteria); foreach (Device theDevice in list) { // Check the settings and log for debug purposes if (!theDevice.Enabled) { Platform.Log(LogLevel.Debug, "Prior Server '{0}' on partition '{1}' is disabled in the device setting", theDevice.AeTitle, partition.AeTitle); continue; } DicomStudyRootQuery remoteQuery = new DicomStudyRootQuery(partition.AeTitle, theDevice.AeTitle, theDevice.IpAddress, theDevice.Port); priorsServerQueries.Add(remoteQuery); } } } // Log the prior servers for debug purpose if (Platform.IsLogLevelEnabled(LogLevel.Debug) && priorsServerQueries.Count > 0) { StringBuilder log = new StringBuilder(); log.Append("Searching for priors on the following servers:"); StringBuilder serverList = new StringBuilder(); foreach (DicomStudyRootQuery server in priorsServerQueries) { if (serverList.Length > 0) { serverList.Append(","); } serverList.AppendFormat("{0}", server); } log.Append(serverList.ToString()); Platform.Log(LogLevel.Debug, log.ToString()); } StudyItemList results = new StudyItemList(); DefaultPatientReconciliationStrategy reconciliationStrategy = new DefaultPatientReconciliationStrategy(); List <string> patientIds = new List <string>(); foreach (Patient patient in Viewer.StudyTree.Patients) { if (_cancel) { break; } IPatientData reconciled = reconciliationStrategy.ReconcileSearchCriteria(patient); if (!patientIds.Contains(reconciled.PatientId)) { patientIds.Add(reconciled.PatientId); } } //Note: we don't catch the exception for this one because it's just querying the other //partitions, so if it fails we want an outright failure to occur. Besides, it should never happen //if the server is functioning correctly. using (StudyRootQueryBridge bridge = new StudyRootQueryBridge(Platform.GetService <IStudyRootQuery>())) { foreach (string patientId in patientIds) { StudyRootStudyIdentifier identifier = new StudyRootStudyIdentifier { PatientId = patientId }; IList <StudyRootStudyIdentifier> studies = bridge.StudyQuery(identifier); foreach (StudyRootStudyIdentifier study in studies) { if (_cancel) { break; } StudyItem studyItem = ConvertToStudyItem(study); if (studyItem != null) { results.Add(studyItem); } } } } bool complete = true; foreach (IStudyRootQuery query in priorsServerQueries) { foreach (string patientId in patientIds) { try { var identifier = new StudyRootStudyIdentifier { PatientId = patientId }; IList <StudyRootStudyIdentifier> list = query.StudyQuery(identifier); foreach (StudyRootStudyIdentifier i in list) { if (_cancel) { break; } StudyItem studyItem = ConvertToStudyItem(i); if (studyItem != null) { results.Add(studyItem); } } } catch (FaultException <DataValidationFault> ex) { complete = false; Platform.Log(LogLevel.Error, ex, "An error has occurred when searching for prior studies on server '{0}'", query.ToString()); } catch (FaultException <QueryFailedFault> ex) { complete = false; Platform.Log(LogLevel.Error, ex, "An error has occurred when searching for prior studies on server '{0}'", query.ToString()); } } } return(new PriorStudyFinderResult(results, complete)); }