internal static UmlAssociationSpec Convert(AsmaSpec asmaSpec, string associatingClassName) { IUmlClassifier associatedClassifierType; var multiType = asmaSpec.AssociatedBieAggregator; if (multiType.IsAbie) { associatedClassifierType = ((UpccAbie)multiType.Abie).UmlClass; } else if (multiType.IsMa) { associatedClassifierType = ((UpccMa)multiType.Ma).UmlClass; } else { associatedClassifierType = null; } var umlAssociationSpec = new UmlAssociationSpec { Stereotype = "ASMA", Name = asmaSpec.Name, UpperBound = asmaSpec.UpperBound, LowerBound = asmaSpec.LowerBound, AggregationKind = AggregationKind.Shared, AssociatedClassifier = associatedClassifierType, }; return(umlAssociationSpec); }
internal AsmaSpec GenerateSpec() { AsmaSpec asmaSpec = new AsmaSpec { Name = name, AssociatedBieAggregator = new BieAggregator(bieLibrary != null ? (object)bieLibrary.GetAbieByName(associatedBieName) : docLibrary.GetMaByName(associatedBieName)), }; return(asmaSpec); }
private void GenerateRootABIE() { var rootElementMapping = schemaMapping.RootElementMapping; if (rootElementMapping is AsmaMapping) { AsmaMapping asmaMapping = (AsmaMapping)rootElementMapping; var ma = docLibrary.CreateMa(new MaSpec { Name = qualifier + "_" + rootElementName, }); AsmaSpec asmaSpec = new AsmaSpec { Name = asmaMapping.SourceElementName, }; if (asmaMapping.TargetMapping is ComplexTypeToAccMapping) { asmaSpec.AssociatedBieAggregator = new BieAggregator(bieLibrary.GetAbieByName(asmaMapping.TargetMapping.BIEName)); } else { asmaSpec.AssociatedBieAggregator = new BieAggregator(docLibrary.GetMaByName(asmaMapping.TargetMapping.BIEName)); } ma.CreateAsma(asmaSpec); } else if (rootElementMapping is AttributeOrSimpleElementOrComplexElementToBccMapping) { var bccMapping = (AttributeOrSimpleElementOrComplexElementToBccMapping)rootElementMapping; var abie = bieLibrary.CreateAbie(new AbieSpec { BasedOn = bccMapping.Acc, Name = qualifier + "_" + bccMapping.Acc.Name, Bbies = new List <BbieSpec>(GenerateBbieSpecs(new List <AttributeOrSimpleElementOrComplexElementToBccMapping> { bccMapping })), }); var ma = docLibrary.CreateMa(new MaSpec { Name = qualifier + "_" + rootElementName, }); ma.CreateAsma(new AsmaSpec { Name = abie.Name, AssociatedBieAggregator = new BieAggregator(abie), }); } else { throw new MappingError("Root element can only be mapped to BCC, but is mapped to something else."); } }
internal AsmaSpec GenerateSpec() { ICctsElement element; if (bieLibrary != null) { element = bieLibrary.GetAbieByName(associatedBieName); } else { element = docLibrary.GetMaByName(associatedBieName); } AsmaSpec asmaSpec = new AsmaSpec { Name = name, AssociatedBieAggregator = new BieAggregator(element), }; return(asmaSpec); }
/// <summary> /// Updates a(n) ASMA to match the given <paramref name="specification"/>. /// <param name="asma">A(n) ASMA.</param> /// <param name="specification">A new specification for the given ASMA.</param> /// <returns>The updated ASMA. Depending on the implementation, this might be the same updated instance or a new instance!</returns> /// </summary> public IAsma UpdateAsma(IAsma asma, AsmaSpec specification) { return(new UpccAsma(UmlClass.UpdateAssociation(((UpccAsma)asma).UmlAssociation, AsmaSpecConverter.Convert(specification, Name)), this)); }
/// <summary> /// Creates a(n) ASMA based on the given <paramref name="specification"/>. /// <param name="specification">A specification for a(n) ASMA.</param> /// <returns>The newly created ASMA.</returns> /// </summary> public IAsma CreateAsma(AsmaSpec specification) { return(new UpccAsma(UmlClass.CreateAssociation(AsmaSpecConverter.Convert(specification, Name)), this)); }