Exemplo n.º 1
0
        public virtual T Get(string name)
        {
            T result = this.registryMap.SafeGet(name);

            if (result == null)
            {
                result = this.registryMap.SafeGet(Hl7DataTypeName.GetTypeWithoutParameters(name));
            }
            if (result == null)
            {
                result = this.registryMap.SafeGet(Hl7DataTypeName.Unqualify(name));
            }
            if (result == null)
            {
                result = this.registryMap.SafeGet(Hl7DataTypeName.GetTypeWithoutParameters(Hl7DataTypeName.Unqualify(name)));
            }
            return(result);
        }
Exemplo n.º 2
0
        public virtual IList <string> ValidateCorrectElementsProvided(string type, VersionNumber version, bool lowProvided, bool highProvided
                                                                      , bool centerProvided, bool widthProvided)
        {
            IList <string>   errors                       = new List <string>();
            StandardDataType standardDataType             = StandardDataType.GetByTypeName(type);
            bool             isCeRx                       = SpecificationVersion.IsVersion(standardDataType, version, Hl7BaseVersion.CERX);
            string           typeWithoutParameters        = Hl7DataTypeName.GetTypeWithoutParameters(type);
            string           parameterizedType            = Hl7DataTypeName.GetParameterizedType(type);
            string           unqualifiedParameterizedType = Hl7DataTypeName.Unqualify(parameterizedType);
            StandardDataType ivlType                      = StandardDataType.GetByTypeName(typeWithoutParameters);
            StandardDataType innerType                    = StandardDataType.GetByTypeName(parameterizedType);
            StandardDataType baseInnerType                = StandardDataType.GetByTypeName(unqualifiedParameterizedType);
            int numberOfCorrectlyProvidedElements         = this.CountProvidedElements(lowProvided, highProvided, centerProvided, widthProvided
                                                                                       );

            if (lowProvided && this.IsLowProhibited(ivlType))
            {
                numberOfCorrectlyProvidedElements--;
                errors.Add(this.CreateIncorrectElementErrorMessage(type, "low"));
            }
            if (highProvided && this.IsHighProhibited(ivlType))
            {
                numberOfCorrectlyProvidedElements--;
                errors.Add(this.CreateIncorrectElementErrorMessage(type, "high"));
            }
            if (widthProvided && this.IsWidthProhibited(ivlType, innerType, baseInnerType))
            {
                numberOfCorrectlyProvidedElements--;
                errors.Add(this.CreateIncorrectElementErrorMessage(type, "width"));
            }
            if (centerProvided && this.IsCenterProhibited(isCeRx, innerType))
            {
                numberOfCorrectlyProvidedElements--;
                errors.Add(this.CreateIncorrectElementErrorMessage(type, "center"));
            }
            if (this.IncorrectNumberOfElementsProvided(numberOfCorrectlyProvidedElements, ivlType))
            {
                errors.Add(this.CreateWrongNumberOfElementsProvidedErrorMessage(isCeRx, type, ivlType, innerType, baseInnerType));
            }
            return(errors);
        }