/// <summary> /// Write Configuration data in XML format to the XML Text Writer. /// </summary> /// <param name="writer">XML Text Writer</param> public override void WriteXmlConfig(XmlTextWriter writer) { writer.WriteStartElement("Hl7PeerToPeerConfiguration"); writer.WriteStartElement("FromActor"); writer.WriteStartElement("ActorName"); writer.WriteElementString("ActorType", ActorTypes.Type(FromActorName.Type)); writer.WriteElementString("ActorId", FromActorName.Id); writer.WriteEndElement(); writer.WriteElementString("AeTitle", FromActorAeTitle); writer.WriteEndElement(); writer.WriteStartElement("ToActor"); writer.WriteStartElement("ActorName"); writer.WriteElementString("ActorType", ActorTypes.Type(ToActorName.Type)); writer.WriteElementString("ActorId", ToActorName.Id); writer.WriteEndElement(); writer.WriteElementString("AeTitle", ToActorAeTitle); writer.WriteElementString("IpAddress", ToActorIpAddress); writer.WriteEndElement(); writer.WriteElementString("PortNumber", PortNumber.ToString()); writer.WriteElementString("MessageDelimiters", MessageDelimiters.ToString()); writer.WriteElementString("SecureConnection", SecureConnection.ToString()); writer.WriteElementString("AutoValidate", AutoValidate.ToString()); writer.WriteElementString("ActorOption1", ActorOption1); writer.WriteElementString("ActorOption2", ActorOption2); writer.WriteElementString("ActorOption3", ActorOption3); writer.WriteElementString("SessionId", _sessionId.ToString()); writer.WriteEndElement(); }
/// <summary> /// Write the configuration out in XML. /// </summary> /// <param name="writer">XML Text Writer.</param> public void WriteXmlConfig(XmlTextWriter writer) { writer.WriteStartElement("ActorConfiguration"); writer.WriteStartElement("ActorName"); writer.WriteElementString("ActorType", ActorTypes.Type(_actorName.Type)); writer.WriteElementString("ActorId", _actorName.Id); writer.WriteEndElement(); writer.WriteElementString("ConfigState", ActorConfigState.ConfigState(_actorConfigState)); writer.WriteEndElement(); }
/// <summary> /// Write Configuration data in XML format to the XML Text Writer. /// </summary> /// <param name="writer">XML Text Writer</param> public override void WriteXmlConfig(XmlTextWriter writer) { writer.WriteStartElement("DicomPeerToPeerConfiguration"); writer.WriteStartElement("FromActor"); writer.WriteStartElement("ActorName"); writer.WriteElementString("ActorType", ActorTypes.Type(FromActorName.Type)); writer.WriteElementString("ActorId", FromActorName.Id); writer.WriteEndElement(); writer.WriteElementString("AeTitle", FromActorAeTitle); writer.WriteEndElement(); writer.WriteStartElement("ToActor"); writer.WriteStartElement("ActorName"); writer.WriteElementString("ActorType", ActorTypes.Type(ToActorName.Type)); writer.WriteElementString("ActorId", ToActorName.Id); writer.WriteEndElement(); writer.WriteElementString("AeTitle", ToActorAeTitle); writer.WriteElementString("IpAddress", ToActorIpAddress); writer.WriteEndElement(); writer.WriteElementString("PortNumber", PortNumber.ToString()); writer.WriteElementString("SecureConnection", SecureConnection.ToString()); writer.WriteElementString("AutoValidate", AutoValidate.ToString()); writer.WriteElementString("ActorOption1", ActorOption1); writer.WriteElementString("ActorOption2", ActorOption2); writer.WriteElementString("ActorOption3", ActorOption3); writer.WriteElementString("SessionId", _sessionId.ToString()); writer.WriteElementString("SourceDataDirectory", _sourceDataDirectory); writer.WriteElementString("StoreDataDirectory", _storeDataDirectory); writer.WriteElementString("StoreData", _storeData.ToString()); writer.WriteStartElement("DefinitionFiles"); foreach (System.String defintionFilename in _definitionFiles) { writer.WriteElementString("DefinitionFile", defintionFilename); } writer.WriteEndElement(); writer.WriteEndElement(); }
/// <summary> /// Set the Comparators needed to handle each message in the Transaction. /// </summary> /// <param name="comparatorCollection">Comparator collection to fill.</param> public void SetComparators(Dvtk.Comparator.BaseComparatorCollection comparatorCollection) { if (_transaction is DicomTransaction) { System.String name = System.String.Empty; DicomTransaction dicomTransaction = (DicomTransaction)_transaction; switch (dicomTransaction.Direction) { case TransactionDirectionEnum.TransactionReceived: name = System.String.Format("Received by {0}:{1} from {2}:{3}", ActorTypes.Type(_toActorName.Type), _toActorName.Id, ActorTypes.Type(_fromActorName.Type), _fromActorName.Id); break; case TransactionDirectionEnum.TransactionSent: name = System.String.Format("Sent from {0}:{1} to {2}:{3}", ActorTypes.Type(_toActorName.Type), _toActorName.Id, ActorTypes.Type(_fromActorName.Type), _fromActorName.Id); break; default: break; } for (int i = 0; i < dicomTransaction.DicomMessages.Count; i++) { DicomMessage dicomMessage = (DicomMessage)dicomTransaction.DicomMessages[i]; DvtkHighLevelInterface.Comparator.Comparator comparator = new DvtkHighLevelInterface.Comparator.Comparator(name); Dvtk.Comparator.DicomComparator dicomComparator = comparator.InitializeDicomComparator(dicomMessage); if (dicomComparator != null) { comparatorCollection.Add(dicomComparator); } } } else if (_transaction is Hl7Transaction) { System.String name = System.String.Empty; Hl7Transaction hl7Transaction = (Hl7Transaction)_transaction; switch (hl7Transaction.Direction) { case TransactionDirectionEnum.TransactionReceived: name = System.String.Format("Received by {0}:{1} from {2}:{3}", ActorTypes.Type(_toActorName.Type), _toActorName.Id, ActorTypes.Type(_fromActorName.Type), _fromActorName.Id); break; case TransactionDirectionEnum.TransactionSent: name = System.String.Format("Sent from {0}:{1} to {2}:{3}", ActorTypes.Type(_toActorName.Type), _toActorName.Id, ActorTypes.Type(_fromActorName.Type), _fromActorName.Id); break; default: break; } Hl7Message hl7Message = hl7Transaction.Request; DvtkHighLevelInterface.Comparator.Comparator comparator = new DvtkHighLevelInterface.Comparator.Comparator(name); Dvtk.Comparator.Hl7Comparator hl7Comparator = comparator.InitializeHl7Comparator(hl7Message); if (hl7Comparator != null) { comparatorCollection.Add(hl7Comparator); } } }
/// <summary> /// Log the transaction to the given stream. /// </summary> /// <param name="sw">Stream Writer - log the transaction to this stream.</param> public void LogToStream(StreamWriter sw) { sw.WriteLine("<<- {0} -------------------------------------------------------------->>", _transactionNumber); if (_transaction is DicomTransaction) { DicomTransaction dicomTransaction = (DicomTransaction)_transaction; switch (dicomTransaction.Direction) { case TransactionDirectionEnum.TransactionSent: sw.WriteLine("DICOM Transaction received by {0}:{1}", ActorTypes.Type(_fromActorName.Type), _fromActorName.Id); sw.WriteLine("from {0}:{1}", ActorTypes.Type(_toActorName.Type), _toActorName.Id); break; case TransactionDirectionEnum.TransactionReceived: sw.WriteLine("DICOM Transaction sent from {0}:{1}", ActorTypes.Type(_fromActorName.Type), _fromActorName.Id); sw.WriteLine("to {0}:{1}", ActorTypes.Type(_toActorName.Type), _toActorName.Id); break; default: break; } sw.WriteLine("{0} errors, {1} warnings", _nrErrors, _nrWarnings); for (int i = 0; i < dicomTransaction.DicomMessages.Count; i++) { sw.WriteLine("DICOM Message {0}...", i + 1); DicomMessage dicomMessage = (DicomMessage)dicomTransaction.DicomMessages[i]; if (dicomMessage.CommandSet != null) { sw.WriteLine("Command: {0} \"{1}\"", dicomMessage.CommandSet.DimseCommandName, dicomMessage.CommandSet.GetSopClassUid()); } if (dicomMessage.DataSet != null) { sw.WriteLine("Dataset Attributes: {0}", dicomMessage.DataSet.Count); } } } else { Hl7Transaction hl7Transaction = (Hl7Transaction)_transaction; switch (hl7Transaction.Direction) { case TransactionDirectionEnum.TransactionSent: sw.WriteLine("HL7 Transaction received by {0}:{1}", ActorTypes.Type(_fromActorName.Type), _fromActorName.Id); sw.WriteLine("from {0}:{1}", ActorTypes.Type(_toActorName.Type), _toActorName.Id); break; case TransactionDirectionEnum.TransactionReceived: sw.WriteLine("HL7 Transaction sent from {0}:{1}", ActorTypes.Type(_fromActorName.Type), _fromActorName.Id); sw.WriteLine("to {0}:{1}", ActorTypes.Type(_toActorName.Type), _toActorName.Id); break; default: break; } sw.WriteLine("{0} errors, {1} warnings", _nrErrors, _nrWarnings); } sw.WriteLine("Results Filename: \"{0}\"", _resultsFilename); sw.WriteLine("Results Pathname: \"{0}\"", _resultsPathname); sw.WriteLine("<<------------------------------------------------------------------>>"); }