Esempio n. 1
0
 private void ProcessPartValue(PartBridge child, Interaction interaction, AssociationBridge relationshipBridge, Visitor visitor
                               )
 {
     if (child.IsEmpty() && !ConformanceLevelUtil.IsMandatory(relationshipBridge.GetRelationship()))
     {
     }
     else
     {
         ProcessAllRelationships(child, interaction, visitor);
     }
 }
Esempio n. 2
0
 private string DetermineXmlName(PartBridge tealBean, Relationship relationship)
 {
     if (!relationship.Choice && !relationship.TemplateRelationship)
     {
         return(relationship.Name);
     }
     else
     {
         if (relationship.TemplateRelationship)
         {
             Argument argument = this.interaction.GetArgumentByTemplateParameterName(relationship.TemplateParameterName);
             if (argument == null)
             {
                 throw new RenderingException("Cannot determine the template/choice parameter type : " + relationship.Name);
             }
             else
             {
                 if (argument.Choice)
                 {
                     Ca.Infoway.Messagebuilder.Xml.Predicate <Relationship> predicate = ChoiceSupport.ChoiceOptionTypePredicate(new string[] {
                         tealBean.GetTypeName()
                     });
                     Relationship option = argument.FindChoiceOption(predicate);
                     if (option == null)
                     {
                         throw new RenderingException("Cannot determine the choice type of template argument : " + argument.Name);
                     }
                     else
                     {
                         return(option.Name);
                     }
                 }
                 else
                 {
                     return(argument.TraversalName);
                 }
             }
         }
         else
         {
             if (tealBean.IsEmpty())
             {
                 return(relationship.Choices[0].Name);
             }
             else
             {
                 if (relationship.Cardinality.Multiple)
                 {
                     return(relationship.Name);
                 }
                 Relationship option = BeanBridgeChoiceRelationshipResolver.ResolveChoice(tealBean, relationship);
                 if (option == null)
                 {
                     // log an error instead?
                     throw new RenderingException("Cannot determine the choice type of relationship : " + relationship.Name);
                 }
                 else
                 {
                     return(option.Name);
                 }
             }
         }
     }
 }
Esempio n. 3
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);
     }
 }
Esempio n. 4
0
 private bool IsSomethingToRender(PartBridge tealBean, Relationship relationship)
 {
     return(!tealBean.IsEmpty() || ConformanceLevelUtil.IsMandatory(relationship) || ConformanceLevelUtil.IsPopulated(relationship
                                                                                                                      ) || tealBean.HasNullFlavor());
 }