Ejemplo n.º 1
0
        public virtual void ShouldWriteNullFlavorOnCollapsedAssociation()
        {
            BeanCPrime  beanC   = new BeanCPrime();
            BeanWrapper wrapper = new BeanWrapper(beanC);

            wrapper.WriteNullFlavor(null, new Relationship("component2", "ABCD_IN123456CA.BeanB", Cardinality.Create("0-1")), Ca.Infoway.Messagebuilder.Domainvalue.Nullflavor.NullFlavor
                                    .NO_INFORMATION);
            Assert.IsNull(beanC.BeanB, "bean");
        }
Ejemplo n.º 2
0
        private bool MapNodeAttributesToTeal(Hl7Source source, BeanWrapper wrapper, Relationship relationship)
        {
            XmlElement       currentElement   = source.GetCurrentElement();
            NullFlavorHelper nullFlavorHelper = new NullFlavorHelper(relationship != null ? relationship.Conformance : Ca.Infoway.Messagebuilder.Xml.ConformanceLevel
                                                                     .OPTIONAL, currentElement, source.GetResult(), true);
            bool hasValidNullFlavorAttribute = nullFlavorHelper.HasValidNullFlavorAttribute();

            if (hasValidNullFlavorAttribute)
            {
                wrapper.WriteNullFlavor(source, relationship, nullFlavorHelper.ParseNullNode());
            }
            else
            {
                XmlAttributeCollection map = currentElement.Attributes;
                foreach (XmlNode attributeNode in new XmlNamedNodeMapIterable(map))
                {
                    Relationship attributeRelationship = source.GetRelationship(NodeUtil.GetLocalOrTagName(attributeNode));
                    if (!NamespaceUtil.IsHl7Node(attributeNode))
                    {
                    }
                    else
                    {
                        // quietly ignore it
                        if (attributeRelationship == null)
                        {
                            this.log.Info("Can't find NodeAttribute relationship named: " + attributeNode.Name);
                        }
                        else
                        {
                            ValidateNamespace(attributeNode, attributeRelationship, source);
                            if (attributeRelationship.HasFixedValue())
                            {
                                ValidateFixedValue(source, currentElement, (XmlAttribute)attributeNode, attributeRelationship);
                            }
                            wrapper.WriteNodeAttribute(attributeRelationship, attributeNode.Value, source.GetVersion(), source.IsR2());
                        }
                    }
                    ValidateMandatoryAttributesExist(source, currentElement);
                }
            }
            return(hasValidNullFlavorAttribute);
        }