private void HandleNotAllowedAndIgnored(Relationship relationship, string propertyPath) { Hl7Error hl7Error = null; if (ConformanceLevelUtil.IsIgnored(relationship)) { if (ConformanceLevelUtil.IsIgnoredNotAllowed()) { string message = System.String.Format(ConformanceLevelUtil.ATTRIBUTE_IS_IGNORED_AND_CANNOT_BE_USED, relationship.Name); hl7Error = new Hl7Error(Hl7ErrorCode.DATA_TYPE_ERROR, ErrorLevel.ERROR, message, propertyPath); } else { string message = System.String.Format(ConformanceLevelUtil.ATTRIBUTE_IS_IGNORED_AND_WILL_NOT_BE_USED, relationship.Name); hl7Error = new Hl7Error(Hl7ErrorCode.DATA_TYPE_ERROR, ErrorLevel.INFO, message, propertyPath); } } else { if (ConformanceLevelUtil.IsNotAllowed(relationship)) { string message = System.String.Format(ConformanceLevelUtil.ATTRIBUTE_IS_NOT_ALLOWED, relationship.Name); hl7Error = new Hl7Error(Hl7ErrorCode.DATA_TYPE_ERROR, ErrorLevel.ERROR, message, propertyPath); } } if (hl7Error != null) { this.result.AddHl7Error(hl7Error); } }
private void CreateWarningIfConformanceLevelIsNotAllowed(Relationship relationship) { // FIXME - TM (see RM19206) - IGNORED/NOT_ALLOWED - these should log a warning in the Hl7Errors bean, not just as a log message if (ConformanceLevelUtil.IsIgnoredNotAllowed() && ConformanceLevelUtil.IsIgnored(relationship)) { this.log.Debug(System.String.Format(relationship.Association ? ConformanceLevelUtil.ASSOCIATION_IS_IGNORED_AND_CANNOT_BE_USED : ConformanceLevelUtil.ATTRIBUTE_IS_IGNORED_AND_CANNOT_BE_USED, relationship.Name)); } else { if (ConformanceLevelUtil.IsNotAllowed(relationship)) { this.log.Debug(System.String.Format(relationship.Association ? ConformanceLevelUtil.ASSOCIATION_IS_NOT_ALLOWED : ConformanceLevelUtil .ATTRIBUTE_IS_NOT_ALLOWED, relationship.Name)); } } }
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); } }