Example #1
0
        private RelationshipFormat ResolveTemplateType(IList <Argument> arguments, string templateName)
        {
            RelationshipFormat templateFormatInfo = null;

            foreach (Argument argument in arguments)
            {
                if (StringUtils.Equals(argument.TemplateParameterName, templateName))
                {
                    templateFormatInfo = new RelationshipFormat(argument.TraversalName, argument.Name, argument);
                }
                else
                {
                    if (argument.Name != null && argument.Name.EndsWith("." + templateName))
                    {
                        // BCH: this looks suspicious.  Investigate later...
                        templateFormatInfo = new RelationshipFormat(argument.TraversalName, argument.Name, argument);
                    }
                    else
                    {
                        templateFormatInfo = ResolveTemplateType(argument.Arguments, templateName);
                    }
                }
                if (templateFormatInfo != null)
                {
                    break;
                }
            }
            return(templateFormatInfo);
        }
Example #2
0
        private string ResolveTemplateType(string templateName, string elementName, bool topmostOnly)
        {
            RelationshipFormat format = ResolveTemplateType(GetInteraction().Arguments, templateName);

            if (format == null)
            {
                throw new MarshallingException("Could not resolve Hl7 template information for template " + templateName);
            }
            else
            {
                if (!topmostOnly && format.GetArgument().Choice)
                {
                    Relationship option = format.GetArgument().FindChoiceOption(ChoiceSupport.ChoiceOptionNamePredicate(elementName));
                    if (option == null)
                    {
                        throw new MarshallingException("Could not resolve Hl7 template choice information for template " + templateName + " and element name "
                                                       + elementName);
                    }
                    else
                    {
                        return(option.Type);
                    }
                }
                else
                {
                    return(format.Type);
                }
            }
        }
Example #3
0
        internal virtual RelationshipFormat ResolveTemplateType(Relationship relationship)
        {
            RelationshipFormat result = ResolveTemplateType(GetInteraction().Arguments, relationship.TemplateParameterName);

            if (result == null)
            {
                throw new MarshallingException("Could not resolve Hl7 type for template " + relationship.TemplateParameterName);
            }
            else
            {
                return(result);
            }
        }