internal static UmlAssociationSpec Convert(AsccSpec asccSpec, string associatingClassName) { var associatedClassifierType = ((UpccAcc)asccSpec.AssociatedAcc).UmlClass; var umlAssociationSpec = new UmlAssociationSpec { Stereotype = "ASCC", Name = asccSpec.Name, UpperBound = asccSpec.UpperBound, LowerBound = asccSpec.LowerBound, AggregationKind = AggregationKind.Shared, AssociatedClassifier = associatedClassifierType, TaggedValues = new[] { new UmlTaggedValueSpec("businessTerm", asccSpec.BusinessTerms), new UmlTaggedValueSpec("definition", asccSpec.Definition), new UmlTaggedValueSpec("dictionaryEntryName", asccSpec.DictionaryEntryName) { DefaultValue = GenerateDictionaryEntryNameDefaultValue(asccSpec, associatingClassName) }, new UmlTaggedValueSpec("languageCode", asccSpec.LanguageCode), new UmlTaggedValueSpec("sequencingKey", asccSpec.SequencingKey), new UmlTaggedValueSpec("uniqueIdentifier", asccSpec.UniqueIdentifier) { DefaultValue = GenerateUniqueIdentifierDefaultValue(asccSpec, associatingClassName) }, new UmlTaggedValueSpec("versionIdentifier", asccSpec.VersionIdentifier), new UmlTaggedValueSpec("usageRule", asccSpec.UsageRules), }, }; return(umlAssociationSpec); }
private static string GenerateDictionaryEntryNameDefaultValue(AsccSpec asccSpec, string associatingClassName) { return(associatingClassName + ". " + asccSpec.Name + ". " + asccSpec.AssociatedAcc.Name); }
private static string GenerateUniqueIdentifierDefaultValue(AsccSpec asccSpec, string associatingClassName) { return(Guid.NewGuid().ToString()); }
/// <summary> /// Updates a(n) ASCC to match the given <paramref name="specification"/>. /// <param name="ascc">A(n) ASCC.</param> /// <param name="specification">A new specification for the given ASCC.</param> /// <returns>The updated ASCC. Depending on the implementation, this might be the same updated instance or a new instance!</returns> /// </summary> public IAscc UpdateAscc(IAscc ascc, AsccSpec specification) { return(new UpccAscc(UmlClass.UpdateAssociation(((UpccAscc)ascc).UmlAssociation, AsccSpecConverter.Convert(specification, Name)), this)); }
/// <summary> /// Creates a(n) ASCC based on the given <paramref name="specification"/>. /// <param name="specification">A specification for a(n) ASCC.</param> /// <returns>The newly created ASCC.</returns> /// </summary> public IAscc CreateAscc(AsccSpec specification) { return(new UpccAscc(UmlClass.CreateAssociation(AsccSpecConverter.Convert(specification, Name)), this)); }