internal static UmlAttributeSpec Convert(CdtSupSpec cdtSupSpec, string className)
        {
            IUmlClassifier type;
            var            multiType = cdtSupSpec.BasicType;

            if (multiType.IsPrim)
            {
                type = ((UpccPrim)multiType.Prim).UmlDataType;
            }
            else
            if (multiType.IsIdScheme)
            {
                type = ((UpccIdScheme)multiType.IdScheme).UmlDataType;
            }
            else
            if (multiType.IsEnum)
            {
                type = ((UpccEnum)multiType.Enum).UmlEnumeration;
            }
            else
            {
                type = null;
            }
            var umlAttributeSpec = new UmlAttributeSpec
            {
                Stereotype   = "SUP",
                Name         = cdtSupSpec.Name,
                Type         = type,
                UpperBound   = cdtSupSpec.UpperBound,
                LowerBound   = cdtSupSpec.LowerBound,
                TaggedValues = new[]
                {
                    new UmlTaggedValueSpec("businessTerm", cdtSupSpec.BusinessTerms),
                    new UmlTaggedValueSpec("definition", cdtSupSpec.Definition),
                    new UmlTaggedValueSpec("dictionaryEntryName", cdtSupSpec.DictionaryEntryName)
                    {
                        DefaultValue = GenerateDictionaryEntryNameDefaultValue(cdtSupSpec, className)
                    },
                    new UmlTaggedValueSpec("languageCode", cdtSupSpec.LanguageCode),
                    new UmlTaggedValueSpec("modificationAllowedIndicator", cdtSupSpec.ModificationAllowedIndicator),
                    new UmlTaggedValueSpec("uniqueIdentifier", cdtSupSpec.UniqueIdentifier)
                    {
                        DefaultValue = GenerateUniqueIdentifierDefaultValue(cdtSupSpec, className)
                    },
                    new UmlTaggedValueSpec("versionIdentifier", cdtSupSpec.VersionIdentifier),
                    new UmlTaggedValueSpec("usageRule", cdtSupSpec.UsageRules),
                },
            };

            return(umlAttributeSpec);
        }
Example #2
0
 /// <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));
 }
Example #3
0
 /// <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));
 }
 private static string GenerateDictionaryEntryNameDefaultValue(CdtSupSpec cdtSupSpec, string className)
 {
     return(className + ". " + cdtSupSpec.Name + ". " + cdtSupSpec.BasicType.Name);
 }
 private static string GenerateUniqueIdentifierDefaultValue(CdtSupSpec cdtSupSpec, string className)
 {
     return(Guid.NewGuid().ToString());
 }