internal static UmlAssociationSpec Convert(AsbieSpec asbieSpec, string associatingClassName) { var associatedClassifierType = ((UpccAbie)asbieSpec.AssociatedAbie).UmlClass; var umlAssociationSpec = new UmlAssociationSpec { Stereotype = "ASBIE", Name = asbieSpec.Name, UpperBound = asbieSpec.UpperBound, LowerBound = asbieSpec.LowerBound, AggregationKind = asbieSpec.AggregationKind == AggregationKind.Shared ? AggregationKind.Shared : AggregationKind.Composite, AssociatedClassifier = associatedClassifierType, TaggedValues = new[] { new UmlTaggedValueSpec("businessTerm", asbieSpec.BusinessTerms), new UmlTaggedValueSpec("definition", asbieSpec.Definition), new UmlTaggedValueSpec("dictionaryEntryName", asbieSpec.DictionaryEntryName) { DefaultValue = GenerateDictionaryEntryNameDefaultValue(asbieSpec, associatingClassName) }, new UmlTaggedValueSpec("languageCode", asbieSpec.LanguageCode), new UmlTaggedValueSpec("sequencingKey", asbieSpec.SequencingKey), new UmlTaggedValueSpec("uniqueIdentifier", asbieSpec.UniqueIdentifier) { DefaultValue = GenerateUniqueIdentifierDefaultValue(asbieSpec, associatingClassName) }, new UmlTaggedValueSpec("versionIdentifier", asbieSpec.VersionIdentifier), new UmlTaggedValueSpec("usageRule", asbieSpec.UsageRules), }, }; return(umlAssociationSpec); }
///<summary> ///</summary> ///<param name="abieComplexType"> ///</param> ///<param name="allElementDefinitions"> ///</param> ///<returns> ///</returns> public static IList <AsbieSpec> CumulateAbiesSpecsFromComplexType(ComplexType abieComplexType, IDictionary <string, string> allElementDefinitions) { IList <AsbieSpec> newAsbieSpecs = new List <AsbieSpec>(); string abieName = abieComplexType.Name.Substring(0, abieComplexType.Name.Length - 4); foreach (Element element in abieComplexType.Items) { if (!(element.Ref.Name.Equals(""))) { string associatedABIEName = allElementDefinitions[element.Ref.Name]; associatedABIEName = associatedABIEName.Substring(0, associatedABIEName.Length - 4); IAbie associatedAbie = BieLibrary.GetAbieByName(associatedABIEName); string asbieName = NDR.GetAsbieNameFromXsdElement(element, associatedABIEName); AsbieSpec asbieSpec = MatchAsbieToAscc(FindBaseACCForABIE(abieName), asbieName, associatedAbie); if (asbieSpec == null) { asbieSpec = CumulateAsbieSpec(element, asbieName, associatedAbie, AggregationKind.Shared); } newAsbieSpecs.Add(asbieSpec); } else { if (element.Type.Prefix.Equals("tns")) { string associatedAbieName = element.Type.Name; associatedAbieName = associatedAbieName.Substring(0, associatedAbieName.Length - 4); IAbie associatedAbie = BieLibrary.GetAbieByName(associatedAbieName); string asbieName = element.Name.Substring(0, element.Name.Length - associatedAbieName.Length); AsbieSpec asbieSpec = MatchAsbieToAscc(FindBaseACCForABIE(abieName), asbieName, associatedAbie); if (asbieSpec == null) { asbieSpec = CumulateAsbieSpec(element, asbieName, associatedAbie, AggregationKind.Composite); } newAsbieSpecs.Add(asbieSpec); } } } return(newAsbieSpecs); }
///<summary> ///</summary> ///<param name="acc"> ///</param> ///<param name="asbieName"> ///</param> ///<param name="associatedAbie"> ///</param> ///<returns> ///</returns> private static AsbieSpec MatchAsbieToAscc(IAcc acc, string asbieName, IAbie associatedAbie) { foreach (IAscc ascc in acc.Asccs) { if (ascc.Name.Equals(asbieName)) { return(AsbieSpec.CloneAscc(ascc, asbieName, associatedAbie)); } } return(null); }
///<summary> ///</summary> ///<param name="element"> ///</param> ///<param name="asbieName"> ///</param> ///<param name="associatedAbie"> ///</param> ///<param name="aggregationKind"> ///</param> ///<returns> ///</returns> public static AsbieSpec CumulateAsbieSpec(Element element, string asbieName, IAbie associatedAbie, AggregationKind aggregationKind) { AsbieSpec asbieSpec = new AsbieSpec { AssociatedAbie = associatedAbie, Name = asbieName, LowerBound = ResolveMinOccurs(element.MinOccurs), UpperBound = ResolveMaxOccurs(element.MaxOccurs), AggregationKind = aggregationKind }; return(asbieSpec); }
internal AsbieSpec GenerateSpec() { return(AsbieSpec.CloneAscc(ascc, asbieName, bieLibrary.GetAbieByName(associatedAbieName))); }
/// <summary> /// Updates a(n) ASBIE to match the given <paramref name="specification"/>. /// <param name="asbie">A(n) ASBIE.</param> /// <param name="specification">A new specification for the given ASBIE.</param> /// <returns>The updated ASBIE. Depending on the implementation, this might be the same updated instance or a new instance!</returns> /// </summary> public IAsbie UpdateAsbie(IAsbie asbie, AsbieSpec specification) { return(new UpccAsbie(UmlClass.UpdateAssociation(((UpccAsbie)asbie).UmlAssociation, AsbieSpecConverter.Convert(specification, Name)), this)); }
/// <summary> /// Creates a(n) ASBIE based on the given <paramref name="specification"/>. /// <param name="specification">A specification for a(n) ASBIE.</param> /// <returns>The newly created ASBIE.</returns> /// </summary> public IAsbie CreateAsbie(AsbieSpec specification) { return(new UpccAsbie(UmlClass.CreateAssociation(AsbieSpecConverter.Convert(specification, Name)), this)); }
private static string GenerateDictionaryEntryNameDefaultValue(AsbieSpec asbieSpec, string associatingClassName) { return(associatingClassName + ". " + asbieSpec.Name + ". " + asbieSpec.AssociatedAbie.Name); }
private static string GenerateUniqueIdentifierDefaultValue(AsbieSpec asbieSpec, string associatingClassName) { return(Guid.NewGuid().ToString()); }