internal static UmlEnumerationSpec Convert(EnumSpec enumSpec) { var umlEnumerationSpec = new UmlEnumerationSpec { Stereotype = "ENUM", Name = enumSpec.Name, TaggedValues = new[] { new UmlTaggedValueSpec("businessTerm", enumSpec.BusinessTerms), new UmlTaggedValueSpec("codeListAgencyIdentifier", enumSpec.CodeListAgencyIdentifier), new UmlTaggedValueSpec("codeListAgencyName", enumSpec.CodeListAgencyName), new UmlTaggedValueSpec("codeListIdentifier", enumSpec.CodeListIdentifier), new UmlTaggedValueSpec("codeListName", enumSpec.CodeListName), new UmlTaggedValueSpec("dictionaryEntryName", enumSpec.DictionaryEntryName) { DefaultValue = GenerateDictionaryEntryNameDefaultValue(enumSpec) }, new UmlTaggedValueSpec("definition", enumSpec.Definition), new UmlTaggedValueSpec("enumerationURI", enumSpec.EnumerationURI), new UmlTaggedValueSpec("languageCode", enumSpec.LanguageCode), new UmlTaggedValueSpec("modificationAllowedIndicator", enumSpec.ModificationAllowedIndicator), new UmlTaggedValueSpec("restrictedPrimitive", enumSpec.RestrictedPrimitive), new UmlTaggedValueSpec("status", enumSpec.Status), new UmlTaggedValueSpec("uniqueIdentifier", enumSpec.UniqueIdentifier) { DefaultValue = GenerateUniqueIdentifierDefaultValue(enumSpec) }, new UmlTaggedValueSpec("versionIdentifier", enumSpec.VersionIdentifier), }, }; var dependencySpecs = new List <UmlDependencySpec>(); if (enumSpec.IsEquivalentTo != null) { dependencySpecs.Add(new UmlDependencySpec { Stereotype = "isEquivalentTo", Target = ((UpccEnum)enumSpec.IsEquivalentTo).UmlEnumeration, LowerBound = "0", UpperBound = "1", }); } umlEnumerationSpec.Dependencies = dependencySpecs; var enumerationLiteralSpecs = new List <UmlEnumerationLiteralSpec>(); if (enumSpec.CodelistEntries != null) { foreach (var codelistEntrySpec in enumSpec.CodelistEntries) { enumerationLiteralSpecs.Add(CodelistEntrySpecConverter.Convert(codelistEntrySpec)); } } umlEnumerationSpec.EnumerationLiterals = enumerationLiteralSpecs; return(umlEnumerationSpec); }
/// <summary> /// Updates a(n) CodelistEntry to match the given <paramref name="specification"/>. /// <param name="codelistEntry">A(n) CodelistEntry.</param> /// <param name="specification">A new specification for the given CodelistEntry.</param> /// <returns>The updated CodelistEntry. Depending on the implementation, this might be the same updated instance or a new instance!</returns> /// </summary> public ICodelistEntry UpdateCodelistEntry(ICodelistEntry codelistEntry, CodelistEntrySpec specification) { return(new UpccCodelistEntry(UmlEnumeration.UpdateEnumerationLiteral(((UpccCodelistEntry)codelistEntry).UmlEnumerationLiteral, CodelistEntrySpecConverter.Convert(specification)), this)); }
/// <summary> /// Creates a(n) CodelistEntry based on the given <paramref name="specification"/>. /// <param name="specification">A specification for a(n) CodelistEntry.</param> /// <returns>The newly created CodelistEntry.</returns> /// </summary> public ICodelistEntry CreateCodelistEntry(CodelistEntrySpec specification) { return(new UpccCodelistEntry(UmlEnumeration.CreateEnumerationLiteral(CodelistEntrySpecConverter.Convert(specification)), this)); }