public void ParseConstraint(IIGTypePlugin igTypePlugin, IConstraint constraint, ValueSet valueSet = null, CodeSystem codeSystem = null) { this.childCount = constraint.Children != null?constraint.Children.Count() : 0; this.Category = constraint.Category; this.Number = constraint.GetFormattedNumber(this.igSettings == null ? null : this.igSettings.PublishDate); this.Context = constraint.Context; this.IsPrimitive = constraint.IsPrimitive == true; this.IsBranch = constraint.IsBranch == true; this.HasChildren = constraint.Children != null && constraint.Children.Count() > 0; this.Narrative = constraint.PrimitiveText; this.Description = constraint.Description; this.Label = constraint.Label; this.IsHeading = constraint.IsHeading; this.HeadingDescription = constraint.HeadingDescription; this.IsChoice = constraint.IsChoice; this.Conformance = constraint.Conformance; this.Cardinality = constraint.Cardinality; this.DataType = constraint.DataType; if (constraint.Parent != null) { var parent = constraint.Parent; // Ignore the fact that the parent is a choice if this is the only constraint within the parent... // The parent is ignored in this case, and this constraint should be treated as a normal constraint if (parent.IsChoice && parent.Children.Count() == 1) { this.Conformance = parent.Conformance; this.Cardinality = parent.Cardinality; if (parent.Parent != null) { parent = constraint.Parent.Parent; } } this.ParentIsBranch = parent.IsBranch == true; this.ParentContext = parent.Context; this.ParentCardinality = parent.Cardinality; this.ParentIsChoice = parent.IsChoice; this.indexInSiblings = parent.Children.OrderBy(y => y.Order).ToList().IndexOf(constraint); } this.ValueConformance = constraint.ValueConformance; if (constraint.IsStatic == true) { this.StaticDynamic = "STATIC"; } else if (constraint.IsStatic == false) { this.StaticDynamic = "DYNAMIC"; } if (constraint.ValueSetId != null) { // If the caller didn't pass in the ValueSet, get it from the db if (valueSet == null && constraint is TemplateConstraint) { valueSet = ((TemplateConstraint)constraint).ValueSet; } else if (valueSet == null || valueSet.Id != constraint.ValueSetId) { valueSet = this.tdb.ValueSets.Single(y => y.Id == constraint.ValueSetId); } this.ValueSetName = valueSet.Name; this.ValueSetOid = valueSet.GetIdentifier(igTypePlugin); this.ValueSetVersion = constraint.ValueSetDate; } if (constraint.ValueCodeSystemId != null) { // If the caller didn't pass in the CodeSystem, get it from the db if (codeSystem == null && constraint is TemplateConstraint) { codeSystem = ((TemplateConstraint)constraint).CodeSystem; } else if (codeSystem == null || codeSystem.Id != constraint.ValueCodeSystemId) { codeSystem = this.tdb.CodeSystems.Single(y => y.Id == constraint.ValueCodeSystemId); } this.CodeSystemName = codeSystem.Name; this.CodeSystemOid = codeSystem.Oid; } this.Value = constraint.Value; this.DisplayName = constraint.ValueDisplayName; }
public void ParseConstraint(IIGTypePlugin igTypePlugin, IConstraint constraint, ValueSet valueSet = null, CodeSystem codeSystem = null) { this.Category = constraint.Category; this.Number = constraint.GetFormattedNumber(this.igSettings == null ? null : this.igSettings.PublishDate); this.Context = constraint.Context; this.IsPrimitive = constraint.IsPrimitive == true; this.IsBranch = constraint.IsBranch == true; this.HasChildren = constraint.Children != null && constraint.Children.Count() > 0; this.Narrative = constraint.PrimitiveText; this.Description = constraint.Description; this.Label = constraint.Label; this.IsHeading = constraint.IsHeading; this.HeadingDescription = constraint.HeadingDescription; if (constraint.Parent != null) { this.ParentIsBranch = constraint.Parent.IsBranch == true; this.ParentContext = constraint.Parent.Context; this.ParentCardinality = constraint.Parent.Cardinality; } this.Conformance = constraint.Conformance; this.Cardinality = constraint.Cardinality; this.DataType = constraint.DataType; this.ValueConformance = constraint.ValueConformance; if (constraint.IsStatic == true) { this.StaticDynamic = "STATIC"; } else if (constraint.IsStatic == false) { this.StaticDynamic = "DYNAMIC"; } if (constraint.ValueSetId != null) { // If the caller didn't pass in the ValueSet, get it from the db if (valueSet == null && constraint is TemplateConstraint) { valueSet = ((TemplateConstraint)constraint).ValueSet; } else if (valueSet == null || valueSet.Id != constraint.ValueSetId) { valueSet = this.tdb.ValueSets.Single(y => y.Id == constraint.ValueSetId); } this.ValueSetName = valueSet.Name; this.ValueSetOid = valueSet.GetIdentifier(igTypePlugin); this.ValueSetVersion = constraint.ValueSetDate; } if (constraint.ValueCodeSystemId != null) { // If the caller didn't pass in the CodeSystem, get it from the db if (codeSystem == null && constraint is TemplateConstraint) { codeSystem = ((TemplateConstraint)constraint).CodeSystem; } else if (codeSystem == null || codeSystem.Id != constraint.ValueCodeSystemId) { codeSystem = this.tdb.CodeSystems.Single(y => y.Id == constraint.ValueCodeSystemId); } this.CodeSystemName = codeSystem.Name; this.CodeSystemOid = codeSystem.Oid; } this.Value = constraint.Value; this.DisplayName = constraint.ValueDisplayName; }
public void ParseConstraint(IConstraint constraint) { this.Category = constraint.Category; this.Number = constraint.GetFormattedNumber(this.igSettings == null ? null : this.igSettings.PublishDate); this.Context = constraint.Context; this.IsPrimitive = constraint.IsPrimitive == true; this.IsBranch = constraint.IsBranch == true; this.HasChildren = constraint.Children != null && constraint.Children.Count() > 0; this.Narrative = constraint.PrimitiveText; this.Description = constraint.Description; this.Label = constraint.Label; this.IsHeading = constraint.IsHeading; this.HeadingDescription = constraint.HeadingDescription; if (constraint.Parent != null) { this.ParentIsBranch = constraint.Parent.IsBranch == true; this.ParentContext = constraint.Parent.Context; this.ParentCardinality = constraint.Parent.Cardinality; } this.Conformance = constraint.Conformance; this.Cardinality = constraint.Cardinality; this.DataType = constraint.DataType; if (constraint.ContainedTemplateId != null) { Template containedTemplate = this.tdb.Templates.Single(y => y.Id == constraint.ContainedTemplateId); this.ContainedTemplateId = containedTemplate.Id; this.ContainedTemplateTitle = containedTemplate.Name; this.ContainedTemplateOid = containedTemplate.Oid; if (this.LinkIsBookmark) { this.ContainedTemplateLink = string.Format("{0}{1}", this.TemplateLinkBase, containedTemplate.Bookmark); } else { this.ContainedTemplateLink = containedTemplate.GetViewUrl(this.TemplateLinkBase); } } this.ValueConformance = constraint.ValueConformance; if (constraint.IsStatic == true) { this.StaticDynamic = "STATIC"; } else if (constraint.IsStatic == false) { this.StaticDynamic = "DYNAMIC"; } if (constraint.ValueSetId != null) { ValueSet valueSet = this.tdb.ValueSets.Single(y => y.Id == constraint.ValueSetId); this.ValueSetName = valueSet.Name; this.ValueSetOid = valueSet.Oid; this.ValueSetVersion = constraint.ValueSetDate; } if (constraint.ValueCodeSystemId != null) { CodeSystem codeSystem = this.tdb.CodeSystems.Single(y => y.Id == constraint.ValueCodeSystemId); this.CodeSystemName = codeSystem.Name; this.CodeSystemOid = codeSystem.Oid; } this.Value = constraint.Value; this.DisplayName = constraint.ValueDisplayName; }