示例#1
0
        internal void Validate(ANY instance, string path, DatatypeFormatterParseResult resultDetails)
        {
            // Don't validate null
            if (instance == null)
            {
                return;
            }

            IResultDetail[] flavor;

            // Validate
            if (resultDetails.ValidateConformance && !instance.Validate())
            {
                foreach (var dtl in instance.ValidateEx())
                {
                    dtl.Location = path;
                    resultDetails.AddResultDetail(dtl);
                }
            }

            // Validate flavor...
            if (instance.Flavor != null && resultDetails.ValidateConformance && Util.ValidateFlavor(instance.Flavor.ToUpper(), instance, out flavor) == false)
            {
                resultDetails.AddResultDetail(new DatatypeFlavorValidationResultDetail(ResultDetailType.Warning, instance.GetType().Name, instance.Flavor, path));
            }

            // Append details
        }
示例#2
0
        /// <summary>
        /// Graph <paramref name="o"/> onto <paramref name="s"/>
        /// </summary>
        /// <param name="s">The stream to graph to</param>
        /// <param name="o">The object to graph</param>
        public override void Graph(System.Xml.XmlWriter s, object o, DatatypeFormatterGraphResult result)
        {
            // Graph this UVP to the stream
            base.Graph(s, o, result);

            // Add probability
            if ((o as ANY).NullFlavor != null)
            {
                return; // No need for this
            }
            object probValue  = o.GetType().GetProperty("Probability").GetValue(o, null),
                   valueValue = o.GetType().GetProperty("Value").GetValue(o, null);

            // Output XSI:TYPE
            // TODO: Safety check this method in the future
            s.WriteAttributeString("xsi", "type", DatatypeFormatter.NS_XSI, Util.CreateXSITypeName(o.GetType()));

            if (probValue != null)
            {
                s.WriteAttributeString("probability", Util.ToWireFormat(probValue));
            }

            // Graph the value
            ANY anyValue = valueValue as ANY;

            if (anyValue == null)
            {
                return;
            }

            var hostResult = this.Host.Graph(s, anyValue);

            result.Code = hostResult.Code;
            result.AddResultDetail(hostResult.Details);
        }
示例#3
0
 public Observation()
 {
     this.negationInd        = new BLImpl();
     this.typeId             = new IIImpl();
     this.templateId         = new LISTImpl <II, Identifier>(typeof(IIImpl));
     this.id                 = new LISTImpl <II, Identifier>(typeof(IIImpl));
     this.derivationExpr     = new STImpl();
     this.text               = new EDImpl <EncapsulatedData>();
     this.statusCode         = new CSImpl();
     this.effectiveTime      = new IVLTSCDAR1Impl();
     this.priorityCode       = new CEImpl();
     this.repeatNumber       = new IVLImpl <INT, Interval <int?> >();
     this.languageCode       = new CSImpl();
     this.value              = new ANYImpl <object>();
     this.interpretationCode = new LISTImpl <CE, Code>(typeof(CEImpl));
     this.methodCode         = new LISTImpl <CE, Code>(typeof(CEImpl));
     this.targetSiteCode     = new LISTImpl <CD, Code>(typeof(CDImpl));
     this.specimen           = new List <Ca.Infoway.Messagebuilder.Model.Ccda_pcs_r1_1.Merged.Specimen>();
     this.performer          = new List <Ca.Infoway.Messagebuilder.Model.Ccda_pcs_r1_1.Merged.Performer2_1>();
     this.author             = new List <Ca.Infoway.Messagebuilder.Model.Ccda_pcs_r1_1.Merged.Author_1>();
     this.informant          = new List <Ca.Infoway.Messagebuilder.Model.Ccda_pcs_r1_1.Merged.Informant12>();
     this.participant        = new List <Ca.Infoway.Messagebuilder.Model.Ccda_pcs_r1_1.Merged.Participant2_2>();
     this.entryRelationship  = new List <Ca.Infoway.Messagebuilder.Model.Ccda_pcs_r1_1.Merged.EntryRelationship_2>();
     this.reference          = new List <Ca.Infoway.Messagebuilder.Model.Ccda_pcs_r1_1.Basemodel.Reference>();
     this.precondition       = new List <Ca.Infoway.Messagebuilder.Model.Ccda_pcs_r1_1.Basemodel.Precondition>();
     this.referenceRange     = new List <Ca.Infoway.Messagebuilder.Model.Ccda_pcs_r1_1.Merged.ReferenceRange>();
 }
        public static CdaSimpleObservation CreateObservation(POCD_MT000040Observation pocdObservation)
        {
            CdaSimpleObservation returnVal = null;

            if (pocdObservation.value != null)
            {
                if (pocdObservation.value.Length > 0)
                {
                    ANY first = pocdObservation.value[0];

                    if (first is INT)
                    {
                        returnVal = new CdaIntObservation(pocdObservation);
                    }
                    else if (first is TS)
                    {
                        returnVal = new CdaDateObservation(pocdObservation);
                    }
                    else if (first is PQ)
                    {
                        returnVal = new CdaPqObservation(pocdObservation);
                    }
                    else if (first is ST)
                    {
                        returnVal = new CdaTextObservation(pocdObservation);
                    }
                }
            }

            return(returnVal);
        }
示例#5
0
 public IssueDescription()
 {
     this.id         = new IIImpl();
     this.text       = new ANYImpl <object>();
     this.authorTime = new TSImpl();
     this.authorAssignedEntityAssignedOrganizationName = new STImpl();
 }
示例#6
0
        public static bool?ValidateFlavor(string flavor, ANY instance, out IResultDetail[] details)
        {
            // Does this flavor exist?
            string kFormat = string.Format(CultureInfo.InvariantCulture, "{0}.{1}", instance.GetType().FullName, flavor.ToUpper());

            // JF - Makes this much faster
            MethodInfo validatorMi = null;

            if (s_flavorValidation.TryGetValue(kFormat, out validatorMi))
            {
                details = new IResultDetail[0];
                return((bool)validatorMi.Invoke(null, new object[] { instance }));
            }

            details = new IResultDetail[0];

            // Add warning
            if (flavor != instance.GetType().Name)
            {
                details = new IResultDetail[] { new ResultDetail(ResultDetailType.Warning, string.Format(EverestFrameworkContext.CurrentCulture, "Can't find flavor '{0}'", flavor), null, null) }
            }
            ;

            return(null);
        }
        public object Parse(System.Xml.XmlReader s, DatatypeFormatterParseResult result)
        {
            ANY instance = new ANY();

            // Read the NullFlavor, and Specialization data from the wire
            if (s.GetAttribute("nullFlavor") != null) // Stop processing if null flavor is present
            {
                instance.NullFlavor = (NullFlavor)Util.FromWireFormat(s.GetAttribute("nullFlavor"), typeof(NullFlavor));
            }
            else if (s.GetAttribute("specializationType") != null && result.CompatibilityMode == DatatypeFormatterCompatibilityMode.Canadian)
            {
                instance.Flavor = s.GetAttribute("specializationType");
            }

            if (result.ValidateConformance && !instance.Validate())
            {
                result.AddResultDetail(new DatatypeValidationResultDetail(ResultDetailType.Error, instance.GetType().Name, s.ToString()));
            }

            // Disabled for test
            // Validate flavor...
            IResultDetail[] flavor;
            if (instance.Flavor != null && result.ValidateConformance && Util.ValidateFlavor(instance.Flavor.ToUpper(), instance, out flavor) == false)
            {
                result.AddResultDetail(new DatatypeFlavorValidationResultDetail(ResultDetailType.Warning, instance.GetType().Name, instance.Flavor, s.ToString()));
                result.AddResultDetail(flavor);
            }

            return(instance);
        }
示例#8
0
 public Observation()
 {
     this.negationInd        = new BLImpl();
     this.typeId             = new IIImpl();
     this.templateId         = new LISTImpl <II, Identifier>(typeof(IIImpl));
     this.id                 = new LISTImpl <II, Identifier>(typeof(IIImpl));
     this.code               = new CD_R2Impl <Ca.Infoway.Messagebuilder.Model.Ccda_r1_1.Domainvalue.LOINC>();
     this.derivationExpr     = new STImpl();
     this.text               = new EDImpl <EncapsulatedData>();
     this.effectiveTime      = new IVL_TSImpl();
     this.priorityCode       = new CE_R2Impl <Code>();
     this.repeatNumber       = new IVLImpl <INT, Interval <int?> >();
     this.languageCode       = new CS_R2Impl <Code>();
     this.value              = new ANYImpl <object>();
     this.interpretationCode = new LISTImpl <CE_R2 <Code>, CodedTypeR2 <Code> >(typeof(CE_R2Impl <Code>));
     this.methodCode         = new CE_R2Impl <Code>();
     this.targetSiteCode     = new CD_R2Impl <Code>();
     this.specimen           = new List <Ca.Infoway.Messagebuilder.Model.Ccda_r1_1.Merged.Specimen>();
     this.performer          = new List <Ca.Infoway.Messagebuilder.Model.Ccda_r1_1.Merged.Performer2_1>();
     this.informant          = new List <Ca.Infoway.Messagebuilder.Model.Ccda_r1_1.Merged.Informant12>();
     this.participant        = new List <Ca.Infoway.Messagebuilder.Model.Ccda_r1_1.Merged.Participant2_2>();
     this.entryRelationship  = new List <Ca.Infoway.Messagebuilder.Model.Ccda_r1_1.Merged.IEntryRelationshipChoice_4>();
     this.reference          = new List <Ca.Infoway.Messagebuilder.Model.Ccda_r1_1.Basemodel.Reference>();
     this.precondition       = new List <Ca.Infoway.Messagebuilder.Model.Ccda_r1_1.Basemodel.Precondition>();
     this.referenceRange     = new List <Ca.Infoway.Messagebuilder.Model.Ccda_r1_1.Merged.ReferenceRange>();
 }
示例#9
0
 public Criterion()
 {
     this.classCode  = new CS_R2Impl <ActClassObservation>();
     this.typeId     = new IIImpl();
     this.templateId = new LISTImpl <II, Identifier>(typeof(IIImpl));
     this.code       = new CD_R2Impl <Code>();
     this.text       = new EDImpl <EncapsulatedData>();
     this.value      = new ANYImpl <object>();
 }
示例#10
0
 public CultureObservations()
 {
     this.code          = new CDImpl();
     this.text          = new STImpl();
     this.statusCode    = new CSImpl();
     this.effectiveTime = new IVLImpl <TS, Interval <PlatformDate> >();
     this.value         = new ANYImpl <object>();
     this.subjectOf1    = new List <Ca.Infoway.Messagebuilder.Model.Pcs_mr2009_r02_04_02.Merged.Includes>();
 }
示例#11
0
 public ReportSectionObservation()
 {
     this.id                  = new IIImpl();
     this.code                = new CDImpl();
     this.text                = new STImpl();
     this.effectiveTime       = new TSImpl();
     this.confidentialityCode = new SETImpl <CV, Code>(typeof(CVImpl));
     this.value               = new ANYImpl <object>();
 }
示例#12
0
 public ObservationRange()
 {
     this.classCode          = new CSImpl();
     this.typeId             = new IIImpl();
     this.templateId         = new LISTImpl <II, Identifier>(typeof(IIImpl));
     this.code               = new CDImpl();
     this.text               = new EDImpl <EncapsulatedData>();
     this.value              = new ANYImpl <object>();
     this.interpretationCode = new CEImpl();
 }
示例#13
0
 /// <summary>
 /// Copy base attributes from one ANY to another
 /// </summary>
 internal static void CopyBaseAttributes(ANY source, ANY dest)
 {
     dest.ControlActExt  = source.ControlActExt;
     dest.ControlActRoot = source.ControlActRoot;
     dest.Flavor         = source.Flavor;
     dest.NullFlavor     = source.NullFlavor;
     dest.UpdateMode     = source.UpdateMode;
     dest.ValidTimeHigh  = source.ValidTimeHigh;
     dest.ValidTimeLow   = source.ValidTimeLow;
 }
示例#14
0
        public object Parse(System.Xml.XmlReader s, DatatypeFormatterParseResult result)
        {
            ANYFormatter pdvFormatter = new ANYFormatter();

            // parse PDV portion
            Type            uvpType = typeof(UVP <>).MakeGenericType(GenericArguments);
            ConstructorInfo ci      = uvpType.GetConstructor(Type.EmptyTypes);
            ANY             retVal  = ci.Invoke(null) as ANY;

            // Property information
            PropertyInfo probabilityProperty = uvpType.GetProperty("Probability"),
                         valueProperty       = uvpType.GetProperty("Value");

            // Clean the
            if (s.GetAttribute("type", DatatypeFormatter.NS_XSI) != null && s is XmlStateReader)
            {
                (s as XmlStateReader).AddFakeAttribute("type", Util.CreateXSITypeName(GenericArguments[0]));
            }

            // Probability
            if (s.GetAttribute("probability") != null)
            {
                decimal prob = (decimal)0.0f;
                if (!Decimal.TryParse(s.GetAttribute("probability"), out prob)) // Try to parse
                {
                    result.AddResultDetail(new ResultDetail(ResultDetailType.Warning, string.Format("Value '{0}' can't be processed into 'Probability' on data type UVP", s.GetAttribute("probability")), s.ToString(), null));
                }
                else // Success, so assign
                {
                    probabilityProperty.SetValue(retVal, prob, null);
                }
            }

            // Set value
            var hostResult = Host.Parse(s, GenericArguments[0]);

            result.Code = hostResult.Code;
            result.AddResultDetail(hostResult.Details);
            valueProperty.SetValue(retVal, hostResult.Structure, null);

            // Move null flavors and flavors up
            ANY resultAny = hostResult.Structure as ANY;

            retVal.NullFlavor    = resultAny.NullFlavor;
            resultAny.NullFlavor = null;
            retVal.Flavor        = resultAny.Flavor;
            resultAny.Flavor     = null;

            // Validate the data type
            ANYFormatter validator = new ANYFormatter();
            string       pathName  = s is XmlStateReader ? (s as XmlStateReader).CurrentPath : s.Name;

            validator.Validate(retVal, pathName, result);
            return(retVal);
        }
示例#15
0
文件: FacadeBase.cs 项目: swmuir/khie
 /// MDHT operation: asks whether the content has actual content (except for the nullFlavor attribute)
 public bool hasContent(ANY o)
 {
     foreach (PropertyInfo field in o.GetType().GetProperties())
     {
         Object value = field.GetValue(o, null);
         if (value != null && field.Name != "nullFlavor")
         {
             return(true);
         }
     }
     return(false);
 }
示例#16
0
 internal AttributeValueBridge(Relationship relationship, object value)
 {
     this.relationship = relationship;
     if (value is ANY <object> )
     {
         this.any   = (ANY <object>)value;
         this.value = any.Value;
     }
     else
     {
         this.value = value;
         this.any   = null;
     }
 }
示例#17
0
        private ICollection <ANY <object> > ObtainFieldInCollection(string propertyName, int indexInList)
        {
            ICollection <ANY <object> > value = null;
            object rawField = GetField(propertyName);

            if (rawField == null)
            {
                log.Error(string.Format("The field %s.%s was not found", this.GetType().Name, propertyName));
                return(null);
            }
            // the rawField will either be an ANY type or a List
            if (rawField is ANY <object> )
            {
                ANY <object> field = (ANY <object>)rawField;
                if (field.Value is ICollection <object> )
                {
                    value = (ICollection <ANY <object> >)field.Value;
                }
                else
                {
                    log.Error(string.Format("The field %s.%s was expected to be of type LIST/SET/COLLECTION. Cannot process.", this.GetType
                                                ().Name, propertyName));
                    return(null);
                }
            }
            else
            {
                if (rawField is ICollection <object> )
                {
                    value = (ICollection <ANY <object> >)rawField;
                }
                else
                {
                    log.Error(string.Format("The field %s.%s was expected to be a Collection type (typically List). Cannot process.", this
                                            .GetType().Name, propertyName));
                    return(null);
                }
            }
            if (indexInList >= value.Count)
            {
                log.Error("Property " + propertyName + " has " + value.Count + " elements, but trying to access element " + indexInList
                          + ". Cannot process.");
                return(null);
            }
            return(value);
        }
示例#18
0
 public DiagnosisOrInterpretationObservation() {
     this.id = new SETImpl<II, Identifier>(typeof(IIImpl));
     this.code = new CDImpl();
     this.text = new STImpl();
     this.statusCode = new CSImpl();
     this.effectiveTime = new TSImpl();
     this.confidentialityCode = new SETImpl<CV, Code>(typeof(CVImpl));
     this.value = new ANYImpl<object>();
     this.specimen = new List<Ca.Infoway.Messagebuilder.Model.Pcs_mr2009_r02_04_02.Lab.Merged.ReportSectionSpecimen>();
     this.receiverRoleChoice = new List<Ca.Infoway.Messagebuilder.Model.Pcs_mr2009_r02_04_02.Lab.Merged.IRoleChoice>();
     this.performer = new List<Ca.Infoway.Messagebuilder.Model.Pcs_mr2009_r02_04_02.Lab.Merged.WasPerformedBy>();
     this.inFulfillmentOfFulfillmentChoice = new List<Ca.Infoway.Messagebuilder.Model.Pcs_mr2009_r02_04_02.Lab.Merged.IFulfillmentChoice>();
     this.pertinentInformation2SupportingClinicalObservationEvent = new List<Ca.Infoway.Messagebuilder.Model.Pcs_mr2009_r02_04_02.Lab.Merged.SupportingClinicalInformation>();
     this.component1ReportableTestIndicator = new List<Ca.Infoway.Messagebuilder.Model.Pcs_mr2009_r02_04_02.Lab.Merged.ReportableHealthIndicator>();
     this.component3ReportLevelObservationEvent = new List<Ca.Infoway.Messagebuilder.Model.Pcs_mr2009_r02_04_02.Lab.Polb_mt004200ca.ReportSectionObservation>();
     this.component4ObservationChoice = new List<Ca.Infoway.Messagebuilder.Model.Pcs_mr2009_r02_04_02.Lab.Polb_mt004200ca.IObservationChoice>();
     this.subjectOf2 = new List<Ca.Infoway.Messagebuilder.Model.Pcs_mr2009_r02_04_02.Merged.Includes>();
 }
        internal void Validate(ANY instance, string path, DatatypeFormatterParseResult resultDetails)
        {
            IResultDetail[] flavor;

            // Validate
            if (resultDetails.ValidateConformance && !instance.Validate())
            {
                resultDetails.AddResultDetail(new DatatypeValidationResultDetail(ResultDetailType.Error, instance.GetType().Name, path));
            }

            // Validate flavor...
            if (instance.Flavor != null && resultDetails.ValidateConformance && Util.ValidateFlavor(instance.Flavor.ToUpper(), instance, out flavor) == false)
            {
                resultDetails.AddResultDetail(new DatatypeFlavorValidationResultDetail(ResultDetailType.Warning, instance.GetType().Name, instance.Flavor, path));
            }

            // Append details
        }
        /// <summary>
        /// Graph the SXCM to the console
        /// </summary>
        public void Graph(System.Xml.XmlWriter s, object o, DatatypeFormatterGraphResult result)
        {
            // Output the object
            Type   t    = o.GetType();
            ANY    any  = (ANY)o;
            object oper = t.GetProperty("Operator").GetValue(o, null),
                   valu = t.GetProperty("Value").GetValue(o, null);

            if (oper != null && any.NullFlavor == null)
            {
                s.WriteAttributeString("operator", Util.ToWireFormat(oper));
            }
            // Format the object
            var formatter = DatatypeFormatter.GetFormatter(valu.GetType());

            formatter.Host = this.Host;
            formatter.Graph(s, valu, result);
        }
示例#21
0
        private bool SetMetadataInCollection(string propertyName, int indexInList, object valueInSet, object valueToApply, bool isSpecializationType)
        {
            // the field specified by propertyName MUST be a LIST/SET/COLLECTION datatype or a Collection, otherwise this method will fail
            ICollection <ANY <object> > value = ObtainFieldInCollection(propertyName, indexInList);

            if (value == null)
            {
                return(false);
            }

            bool result = false;
            int  pos    = 0;

            for (IEnumerator <ANY <object> > iterator = value.GetEnumerator(); iterator.MoveNext(); pos++)
            {
                ANY <object> item        = iterator.Current;
                object       actualValue = item.Value;
                if ((indexInList == -1 && valueInSet.Equals(actualValue)) || pos == indexInList)
                {
                    if (isSpecializationType)
                    {
                        item.DataType = (StandardDataType)valueToApply;
                    }
                    else
                    {
                        item.NullFlavor = (Ca.Infoway.Messagebuilder.Domainvalue.NullFlavor)valueToApply;
                    }
                    result = true;
                    break;
                }
            }

            if (!result)
            {
                log.Error(string.Format("Could not find the specified entry in the field/collection %s.%s. Value not set.", this.GetType().Name, propertyName));
            }

            return(result);
        }
示例#22
0
 public ResultObservation()
 {
     this.id                  = new SETImpl <II, Identifier>(typeof(IIImpl));
     this.code                = new CDImpl();
     this.text                = new STImpl();
     this.statusCode          = new CSImpl();
     this.effectiveTime       = new IVLImpl <TS, Interval <PlatformDate> >();
     this.confidentialityCode = new SETImpl <CV, Code>(typeof(CVImpl));
     this.value               = new ANYImpl <object>();
     this.interpretationCode  = new CVImpl();
     this.methodCode          = new CVImpl();
     this.specimen            = new List <Ca.Infoway.Messagebuilder.Model.Pcs_mr2009_r02_04_03.Lab.Merged.ReportSectionSpecimen>();
     this.receiverRoleChoice  = new List <Ca.Infoway.Messagebuilder.Model.Pcs_mr2009_r02_04_03.Lab.Merged.IRoleChoice>();
     this.performerRoleChoice = new List <Ca.Infoway.Messagebuilder.Model.Pcs_mr2009_r02_04_03.Lab.Merged.IRoleChoice>();
     this.inFulfillmentOfFulfillmentChoice  = new List <Ca.Infoway.Messagebuilder.Model.Pcs_mr2009_r02_04_03.Lab.Merged.IFulfillmentChoice>();
     this.derivedFromObservationEvent       = new List <Ca.Infoway.Messagebuilder.Model.Pcs_mr2009_r02_04_03.Lab.Polb_mt004000ca.ResultObservation>();
     this.referenceRangeInterpretationRange = new List <Ca.Infoway.Messagebuilder.Model.Pcs_mr2009_r02_04_03.Lab.Polb_mt004000ca.ReferenceRange>();
     this.pertinentInformation2SupportingClinicalObservationEvent = new List <Ca.Infoway.Messagebuilder.Model.Pcs_mr2009_r02_04_03.Lab.Merged.SupportingClinicalInformation>();
     this.component2ReportableTestIndicator = new List <Ca.Infoway.Messagebuilder.Model.Pcs_mr2009_r02_04_03.Lab.Merged.ReportableHealthIndicator>();
     this.component3ResultChoice            = new List <Ca.Infoway.Messagebuilder.Model.Pcs_mr2009_r02_04_03.Lab.Polb_mt004000ca.IResultChoice>();
     this.subjectOf2 = new List <Ca.Infoway.Messagebuilder.Model.Pcs_mr2009_r02_04_03.Merged.Includes>();
 }
示例#23
0
文件: FacadeBase.cs 项目: swmuir/khie
 /// MDHT operation: asks whether the string-valued feature of the given object matches the given regular expression
 public bool matches(ANY o, String featureName, String regularExpression)
 {
     try
     {
         PropertyInfo field = o.GetType().GetProperty(featureName);
         if (field == null)
         {
             return(false);
         }
         object x = field.GetValue(o, null);
         if (x is String)
         {
             String s      = (String)x;
             bool   result = System.Text.RegularExpressions.Regex.IsMatch(s, "^" + regularExpression + "$");
             return(result);
         }
         return(false);
     }
     catch (Exception)
     {
         return(false);
     }
 }
示例#24
0
        // TODO - TM - modify get/set to accommodate NFs on collections of associations? (users can set NF directly on MessagePart beans, not really necessary to do this here)
        private object GetMetadataInCollection(string propertyName, int indexInList, object valueInSet, bool isSpecializationType)
        {
            ICollection <ANY <object> > value = ObtainFieldInCollection(propertyName, indexInList);

            if (value == null)
            {
                return(null);
            }

            object result = null;
            int    pos    = 0;

            for (IEnumerator <ANY <object> > iterator = value.GetEnumerator(); iterator.MoveNext(); pos++)
            {
                ANY <object> item        = iterator.Current;
                object       actualValue = item.Value;
                if ((indexInList == -1 && valueInSet.Equals(actualValue)) || pos == indexInList)
                {
                    result = isSpecializationType ? (object)item.DataType : (object)item.NullFlavor;
                    break;
                }
            }
            return(result);
        }
示例#25
0
        public virtual object Parse(System.Xml.XmlReader s, DatatypeFormatterParseResult result)
        {
            ANY instance = this.Parse <ANY>(s, result);

            if (result.ValidateConformance && !instance.Validate())
            {
                foreach (var r in instance.ValidateEx())
                {
                    r.Location = s.ToString();
                    result.AddResultDetail(r);
                }
            }
            //result.AddResultDetail(new DatatypeValidationResultDetail(ResultDetailType.Error, instance.GetType().Name, s.ToString()));
            // Disabled for test
            // Validate flavor...
            IResultDetail[] flavor;
            if (instance.Flavor != null && result.ValidateConformance && Util.ValidateFlavor(instance.Flavor.ToUpper(), instance, out flavor) == false)
            {
                result.AddResultDetail(new DatatypeFlavorValidationResultDetail(ResultDetailType.Warning, instance.GetType().Name, instance.Flavor, s.ToString()));
                result.AddResultDetail(flavor);
            }

            return(instance);
        }
示例#26
0
 public SpecialAuthorizationCriteria()
 {
     this.code  = new CVImpl();
     this.text  = new STImpl();
     this.value = new ANYImpl <object>();
 }
示例#27
0
 /// <summary>
 /// Copy base attributes from one ANY to another
 /// </summary>
 internal static void CopyBaseAttributes(ANY source, ANY dest)
 {
     dest.ControlActExt = source.ControlActExt;
     dest.ControlActRoot = source.ControlActRoot;
     dest.Flavor = source.Flavor;
     dest.NullFlavor = source.NullFlavor;
     dest.UpdateMode = source.UpdateMode;
     dest.ValidTimeHigh = source.ValidTimeHigh;
     dest.ValidTimeLow = source.ValidTimeLow;
 }
示例#28
0
        public void Graph(System.Xml.XmlWriter s, object o, DatatypeR2FormatterGraphResult result)
        {
            ANY instance = o as ANY;

            IResultDetail[] enumer = new IResultDetail[0], flavor = new IResultDetail[0],
            invalidAttributes = new IResultDetail[0];

            // Now render
            if (instance == null)
            {
                throw new InvalidOperationException("Could not cast object to the ANY data type");
            }

            if (instance.Flavor != null &&
                (instance.NullFlavor == null ||
                 (instance is ICodedSimple && ((NullFlavor)instance.NullFlavor).IsChildConcept(NullFlavor.Other)) ||
                 (instance is IQuantity && ((NullFlavor)instance.NullFlavor).IsChildConcept(NullFlavor.Derived))
                )
                )
            {
                s.WriteAttributeString("flavorId", instance.Flavor);
            }

            if (instance.NullFlavor != null)
            {
                s.WriteAttributeString("nullFlavor", Util.ToWireFormat(instance.NullFlavor));
            }
            else
            {
                // Warn if items can't be represented in R2
                if (instance.ControlActExt != null)
                {
                    s.WriteAttributeString("controlInformationExtension", instance.ControlActExt);
                }
                if (instance.ControlActRoot != null)
                {
                    s.WriteAttributeString("controlInformationRoot", instance.ControlActRoot);
                }
                if (instance.ValidTimeHigh != null && !instance.ValidTimeHigh.IsNull)
                {
                    s.WriteAttributeString("validTimeHigh", instance.ValidTimeHigh.Value);
                }
                if (instance.ValidTimeLow != null && !instance.ValidTimeLow.IsNull)
                {
                    s.WriteAttributeString("validTimeLow", instance.ValidTimeLow.Value);
                }
                if (instance.UpdateMode != null && !instance.UpdateMode.IsNull)
                {
                    s.WriteAttributeString("updateMode", Util.ToWireFormat(instance.UpdateMode));
                }
            }

            string currentElementName = "";

            if (s is MARC.Everest.Xml.XmlStateWriter)
            {
                currentElementName = (s as MARC.Everest.Xml.XmlStateWriter).CurrentPath;
            }

            // Validate
            if (result.ValidateConformance && !instance.Validate())
            {
                foreach (var r in instance.ValidateEx())
                {
                    r.Location = currentElementName;
                    result.AddResultDetail(r);
                }
            }
            //{
            //    result.AddResultDetail(new DatatypeValidationResultDetail(ResultDetailType.Error, o.GetType().Name, currentElementName));
            //}

            // Disabled for test
            // Validate flavor...
            if (result.ValidateConformance && instance.Flavor != null && Util.ValidateFlavor(instance.Flavor.ToUpper(), instance, out flavor) == false)
            {
                result.AddResultDetail(new DatatypeFlavorValidationResultDetail(ResultDetailType.Warning, instance.GetType().Name, instance.Flavor, currentElementName));
                result.AddResultDetail(flavor);
            }
        }
示例#29
0
 public SpecimenObservation()
 {
     this.code          = new CVImpl();
     this.effectiveTime = new IVLImpl <TS, Interval <PlatformDate> >();
     this.value         = new ANYImpl <object>();
 }
示例#30
0
 public PatientImmunizationObservations()
 {
     this.code  = new CVImpl();
     this.value = new ANYImpl <object>();
 }
示例#31
0
 public SupportingClinicalInformation()
 {
     this.code  = new CDImpl();
     this.value = new ANYImpl <object>();
 }