public AsbieToGenerate(IBieLibrary bieLibrary, IAscc ascc, string asbieName, string associatedAbieName)
 {
     this.bieLibrary         = bieLibrary;
     this.ascc               = ascc;
     this.asbieName          = asbieName;
     this.associatedAbieName = associatedAbieName;
 }
        ///<summary>
        ///</summary>
        ///<param name="asbie"></param>
        ///<returns></returns>
        public static XmlSchemaAnnotation GetASCCAnnotiation(IAscc ascc)
        {
            // Contains all the documentation items such as DictionaryEntryName
            IList <XmlNode> documentation = new List <XmlNode>();

            AddDocumentation(documentation, "UniqueID", ascc.UniqueIdentifier);
            AddDocumentation(documentation, "VersionID", ascc.VersionIdentifier);
            AddDocumentation(documentation, "Cardinality", ascc.LowerBound + ".." + ascc.UpperBound);
            AddDocumentation(documentation, "SequencingKey", ascc.SequencingKey);
            AddDocumentation(documentation, "DictionaryEntryName", ascc.DictionaryEntryName);
            AddDocumentation(documentation, "Definition", ascc.Definition);
            AddDocumentation(documentation, "BusinessTermName", ascc.BusinessTerms);
            AddDocumentation(documentation, "AssociationType", EaAggregationKind.Shared.ToString());
            AddDocumentation(documentation, "PropertyTermName", ascc.Name);
            // PropertyQualifierName could be extracted from the PropertyTermName (e.g. "My" in
            // "My_Address") but is not implement at this point
            AddDocumentation(documentation, "PropertyQualifierName", "");
            AddDocumentation(documentation, "AssociatedObjectClassTermName", ascc.AssociatedAcc.Name);
            // AssociatedObjectClassQualifierTermName could be extracted from the AssociatedObjectClassTermName
            // (e.g. "My" in "My_Address") but is not implement at this point
            AddDocumentation(documentation, "AcronymCode", "ASBIE");


            XmlSchemaAnnotation annotation = new XmlSchemaAnnotation();

            annotation.Items.Add(new XmlSchemaDocumentation {
                Language = "en", Markup = documentation.ToArray()
            });

            return(annotation);
        }
        /// <exception cref="MappingError"><c>MappingError</c>.</exception>
        private void CreateChildren(Entry entry, IAcc acc)
        {
            foreach (Entry subEntry in entry.SubEntries)
            {
                IBcc bcc = GetBcc(acc, subEntry.Name);

                if (bcc != null)
                {
                    AddToIndex(subEntry, bcc);
                    CreateChildren(subEntry, bcc.Cdt);
                }
                else
                {
                    IAscc ascc = GetAscc(acc, subEntry.Name);
                    if (ascc != null)
                    {
                        AddToIndex(subEntry, ascc);
                        CreateChildren(subEntry, ascc.AssociatedAcc);
                    }
                    else
                    {
                        throw new MappingError("BCC or ASCC '" + subEntry.Name + "' not found.");
                    }
                }
            }
        }
        public PotentialAsbie(IAscc originalAscc)
        {
            mName    = originalAscc.Name;
            mChecked = false;
            mBasedOn = originalAscc;

            mItemReadOnly  = true;
            mItemCursor    = Cursors.Arrow;
            mItemFocusable = false;
        }
        /// <exception cref="MappingError">Simple typed element mapped to non-BCC CCTS element.</exception>
        private ElementMapping MapElement(SourceItem sourceElement, string path, Stack <XmlQualifiedName> parentComplexTypeNames)
        {
            if (sourceElement.HasSimpleType())
            {
                if (!sourceElement.IsMapped)
                {
                    // ignore element
                    return(ElementMapping.NullElementMapping);
                }
                if (IsMappedToBcc(sourceElement))
                {
                    SimpleTypeToCdtMapping simpleTypeToCdtMapping = MapSimpleType(sourceElement);
                    return(new AttributeOrSimpleElementOrComplexElementToBccMapping(sourceElement, (IBcc)GetTargetElement(sourceElement), simpleTypeToCdtMapping));
                }
                if (IsMappedToSup(sourceElement))
                {
                    return(new AttributeOrSimpleElementToSupMapping(sourceElement, (ICdtSup)GetTargetElement(sourceElement)));
                }
                if (IsMappedToSplitFunction(sourceElement))
                {
                    List <SimpleTypeToCdtMapping> simpleTypeToCdtMappings = new List <SimpleTypeToCdtMapping>();
                    MappingFunction splitFunction = GetMappingFunction(sourceElement);
                    foreach (IBcc targetBcc in splitFunction.TargetCcs)
                    {
                        simpleTypeToCdtMappings.Add(MapSimpleType(sourceElement, targetBcc));
                    }
                    return(new SplitMapping(sourceElement, splitFunction.TargetCcs.Convert(cc => (IBcc)cc), simpleTypeToCdtMappings));
                }
                throw new MappingError("Simple typed element '" + path + "' mapped to non-BCC CCTS element.");
            }

            if (sourceElement.HasComplexType())
            {
                MapComplexType(sourceElement, path, parentComplexTypeNames);

                if (!sourceElement.IsMapped)
                {
                    return(new AsmaMapping(sourceElement));
                }
                if (IsMappedToAscc(sourceElement))
                {
                    IAscc targetAscc = (IAscc)GetTargetElement(sourceElement);
                    return(new ComplexElementToAsccMapping(sourceElement, targetAscc));
                }
                if (IsMappedToBcc(sourceElement))
                {
                    IBcc targetBcc = (IBcc)GetTargetElement(sourceElement);
                    return(new AttributeOrSimpleElementOrComplexElementToBccMapping(sourceElement, targetBcc, null));
                }

                throw new MappingError("Complex typed element '" + path + "' not mapped to either a BCC or an ASCC.");
            }
            throw new Exception("Source element '" + path + "' has neither simple nor complex type.");
        }
 public static AsbieSpec CloneAscc(IAscc ascc, string name, IAbie associatedAbie)
 {
     return(new AsbieSpec
     {
         BusinessTerms = new List <string>(ascc.BusinessTerms),
         Definition = ascc.Definition,
         LanguageCode = ascc.LanguageCode,
         SequencingKey = ascc.SequencingKey,
         UsageRules = new List <string>(ascc.UsageRules),
         Name = name,
         AssociatedAbie = associatedAbie,
         LowerBound = ascc.LowerBound,
         UpperBound = ascc.UpperBound,
     });
 }
예제 #7
0
 public static AsccSpec CloneAscc(IAscc ascc)
 {
     return(new AsccSpec
     {
         Name = ascc.Name,
         UpperBound = ascc.UpperBound,
         LowerBound = ascc.LowerBound,
         AssociatedAcc = ascc.AssociatedAcc,
         BusinessTerms = new List <string>(ascc.BusinessTerms),
         Definition = ascc.Definition,
         LanguageCode = ascc.LanguageCode,
         SequencingKey = ascc.SequencingKey,
         VersionIdentifier = ascc.VersionIdentifier,
         UsageRules = new List <string>(ascc.UsageRules),
     });
 }
        private void AddPotentialAsbieToCandidateAbie(string abieName, IAscc ascc)
        {
            foreach (CandidateAbie candidateAbie in mCandidateAbies)
            {
                if (candidateAbie.Name.Equals(abieName))
                {
                    if (candidateAbie.PotentialAsbies == null)
                    {
                        candidateAbie.PotentialAsbies = new List <PotentialAsbie>();
                    }

                    candidateAbie.PotentialAsbies.Add(new PotentialAsbie(ascc));

                    break;
                }
            }
        }
예제 #9
0
 /// <summary>
 /// Removes a(n) ASCC from this ACC.
 /// <param name="ascc">A(n) ASCC.</param>
 /// </summary>
 public void RemoveAscc(IAscc ascc)
 {
     UmlClass.RemoveAssociation(((UpccAscc)ascc).UmlAssociation);
 }
예제 #10
0
 /// <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));
 }
예제 #11
0
 public static string GenerateASCCName(IAscc ascc)
 {
     return(ascc.Name + TrimElementName(ascc.AssociatedAcc.Name));
 }
 public ComplexElementToAsccMapping(SourceItem sourceElement, IAscc targetAscc)
     : base(sourceElement)
 {
     Ascc = targetAscc;
     Acc  = Ascc.AssociatingAcc;
 }
예제 #13
0
 public static string GenerateASCCName(IAscc ascc)
 {
     return(ascc.Name + ascc.AssociatedAcc.Name);
 }
        private void ShouldContainTargetAsccElement(TargetElementStore targetElementStore, string name, IAscc referencedAscc)
        {
            object targetCc = ShouldContainTargetCc(name, targetElementStore, referencedAscc);

            Assert.IsTrue(targetCc is IAscc);
            Assert.That(((IAscc)targetCc).Id, Is.EqualTo(referencedAscc.Id));
        }