internal static UmlClassSpec Convert(CdtSpec cdtSpec) { var umlClassSpec = new UmlClassSpec { Stereotype = "CDT", Name = cdtSpec.Name, TaggedValues = new[] { new UmlTaggedValueSpec("businessTerm", cdtSpec.BusinessTerms), new UmlTaggedValueSpec("definition", cdtSpec.Definition), new UmlTaggedValueSpec("dictionaryEntryName", cdtSpec.DictionaryEntryName) { DefaultValue = GenerateDictionaryEntryNameDefaultValue(cdtSpec) }, new UmlTaggedValueSpec("languageCode", cdtSpec.LanguageCode), new UmlTaggedValueSpec("uniqueIdentifier", cdtSpec.UniqueIdentifier) { DefaultValue = GenerateUniqueIdentifierDefaultValue(cdtSpec) }, new UmlTaggedValueSpec("versionIdentifier", cdtSpec.VersionIdentifier), new UmlTaggedValueSpec("usageRule", cdtSpec.UsageRules), }, }; var dependencySpecs = new List <UmlDependencySpec>(); if (cdtSpec.IsEquivalentTo != null) { dependencySpecs.Add(new UmlDependencySpec { Stereotype = "isEquivalentTo", Target = ((UpccCdt)cdtSpec.IsEquivalentTo).UmlClass, LowerBound = "0", UpperBound = "1", }); } umlClassSpec.Dependencies = dependencySpecs; var attributeSpecs = new List <UmlAttributeSpec>(); if (cdtSpec.Con != null) { attributeSpecs.Add(CdtConSpecConverter.Convert(cdtSpec.Con, cdtSpec.Name)); } if (cdtSpec.Sups != null) { foreach (var cdtSupSpec in cdtSpec.Sups) { attributeSpecs.Add(CdtSupSpecConverter.Convert(cdtSupSpec, cdtSpec.Name)); } } umlClassSpec.Attributes = MakeAttributeNamesUnique(attributeSpecs); return(umlClassSpec); }
/// <summary> /// Creates a(n) SUP based on the given <paramref name="specification"/>. /// <param name="specification">A specification for a(n) SUP.</param> /// <returns>The newly created SUP.</returns> /// </summary> public ICdtSup CreateCdtSup(CdtSupSpec specification) { return(new UpccCdtSup(UmlClass.CreateAttribute(CdtSupSpecConverter.Convert(specification, Name)), this)); }
/// <summary> /// Updates a(n) SUP to match the given <paramref name="specification"/>. /// <param name="cdtSup">A(n) SUP.</param> /// <param name="specification">A new specification for the given SUP.</param> /// <returns>The updated SUP. Depending on the implementation, this might be the same updated instance or a new instance!</returns> /// </summary> public ICdtSup UpdateCdtSup(ICdtSup cdtSup, CdtSupSpec specification) { return(new UpccCdtSup(UmlClass.UpdateAttribute(((UpccCdtSup)cdtSup).UmlAttribute, CdtSupSpecConverter.Convert(specification, Name)), this)); }