protected override string FormatNonNullValue(FormatContext context, UncertainRange <PlatformDate> value, int indentLevel) { // convert URG to an IVL and use IVL formatter Interval <PlatformDate> convertedInterval = IntervalFactory.CreateFromUncertainRange(value); IVLImpl <TS, Interval <PlatformDate> > convertedHl7Interval = new IVLImpl <TS, Interval <PlatformDate> >(convertedInterval); FormatContext ivlContext = new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl(context.Type.Replace ("URG", "IVL"), context.IsSpecializationType(), context); string xml = this.formatter.Format(ivlContext, convertedHl7Interval, indentLevel); xml = ChangeAnyIvlRemnants(xml); // inclusive attributes not allowed for URG<TS> if (value.LowInclusive != null || value.HighInclusive != null) { context.GetModelToXmlResult().AddHl7Error(new Hl7Error(Hl7ErrorCode.DATA_TYPE_ERROR, "High/Low inclusive fields should not be set; these attributes are not allowed for " + context.Type + " types", context.GetPropertyPath())); } return(xml); }
protected override string FormatNonNullDataType(FormatContext context, BareANY dataType, int indentLevel) { UncertainRange <PhysicalQuantity> value = (UncertainRange <PhysicalQuantity>)dataType.BareValue; // convert URG to an IVL and use IVL formatter (loses any inclusive info; we'll pull that out later) Interval <PhysicalQuantity> convertedInterval = IntervalFactory.CreateFromUncertainRange(value); IVLImpl <PQ, Interval <PhysicalQuantity> > convertedHl7Interval = new IVLImpl <PQ, Interval <PhysicalQuantity> >(convertedInterval ); FormatContext ivlContext = new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl(context.Type.Replace ("URG", "IVL"), context.IsSpecializationType(), context); string xml = this.formatter.Format(ivlContext, convertedHl7Interval, indentLevel); xml = ChangeAnyIvlRemnants(xml); xml = AddOriginalText(xml, dataType, indentLevel); // add in inclusive attributes if necessary if (value.LowInclusive != null) { xml = AddInclusiveAttribute(xml, "low", value.LowInclusive); } if (value.HighInclusive != null) { xml = AddInclusiveAttribute(xml, "high", value.HighInclusive); } return(xml); }