Exemple #1
0
        protected string ConvertMessageObjectToXML(IInteraction msg)
        {
            ModelToXmlResult xmlQuery = this.CreateTransformer().TransformToHl7AndReturnResult(
                MBSpecificationVersion, msg);

            return(xmlQuery.GetXmlMessage());
        }
Exemple #2
0
        public virtual void ShouldRenderNotNonStructuralAttributeFullDate()
        {
            TNImpl       attributeValue = new TNImpl(new TrivialName("Trivial Name"));
            Relationship relationship   = new Relationship();

            relationship.Name = "value";
            relationship.Type = StandardDataType.ANY_LAB.Type;
            ExerciseVisitorOverInteractionWithAttribute(attributeValue, relationship);
            ModelToXmlResult result = this.visitor.ToXml();

            result.GetXmlMessage();
            IList <Hl7Error> hl7Errors = result.GetHl7Errors();

            Assert.IsFalse(hl7Errors.IsEmpty(), "should have incompatable ANY.LAB value");
            Assert.AreEqual(1, hl7Errors.Count, "should have incompatable ANY.LAB value");
            Assert.AreEqual("Cannot support properties of type TN for ANY.LAB. Please specify a specializationType applicable for ANY.LAB in the appropriate message bean."
                            , hl7Errors[0].GetMessage(), "should have incompatable ANY.LAB value");
        }
Exemple #3
0
        public virtual ModelToXmlResult TransformToHl7(VersionNumber version, IInteraction messageBean, TimeZoneInfo dateTimeZone
                                                       , TimeZoneInfo dateTimeTimeZone, GenericCodeResolverRegistry codeResolverRegistryOverride)
        {
            CodeResolverRegistry.SetThreadLocalVersion(version);
            CodeResolverRegistry.SetThreadLocalCodeResolverRegistryOverride(codeResolverRegistryOverride);
            XmlRenderingVisitor visitor = new XmlRenderingVisitor(this.service.IsR2(version), this.service.IsCda(version), version);

            // TODO: Since the two boolean flags are derived from the version, we chould simplify this interface
            new TealBeanRenderWalker(messageBean, version, dateTimeZone, dateTimeTimeZone, this.service).Accept(visitor);
            CodeResolverRegistry.ClearThreadLocalVersion();
            CodeResolverRegistry.ClearThreadLocalCodeResolverRegistryOverride();
            ModelToXmlResult result = visitor.ToXml();

            if (this.service.IsCda(version))
            {
                PerformAdditionalCdaValidation(version, result.GetXmlMessage(), result);
            }
            if (!result.IsValid() && IsStrict())
            {
                throw new InvalidRenderInputException(result.GetHl7Errors());
            }
            return(result);
        }
Exemple #4
0
        public string ConvertMessageObjectToXML(IInteraction msg, VersionNumber version)
        {
            ModelToXmlResult xmlQuery = this.CreateTransformer().TransformToHl7(version, msg);

            return(xmlQuery.GetXmlMessage());
        }