Esempio n. 1
0
        public virtual XmlToModelResult TransformFromHl7(VersionNumber version, XmlDocument hl7Message, TimeZoneInfo dateTimeZone
                                                         , TimeZoneInfo dateTimeTimeZone, GenericCodeResolverRegistry codeResolverRegistryOverride)
        {
            CodeResolverRegistry.SetThreadLocalVersion(version);
            CodeResolverRegistry.SetThreadLocalCodeResolverRegistryOverride(codeResolverRegistryOverride);
            XmlToModelResult result = new Hl7SourceMapper().MapToTeal(new Hl7MessageSource(version, hl7Message, dateTimeZone, dateTimeTimeZone
                                                                                           , this.service));

            if (this.performAdditionalCdaValidationWhenUnmarshalling)
            {
                PerformAdditionalCdaValidation(version, hl7Message, result);
            }
            CodeResolverRegistry.ClearThreadLocalVersion();
            CodeResolverRegistry.ClearThreadLocalCodeResolverRegistryOverride();
            return(result);
        }
Esempio n. 2
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);
        }