/// <summary> /// Graph this object to the specified stream /// </summary> public void Graph(System.Xml.XmlWriter s, object o, DatatypeFormatterGraphResult result) { ENFormatter formatter = new ENFormatter() { Host = this.Host }; // Validate and remove any incriminating data ON instance = o as ON; for (int i = instance.Part.Count - 1; i >= 0; i--) { if (instance.Part[i].Type == EntityNamePartType.Family || instance.Part[i].Type == EntityNamePartType.Given) { result.AddResultDetail(new VocabularyIssueResultDetail(ResultDetailType.Warning, String.Format("Part name '{0}' in ON instance will be removed. ON Parts cannot have FAM or GIV parts", instance.Part[i]), s.ToString(), null)); instance.Part.RemoveAt(i); } } formatter.Graph(s, o, result); }
/// <summary> /// Graphs the object <paramref name="o"/> onto the stream. /// </summary> /// <param name="s">The XmlWriter stream to write to.</param> /// <param name="o">The object to graph.</param> public override void Graph(System.Xml.XmlWriter s, object o, DatatypeFormatterGraphResult result) { TN tn = (TN)o; base.Graph(s, o, result); if (tn.Part.Count > 0 && tn.NullFlavor == null) { s.WriteString(tn.Part[0].Value); } if (tn.Part.Count > 1) { result.AddResultDetail(new InsufficientRepetitionsResultDetail(ResultDetailType.Warning, "TN is only permitted to have one part", s.ToString())); } }
protected override bool SerializeElement( System.Xml.XmlWriter writer, bool serializeCollectionKey) { bool ret = base.SerializeElement(writer, serializeCollectionKey); // Enter your custom processing code here. if (_displayIt) { Console.WriteLine( "AccountPointNoticeMailEntity.SerializeElement({0}, {1}) called = {2}", (writer == null) ? "null" : writer.ToString(), serializeCollectionKey.ToString(), ret.ToString()); } return(ret); }
/// <summary> /// Graph this object to the specified stream /// </summary> public override void Graph(System.Xml.XmlWriter s, object o, DatatypeFormatterGraphResult result) { // Validate and remove any incriminating data ON instance = o as ON; instance = new ON(instance.Use, instance.Part); instance.NullFlavor = (o as IAny).NullFlavor; instance.Flavor = (o as IAny).Flavor; for (int i = instance.Part.Count - 1; i >= 0; i--) { if (instance.Part[i].Type == EntityNamePartType.Family || instance.Part[i].Type == EntityNamePartType.Given) { result.AddResultDetail(new VocabularyIssueResultDetail(ResultDetailType.Warning, String.Format("Part name '{0}' in ON instance will be removed. ON Parts cannot have FAM or GIV parts", instance.Part[i]), s.ToString(), null)); instance.Part.RemoveAt(i); } } base.Graph(s, instance, result); }
/// <summary> /// Graph to the stream /// </summary> public override void Graph(System.Xml.XmlWriter s, object o, DatatypeFormatterGraphResult result) { result.AddResultDetail(new NotImplementedResultDetail(ResultDetailType.Warning, String.Format("{0} cannot be graphed by the R1 formatter directly, processing as SXPR", this.HandlesType), s.ToString(), null)); // Convert o as SXPR base.Graph(s, o.GetType().GetMethod("TranslateToSXPR").Invoke(o, null), result); }
/// <summary> /// Grap the object to a stream /// </summary> public override void Graph(System.Xml.XmlWriter s, object o, DatatypeFormatterGraphResult result) { ADXP instance = o as ADXP; // Start with part type and code attributes base.Graph(s, o, result); if (instance == null || instance.NullFlavor != null) { return; } // Now format our data if (instance.Type != null && result.CompatibilityMode != DatatypeFormatterCompatibilityMode.ClinicalDocumentArchitecture) { s.WriteAttributeString("partType", Util.ToWireFormat(instance.Type)); } if (instance.Code != null) { if (result.CompatibilityMode == DatatypeFormatterCompatibilityMode.Canadian) { s.WriteAttributeString("code", instance.Code); } else { result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "Code", "ADXP", s.ToString())); } } if (instance.Value != null) { s.WriteValue(instance.Value); } if (instance.CodeSystem != null) // Warn if there is no way to represent this in R1 { result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "CodeSystem", "ADXP", s.ToString())); } if (instance.CodeSystemVersion != null) { result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "CodeSystemVersion", "ADXP", s.ToString())); } }
public override void Graph(System.Xml.XmlWriter s, object o, DatatypeFormatterGraphResult result) { // Represent the ST as an ED and serialize the ED base.Graph(s, o, result); ST instance = o as ST; // Get rid of these attributes if (result.CompatibilityMode != DatatypeFormatterCompatibilityMode.ClinicalDocumentArchitecture) { // In R1 data types an ST is a restriction of an ED with these attributes fixed s.WriteAttributeString("mediaType", "text/plain"); s.WriteAttributeString("representation", "TXT"); } // Language if (instance.Language != null) { s.WriteAttributeString("language", instance.Language); } // Content s.WriteString(instance.Value); // Translation if (instance.Translation != null) { result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "Translation", "ST", s.ToString())); } }
/// <summary> /// Graph <paramref name="o"/> onto <paramref name="s"/> /// </summary> /// <param name="s">The stream to graph to</param> /// <param name="o">The object to graph</param> public override void Graph(System.Xml.XmlWriter s, object o, DatatypeFormatterGraphResult result) { var instance = o as INT; base.Graph(s, instance, result); // Unsupported properties if (instance.Expression != null) { result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "Expression", "INT", s.ToString())); } if (instance.OriginalText != null) { result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "OriginalText", "INT", s.ToString())); } if (instance.Uncertainty != null) { result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "Uncertainty", "INT", s.ToString())); } if (instance.UncertaintyType != null) { result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "UncertaintyType", "INT", s.ToString())); } if (instance.UncertainRange != null) { result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "UncertaintyRange", "INT", s.ToString())); } }
public override void Graph(System.Xml.XmlWriter s, object o, DatatypeFormatterGraphResult result) { CO instance = (o as ANY).Clone() as CO; // We'll be modifying data instance.Code = (instance.Code ?? new CD <String>()).Clone() as CD <String>; // First, is the instance null? if (instance == null) { return; } else if (instance.IsNull) { if (instance.Code == null) { instance.Code = new CD <string>(); } else if (instance.Code.IsNull) { result.AddResultDetail(new ResultDetail(ResultDetailType.Warning, "NullFlavor from CO instance will overwrite NullFlavor from Code Property", s.ToString(), null)); } instance.Code.NullFlavor = instance.NullFlavor; } else if (instance.Flavor != null) { if (instance.Code == null) { instance.Code = new CD <string>(); } else if (instance.Code.Flavor != null) { result.AddResultDetail(new ResultDetail(ResultDetailType.Warning, "Flavor from CO instance will overwrite Flavor from Code Property", s.ToString(), null)); } instance.Code.Flavor = instance.Flavor; } // Graph base.Graph(s, instance.Code, result); // Append details if (instance.Value != null) { result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "Value", "CO", s.ToString())); } if (instance.Code != null && instance.Code.Qualifier != null) { result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "Code.Qualifier", "CO", s.ToString())); } if (instance.Code != null && instance.Code.Translation != null) { result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "Code.Translation", "CO", s.ToString())); } }
/// <summary> /// Graph the object <paramref name="o"/> onto stream <paramref name="s"/> /// </summary> /// <param name="s">The XmlWriter to graph object to</param> /// <param name="o">The object to graph</param> public override void Graph(System.Xml.XmlWriter s, object o, DatatypeFormatterGraphResult result) { // Get an instance ref TEL instance_tel = (TEL)o; // Do a base format base.Graph(s, o, result); // Null flavor if (((ANY)o).NullFlavor != null) { return; } // Attributes if (instance_tel.Value != null) { s.WriteAttributeString("value", instance_tel.Value); } if (instance_tel.Use != null && instance_tel.Use.Items != null && instance_tel.Use.Items.Count > 0) { s.WriteAttributeString("use", Util.ToWireFormat(instance_tel.Use)); } if (instance_tel.Capabilities != null) { result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail( ResultDetailType.Warning, "Capabilities", "TEL", s.ToString())); } // Elements if (instance_tel.UseablePeriod != null) { s.WriteStartElement("useablePeriod", "urn:hl7-org:v3"); GTSFormatter formatterHelper = new GTSFormatter(); formatterHelper.Host = this.Host; formatterHelper.Graph(s, instance_tel.UseablePeriod, result); s.WriteEndElement(); // usable period } }
/// <summary> /// Graph the object <paramref name="o"/> onto <paramref name="s"/> /// </summary> public void Graph(System.Xml.XmlWriter s, object o, DatatypeR2FormatterGraphResult result) { // Cast the object to GTS GTS instance = o as GTS; // Hull instance corrections if (instance.Hull != null) { if (instance.NullFlavor != null) { instance.Hull.NullFlavor = instance.Hull.NullFlavor ?? instance.NullFlavor; result.AddResultDetail(new PropertyValuePropagatedResultDetail(ResultDetailType.Warning, "NullFlavor", "Hull.NullFlavor", instance.Hull.NullFlavor, s.ToString())); } if (instance.Flavor != null) { instance.Hull.Flavor = instance.Hull.Flavor ?? instance.Flavor; result.AddResultDetail(new PropertyValuePropagatedResultDetail(ResultDetailType.Warning, "Flavor", "Hull.Flavor", instance.Hull.Flavor, s.ToString())); } } else { result.AddResultDetail(new ResultDetail(ResultDetailType.Error, "Cannot graph a GTS instance with a null Hull", s.ToString())); return; } // Map QSET/SXPR/SXCM object instanceHull = instance.Hull; if (instanceHull is SXPR <TS> ) { instanceHull = (instanceHull as SXPR <TS>).TranslateToQSET(); } // Emit the type name string xsiTypeName = Util.CreateXSITypeName(instanceHull.GetType()); s.WriteAttributeString("xsi", "type", DatatypeR2Formatter.NS_XSI, xsiTypeName); // Host results var hostResult = this.Host.Graph(s, (IGraphable)instanceHull); result.Code = hostResult.Code; result.AddResultDetail(hostResult.Details); }
/// <summary> /// Graph object <paramref name="o"/> onto stream <paramref name="s"/> /// </summary> /// <param name="s">The stream</param> /// <param name="o">The object</param> public override void Graph(System.Xml.XmlWriter s, object o, DatatypeFormatterGraphResult result) { // When graphing an NPPD, we're actually graphing a set of UVP, for example // NPPD<INT> is really SET<UVP<INT>> // This is why we do the formatting in such an odd way result.AddResultDetail(new MARC.Everest.Connectors.NotImplementedResultDetail(Connectors.ResultDetailType.Warning, "The NPPD type is not an official R1 data type, the data has been graphed but may not be interpreted by remote systems", s.ToString())); SETFormatter formatter = new SETFormatter(); formatter.Host = this.Host; // Create new generic arguments var uvpType = typeof(UVP <>); var genType = uvpType.MakeGenericType(GenericArguments); formatter.GenericArguments = new Type[] { genType }; formatter.Graph(s, o, result); }
/// <summary> /// Graph the object <paramref name="o"/> onto stream <paramref name="s"/> /// </summary> /// <param name="s">The XmlWriter to graph object to</param> /// <param name="o">The object to graph</param> public void Graph(System.Xml.XmlWriter s, object o, DatatypeFormatterGraphResult result) { // Get an instance ref TEL instance_tel = (TEL)o; // Do a base format ANYFormatter baseFormatter = new ANYFormatter(); baseFormatter.Graph(s, o, result); // Null flavor if (((ANY)o).NullFlavor != null) { return; } // Attributes if (instance_tel.Value != null) { s.WriteAttributeString("value", instance_tel.Value); } if (instance_tel.Use != null && instance_tel.Use.Items != null && instance_tel.Use.Items.Count > 0) { s.WriteAttributeString("use", Util.ToWireFormat(instance_tel.Use)); } if (instance_tel.Capabilities != null) { result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail( ResultDetailType.Warning, "Capabilities", "TEL", s.ToString())); } // Elements if (instance_tel.UseablePeriod != null) { s.WriteStartElement("useablePeriod", "urn:hl7-org:v3"); GTSFormatter formatterHelper = new GTSFormatter(); formatterHelper.Host = this.Host; formatterHelper.Graph(s, instance_tel.UseablePeriod, result); s.WriteEndElement(); // usable period } //foreach (SXCM<TS> up in instance_tel.UseablePeriod) //{ // // Start element // s.WriteStartElement("useablePeriod", "urn:hl7-org:v3"); // // Attributes for SXCM // if(up.Operator != null) // s.WriteAttributeString("operator", Util.ToWireFormat(up.Operator)); // // Timestamp portion // TSFormatter tsFormatter = new TSFormatter(); // tsFormatter.Graph(s, (TS)up, result); // s.WriteEndElement(); // end usablePeriod //} }
public void Graph(System.Xml.XmlWriter s, object o, DatatypeFormatterGraphResult result) { ANY instance = o as ANY; XmlStateWriter stw = s as XmlStateWriter; // Now render if (instance == null) { throw new InvalidOperationException("Could not cast object to the ANY data type"); } else if (instance.NullFlavor != null) { s.WriteAttributeString("nullFlavor", Util.ToWireFormat(instance.NullFlavor)); } else if (instance.Flavor != null) { if (result.CompatibilityMode == DatatypeFormatterCompatibilityMode.Canadian) { s.WriteAttributeString("specializationType", instance.Flavor); } else { result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "Flavor", "ANY", s.ToString())); } } string currentElementName = ""; if (s is MARC.Everest.Xml.XmlStateWriter) { currentElementName = (s as MARC.Everest.Xml.XmlStateWriter).CurrentPath; } // Validate if (result.ValidateConformance && !instance.Validate()) { result.AddResultDetail(new DatatypeValidationResultDetail(ResultDetailType.Error, o.GetType().Name, currentElementName)); } // Disabled for test // Validate flavor... IResultDetail[] flavor; if (instance.Flavor != null && result.ValidateConformance && Util.ValidateFlavor(instance.Flavor.ToUpper(), instance, out flavor) == false) { result.AddResultDetail(new DatatypeFlavorValidationResultDetail(ResultDetailType.Warning, instance.GetType().Name, instance.Flavor, currentElementName)); result.AddResultDetail(flavor); } // Warn if items can't be represented in R1 if (instance.ControlActExt != null) { result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "ControlActExt", "ANY", currentElementName)); } if (instance.ControlActRoot != null) { result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "ControlActRoot", "ANY", currentElementName)); } if (instance.ValidTimeHigh != null) { result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "ValidTimeHigh", "ANY", currentElementName)); } if (instance.ValidTimeLow != null) { result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "ValidTimeLow", "ANY", currentElementName)); } if (instance.UpdateMode != null) { result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "UpdateMode", "ANY", currentElementName)); } }
/// <summary> /// Graph <paramref name="o"/> onto <paramref name="s"/> /// </summary> /// <param name="s">The stream to graph to</param> /// <param name="o">The object to graph</param> public override void Graph(System.Xml.XmlWriter s, object o, DatatypeFormatterGraphResult result) { // We don't use base.graph() here because we want to control the value property ANYFormatter baseFormatter = new ANYFormatter(); baseFormatter.Graph(s, o, result); REAL instance = o as REAL; if (instance.NullFlavor != null) { return; // Don't graph anymore } // Precision if (instance.Value.HasValue && instance.Precision != 0) { s.WriteAttributeString("value", instance.Value.Value.ToString(String.Format("0.{0}", new String('0', instance.Precision), DatatypeFormatter.FormatterCulture.NumberFormat.NumberDecimalSeparator), DatatypeFormatter.FormatterCulture)); } else if (instance.Value.HasValue) { s.WriteAttributeString("value", instance.Value.Value.ToString(DatatypeFormatter.FormatterCulture)); } // Unsupported properties if (instance.Expression != null) { result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "Expression", "REAL", s.ToString())); } if (instance.OriginalText != null) { result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "OriginalText", "REAL", s.ToString())); } if (instance.Uncertainty != null) { result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "Uncertainty", "REAL", s.ToString())); } if (instance.UncertaintyType != null) { result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "UncertaintyType", "REAL", s.ToString())); } if (instance.UncertainRange != null) { result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "UncertainRange", "REAL", s.ToString())); } }
/// <summary> /// Graph the object <paramref name="o"/> onto stream <paramref name="s"/> /// </summary> /// <param name="s">The XmlWriter to write the object to</param> /// <param name="o">The object to graph</param> public void Graph(System.Xml.XmlWriter s, object o, DatatypeFormatterGraphResult result) { // Get an instance ref ED instance_ed = (ED)o; // Do a base format ANYFormatter baseFormatter = new ANYFormatter(); baseFormatter.Graph(s, o, result); // Null flavor if (((ANY)o).NullFlavor != null) { return; } // Attributes s.WriteAttributeString("representation", Util.ToWireFormat(instance_ed.Representation)); if (instance_ed.MediaType != null) { s.WriteAttributeString("mediaType", Util.ToWireFormat(instance_ed.MediaType)); } if (instance_ed.Language != null) { s.WriteAttributeString("language", instance_ed.Language); } if (instance_ed.Compression != null) { s.WriteAttributeString("compression", Util.ToWireFormat(instance_ed.Compression)); } if (instance_ed.IntegrityCheck != null) { s.WriteAttributeString("integrityCheck", Convert.ToBase64String(instance_ed.IntegrityCheck)); } if (instance_ed.Description != null) { result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "Description", "ED", s.ToString())); } if (instance_ed.IntegrityCheckAlgorithm != null) { // Incorrect representation of the SHA1 and SHA256 names in r1 switch ((EncapsulatedDataIntegrityAlgorithm)instance_ed.IntegrityCheckAlgorithm) { case EncapsulatedDataIntegrityAlgorithm.SHA1: s.WriteAttributeString("integrityCheckAlgorithm", "SHA-1"); break; case EncapsulatedDataIntegrityAlgorithm.SHA256: s.WriteAttributeString("integrityCheckAlgorithm", "SHA-256"); break; } } // Elements if (instance_ed.Reference != null) { TELFormatter refFormatter = new TELFormatter(); s.WriteStartElement("reference", "urn:hl7-org:v3"); refFormatter.Graph(s, instance_ed.Reference, result); s.WriteEndElement(); } if (instance_ed.Thumbnail != null) { EDFormatter thumbFormatter = new EDFormatter(); s.WriteStartElement("thumbnail", "urn:hl7-org:v3"); thumbFormatter.Graph(s, instance_ed.Thumbnail, result); s.WriteEndElement(); } if (instance_ed.Translation != null) { result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "Translation", "ED", s.ToString())); } Encoding textEncoding = System.Text.Encoding.UTF8; // Value if (instance_ed.Data != null && instance_ed.Data.Length > 0) { if (instance_ed.Representation == EncapsulatedDataRepresentation.B64) { s.WriteBase64(instance_ed.Data, 0, instance_ed.Data.Length); } else if (instance_ed.Representation == EncapsulatedDataRepresentation.TXT) { s.WriteString(textEncoding.GetString(instance_ed.Data)); } else { char[] charBuffer = textEncoding.GetChars(instance_ed.Data); s.WriteRaw(charBuffer, 0, charBuffer.Length); } } }
public void Graph(System.Xml.XmlWriter s, object o, DatatypeFormatterGraphResult result) { ANYFormatter baseFormatter = new ANYFormatter(); baseFormatter.Graph(s, o, result); MO instance = o as MO; if (instance.NullFlavor != null) { return; // Don't graph anymore } if (instance.Expression != null) { result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "Expression", "PQ", s.ToString())); } if (instance.OriginalText != null) { result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "OriginalText", "PQ", s.ToString())); } if (instance.Uncertainty != null) { result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "Uncertainty", "PQ", s.ToString())); } if (instance.UncertaintyType != null) { result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "UncertaintyType", "PQ", s.ToString())); } if (instance.UncertainRange != null) { result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "UncertainRange", "PQ", s.ToString())); } if (instance.Currency != null) { s.WriteAttributeString("currency", instance.Currency); } // Precision if (instance.Precision != null && instance.Precision != 0 && instance.Value.HasValue) { s.WriteAttributeString("value", instance.Value.Value.ToString(String.Format("0.{0}", new String('0', instance.Precision)))); } else if (instance.Value.HasValue) { s.WriteAttributeString("value", instance.Value.Value.ToString()); } }
/// <summary> /// Graph the object <paramref name="o"/> to <paramref name="s"/> /// </summary> public void Graph(System.Xml.XmlWriter s, object o, DatatypeFormatterGraphResult result) { // Cast the object to GTS GTS instance = o as GTS; // Hull instance corrections if (instance.Hull != null) { if (instance.Hull.NullFlavor != null) { instance.NullFlavor = instance.NullFlavor ?? instance.Hull.NullFlavor; instance.Hull.NullFlavor = null; result.AddResultDetail(new PropertyValuePropagatedResultDetail(ResultDetailType.Warning, "Hull.NullFlavor", "NullFlavor", instance.NullFlavor, s.ToString())); } if (instance.Hull.Flavor != null) { instance.Flavor = instance.Flavor ?? instance.Hull.Flavor; instance.Hull.Flavor = null; result.AddResultDetail(new PropertyValuePropagatedResultDetail(ResultDetailType.Warning, "Hull.Flavor", "Flavor", instance.Flavor, s.ToString())); } } ANYFormatter anyFormatter = new ANYFormatter(); // Graph the base anyFormatter.Graph(s, o as ANY, result); // Determine what type of hull we have if (instance.NullFlavor != null) // Null flavor specified, no hull will be graphed { return; } else if (instance.Hull == null) { result.AddResultDetail(new ResultDetail(ResultDetailType.Error, "Cannot graph a GTS with a Null Hull", s.ToString())); return; } object instanceHull = instance.Hull; if (instanceHull.GetType().Name.StartsWith("QS")) { instanceHull = instanceHull.GetType().GetMethod("TranslateToSXPR").Invoke(instanceHull, null); } string xsiTypeName = Util.CreateXSITypeName(instanceHull.GetType()); s.WriteAttributeString("xsi", "type", DatatypeFormatter.NS_XSI, xsiTypeName); // Output the formatting var hostResult = this.Host.Graph(s, (IGraphable)instanceHull); result.Code = hostResult.Code; result.AddResultDetail(hostResult.Details); }
public void Graph(System.Xml.XmlWriter s, object o, DatatypeFormatterGraphResult result) { ANYFormatter anyFormatter = new ANYFormatter(); anyFormatter.Graph(s, o, result); // Now graph the attributes Type pivlType = o.GetType(); object valueValue = pivlType.GetProperty("Value").GetValue(o, null), operatorValue = pivlType.GetProperty("Operator").GetValue(o, null), alignmentValue = pivlType.GetProperty("Alignment").GetValue(o, null), phaseValue = pivlType.GetProperty("Phase").GetValue(o, null), periodValue = pivlType.GetProperty("Period").GetValue(o, null), institutionSpecifiedValue = pivlType.GetProperty("InstitutionSpecified").GetValue(o, null), countValue = pivlType.GetProperty("Count").GetValue(o, null), frequencyValue = pivlType.GetProperty("Frequency").GetValue(o, null); // Append the attributes to the writer if ((o as ANY).NullFlavor != null) { return; // Nothing to report } if (valueValue != null) { result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "Value", "PIVL", s.ToString())); } //s.WriteAttributeString("value", Util.ToWireFormat(valueValue)); if (operatorValue != null) { s.WriteAttributeString("operator", Util.ToWireFormat(operatorValue)); } if (alignmentValue != null) { s.WriteAttributeString("alignment", Util.ToWireFormat(alignmentValue)); } if (institutionSpecifiedValue != null) { s.WriteAttributeString("institutionSpecified", Util.ToWireFormat(institutionSpecifiedValue)); } if (countValue != null) { result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "Count", "PIVL", s.ToString())); } // Write elements if (phaseValue != null) { s.WriteStartElement("phase", "urn:hl7-org:v3"); Host.GraphObject(s, (IGraphable)phaseValue); s.WriteEndElement(); } if (frequencyValue != null) { // JF - Frequency is not supported by UV R1 if (result.CompatibilityMode == DatatypeFormatterCompatibilityMode.Canadian) { s.WriteStartElement("frequency", "urn:hl7-org:v3"); var hostResult = this.Host.Graph(s, (IGraphable)frequencyValue); result.AddResultDetail(hostResult.Details); result.Code = hostResult.Code; s.WriteEndElement(); } else { RTO <INT, PQ> rto = frequencyValue as RTO <INT, PQ>; periodValue = rto.Denominator / rto.Numerator; result.AddResultDetail(new PropertyValuePropagatedResultDetail(ResultDetailType.Warning, "Frequency", "Period", periodValue, s.ToString())); s.WriteStartElement("period", "urn:hl7-org:v3"); var hostResult = Host.Graph(s, (IGraphable)periodValue); result.AddResultDetail(hostResult.Details); result.Code = hostResult.Code; s.WriteEndElement(); } } else if (periodValue != null) { s.WriteStartElement("period", "urn:hl7-org:v3"); var hostResult = Host.Graph(s, (IGraphable)periodValue); result.AddResultDetail(hostResult.Details); result.Code = hostResult.Code; s.WriteEndElement(); } }
public virtual void Graph(System.Xml.XmlWriter s, object o, DatatypeFormatterGraphResult result) { ANY instance = o as ANY; XmlStateWriter stw = s as XmlStateWriter; // Now render if (instance == null) { throw new InvalidOperationException("Could not cast object to the ANY data type"); } else if (instance.NullFlavor != null) { s.WriteAttributeString("nullFlavor", Util.ToWireFormat(instance.NullFlavor)); } else if (instance.Flavor != null) { if (result.CompatibilityMode == DatatypeFormatterCompatibilityMode.Canadian) { s.WriteAttributeString("specializationType", instance.Flavor); } else { result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "Flavor", "ANY", s.ToString())); } } // Validate if (result.ValidateConformance && !instance.Validate()) { foreach (var r in instance.ValidateEx()) { r.Location = s.ToString(); result.AddResultDetail(r); } result.Code = ResultCode.Rejected; } // Disabled for test // Validate flavor... IResultDetail[] flavor; if (instance.Flavor != null && result.ValidateConformance && Util.ValidateFlavor(instance.Flavor.ToUpper(), instance, out flavor) == false) { result.AddResultDetail(new DatatypeFlavorValidationResultDetail(ResultDetailType.Warning, instance.GetType().Name, instance.Flavor, s.ToString())); result.AddResultDetail(flavor); if (result.Code < ResultCode.AcceptedNonConformant) { result.Code = ResultCode.AcceptedNonConformant; } } // Warn if items can't be represented in R1 if (instance.ControlActExt != null) { result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "ControlActExt", "ANY", s.ToString())); } if (instance.ControlActRoot != null) { result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "ControlActRoot", "ANY", s.ToString())); } if (instance.ValidTimeHigh != null && !(instance is EN)) { result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "ValidTimeHigh", "ANY", s.ToString())); } if (instance.ValidTimeLow != null && !(instance is EN)) { result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "ValidTimeLow", "ANY", s.ToString())); } if (instance.UpdateMode != null) { result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "UpdateMode", "ANY", s.ToString())); } }
/// <summary> /// Graph to the stream /// </summary> public void Graph(System.Xml.XmlWriter s, object o, DatatypeFormatterGraphResult result) { result.AddResultDetail(new NotImplementedResultDetail(ResultDetailType.Warning, "QSS cannot be graphed by the R1 formatter directly, processing as SXPR", s.ToString(), null)); SXPRFormatter formatter = new SXPRFormatter(); formatter.Host = this.Host; formatter.GenericArguments = this.GenericArguments; // Convert o as SXPR formatter.Graph(s, o.GetType().GetMethod("TranslateToSXPR").Invoke(o, null), result); }
public void Graph(System.Xml.XmlWriter s, object o, DatatypeFormatterGraphResult result) { // Format the UVP to the wire UVPFormatter uvpFormatter = new UVPFormatter(); uvpFormatter.Host = this.Host; uvpFormatter.Graph(s, o, result); if ((o as ANY).NullFlavor != null) { return; } // Get the value of the elements, since it is a generic type Type ivlType = o.GetType(); object lowValue = ivlType.GetProperty("Low").GetValue(o, null), highValue = ivlType.GetProperty("High").GetValue(o, null), widthValue = ivlType.GetProperty("Width").GetValue(o, null), originalTextValue = ivlType.GetProperty("OriginalText").GetValue(o, null), lowClosedValue = ivlType.GetProperty("LowClosed").GetValue(o, null), highClosedValue = ivlType.GetProperty("HighClosed").GetValue(o, null), valueValue = ivlType.GetProperty("Value").GetValue(o, null); // Warn the developer if there are any properties that can't be represented in R1 if (originalTextValue != null) { result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "OriginalText", "URG", s.ToString())); } if (lowClosedValue != null) { result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "LowClosed", "URG", s.ToString())); } if (highClosedValue != null) { result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "HighClosed", "URG", s.ToString())); } if (lowValue != null && highValue != null) // low & high { s.WriteStartElement("low", "urn:hl7-org:v3"); var hostResult = Host.Graph(s, (IGraphable)lowValue); result.Code = hostResult.Code; result.AddResultDetail(hostResult.Details); s.WriteEndElement(); s.WriteStartElement("high", "urn:hl7-org:v3"); hostResult = Host.Graph(s, (IGraphable)highValue); result.Code = hostResult.Code; result.AddResultDetail(hostResult.Details); s.WriteEndElement(); #region Warnings if (valueValue != null) { result.AddResultDetail(new ResultDetail(ResultDetailType.Warning, "low, high, value can't be represented together in an URG data type in R1. Only formatting low and high", s.ToString(), null)); } if (widthValue != null) { result.AddResultDetail(new ResultDetail(ResultDetailType.Warning, "low, high, width can't be represented together in an URG data type in R1. Only formatting low and high", s.ToString(), null)); } #endregion } else if (lowValue != null && widthValue != null) // Low & width { s.WriteStartElement("low", "urn:hl7-org:v3"); var hostResult = Host.Graph(s, (IGraphable)lowValue); result.Code = hostResult.Code; result.AddResultDetail(hostResult.Details); s.WriteEndElement(); s.WriteStartElement("width", "urn:hl7-org:v3"); hostResult = Host.Graph(s, (IGraphable)widthValue); result.Code = hostResult.Code; result.AddResultDetail(hostResult.Details); s.WriteEndElement(); #region Warnings if (valueValue != null) { result.AddResultDetail(new ResultDetail(ResultDetailType.Warning, "low, width, value can't be represented together in an URG data type in R1. Only formatting low and width", s.ToString(), null)); } if (highValue != null) { result.AddResultDetail(new ResultDetail(ResultDetailType.Warning, "low, width, high can't be represented together in an URG data type in R1. Only formatting low and width", s.ToString(), null)); } #endregion } else if (highValue != null && widthValue != null) // high & width { s.WriteStartElement("width", "urn:hl7-org:v3"); var hostResult = Host.Graph(s, (IGraphable)widthValue); result.Code = hostResult.Code; result.AddResultDetail(hostResult.Details); s.WriteEndElement(); s.WriteStartElement("high", "urn:hl7-org:v3"); hostResult = Host.Graph(s, (IGraphable)highValue); result.Code = hostResult.Code; result.AddResultDetail(hostResult.Details); s.WriteEndElement(); #region Warnings if (valueValue != null) { result.AddResultDetail(new ResultDetail(ResultDetailType.Warning, "high, width, value can't be represented together in an URG data type in R1. Only formatting width and high", s.ToString(), null)); } if (lowValue != null) { result.AddResultDetail(new ResultDetail(ResultDetailType.Warning, "high, width, low can't be represented together in an URG data type in R1. Only formatting width and high", s.ToString(), null)); } #endregion } else if (lowValue != null) // low only { s.WriteStartElement("low", "urn:hl7-org:v3"); var hostResult = Host.Graph(s, (IGraphable)lowValue); result.Code = hostResult.Code; result.AddResultDetail(hostResult.Details); s.WriteEndElement(); } else if (highValue != null) // High only { s.WriteStartElement("high", "urn:hl7-org:v3"); var hostResult = Host.Graph(s, (IGraphable)highValue); result.Code = hostResult.Code; result.AddResultDetail(hostResult.Details); s.WriteEndElement(); } else if (widthValue != null) // width only { s.WriteStartElement("width", "urn:hl7-org:v3"); var hostResult = Host.Graph(s, (IGraphable)widthValue); result.Code = hostResult.Code; result.AddResultDetail(hostResult.Details); s.WriteEndElement(); } else if (valueValue != null) { ; } //DOC: The next comment makes no sence, further documentation required. // No need for this ; else { result.AddResultDetail(new ResultDetail(ResultDetailType.Error, "Can't create a valid representation of URG using the supplied data for data types R1. Valid IVL must have [low & [high | width]] | [high & width] | high | value to satisfy data type R1 constraints", s.ToString(), null)); } }
/// <summary> /// Graph object <paramref name="o"/> onto stream <paramref name="s"/> /// </summary> /// <param name="s">The XmlWriter to graph to</param> /// <param name="o">The object to graph</param> public override void Graph(System.Xml.XmlWriter s, object o, DatatypeFormatterGraphResult result) { // Get an instance ref ICodedValue instance_ics = (ICodedValue)o; // Do a base format base.Graph(s, o, result); // Format the coded simple if (instance_ics.CodeSystem != null) { s.WriteAttributeString("codeSystem", instance_ics.CodeSystem); } if (instance_ics.CodeSystemName != null) { s.WriteAttributeString("codeSystemName", instance_ics.CodeSystemName); } if (instance_ics.CodeSystemVersion != null) { s.WriteAttributeString("codeSystemVersion", instance_ics.CodeSystemVersion); } if (instance_ics.DisplayName != null) { s.WriteAttributeString("displayName", instance_ics.DisplayName); } if (instance_ics.OriginalText != null) // Original Text { EDFormatter edFormatter = new EDFormatter(); s.WriteStartElement("originalText", "urn:hl7-org:v3"); edFormatter.Graph(s, instance_ics.OriginalText, result); s.WriteEndElement(); } if (!String.IsNullOrEmpty(instance_ics.ValueSet)) { result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "ValueSet", "CV", s.ToString())); } if (!String.IsNullOrEmpty(instance_ics.ValueSetVersion)) { result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "ValueSetVersion", "CV", s.ToString())); } }
/// <summary> /// Graph object <paramref name="o"/> onto stream <paramref name="s"/> /// </summary> public override void Graph(System.Xml.XmlWriter s, object o, DatatypeFormatterGraphResult result) { Type sxprType = typeof(SXPR <>); Type sxprGenericType = sxprType.MakeGenericType(GenericArguments); // Format the base type base.Graph(s, o, result); // Was a nullflavor present if ((o as ANY).NullFlavor != null) { return; } // Current path string currentPath = s is XmlStateWriter ? (s as XmlStateWriter).CurrentPath : "NA"; // Graph the operator PropertyInfo operatorProperty = sxprGenericType.GetProperty("Operator"), componentProperty = sxprGenericType.GetProperty("Terms"); SetOperator?operatorValue = (SetOperator?)operatorProperty.GetValue(o, null); IEnumerable componentValue = (IEnumerable)componentProperty.GetValue(o, null); // Write the operator out if (operatorValue != null) { s.WriteAttributeString("operator", Util.ToWireFormat(operatorValue)); } // Elements if (componentValue != null) { int count = 0; foreach (var component in componentValue) { s.WriteStartElement("comp", "urn:hl7-org:v3"); object value = component; var compType = component.GetType(); string xsiTypeName = Util.CreateXSITypeName(compType); // Write the type if (this.Host.Host == null) { s.WriteAttributeString("type", DatatypeFormatter.NS_XSI, xsiTypeName.ToString()); } else { s.WriteAttributeString("xsi", "type", DatatypeFormatter.NS_XSI, xsiTypeName.ToString()); } if (count == 0) // the first element should have no operator { var pi = compType.GetProperty("Operator"); if (pi.GetValue(component, null) != null) { result.AddResultDetail(new ResultDetail(ResultDetailType.Warning, "Operator won't be represented in the first object in the SXPR", s.ToString(), null)); } pi.SetValue(component, null, null); } var hostGraphResult = Host.Graph(s, (IGraphable)value); result.AddResultDetail(hostGraphResult.Details); s.WriteEndElement(); // comp count++; } } }
/// <summary> /// Graphs the object <paramref name="o"/> onto the stream /// <paramref name="s"/>. /// </summary> /// <param name="s">The XmlWriter stream to graph to.</param> /// <param name="o">The object to graph.</param> public void Graph(System.Xml.XmlWriter s, object o, DatatypeFormatterGraphResult result) { // Serialize CS SC cs = (SC)o; // Serialize ST if (((ANY)o).NullFlavor != null) { return; } else if (cs.Code != null && !cs.Code.IsNull) { if (cs.Code.Code != null) { s.WriteAttributeString("code", Util.ToWireFormat(cs.Code)); } if (cs.Code.CodeSystem != null) { s.WriteAttributeString("codeSystem", Util.ToWireFormat(cs.Code.CodeSystem)); } if (cs.Code.CodeSystemName != null) { s.WriteAttributeString("codeSystemName", Util.ToWireFormat(cs.Code.CodeSystemName)); } if (cs.Code.CodeSystemVersion != null) { s.WriteAttributeString("codeSystemVersion", Util.ToWireFormat(cs.Code.CodeSystemVersion)); } if (cs.Code.DisplayName != null) { s.WriteAttributeString("displayName", Util.ToWireFormat(cs.Code.DisplayName)); } // Not supported properties if (cs.Code.ValueSet != null) { result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "Code.ValueSet", "SC", s.ToString())); } if (cs.Code.ValueSetVersion != null) { result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "Code.ValueSetVersion", "SC", s.ToString())); } if (cs.Code.CodingRationale != null) { result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "Code.CodingRationale", "SC", s.ToString())); } if (cs.Code.OriginalText != null) { result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "Code.OriginalText", "SC", s.ToString())); } if (cs.Code.Qualifier != null) { result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "Code.Qualifier", "SC", s.ToString())); } if (cs.Code.Translation != null) { result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "Code.Translation", "SC", s.ToString())); } } ST st = (ST)o; STFormatter stFormatter = new STFormatter(); stFormatter.Graph(s, st, result); }
/// <summary> /// Grap the object to a stream /// </summary> public void Graph(System.Xml.XmlWriter s, object o, DatatypeFormatterGraphResult result) { ENXP instance = o as ENXP; // Start with part type and code attributes ANYFormatter baseFormatter = new ANYFormatter(); baseFormatter.Graph(s, o, result); IResultDetail[] partTypeDetails = new IResultDetail[0]; if (instance.NullFlavor != null) { return; } // Now format our data if (instance.Type != null && result.CompatibilityMode != DatatypeFormatterCompatibilityMode.ClinicalDocumentArchitecture) { s.WriteAttributeString("partType", Util.ToWireFormat(instance.Type)); } if (instance.Qualifier != null && !instance.Qualifier.IsEmpty) { s.WriteAttributeString("qualifier", Util.ToWireFormat(instance.Qualifier)); } if (instance.Code != null) { result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "Code", "ADXP", s.ToString())); } //s.WriteAttributeString("code", instance.Code); if (instance.Value != null) { s.WriteValue(instance.Value); } if (instance.CodeSystem != null) // Warn if there is no way to represent this in R1 { result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "CodeSystem", "ENXP", s.ToString())); } if (instance.CodeSystemVersion != null) { result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "CodeSystemVersion", "ENXP", s.ToString())); } }
public override void Graph(System.Xml.XmlWriter s, object o, DatatypeFormatterGraphResult result) { // Want to control output of the value attribute ANYFormatter baseFormatter = new ANYFormatter(); baseFormatter.Graph(s, o, result); PQ instance = o as PQ; if (instance.NullFlavor != null) { return; // Don't graph anymore } if (instance.CodingRationale != null) { result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "CodingRationale", "PQ", s.ToString())); } if (instance.Expression != null) { result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "Expression", "PQ", s.ToString())); } if (instance.OriginalText != null) { result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "OriginalText", "PQ", s.ToString())); } if (instance.Uncertainty != null) { result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "Uncertainty", "PQ", s.ToString())); } if (instance.UncertaintyType != null) { result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "UncertaintyType", "PQ", s.ToString())); } if (instance.UncertainRange != null) { result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "UncertainRange", "PQ", s.ToString())); } if (instance.Unit != null) { s.WriteAttributeString("unit", instance.Unit); } // Precision if (instance.Precision != null && instance.Precision != 0 && instance.Value.HasValue) { s.WriteAttributeString("value", instance.Value.Value.ToString(String.Format("0.{0}", new String('0', instance.Precision)), DatatypeFormatter.FormatterCulture)); } else if (instance.Value.HasValue) { s.WriteAttributeString("value", instance.Value.Value.ToString(DatatypeFormatter.FormatterCulture)); } if (instance.Translation != null) { foreach (var trans in instance.Translation) { s.WriteStartElement("translation", "urn:hl7-org:v3"); PQRFormatter pqrFormatter = new PQRFormatter(); pqrFormatter.Graph(s, trans, result); s.WriteEndElement(); } } }
public virtual void Graph(System.Xml.XmlWriter s, object o, DatatypeFormatterGraphResult result) { // Has this formatter found the elemScopeStack yet? string currentElementName = null; // TODO: Make all parameters XmlStateWriters, next release of Everest // TODO: Don't have enough time to test what this may change upstream if (s is XmlStateWriter) { currentElementName = (s as XmlStateWriter).CurrentElement.Name; } else { result.AddResultDetail(new ResultDetail(ResultDetailType.Error, "Can't represent a SET or LIST using this Xml Stream as it does not inherit from an XmlStateWriter", s.ToString(), null)); return; } // Graph base ANYFormatter baseFormatter = new ANYFormatter(); baseFormatter.Host = this.Host; baseFormatter.Graph(s, o, result); if (((ANY)o).IsNull) { return; } // Write the array IEnumerable instance = (IEnumerable)o; int count = 0; // Get each element in the instance IEnumerator enumerator = instance.GetEnumerator(); if (!enumerator.MoveNext()) { return; // No elements } // Loop through elements while (enumerator.Current != null) { if (count != 0) // Not the first element, write the element name again { s.WriteStartElement(currentElementName, "urn:hl7-org:v3"); } // JF: Output XSI:Type if (GenericArguments != null && !enumerator.Current.GetType().Equals(GenericArguments[0])) { string xsiTypeName = Util.CreateXSITypeName(enumerator.Current.GetType()); s.WriteAttributeString("xsi", "type", DatatypeFormatter.NS_XSI, xsiTypeName); } var hostResult = Host.Graph(s, (IGraphable)enumerator.Current); result.Code = hostResult.Code; result.AddResultDetail(hostResult.Details); if (!enumerator.MoveNext()) { break; // No further objects } s.WriteEndElement(); count++; } }
/// <summary> /// Graphs <paramref name="o"/> to <paramref name="s"/> /// </summary> public void Graph(System.Xml.XmlWriter s, object o, DatatypeR2FormatterGraphResult result) { // Any formatter ANYFormatter anyFormatter = new ANYFormatter(); anyFormatter.GenericArguments = this.GenericArguments; anyFormatter.Host = this.Host; // Graph base anyFormatter.Graph(s, o, result); // Instance II iiInstance = o as II; // Other nullFlavor if (iiInstance.NullFlavor != null) { return; } // Properties if (iiInstance.Root != null) { s.WriteAttributeString("root", iiInstance.Root); } if (iiInstance.Extension != null) { s.WriteAttributeString("extension", iiInstance.Extension); } if (iiInstance.IdentifierName != null) { s.WriteAttributeString("identifierName", iiInstance.IdentifierName); } if (iiInstance.Displayable != null) { s.WriteAttributeString("displayable", Util.ToWireFormat(iiInstance.Displayable)); } if (iiInstance.Scope != null) { s.WriteAttributeString("scope", Util.ToWireFormat(iiInstance.Scope)); } if (iiInstance.Reliability != null) { s.WriteAttributeString("reliability", Util.ToWireFormat(iiInstance.Reliability)); } if (iiInstance.AssigningAuthorityName != null) { result.AddResultDetail(new UnsupportedDatatypeR2PropertyResultDetail( ResultDetailType.Warning, "AssigningAuthorityName", "II", s.ToString() )); } }
public void Graph(System.Xml.XmlWriter s, object o, DatatypeFormatterGraphResult result) { ANYFormatter baseFormatter = new ANYFormatter(); baseFormatter.Graph(s, o, result); // Since this is a generic type, we'll need to get the values we're interested in // for the formatting operation Type oType = o.GetType(); object numerator = oType.GetProperty("Numerator").GetValue(o, null), denominator = oType.GetProperty("Denominator").GetValue(o, null); // Check for the QTY members QTY <Nullable <Double> > qtyPortion = o as QTY <Nullable <Double> >; // Check for non-representable properties if (qtyPortion.Expression != null) { result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "Expression", "RTO", s.ToString())); } if (qtyPortion.OriginalText != null) { result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "OriginalText", "RTO", s.ToString())); } if (qtyPortion.Uncertainty != null) { result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "Uncertainty", "RTO", s.ToString())); } if (qtyPortion.UncertaintyType != null) { result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "UncertaintyType", "RTO", s.ToString())); } if (qtyPortion.UncertainRange != null) { result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "UncertainRange", "RTO", s.ToString())); } if (qtyPortion.Value != null) { result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "Value", "RTO", s.ToString())); } IXmlStructureFormatter serFormatter = Host; // Serialize the data-type if (numerator != null) { s.WriteStartElement("numerator", "urn:hl7-org:v3"); // Write the XSI type string xsiTypeName = Util.CreateXSITypeName(numerator.GetType()); // Write the type if (this.Host.Host == null) { s.WriteAttributeString("type", DatatypeFormatter.NS_XSI, xsiTypeName.ToString()); } else { s.WriteAttributeString("xsi", "type", DatatypeFormatter.NS_XSI, xsiTypeName.ToString()); } var hostResult = serFormatter.Graph(s, (IGraphable)numerator); result.Code = hostResult.Code; result.AddResultDetail(hostResult.Details); s.WriteEndElement(); } if (denominator != null) { s.WriteStartElement("denominator", "urn:hl7-org:v3"); // Write the XSI type string xsiTypeName = Util.CreateXSITypeName(denominator.GetType()); // Write the type if (this.Host.Host == null) { s.WriteAttributeString("type", DatatypeFormatter.NS_XSI, xsiTypeName.ToString()); } else { s.WriteAttributeString("xsi", "type", DatatypeFormatter.NS_XSI, xsiTypeName.ToString()); } var hostResult = serFormatter.Graph(s, (IGraphable)denominator); result.Code = hostResult.Code; result.AddResultDetail(hostResult.Details); s.WriteEndElement(); } // Append details //details.AddRange(serFormatter.Details); }