Exemple #1
0
        protected virtual string CreateElement(FormatContext context, string name, QTY <T> value, Boolean?inclusive, bool isSxcm,
                                               int indentLevel)
        {
            string type = Hl7DataTypeName.GetParameterizedType(context.Type);

            if (isSxcm)
            {
                type = "SXCM<" + type + ">";
            }
            PropertyFormatter formatter = FormatterR2Registry.GetInstance().Get(type);

            if (formatter != null)
            {
                bool          isSpecializationType = false;
                FormatContext newContext           = new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl(type, isSpecializationType
                                                                                                                               , Ca.Infoway.Messagebuilder.Xml.ConformanceLevel.POPULATED, Cardinality.Create("1"), name, context);
                string result = formatter.Format(newContext, value, indentLevel);
                if (inclusive != null)
                {
                    // TM - small hack to add in the inclusive attribute (low/high) (operator, simple only, is already formatted by using the SXCM type)
                    result = result.ReplaceFirst(" value=", " inclusive=\"" + inclusive.ToString().ToLower() + "\" value=");
                }
                return(result);
            }
            else
            {
                throw new ModelToXmlTransformationException("No formatter found for " + type);
            }
        }
Exemple #2
0
        /// <exception cref="Ca.Infoway.Messagebuilder.Marshalling.HL7.XmlToModelTransformationException"></exception>
        private string GetSubType(ParseContext context)
        {
            string subType = Hl7DataTypeName.GetParameterizedType(context.Type);

            if (StringUtils.IsNotBlank(subType))
            {
                return(subType);
            }
            else
            {
                throw new XmlToModelTransformationException("Cannot find the sub type for " + context.Type);
            }
        }
Exemple #3
0
        protected virtual string CreateElement(FormatContext context, string name, QTY <T> value, int indentLevel)
        {
            string            type      = Hl7DataTypeName.GetParameterizedType(context.Type);
            PropertyFormatter formatter = FormatterRegistry.GetInstance().Get(type);

            if (formatter != null)
            {
                bool isSpecializationType = false;
                return(formatter.Format(new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl(type, isSpecializationType
                                                                                                                  , Ca.Infoway.Messagebuilder.Xml.ConformanceLevel.POPULATED, Cardinality.Create("1"), name, context), value, indentLevel));
            }
            else
            {
                throw new ModelToXmlTransformationException("No formatter found for " + type);
            }
        }
Exemple #4
0
 protected virtual string CreateWidthElement(FormatContext context, string name, BareDiff diff, int indentLevel)
 {
     if (IsTimestamp(context))
     {
         return(CreateTimestampWidthElement(context, name, diff, indentLevel));
     }
     else
     {
         string            type      = Hl7DataTypeName.GetParameterizedType(context.Type);
         PropertyFormatter formatter = FormatterRegistry.GetInstance().Get(type);
         if (formatter != null)
         {
             bool isSpecializationType = false;
             return(formatter.Format(new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl(type, isSpecializationType
                                                                                                               , Ca.Infoway.Messagebuilder.Xml.ConformanceLevel.MANDATORY, Cardinality.Create("1"), name, context), WrapWithHl7DataType
                                         (type, diff), indentLevel));
         }
         else
         {
             throw new ModelToXmlTransformationException("No formatter found for " + type);
         }
     }
 }
Exemple #5
0
        private ParseContext ConvertContext(ParseContext context)
        {
            string newType = "IVL<" + Hl7DataTypeName.GetParameterizedType(context.Type) + ">";

            return(ParseContextImpl.CreateWithConstraints(newType, context));
        }
Exemple #6
0
 private bool IsTimestamp(FormatContext context)
 {
     return("TS".Equals(Hl7DataTypeName.Unqualify(Hl7DataTypeName.GetParameterizedType(context.Type))));
 }
Exemple #7
0
 private string GetParameterizedType(ParseContext context)
 {
     return(Hl7DataTypeName.GetParameterizedType(context.Type));
 }