private string AddNullFlavor(EntityNamePart namePart) { NullFlavor nullFlavor = namePart.NullFlavor; return(nullFlavor == null || StringUtils.IsBlank(nullFlavor.CodeValue) ? string.Empty : " nullFlavor=\"" + nullFlavor.CodeValue + "\""); }
/// <summary>Constructs an Interval using the supplied parameters.</summary> /// <remarks>Constructs an Interval using the supplied parameters.</remarks> /// <TBD></TBD> /// <param name="low">the low bound</param> /// <param name="width">the width as a Diff object</param> /// <param name="lowNullFlavor"></param> /// <returns>the constructed interval</returns> public static Interval <T> CreateLowWidth <T>(T low, Diff <T> width, NullFlavor lowNullFlavor) { T high = GenericMath.Add(low, width); return(new Interval <T>(low, high, GenericMath.Average(low, high), width, Representation.LOW_WIDTH, lowNullFlavor, null, null )); }
/// <exception cref="Ca.Infoway.Messagebuilder.Marshalling.HL7.XmlToModelTransformationException"></exception> public override BareANY Parse(ParseContext context, XmlNode node, XmlToModelResult xmlToModelResult) { BareANY result = CreateDataTypeInstance(context != null ? GetType(context) : null); // RM20416 - some PQ specifications allow for NF to coexist with other properties if (HasValidNullFlavorAttribute(context, node, xmlToModelResult)) { NullFlavor nullFlavor = ParseNullNode(context, node, xmlToModelResult); result.NullFlavor = nullFlavor; } PhysicalQuantity value = ParseNonNullNode(context, node, result, GetReturnType(context), xmlToModelResult); if (value != null && (value.Quantity != null || value.Unit != null)) { ((BareANYImpl)result).BareValue = value; } XmlElement element = (XmlElement)node; // validation of OT done a bit later below string originalText = GetOriginalText(element); if (HasOriginalText(element)) { ((PQ)result).OriginalText = originalText; } bool hasValues = HasAnyValues(element); bool hasNullFlavor = HasValidNullFlavorAttribute(context, node, xmlToModelResult); this.pqValidationUtils.ValidateOriginalText(context.Type, originalText, hasValues, hasNullFlavor, context.GetVersion(), element , null, xmlToModelResult); return(result); }
public virtual NullFlavor ParseNullNode() { string attributeValue = GetAttributeValue(node, NULL_FLAVOR_ATTRIBUTE_NAME); NullFlavor nullFlavor = CodeResolverRegistry.Lookup <NullFlavor>(attributeValue); if (ConformanceLevelUtil.IsMandatory(this.conformanceLevel, null)) { xmlToModelResult.AddHl7Error(Hl7Error.CreateMandatoryAttributeIsNullError(NodeUtil.GetLocalOrTagName((XmlElement)node), GetAttributeValue (node, NULL_FLAVOR_ATTRIBUTE_NAME), (XmlElement)node)); } else { // RM #15431 - strictly speaking, nullFlavors are not allowed for REQUIRED fields. However, jurisdictions often ignore this restriction. // FIXME: TM (see RM18424) - once MB has error levels implemented, this can be reinstated as a warning // } else if (this.conformanceLevel != null && this.conformanceLevel == ConformanceLevel.REQUIRED) { // xmlToModelResult.addHl7Error(Hl7Error.createRequiredAttributeIsNullError( // NodeUtil.getLocalOrTagName((Element) node), // getAttributeValue(node, NULL_FLAVOR_ATTRIBUTE_NAME), // (Element) node)); if (this.isAssociation && !StringUtils.Equals(GetAttributeValue(node, NULL_FLAVOR_XSI_NIL_ATTRIBUTE_NAME), "true")) { if (!Ca.Infoway.Messagebuilder.BooleanUtils.ValueOf(Runtime.GetProperty(Ca.Infoway.Messagebuilder.Marshalling.HL7.Parser.NullFlavorHelper .MB_SUPPRESS_XSI_NIL_ON_NULLFLAVOR))) { xmlToModelResult.AddHl7Error(Hl7Error.CreateNullFlavorMissingXsiNilError(NodeUtil.GetLocalOrTagName((XmlElement)node), (XmlElement )node)); } } } return(nullFlavor); }
/// <summary> /// Constructs an EntityNamePart using the supplied parameters. /// This constructor may not make sense to have as public. May become private in a later release. /// </summary> /// <param name="value_ren"></param> /// <param name="type_0"></param> /// <param name="qualifier"></param> /// <param name="nullFlavor"></param> public EntityNamePart(String value_ren, NamePartType type_0, EntityNamePartQualifier qualifier, NullFlavor nullFlavor) { this.value_ren = value_ren; this.type = type_0; this.qualifier = qualifier; this.nullFlavor = nullFlavor; }
protected virtual IDictionary <string, string> CreateNullFlavorAttributes(NullFlavor nullFlavor) { Dictionary <string, string> attributes = new Dictionary <string, string>(); attributes[AbstractPropertyFormatter.NULL_FLAVOR_ATTRIBUTE_NAME] = nullFlavor.CodeValue; return(attributes); }
/// <summary>Constructs an Interval using the supplied parameters.</summary> /// <remarks>Constructs an Interval using the supplied parameters.</remarks> /// <TBD></TBD> /// <param name="low">the low bound</param> /// <param name="high">the high bound</param> /// <param name="lowNullFlavor"></param> /// <param name="highNullFlavor"></param> /// <returns>the constructed interval</returns> public static Interval <T> CreateLowHigh <T>(T low, T high, NullFlavor lowNullFlavor, NullFlavor highNullFlavor) { bool hasNullFlavor = lowNullFlavor != null || highNullFlavor != null; T average = hasNullFlavor ? default(T) : GenericMath.Average(low, high); Diff <T> diff = hasNullFlavor ? null : GenericMath.Diff(low, high); return(new Interval <T>(low, high, average, diff, Representation.LOW_HIGH, lowNullFlavor, highNullFlavor, null)); }
private void HandleNullFlavor(XmlElement element, BareANY dataType, ParseContext context, XmlToModelResult result) { if (HasValidNullFlavorAttribute(context, element, result)) { NullFlavor nullFlavor = ParseNullNode(context, element, result); dataType.NullFlavor = nullFlavor; } }
private void PopulateNullFlavor(BareANY dataType, ParseContext context, XmlNode node, XmlToModelResult xmlToModelResult) { if (HasValidNullFlavorAttribute(context, node, xmlToModelResult)) { NullFlavor nullFlavor = ParseNullNode(context, node, xmlToModelResult); dataType.NullFlavor = nullFlavor; } }
/// <summary> /// Returns true if <paramref name="a"/> implies <paramref name="implied"/> /// </summary> public static bool IsChildConcept(this NullFlavor a, NullFlavor parent) { NullFlavor parentAttempt = a; do { if (parentAttempt == parent) return true; } while (m_heirarchy.TryGetValue(parentAttempt, out parentAttempt)); return false; }
/// <summary>Constructs an Interval using the supplied parameters.</summary> /// <remarks>Constructs an Interval using the supplied parameters.</remarks> /// <param name="low"></param> /// <param name="centre"></param> /// <param name="lowNullFlavor"></param> /// <param name="centreNullFlavor"></param> /// <returns>the constructed interval</returns> public static Interval <T> CreateLowCentre <T>(T low, T centre, NullFlavor lowNullFlavor, NullFlavor centreNullFlavor) { Diff <T> tempDiff = GenericMath.Diff(low, centre); bool tempDiffNull = (tempDiff == (Diff <T>)null); T halfDiff = tempDiffNull ? default(T) : tempDiff.Value; T high = GenericMath.Add(centre, halfDiff); Diff <T> width = GenericMath.Diff(low, high); return(new Interval <T>(low, high, centre, width, Representation.LOW_CENTER, lowNullFlavor, null, centreNullFlavor)); }
/// <summary>Constructs an Interval using the supplied parameters.</summary> /// <remarks>Constructs an Interval using the supplied parameters.</remarks> /// <TBD></TBD> /// <param name="width">the width as a Diff object</param> /// <param name="high">the high bound</param> /// <param name="highNullFlavor"></param> /// <returns>the constructed interval</returns> public static Interval <T> CreateWidthHigh <T>(Diff <T> width, T high, NullFlavor highNullFlavor) { bool widthNull = (width == (Diff <T>)null); Diff <T> tempDiff = GenericMath.Diff(widthNull ? default(T) : width.Value, high); bool tempDiffNull = (tempDiff == (Diff <T>)null); T low = tempDiffNull ? default(T) : tempDiff.Value; return(new Interval <T>(low, high, GenericMath.Average(low, high), width, Representation.WIDTH_HIGH, null, highNullFlavor, null)); }
/// <summary> /// Gets a common ancestor /// </summary> public static NullFlavor GetCommonParent(this NullFlavor a, NullFlavor other) { NullFlavor parentAttempt = a; do { if (other.IsChildConcept(parentAttempt)) return parentAttempt; } while (m_heirarchy.TryGetValue(parentAttempt, out parentAttempt)); return NullFlavor.NoInformation; }
private NullFlavor GetNullFlavor(PartBridge tealBean) { NullFlavor nullFlavor = Ca.Infoway.Messagebuilder.Domainvalue.Nullflavor.NullFlavor.NO_INFORMATION; if (tealBean.HasNullFlavor()) { nullFlavor = tealBean.GetNullFlavor(); } return(nullFlavor); }
internal void SetNameNull(NullFlavor nullValue) { name = new List <PN>(); PN thisname = new PN(); thisname.NullFlavor = new CS <NullFlavor>(nullValue); name.Add(thisname); }
private void EnsureNotPinfOrNinf(string intervalElement, NullFlavor nullFlavor, IList <string> errors) { if (nullFlavor != null) { if (Ca.Infoway.Messagebuilder.Domainvalue.Nullflavor.NullFlavor.POSITIVE_INFINITY.CodeValue.Equals(nullFlavor.CodeValue) || Ca.Infoway.Messagebuilder.Domainvalue.Nullflavor.NullFlavor.NEGATIVE_INFINITY.CodeValue.Equals(nullFlavor.CodeValue)) { errors.Add("The " + intervalElement + " element can not have a null flavor of PINF or NINF."); } } }
/// <summary>Constructs an Interval using the supplied parameters.</summary> /// <remarks>Constructs an Interval using the supplied parameters.</remarks> /// <TBD></TBD> /// <param name="centre">the centre bound</param> /// <param name="width">the width as a Diff object</param> /// <param name="centreNullFlavor"></param> /// <returns>the constructed interval</returns> public static Interval <T> CreateCentreWidth <T>(T centre, Diff <T> width, NullFlavor centreNullFlavor) { bool widthNull = (width == (Diff <T>)null); T half = GenericMath.Half(widthNull ? default(T) : width.Value); Diff <T> tempDiff = GenericMath.Diff(half, centre); bool tempDiffNull = (tempDiff == (Diff <T>)null); T low = tempDiffNull ? default(T) : tempDiff.Value; T high = GenericMath.Add(low, width); return(new Interval <T>(low, high, centre, width, Representation.CENTRE_WIDTH, null, null, centreNullFlavor)); }
public static Extension CreateNullElementExtension(NullFlavor nullFlavor) { return(new Extension() { Url = GetExtensionNameUrl("data-absent-reason"), Value = new Coding( typeof(NullFlavor).GetValueSetDefinition(), MARC.Everest.Connectors.Util.ToWireFormat(nullFlavor) ) }); }
public virtual NullFlavor GetNullFlavor() { NullFlavor result = null; if (this.bean is NullFlavorSupport) { NullFlavorSupport nullable = (NullFlavorSupport)this.bean; result = nullable.NullFlavor; } return(result); }
/// <summary> /// Cascade a null flavor /// </summary> static void CascadeNullFlavor(IImplementsNullFlavor me, NullFlavor flavor) { me.NullFlavor = flavor; foreach (var propertyInfo in me.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance)) { Type propertyType = propertyInfo.PropertyType; if (typeof(IList).IsAssignableFrom(propertyType)) // correct for lists propertyType = propertyType.GetGenericArguments()[0]; // Only IImpleentsNullFlavor should be allowed if (!typeof(IImplementsNullFlavor).IsAssignableFrom(propertyType)) continue; var instance = propertyInfo.GetValue(me, null) as IImplementsNullFlavor; // Make some intelligent decisions about populating var propertyAtt = propertyInfo.GetCustomAttributes(typeof(PropertyAttribute), true); if (propertyAtt.Length > 0) { var strongPropertyAtt = propertyAtt[0] as PropertyAttribute; // Don't set a null flavor on structural (attributes) if (strongPropertyAtt.PropertyType == PropertyAttribute.AttributeAttributeType.Structural) continue; if (strongPropertyAtt.Conformance == PropertyAttribute.AttributeConformanceType.Optional && instance == null) continue; } // is this a list or IImplementsNullFlavor if (instance == null) { var constructorInfo = propertyType.GetConstructor(Type.EmptyTypes); if (constructorInfo == null) continue; // sanity check, can't create // Construct an instance instance = constructorInfo.Invoke(null) as IImplementsNullFlavor; } // Don't cascade down data types if (instance is IAny) instance.NullFlavor = flavor; else CascadeNullFlavor(instance, flavor); // Set if not a list if (propertyInfo.PropertyType == propertyType) propertyInfo.SetValue(me, instance, null); else // Add to list if not (propertyInfo.GetValue(me, null) as IList).Add(instance); } }
/// <summary>Constructs an Interval using the supplied parameters.</summary> /// <remarks>Constructs an Interval using the supplied parameters.</remarks> /// <param name="centre"></param> /// <param name="high"></param> /// <param name="centreNullFlavor"></param> /// <param name="highNullFlavor"></param> /// <returns>the constructed interval</returns> public static Interval <T> CreateCentreHigh <T>(T centre, T high, NullFlavor centreNullFlavor, NullFlavor highNullFlavor) { Diff <T> tempDiff = GenericMath.Diff(centre, high); bool tempDiffNull = (tempDiff == (Diff <T>)null); T halfDiff = tempDiffNull ? default(T) : tempDiff.Value; Diff <T> tempDiff2 = GenericMath.Diff(halfDiff, centre); bool tempDiff2Null = (tempDiff2 == (Diff <T>)null); T low = tempDiff2Null ? default(T) : tempDiff2.Value; Diff <T> width = GenericMath.Diff(low, high); return(new Interval <T>(low, high, centre, width, Representation.CENTRE_HIGH, null, highNullFlavor, centreNullFlavor)); }
/// <summary> /// Gets a common ancestor /// </summary> public static NullFlavor CommonAncestorWith(this NullFlavor a, NullFlavor other) { NullFlavor parentAttempt = a; do { if (other.IsChildConcept(parentAttempt)) { return(parentAttempt); } } while (m_heirarchy.TryGetValue(parentAttempt, out parentAttempt)); return(NullFlavor.NoInformation); }
/// <summary> /// Returns true if <paramref name="a"/> implies <paramref name="implied"/> /// </summary> public static bool IsChildConcept(this NullFlavor a, NullFlavor parent) { NullFlavor parentAttempt = a; do { if (parentAttempt == parent) { return(true); } } while (m_heirarchy.TryGetValue(parentAttempt, out parentAttempt)); return(false); }
public void CSCastGenericToTypeTest() { //CS<NullFlavor>.Code = Other CS <NullFlavor> csInstance = new CS <NullFlavor>(); csInstance.Code = NullFlavor.Other; // Cast CS<T> to T NullFlavor nvInstance = (NullFlavor)csInstance; // True if cast was successful Assert.IsTrue(nvInstance == NullFlavor.Other); }
internal virtual BareANY CopyAndReturnAdapted(BareANY any, BareANY adaptedAny, object newValue) { if (any.HasNullFlavor()) { NullFlavor nullFlavor = any.NullFlavor; adaptedAny.NullFlavor = nullFlavor; } else { ((BareANYImpl)adaptedAny).BareValue = newValue; } return(adaptedAny); }
public void CECastTypeToCEGenericTest() { // set NullFlavor.Other NullFlavor mode = NullFlavor.Other; // create an CE<NullFlavor> instance CE <NullFlavor> ceInstance = new CE <NullFlavor>(); // instance is a CE<T> where T is a nullflavor // cast T to CE<T> ceInstance = mode; // will be true if cast was successful Assert.IsTrue(ceInstance.Code == NullFlavor.Other); }
public virtual NullFlavor GetNullFlavor() { //AG: make sure we always traverse down collapsed associations. NullFlavor nullFlavor = null; if (this.parentWrapper == null) { if (this.sorter.GetBean() is NullFlavorSupport) { return(((NullFlavorSupport)this.sorter.GetBean()).NullFlavor); } } return(nullFlavor); }
/// <exception cref="Ca.Infoway.Messagebuilder.Marshalling.HL7.XmlToModelTransformationException"></exception> public virtual BareANY Parse(ParseContext context, XmlNode node, XmlToModelResult xmlToModelResult) { BareANY result = CreateDataTypeInstance(context != null ? GetType(context) : null); if (HasValidNullFlavorAttribute(context, node, xmlToModelResult)) { NullFlavor nullFlavor = ParseNullNode(context, node, xmlToModelResult); result.NullFlavor = nullFlavor; } else { V value = ParseNonNullNode(context, node, result, GetReturnType(context), xmlToModelResult); ((BareANYImpl)result).BareValue = value; } return(result); }
internal Interval(T low_0, T high_1, T centre_2, Diff <T> width_3, Representation representation_4, NullFlavor lowNullFlavor_5, NullFlavor highNullFlavor_6, NullFlavor centreNullFlavor_7, T value_ren_8, SetOperator setOperator_9, Boolean?lowInclusive_10, Boolean?highInclusive_11) : base(value_ren_8, setOperator_9) { this.low = low_0; this.high = high_1; this.centre = centre_2; this.width = width_3; this.representation = representation_4; this.lowNullFlavor = lowNullFlavor_5; this.highNullFlavor = highNullFlavor_6; this.centreNullFlavor = centreNullFlavor_7; LowInclusive = lowInclusive_10; HighInclusive = highInclusive_11; }
private void DoOtherValidations(BareANY lowAny, BareANY highAny, BareANY centerAny, BareDiff widthType, XmlElement element , ParseContext context, XmlToModelResult xmlToModelResult) { string type = context.Type; NullFlavor lowNullFlavor = (lowAny == null ? null : lowAny.NullFlavor); NullFlavor centerNullFlavor = (centerAny == null ? null : centerAny.NullFlavor); NullFlavor highNullFlavor = (highAny == null ? null : highAny.NullFlavor); NullFlavor widthNullFlavor = (widthType == null ? null : widthType.NullFlavor); Ca.Infoway.Messagebuilder.Domainvalue.UnitsOfMeasureCaseSensitive widthTimeUnits = ((widthType != null && widthType is DateDiff ) ? ((DateDiff)widthType).Unit : null); IList <string> errors = this.ivlValidationUtils.DoOtherValidations(type, lowNullFlavor, centerNullFlavor, highNullFlavor, widthNullFlavor, widthTimeUnits); RecordAnyErrors(errors, element, xmlToModelResult); }
protected override IDictionary <string, string> GetAttributeNameValuePairs(FormatContext context, V t, BareANY bareAny) { IDictionary <string, string> result = new Dictionary <string, string>(); if (t != null) { result["value"] = GetValue(t, context, bareAny); AddOtherAttributesIfNecessary(t, result, context, bareAny); } else { NullFlavor providedNullFlavor = bareAny.NullFlavor; result[AbstractPropertyFormatter.NULL_FLAVOR_ATTRIBUTE_NAME] = providedNullFlavor == null ? AbstractPropertyFormatter.NULL_FLAVOR_NO_INFORMATION : providedNullFlavor.CodeValue; } return(result); }
public virtual BareANY Adapt(string toDataTypeName, BareANY any) { MethodInfo rawCollectionMethod = any.GetType().GetMethod("RawCollection"); ICollection <object> collection = (ICollection <object>)rawCollectionMethod.Invoke(any, new object[] { }); SETImpl <TNImpl, TrivialName> adaptedSet = new SETImpl <TNImpl, TrivialName>(typeof(TNImpl)); if (any.HasNullFlavor()) { NullFlavor nullFlavor = any.NullFlavor; adaptedSet.NullFlavor = nullFlavor; } else { adaptedSet.RawSet().AddAll(ToSetOfTrivialName(collection)); } return(adaptedSet); }
private IList <EntityNamePart> ParseNameParts(ParseContext context, XmlNodeList childNodes, XmlToModelResult xmlToModelResult ) { IList <EntityNamePart> parts = new List <EntityNamePart>(); foreach (XmlNode childNode in new XmlNodeListIterable(childNodes)) { if (childNode is XmlElement) { XmlElement element = (XmlElement)childNode; string name = NodeUtil.GetLocalOrTagName(element); if (!StringUtils.Equals(AbstractNameR2ElementParser <V> .VALID_TIME_ELEMENT, name)) { if (StringUtils.Equals("TN", context.Type)) { RecordError("TN fields only support text and a single (optional) validTime element. Found element: " + name, element, xmlToModelResult ); } else { NullFlavor nullFlavor = GetNullFlavor(element, xmlToModelResult); string value = GetTextValue(element, xmlToModelResult); EntityNamePartQualifier qualifier = GetQualifier(context, element, xmlToModelResult); if (StringUtils.IsNotBlank(value) || nullFlavor != null) { NamePartType namePartType = GetNamePartType(name, context.Type, element, xmlToModelResult); if (namePartType != null) { parts.Add(new EntityNamePart(value, namePartType, qualifier, nullFlavor)); } } } } } else { if (IsNonBlankTextNode(childNode)) { parts.Add(new EntityNamePart(childNode.Value.Trim(), null)); } } } return(parts); }
internal void SetRecipientRoleCode(NullFlavor nullType) { recipientRoleCode = new CV<string>(); recipientRoleCode.NullFlavor = nullType; }
internal void SetDischargeDispositionCode(NullFlavor nullFlavorValue) { dischargeDispositionCode = new CV<string>(); dischargeDispositionCode.NullFlavor = nullFlavorValue; }
internal void SetNameNull(NullFlavor nullValue) { name = new List<PN>(); PN thisname = new PN(); thisname.NullFlavor = new CS<NullFlavor>(nullValue); name.Add(thisname); }