Example #1
0
 public virtual void VisitRootStart(PartBridge tealBean, Interaction interaction)
 {
     this.propertyPathNames.Push(DeterminePropertyName(tealBean.GetPropertyName(), interaction));
     this.interaction = interaction;
     this.buffers.Clear();
     this.buffers.Push(new XmlRenderingVisitor.Buffer(this, this.isCda ? "ClinicalDocument" : interaction.Name, 0));
     CurrentBuffer().GetStructuralBuilder().Append(" xmlns=\"urn:hl7-org:v3\" ");
     CurrentBuffer().GetStructuralBuilder().Append("xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" ");
     if (this.isCda)
     {
         CurrentBuffer().GetStructuralBuilder().Append("xmlns:sdtc=\"urn:hl7-org:sdtc\" xmlns:cda=\"urn:hl7-org:v3\"");
     }
     else
     {
         CurrentBuffer().GetStructuralBuilder().Append("ITSVersion=\"XML_1.0\"");
     }
     RenderRealmCodes(tealBean);
 }
Example #2
0
 public virtual void VisitAssociationStart(PartBridge part, Relationship relationship)
 {
     if (IsSomethingToRender(part, relationship))
     {
         bool   validationWarning = false;
         string warningMessage    = null;
         PushPropertyPathName(DeterminePropertyName(part.GetPropertyName(), relationship), part.IsCollapsed());
         string propertyPath   = BuildPropertyPath();
         string xmlElementName = DetermineXmlName(part, relationship);
         if (StringUtils.IsNotBlank(relationship.Namespaze))
         {
             xmlElementName = relationship.Namespaze + ":" + xmlElementName;
         }
         this.buffers.Push(new XmlRenderingVisitor.Buffer(this, xmlElementName, this.buffers.Count));
         AddChoiceAnnotation(part, relationship);
         if (part.IsEmpty() && (ConformanceLevelUtil.IsPopulated(relationship) || part.HasNullFlavor()))
         {
             // MBR-319 - some clients want xsi:nil suppressed
             string nf = Ca.Infoway.Messagebuilder.BooleanUtils.ValueOf(Runtime.GetProperty(NullFlavorHelper.MB_SUPPRESS_XSI_NIL_ON_NULLFLAVOR
                                                                                            )) ? NULL_FLAVOR_FORMAT_FOR_ASSOCIATIONS_NO_XSI_NIL : NULL_FLAVOR_FORMAT_FOR_ASSOCIATIONS;
             CurrentBuffer().GetStructuralBuilder().Append(System.String.Format(nf, GetNullFlavor(part).CodeValue));
         }
         else
         {
             if (part.IsEmpty() && ConformanceLevelUtil.IsMandatory(relationship) && !IsTrivial(part))
             {
                 // some errors are due to "null" parts MB has inserted to create structural XML; don't log errors on these
                 validationWarning = !part.IsNullPart() && !part.IsCollapsed();
                 warningMessage    = "Mandatory association has no data.";
                 if (!validationWarning)
                 {
                     CurrentBuffer().AddWarning(warningMessage + " (" + propertyPath + ")");
                 }
             }
             else
             {
                 if (ConformanceLevelUtil.IsIgnored(relationship))
                 {
                     validationWarning = true;
                     warningMessage    = System.String.Format(ConformanceLevelUtil.IsIgnoredNotAllowed() ? ConformanceLevelUtil.ASSOCIATION_IS_IGNORED_AND_CANNOT_BE_USED
                                                          : ConformanceLevelUtil.ASSOCIATION_IS_IGNORED_AND_WILL_NOT_BE_USED, relationship.Name);
                 }
                 else
                 {
                     if (ConformanceLevelUtil.IsNotAllowed(relationship))
                     {
                         validationWarning = true;
                         warningMessage    = System.String.Format(ConformanceLevelUtil.ASSOCIATION_IS_NOT_ALLOWED, relationship.Name);
                     }
                 }
             }
         }
         if (validationWarning)
         {
             // store error within error collection
             this.result.AddHl7Error(new Hl7Error(Hl7ErrorCode.DATA_TYPE_ERROR, warningMessage, propertyPath));
         }
         AddNewErrorsToList(CurrentBuffer().GetWarnings());
         RenderRealmCodes(part);
     }
 }