Beispiel #1
0
 /// <summary>
 /// Creates a(n) BBIE based on the given <paramref name="specification"/>.
 /// <param name="specification">A specification for a(n) BBIE.</param>
 /// <returns>The newly created BBIE.</returns>
 /// </summary>
 public IBbie CreateBbie(BbieSpec specification)
 {
     return(new UpccBbie(UmlClass.CreateAttribute(BbieSpecConverter.Convert(specification, Name)), this));
 }
Beispiel #2
0
 /// <summary>
 /// Updates a(n) BBIE to match the given <paramref name="specification"/>.
 /// <param name="bbie">A(n) BBIE.</param>
 /// <param name="specification">A new specification for the given BBIE.</param>
 /// <returns>The updated BBIE. Depending on the implementation, this might be the same updated instance or a new instance!</returns>
 /// </summary>
 public IBbie UpdateBbie(IBbie bbie, BbieSpec specification)
 {
     return(new UpccBbie(UmlClass.UpdateAttribute(((UpccBbie)bbie).UmlAttribute, BbieSpecConverter.Convert(specification, Name)), this));
 }
        internal static UmlClassSpec Convert(AbieSpec abieSpec)
        {
            var umlClassSpec = new UmlClassSpec
            {
                Stereotype   = "ABIE",
                Name         = abieSpec.Name,
                TaggedValues = new[]
                {
                    new UmlTaggedValueSpec("businessTerm", abieSpec.BusinessTerms),
                    new UmlTaggedValueSpec("definition", abieSpec.Definition),
                    new UmlTaggedValueSpec("dictionaryEntryName", abieSpec.DictionaryEntryName)
                    {
                        DefaultValue = GenerateDictionaryEntryNameDefaultValue(abieSpec)
                    },
                    new UmlTaggedValueSpec("languageCode", abieSpec.LanguageCode),
                    new UmlTaggedValueSpec("uniqueIdentifier", abieSpec.UniqueIdentifier)
                    {
                        DefaultValue = GenerateUniqueIdentifierDefaultValue(abieSpec)
                    },
                    new UmlTaggedValueSpec("versionIdentifier", abieSpec.VersionIdentifier),
                    new UmlTaggedValueSpec("usageRule", abieSpec.UsageRules),
                },
            };

            var dependencySpecs = new List <UmlDependencySpec>();

            if (abieSpec.IsEquivalentTo != null)
            {
                dependencySpecs.Add(new UmlDependencySpec
                {
                    Stereotype = "isEquivalentTo",
                    Target     = ((UpccAbie)abieSpec.IsEquivalentTo).UmlClass,
                    LowerBound = "0",
                    UpperBound = "1",
                });
            }
            if (abieSpec.BasedOn != null)
            {
                dependencySpecs.Add(new UmlDependencySpec
                {
                    Stereotype = "basedOn",
                    Target     = ((UpccAcc)abieSpec.BasedOn).UmlClass,
                    LowerBound = "0",
                    UpperBound = "1",
                });
            }
            umlClassSpec.Dependencies = dependencySpecs;

            var attributeSpecs = new List <UmlAttributeSpec>();

            if (abieSpec.Bbies != null)
            {
                foreach (var bbieSpec in abieSpec.Bbies)
                {
                    attributeSpecs.Add(BbieSpecConverter.Convert(bbieSpec, abieSpec.Name));
                }
            }
            umlClassSpec.Attributes = MakeAttributeNamesUnique(attributeSpecs);

            var associationSpecs = new List <UmlAssociationSpec>();

            if (abieSpec.Asbies != null)
            {
                foreach (var asbieSpec in abieSpec.Asbies)
                {
                    associationSpecs.Add(AsbieSpecConverter.Convert(asbieSpec, abieSpec.Name));
                }
            }
            umlClassSpec.Associations = MakeAssociationNamesUnique(associationSpecs);

            return(umlClassSpec);
        }