internal static Property Parse(ClassAttribute clsa, String vocabBindingRealm, ClassRepository cr, Dictionary <string, Package> derivationSuppliers) { // TODO: Support EnumerationValue stuff Property retVal = new Property(); // Name (and busines names) retVal.Name = clsa.Name; foreach (BusinessName bn in clsa.BusinessName) { if (bn.Language == MifCompiler.Language || bn.Language == null) { retVal.BusinessName = bn.Name; } } // Documentation if (clsa.Annotations != null) { retVal.Documentation = DocumentationParser.Parse(clsa.Annotations.Documentation); } // Conformance retVal.Conformance = clsa.IsMandatory ? ClassContent.ConformanceKind.Mandatory : clsa.Conformance == ConformanceKind.Required ? ClassContent.ConformanceKind.Required : ClassContent.ConformanceKind.Optional; if (retVal.Conformance != Property.ConformanceKind.Mandatory && clsa.MinimumMultiplicity == "1") { retVal.Conformance = Property.ConformanceKind.Populated; } // Min / Max occurs if (retVal.Conformance == MohawkCollege.EHR.gpmr.COR.Property.ConformanceKind.Mandatory) { retVal.MinOccurs = "1"; } else { retVal.MinOccurs = clsa.MinimumMultiplicity; } retVal.MaxOccurs = clsa.MaximumMultiplicity == "-1" ? "*" : clsa.MaximumMultiplicity; retVal.MaxLength = clsa.MaximumLength; retVal.MinLength = clsa.MinimumLength; // Structural or non? retVal.PropertyType = clsa.IsImmutable ? Property.PropertyTypes.Structural : Property.PropertyTypes.NonStructural; // Default value retVal.DefaultValue = clsa.DefaultValue; retVal.Initializor = clsa.DefaultFrom == DefaultDeterminerKind.ITS ? Property.InitializorTypes.ITS : clsa.DefaultFrom == DefaultDeterminerKind.Realm ? Property.InitializorTypes.Realm : clsa.DefaultFrom == DefaultDeterminerKind.ReferencingAttribute ? Property.InitializorTypes.ReferencedAttributes : Property.InitializorTypes.DefaultValue; if (clsa.DerivedFrom != null) { retVal.Realization = new List <ClassContent>(); foreach (var dei in clsa.DerivedFrom) { MohawkCollege.EHR.gpmr.COR.Feature ss = null; Package derivationPkg = null; if (!derivationSuppliers.TryGetValue(dei.StaticModelDerivationId, out derivationPkg) || derivationPkg == null) { continue; } // Has the package been compiled? if (!cr.TryGetValue(string.Format("{0}", derivationPkg.PackageLocation.Artifact == ArtifactKind.RIM ? "RIM" : derivationPkg.PackageLocation.ToString(MifCompiler.NAME_FORMAT)), out ss)) { // Attempt to parse PackageParser.Parse(derivationPkg.PackageLocation.ToString(MifCompiler.NAME_FORMAT), derivationPkg.MemberOfRepository, cr); // Ditch if still can't find if (!cr.TryGetValue(string.Format("{0}", derivationPkg.PackageLocation.Artifact == ArtifactKind.RIM ? "RIM" : derivationPkg.PackageLocation.ToString(MifCompiler.NAME_FORMAT)), out ss)) { System.Diagnostics.Trace.WriteLine(String.Format("Can't find derivation class '{0}' for association '{1}' (derivation supplier {2})", dei.ClassName, dei.AttributeName, dei.StaticModelDerivationId), "warn"); } } // Feature was found var f = (ss as MohawkCollege.EHR.gpmr.COR.SubSystem).FindClass(dei.ClassName); if (f != null) { ClassContent cc = f.GetFullContent().Find(o => o.Name == dei.AttributeName); retVal.Realization.Add(cc); } else { System.Diagnostics.Trace.WriteLine(String.Format("Can't find derivation class '{0}' for association '{1}' (derivation supplier {2})", dei.ClassName, dei.AttributeName, dei.StaticModelDerivationId), "warn"); } } } // Derived from retVal.DerivedFrom = clsa; // Fixed Value retVal.FixedValue = clsa.FixedValue; // Sort key retVal.SortKey = clsa.SortKey; // Datatype retVal.Type = TypeReferenceParser.Parse(clsa.Type); // Update Modes retVal.UpdateMode = clsa.UpdateModeDefault.ToString(); if (clsa.UpdateModesAllowed != null) { retVal.AllowedUpdateModes = new List <string>(); foreach (string s in clsa.UpdateModesAllowed.Split(',')) { retVal.AllowedUpdateModes.Add(s); } } // Supplier domains if (clsa.Vocabulary != null) { if (clsa.Vocabulary.Code != null && !String.IsNullOrEmpty(clsa.Vocabulary.Code.Code)) // Fixed code { retVal.FixedValue = string.Format("{0}", clsa.Vocabulary.Code.Code); } // JF: If the code system is identified, then bind if (clsa.Vocabulary.Code != null && !String.IsNullOrEmpty(clsa.Vocabulary.Code.CodeSystemName)) // Very odd thing that is present in UV mifs { Trace.WriteLine(String.Format("'{0}' is specified as fixed code's code system, however no fixed code is present. Assuming this is a bound code system instead", "assumption")); retVal.SupplierDomain = cr.Find(o => o is CodeSystem && (o as CodeSystem).Name.Equals(clsa.Vocabulary.Code.CodeSystemName)) as Enumeration; if (retVal.SupplierDomain == null) { Trace.WriteLine(String.Format("'{0}' could not be bound to '{1}' as the code system was not found", clsa.Name, clsa.Vocabulary.Code.CodeSystemName), "warn"); } } if (clsa.Vocabulary.ConceptDomain != null) { retVal.SupplierDomain = cr.Find(o => o is ConceptDomain && (o as ConceptDomain).Name.Equals(clsa.Vocabulary.ConceptDomain.Name)) as Enumeration; if (retVal.SupplierDomain == null && MifCompiler.hostContext.Mode == Pipeline.OperationModeType.Quirks) { retVal.SupplierDomain = cr.Find(o => o is Enumeration && o.Name.Equals(clsa.Vocabulary.ConceptDomain.Name)) as Enumeration; if (retVal.SupplierDomain != null) { Trace.WriteLine(String.Format("'{0}' couldn't be bound to concept domain '{1}', '{2}' with name '{1}' was located, so the binding was changed", clsa.Name, clsa.Vocabulary.ConceptDomain.Name, retVal.SupplierDomain.EnumerationType), "quirks"); } } if (retVal.SupplierDomain == null) { Trace.WriteLine(String.Format("'{0}' could not be bound to '{1}' as the concept domain was not found", clsa.Name, clsa.Vocabulary.ConceptDomain.Name), "warn"); } } if (clsa.Vocabulary.ValueSet != null) { retVal.SupplierDomain = cr.Find(o => o is ValueSet && (o as ValueSet).Name.Equals(clsa.Vocabulary.ValueSet.Name)) as Enumeration; if (retVal.SupplierDomain == null) { Trace.WriteLine(String.Format("'{0}' could not be bound to '{1}' as the value set was not found", clsa.Name, clsa.Vocabulary.ValueSet.Name), "warn"); } if (!String.IsNullOrEmpty(clsa.Vocabulary.ValueSet.RootCode)) { bool shouldFix = false; if (retVal.SupplierDomain != null) { var enumLiteral = retVal.SupplierDomain.Literals.Find(o => o.Name == clsa.Vocabulary.ValueSet.RootCode); shouldFix = enumLiteral != null && enumLiteral.RelatedCodes != null && enumLiteral.RelatedCodes.Count == 0; } if (shouldFix) { retVal.FixedValue = String.Format("{0}", clsa.Vocabulary.ValueSet.RootCode); } } } // Supplier strength(s) if (clsa.Vocabulary.ValueSet != null) { retVal.SupplierStrength = clsa.Vocabulary.ValueSet.CodingStrength == CodingStrengthKind.CNE ? (Property.CodingStrengthKind?)Property.CodingStrengthKind.CodedNoExtensions: clsa.Vocabulary.ValueSet.CodingStrength == CodingStrengthKind.CWE ? (Property.CodingStrengthKind?)Property.CodingStrengthKind.CodedNoExtensions : null; } // Supplier domain strength if (retVal.SupplierDomain != null) { if (defaultCodingStrengths.ContainsKey(retVal.SupplierDomain.Name ?? "") && !retVal.SupplierStrength.HasValue) { retVal.SupplierStrength = defaultCodingStrengths[retVal.SupplierDomain.Name]; } else { retVal.SupplierStrength = Property.CodingStrengthKind.CodedNoExtensions; System.Diagnostics.Trace.WriteLine(string.Format("No vocabulary value set on property {0}! Defaulting to CNE for supplier strength", retVal.Name), "assumption"); } } } return(retVal); }
internal static MohawkCollege.EHR.gpmr.COR.Class Parse(ClassParameterInfo classInfo) { // Has this been processed? if (classInfo.CompilerRepository.ContainsKey(string.Format("{0}.{1}", classInfo.ScopedPackageName, classInfo.Class.Name))) { return(null); } // Get the vocabulary realm that this package is bound to string vocabularyRealm = classInfo.MifContainer is StaticModel && (classInfo.MifContainer as StaticModel).ImportedVocabularyModelPackage != null ? (classInfo.MifContainer as StaticModel).ImportedVocabularyModelPackage.Realm : null; // Parse the common (class base) portion of the classes MohawkCollege.EHR.gpmr.COR.Class retVal = Parse(classInfo.Class as ClassBase, vocabularyRealm, classInfo.CompilerRepository, classInfo.DerivationSuppliers); // Base class retVal.BaseClass = classInfo.EnforcedBaseClass; // Containing subsystem retVal.ContainerPackage = classInfo.CompilerRepository[classInfo.ScopedPackageName] as MohawkCollege.EHR.gpmr.COR.SubSystem; // Fire parsed event retVal.FireParsed(); #region Specializations retVal.SpecializedBy = new List <TypeReference>(); // Iterate through each child class and process where neccessary foreach (ClassGeneralization cg in (classInfo.Class as MohawkCollege.EHR.HL7v3.MIF.MIF20.StaticModel.Flat.Class).SpecializationChild) { TypeReference tr = new TypeReference(); tr.Name = string.Format("{0}.{1}", classInfo.ScopedPackageName, cg.ChildClassName); // Make a ref to the child class tr.MemberOf = classInfo.CompilerRepository; bool isCMET = false; // Get the child class if (classInfo.MifContainer is GlobalStaticModel) { // Get the CMET reference from the MIF class hierarchy ClassElement ce = (classInfo.MifContainer as GlobalStaticModel).OwnedClass.Find(delegate(ClassElement c) { if (c != null && c.Choice != null && c.Choice is CommonModelElementRef) { return((c.Choice as CommonModelElementRef).Name == cg.ChildClassName); } else { return(false); } }); string cmetName = ce != null ? (ce.Choice as CommonModelElementRef).CmetName ?? (ce.Choice as CommonModelElementRef).Name : ""; // Determine if the reference is a cmet and gathe t isCMET = cmetName != null && ce != null && classInfo.CompilerRepository.ContainsKey(cmetName) && classInfo.CompilerRepository[cmetName] is CommonTypeReference; if (isCMET) // A CMET was successfully resolved { tr = (classInfo.CompilerRepository[cmetName] as CommonTypeReference).Class; } else if (ce != null && MifCompiler.cmetBindings.ContainsKey(cmetName)) // A CMET was not resolved, but a binding exists! { string boundModel = MifCompiler.cmetBindings[cmetName]; MohawkCollege.EHR.gpmr.COR.Feature boundSubSystem = null; if (classInfo.CompilerRepository.TryGetValue(boundModel, out boundSubSystem)) { tr = (boundSubSystem as MohawkCollege.EHR.gpmr.COR.SubSystem).EntryPoint[0].CreateTypeReference(); } else { PackageParser.Parse(boundModel, classInfo.MifContainer.MemberOfRepository, classInfo.CompilerRepository); } } else if (ce != null) // MIF References a CMET but one was never processed? This is odd! { System.Diagnostics.Trace.WriteLine(string.Format("CMET '{0}' was never processed, therefore CommonModelElementRef can't be processed in file '{1}'", cmetName, classInfo.ScopedPackageName), "warn"); continue; } } // The child class has not been processed yet if (!classInfo.CompilerRepository.ContainsKey(tr.Name)) { if (isCMET) // Explicit, have to process another model { PackageParser.ParseClassFromPackage(tr.Name, classInfo.MifContainer.MemberOfRepository, classInfo.CompilerRepository); // Assign the base class //if ((classInfo.CompilerRepository[tr.Name] as MohawkCollege.EHR.gpmr.COR.Class).BaseClass != null) // System.Diagnostics.Debugger.Break(); } else { ClassParameterInfo parm2 = new ClassParameterInfo(); parm2.Class = (classInfo.MifContainer as StaticModel).OwnedClass.Find(o => (o.Choice is MohawkCollege.EHR.HL7v3.MIF.MIF20.StaticModel.Flat.Class && string.Format("{0}.{1}", classInfo.ScopedPackageName, (o.Choice as MohawkCollege.EHR.HL7v3.MIF.MIF20.StaticModel.Flat.Class).Name) == tr.Name)).Choice as ClassBase; parm2.CompilerRepository = classInfo.CompilerRepository; parm2.DerivationSuppliers = classInfo.DerivationSuppliers; parm2.MifContainer = classInfo.MifContainer; parm2.ScopedPackageName = classInfo.ScopedPackageName; parm2.EnforcedBaseClass = retVal.CreateTypeReference(); ClassParser.Parse(parm2); } } // Add to specialization list MohawkCollege.EHR.gpmr.COR.Feature f = null; if (classInfo.CompilerRepository.TryGetValue(tr.Name, out f)) { retVal.SpecializedBy.Add((f as MohawkCollege.EHR.gpmr.COR.Class).CreateTypeReference()); (f as MohawkCollege.EHR.gpmr.COR.Class).BaseClass = retVal.CreateTypeReference(); } else { Trace.WriteLine(String.Format("Cannot find base class '{0}' for '{1}'. Base class must exist before it can be specialized", tr.Name, retVal.Name), "error"); } } #endregion // Assign Temporary Membership to the compiler class repository so the // locating of a structural member will succeed retVal.MemberOf = classInfo.CompilerRepository; // Is a classCode enforcement placed on this class? #region Supplier Structural Domain if (classInfo.Class.SupplierStructuralDomain != null && classInfo.Class.SupplierStructuralDomain.Code != null) { MohawkCollege.EHR.gpmr.COR.Property clsa = retVal.FindMember("classCode", false, MohawkCollege.EHR.gpmr.COR.Property.PropertyTypes.Structural); if (clsa == null)// Class code is derived... we need to override it { clsa = retVal.FindMember("classCode", true, MohawkCollege.EHR.gpmr.COR.Property.PropertyTypes.Structural); // Any class code defined? if (clsa != null) { clsa = PropertyParser.Parse(clsa.DerivedFrom as ClassAttribute, vocabularyRealm, classInfo.CompilerRepository, classInfo.DerivationSuppliers); retVal.AddContent(clsa); } else // Makes no sense, we have a class code enforcement but no class code? { if (MifCompiler.hostContext.Mode == Pipeline.OperationModeType.Quirks) { Trace.WriteLine(String.Format("Supplier domain is specified on class '{0}' which has class code. Since GPMR is in quirks mode, the classCode attribute will be created", retVal.Name), "quirks"); clsa = new Property(); clsa.Name = "classCode"; clsa.PropertyType = Property.PropertyTypes.Structural; clsa.Conformance = ClassContent.ConformanceKind.Mandatory; retVal.AddContent(clsa); } else { throw new InvalidOperationException("Shouldn't be here. Supplier domain specified on a class with no classCode"); } } } #region Now populate the code domain // Supplier domains if (classInfo.Class.SupplierStructuralDomain != null) { var supplierStruct = classInfo.Class.SupplierStructuralDomain; if (supplierStruct.Code != null && !String.IsNullOrEmpty(supplierStruct.Code.Code)) // Fixed code { clsa.FixedValue = string.Format("{0}", supplierStruct.Code.Code); } // JF: If the code system is identified, then bind if (supplierStruct.Code != null && !String.IsNullOrEmpty(supplierStruct.Code.CodeSystemName)) // Very odd thing that is present in UV mifs { Trace.WriteLine(String.Format("'{0}' is specified as fixed code's code system, however no fixed code is present. Assuming this is a bound code system instead", "assumption")); clsa.SupplierDomain = classInfo.CompilerRepository.Find(o => o is CodeSystem && (o as CodeSystem).Name.Equals(supplierStruct.Code.CodeSystemName)) as Enumeration; if (clsa.SupplierDomain == null) { Trace.WriteLine(String.Format("'{0}' could not be bound to '{1}' as the code system was not found", clsa.Name, supplierStruct.Code.CodeSystemName), "warn"); } } if (supplierStruct.ConceptDomain != null) { clsa.SupplierDomain = classInfo.CompilerRepository.Find(o => o is ConceptDomain && (o as ConceptDomain).Name.Equals(supplierStruct.ConceptDomain.Name)) as Enumeration; if (clsa.SupplierDomain == null) { Trace.WriteLine(String.Format("'{0}' could not be bound to '{1}' as the concept domain was not found", clsa.Name, supplierStruct.ConceptDomain.Name), "warn"); } } if (supplierStruct.ValueSet != null) { clsa.SupplierDomain = classInfo.CompilerRepository.Find(o => o is ValueSet && (o as ValueSet).Name.Equals(supplierStruct.ValueSet.Name)) as Enumeration; if (clsa.SupplierDomain == null) { Trace.WriteLine(String.Format("'{0}' could not be bound to '{1}' as the value set was not found", clsa.Name, supplierStruct.ValueSet.Name), "warn"); } bool shouldFix = false; if (clsa.SupplierDomain != null) { var enumLiteral = clsa.SupplierDomain.Literals.Find(o => o.Name == supplierStruct.ValueSet.RootCode); shouldFix = enumLiteral != null && enumLiteral.RelatedCodes != null && enumLiteral.RelatedCodes.Count == 0; } if (shouldFix) { clsa.FixedValue = String.Format("{0}", supplierStruct.ValueSet.RootCode); } } // Supplier strength(s) if (supplierStruct.ValueSet != null) { clsa.SupplierStrength = supplierStruct.ValueSet.CodingStrength == CodingStrengthKind.CNE ? (Property.CodingStrengthKind?)Property.CodingStrengthKind.CodedNoExtensions: supplierStruct.ValueSet.CodingStrength == CodingStrengthKind.CWE ? (Property.CodingStrengthKind?)Property.CodingStrengthKind.CodedNoExtensions : null; } else { clsa.SupplierStrength = Property.CodingStrengthKind.CodedNoExtensions; System.Diagnostics.Trace.WriteLine(string.Format("No vocabulary value set on property {0}! Defaulting to CNE for supplier strength", retVal.Name), "assumption"); } } //if (classInfo.Class.SupplierStructuralDomain.Code != null) // clsa.FixedValue = string.Format("{0}{1}", classInfo.Class.SupplierStructuralDomain.Code.CodeSystem == null ? "" : classInfo.Class.SupplierStructuralDomain.Code.CodeSystem + ":", classInfo.Class.SupplierStructuralDomain.Code.Code); //if (classInfo.Class.SupplierStructuralDomain.ConceptDomain != null) // clsa.SupplierDomain = classInfo.Class.SupplierStructuralDomain.ConceptDomain.Name; //if (classInfo.Class.SupplierStructuralDomain.ValueSet != null) //{ // clsa.SupplierStrength = classInfo.Class.SupplierStructuralDomain.ValueSet.CodingStrength == CodingStrengthKind.CNE ? (Property.CodingStrengthKind?)Property.CodingStrengthKind.CodedNoExtensions : // classInfo.Class.SupplierStructuralDomain.ValueSet.CodingStrength == CodingStrengthKind.CWE ? (Property.CodingStrengthKind?)Property.CodingStrengthKind.CodedNoExtensions : null; // clsa.SupplierDomainValueSet = classInfo.Class.SupplierStructuralDomain.ValueSet.Id; //} //else //{ // clsa.SupplierStrength = Property.CodingStrengthKind.CodedNoExtensions; // System.Diagnostics.Trace.WriteLine(string.Format("No vocabulary value set on property {0}! Defaulting to CNE for supplier strength", retVal.Name), "assumption"); //} #endregion } #endregion // All specifications #region Specializations //if ((classInfo.Class as MohawkCollege.EHR.HL7v3.MIF.MIF20.StaticModel.Flat.Class).SpecializationChild != null && (classInfo.Class as MohawkCollege.EHR.HL7v3.MIF.MIF20.StaticModel.Flat.Class).SpecializationChild.Count > 0) //{ // retVal.SpecializedBy = new List<MohawkCollege.EHR.gpmr.COR.TypeReference>(); // foreach (ClassGeneralization cg in (classInfo.Class as MohawkCollege.EHR.HL7v3.MIF.MIF20.StaticModel.Flat.Class).SpecializationChild) // { // MohawkCollege.EHR.gpmr.COR.TypeReference specRef = new MohawkCollege.EHR.gpmr.COR.TypeReference(); // specRef.Name = string.Format("{0}.{1}", classInfo.ScopedPackageName, cg.ChildClassName); // MohawkCollege.EHR.gpmr.COR.Property noProp = new MohawkCollege.EHR.gpmr.COR.Property(); // noProp.Container = retVal; // specRef.Container = noProp; // retVal.SpecializedBy.Add(specRef); // } //} #endregion #region Behaviors // State machine on the class if (classInfo.Class.Behavior != null) { // Find the property that this state machine acts on Property stateProperty = retVal.FindMember(classInfo.Class.Behavior.SupplierStateAttributeName, false, Property.PropertyTypes.NonStructural | Property.PropertyTypes.Structural); stateProperty.StateMachine = StateMachineParser.Parse(classInfo.Class.Behavior); } #endregion #region Derivation Supplier if (classInfo.Class.DerivedFrom != null) { // Init retVal projection retVal.Realizations = new List <MohawkCollege.EHR.gpmr.COR.TypeReference>(); // Iterate through each class this class is a projection of (is based on) foreach (ClassDerivation cd in classInfo.Class.DerivedFrom) { try { // See if this class has been parsed Package derivationPackage = null; if (!classInfo.DerivationSuppliers.TryGetValue(cd.StaticModelDerivationId, out derivationPackage) || derivationPackage == null) { continue; } MohawkCollege.EHR.gpmr.COR.Feature ss = null; // Has the package been compiled? if (!classInfo.CompilerRepository.TryGetValue(string.Format("{0}", derivationPackage.PackageLocation.Artifact == ArtifactKind.RIM ? "RIM" : derivationPackage.PackageLocation.ToString(MifCompiler.NAME_FORMAT)), out ss)) { // Attempt to parse PackageParser.Parse(derivationPackage.PackageLocation.ToString(MifCompiler.NAME_FORMAT), derivationPackage.MemberOfRepository, classInfo.CompilerRepository); // Ditch if still can't find if (!classInfo.CompilerRepository.TryGetValue(string.Format("{0}", derivationPackage.PackageLocation.Artifact == ArtifactKind.RIM ? "RIM" : derivationPackage.PackageLocation.ToString(MifCompiler.NAME_FORMAT)), out ss) || ss == null) { System.Diagnostics.Trace.WriteLine(String.Format("Can't find derivation class '{0}' (derivation supplier {1})", cd.ClassName, cd.StaticModelDerivationId), "warn"); } } // Attempt to parse MohawkCollege.EHR.gpmr.COR.SubSystem supplierSubSystem = ss as MohawkCollege.EHR.gpmr.COR.SubSystem; // Find the class MohawkCollege.EHR.gpmr.COR.Class supplierClass = classInfo.CompilerRepository[string.Format("{0}.{1}", supplierSubSystem.Name, cd.ClassName)] as MohawkCollege.EHR.gpmr.COR.Class; // Add a realization retVal.Realizations.Add(supplierClass.CreateTypeReference()); // Now do some processing foreach (ClassContent cc in supplierClass.Content) { ClassContent rcc = null; // Find the class content we are talking about if (cc is Property) { rcc = retVal.FindMember(cc.Name, true, (cc as MohawkCollege.EHR.gpmr.COR.Property).PropertyType); } else { ; //TODO: Clean up choices so they match the realization class. Not sure if this supposed to be done } // Correct Items if (rcc != null) { if (MohawkCollege.EHR.gpmr.COR.Documentation.IsEmpty(rcc.Documentation))// Correct documentation { rcc.Documentation = cc.Documentation; } // Removed: This was supposed to correct missing supplier domains from the RMIMs using the RIM data, however it does // cause some issues. // if (rcc is MohawkCollege.EHR.gpmr.COR.Property && (rcc as MohawkCollege.EHR.gpmr.COR.Property).SupplierDomain == null && // (cc as MohawkCollege.EHR.gpmr.COR.Property).SupplierDomain != null) // { // (rcc as MohawkCollege.EHR.gpmr.COR.Property).SupplierDomain = (cc as MohawkCollege.EHR.gpmr.COR.Property).SupplierDomain; // (rcc as MohawkCollege.EHR.gpmr.COR.Property).SupplierStrength = (cc as MohawkCollege.EHR.gpmr.COR.Property).SupplierStrength; // } } } } catch (Exception e) { System.Diagnostics.Trace.WriteLine(string.Format("Could not find derivation supplier information for {0}", retVal.Name), "warn"); } } } #endregion #region Correct Vocabulary // This is quite a problem, when a property is bound to a value set, and that value set // is merely a pointer to other value sets of data we need to correct the pointer foreach (var property in retVal.Content) { // If the content is a property and it has a supplier domain, try to find the supplier domain if (property is Property && (property as Property).SupplierDomain != null) { // Now to correct the reference if ((property as Property).SupplierDomain.EnumerationReference != null && (property as Property).SupplierDomain.EnumerationReference.Count == 1) { (property as Property).SupplierDomain = (property as Property).SupplierDomain.EnumerationReference[0]; } } } #endregion // Sort the class content retVal.Content.Sort(new ClassContent.Comparator()); // Return return(retVal); }