Exemplo n.º 1
0
        private void Validate(StringBuilder buffer, int indentLevel, FormatContext context, bool isStLang, BareANY dataType)
        {
            // ST.LANG not allowed for CeRx; not checking as this should be controlled by the message set
            // is ST allowed to be 0 length or only whitespace???
            ModelToXmlResult result   = context.GetModelToXmlResult();
            string           language = GetLanguage(dataType);

            if (isStLang)
            {
                if (!STImpl.ALLOWED_LANGUAGES.Contains(language))
                {
                    Hl7Error hl7Error = new Hl7Error(Hl7ErrorCode.DATA_TYPE_ERROR, System.String.Format("The language attribute content ({0}) is not an allowed value. Using en-CA instead."
                                                                                                        , language), context.GetPropertyPath());
                    result.AddHl7Error(hl7Error);
                }
            }
            else
            {
                if (language != null)
                {
                    Hl7Error hl7Error = new Hl7Error(Hl7ErrorCode.DATA_TYPE_ERROR, System.String.Format("The language attribute ({0}) is not allowed for ST element types"
                                                                                                        , language), context.GetPropertyPath());
                    result.AddHl7Error(hl7Error);
                }
            }
        }
Exemplo n.º 2
0
        private void Validate(StringBuilder buffer, int indentLevel, FormatContext context, bool hasLang, BareANY dataType)
        {
            // ST has min length of 1 according to schema, and cannot have both a NF and text
            // no details on what language strings are allowed
            ModelToXmlResult result = context.GetModelToXmlResult();

            if (dataType.HasNullFlavor())
            {
                if (dataType.BareValue != null)
                {
                    Hl7Error hl7Error = new Hl7Error(Hl7ErrorCode.DATA_TYPE_ERROR, "ST cannot have both a nullFlavour and a text value.", context
                                                     .GetPropertyPath());
                    result.AddHl7Error(hl7Error);
                }
            }
            else
            {
                if (StringUtils.IsBlank(GetStringValue(dataType)))
                {
                    Hl7Error hl7Error = new Hl7Error(Hl7ErrorCode.DATA_TYPE_ERROR, "ST text value must be provided.", context.GetPropertyPath
                                                         ());
                    result.AddHl7Error(hl7Error);
                }
            }
            if (hasLang && StringUtils.IsBlank(GetLanguage(dataType)))
            {
                Hl7Error hl7Error = new Hl7Error(Hl7ErrorCode.DATA_TYPE_ERROR, "ST language attribute, if provided, can not be blank.", context
                                                 .GetPropertyPath());
                result.AddHl7Error(hl7Error);
            }
        }
Exemplo n.º 3
0
 private void RecordMissingValueError(string propertyPath, ModelToXmlResult modelToXmlResult)
 {
     modelToXmlResult.AddHl7Error(new Hl7Error(Hl7ErrorCode.DATA_TYPE_ERROR, "The attribute \"value\" is mandatory and must be specified."
                                               , propertyPath));
 }
Exemplo n.º 4
0
 private void RecordCurrencyMustBeCadError(string propertyPath, ModelToXmlResult modelToXmlResult)
 {
     modelToXmlResult.AddHl7Error(new Hl7Error(Hl7ErrorCode.DATA_TYPE_ERROR, "The attribute \"currency\" has been provided, but it must be CAD."
                                               , propertyPath));
 }
Exemplo n.º 5
0
 private void RecordMustContainDigitsOnlyError(string value, string propertyPath, ModelToXmlResult result)
 {
     result.AddHl7Error(new Hl7Error(Hl7ErrorCode.DATA_TYPE_ERROR, "Value \"" + value + "\" can only contain digits, with a maximum of "
                                     + MAX_DIGITS_BEFORE_DECIMAL + " before the decimal and " + MAX_DIGITS_AFTER_DECIMAL + " after the decimal.", propertyPath
                                     ));
 }
Exemplo n.º 6
0
 private void RecordTooManyDigitsBeforeDecimalError(string value, string propertyPath, ModelToXmlResult result)
 {
     result.AddHl7Error(new Hl7Error(Hl7ErrorCode.DATA_TYPE_ERROR, "Value " + value + " of type MO.CAD" + " should have no more than "
                                     + MAX_DIGITS_BEFORE_DECIMAL + " digits before the decimal", propertyPath));
 }
Exemplo n.º 7
0
 private void RecordNotNegativeError(Int32?integer, string propertyPath, ModelToXmlResult modelToXmlResult)
 {
     modelToXmlResult.AddHl7Error(new Hl7Error(Hl7ErrorCode.DATA_TYPE_ERROR, "The attribute \"value\" must not be negative for INT.NONNEG."
                                               , propertyPath));
 }
Exemplo n.º 8
0
		private void RecordTooManyDigitsToRightOfDecimalError(string propertyPath, ModelToXmlResult modelToXmlResult)
		{
			modelToXmlResult.AddHl7Error(new Hl7Error(Hl7ErrorCode.DATA_TYPE_ERROR, "Value for REAL.COORD must have no more than " + 
				realFormat.GetMaxDecimalPartLength() + " digits to the right of the decimal. Value has been modified to fit format requirements."
				, propertyPath));
		}
Exemplo n.º 9
0
 private void RecordMustContainDigitsOnlyError(string value, string propertyPath, ModelToXmlResult result)
 {
     result.AddHl7Error(new Hl7Error(Hl7ErrorCode.DATA_TYPE_ERROR, "Value \"" + value + "\" can only contain digits.", propertyPath
                                     ));
 }
Exemplo n.º 10
0
 private void RecordMustBeGreaterThanZeroError(Int32?integer, string propertyPath, ModelToXmlResult modelToXmlResult)
 {
     modelToXmlResult.AddHl7Error(new Hl7Error(Hl7ErrorCode.DATA_TYPE_ERROR, "The attribute \"value\" must be greater than zero for INT.POS."
                                               , propertyPath));
 }
Exemplo n.º 11
0
 private void RecordValueMustBeBetweenZeroAndOneError(string propertyPath, ModelToXmlResult modelToXmlResult)
 {
     modelToXmlResult.AddHl7Error(new Hl7Error(Hl7ErrorCode.DATA_TYPE_ERROR, "Value for REAL.CONF must be between 0 and 1 (inclusive). Value may have been modified to fit format requirements."
                                               , propertyPath));
 }