private NullFlavor GetNullFlavor(PartBridge tealBean) { NullFlavor nullFlavor = Ca.Infoway.Messagebuilder.Domainvalue.Nullflavor.NullFlavor.NO_INFORMATION; if (tealBean.HasNullFlavor()) { nullFlavor = tealBean.GetNullFlavor(); } return(nullFlavor); }
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); } }
private bool IsSomethingToRender(PartBridge tealBean, Relationship relationship) { return(!tealBean.IsEmpty() || ConformanceLevelUtil.IsMandatory(relationship) || ConformanceLevelUtil.IsPopulated(relationship ) || tealBean.HasNullFlavor()); }