コード例 #1
0
 private void CcLibraryComboBoxSelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (ccLibraryComboBox.SelectedIndex > -1)
     {
         SelectedCcLibrary = Model.CcLibraries[ccLibraryComboBox.SelectedIndex];
     }
     CheckIfInputIsValid();
 }
コード例 #2
0
 /// <summary>
 /// </summary>
 /// <param name="xmlSchemaFiles"></param>
 /// <param name="ccLibrary">The CC Library.</param>
 /// <param name="bLibrary">The bLibrary.</param>
 /// <param name="mapForceMappingFiles">The MapForce mapping file.</param>
 /// <param name="docLibraryName">The name of the DOCLibrary to be created.</param>
 /// <param name="bieLibraryName">The name of the BIELibrary to be created.</param>
 /// <param name="bdtLibraryName">The name of the BDTLibrary to be created.</param>
 /// <param name="qualifier">The qualifier for the business domain (e.g. "ebInterface").</param>
 /// <param name="rootElementName"></param>
 public MappingImporter(IEnumerable <string> mapForceMappingFiles, IEnumerable <string> xmlSchemaFiles, ICcLibrary ccLibrary, IBLibrary bLibrary, string docLibraryName, string bieLibraryName, string bdtLibraryName, string qualifier, string rootElementName, ICctsRepository cctsRepository)
 {
     this.ccLibrary            = ccLibrary;
     this.bLibrary             = bLibrary;
     this.mapForceMappingFiles = new List <string>(mapForceMappingFiles).ToArray();
     this.xmlSchemaFiles       = new List <string>(xmlSchemaFiles).ToArray();
     this.docLibraryName       = docLibraryName;
     this.bieLibraryName       = bieLibraryName;
     this.bdtLibraryName       = bdtLibraryName;
     this.qualifier            = qualifier;
     this.rootElementName      = rootElementName;
     this.cctsRepository       = cctsRepository;
 }
コード例 #3
0
 public static CcLibrarySpec CloneCcLibrary(ICcLibrary ccLibrary)
 {
     return(new CcLibrarySpec
     {
         Name = ccLibrary.Name,
         BusinessTerms = new List <string>(ccLibrary.BusinessTerms),
         Copyrights = new List <string>(ccLibrary.Copyrights),
         Owners = new List <string>(ccLibrary.Owners),
         References = new List <string>(ccLibrary.References),
         Status = ccLibrary.Status,
         VersionIdentifier = ccLibrary.VersionIdentifier,
         BaseURN = ccLibrary.BaseURN,
         NamespacePrefix = ccLibrary.NamespacePrefix,
     });
 }
コード例 #4
0
        public TargetElementStore(MapForceMapping mapForceMapping, ICcLibrary ccLibrary, ICctsRepository cctsRepository)
        {
            cache = CcCache.GetInstance(cctsRepository);

            IEnumerable <SchemaComponent> targetSchemaComponents = mapForceMapping.GetTargetSchemaComponents();

            foreach (SchemaComponent component in targetSchemaComponents)
            {
                Entry entry = component.RootEntry;

                IAcc acc = cache.GetCcFromCcLibrary(ccLibrary.Name, entry.Name);

                if (acc == null)
                {
                    throw new MappingError("ACC '" + entry.Name + "' not found.");
                }
                AddToIndex(entry, acc);
                CreateChildren(entry, acc);
            }
        }
コード例 #5
0
ファイル: Cache.cs プロジェクト: hahaking119/vienna-add-in
        public void LoadACCs(ICctsRepository repository)
        {
            if (ACCs.Count == 0)
            {
                ICcLibrary ccl = repository.GetCcLibraryById(Id);

                foreach (IAcc acc in ccl.Accs)
                {
                    if (ACCs.ContainsKey(acc.Name))
                    {
                        ACCs.Clear();
                        throw new CacheException("The wizard encountered two ACCs having identical names. Please verify your model!");
                    }

                    ACCs.Add(acc.Name, new cACC(acc.Name, acc.Id, CheckState.Unchecked));
                }
            }

            if (ACCs.Count == 0)
            {
                throw new CacheException("The CC library did not contain any ACCs. Please make sure at least one ACC is present in the library before proceeding with the wizard.");
            }
        }
コード例 #6
0
        public static void ImportACCs(ICcLibrary ccLibrary, IEnumerable <AccSpec> accSpecs, Dictionary <string, List <AsccSpecWithAssociatedAccName> > accAsccSpecs)
        {
            // need two passes:
            //  (1) create the ACCs
            //  (2) create the ASCCs
            var accs = new Dictionary <string, IAcc>();

            foreach (var accSpec in accSpecs)
            {
                Console.WriteLine("INFO: Importing ACC " + accSpec.Name + ".");
                accs[accSpec.Name] = ccLibrary.CreateAcc(accSpec);
            }
            foreach (var accSpec in accSpecs)
            {
                Console.WriteLine("INFO: Importing ASCCs for ACC " + accSpec.Name + ".");
                var associatingAcc = accs[accSpec.Name];
                foreach (var asccSpec in accAsccSpecs.GetAndCreate(accSpec.Name))
                {
                    asccSpec.AssociatedAcc = accs[asccSpec.AssociatedAccName];
                    associatingAcc.CreateAscc(asccSpec);
                }
            }
        }
コード例 #7
0
 public static void InitLibraries(ImporterContext context)
 {
     ExistingAccs = context.CCLibrary;
     ExistingBdts = context.BDTLibrary;
     BieLibrary   = context.BIELibrary;
 }
コード例 #8
0
 public void RemoveCcLibrary(ICcLibrary ccLibrary)
 {
     throw new NotImplementedException();
 }
コード例 #9
0
 public ICcLibrary UpdateCcLibrary(ICcLibrary ccLibrary, CcLibrarySpec specification)
 {
     throw new NotImplementedException();
 }
コード例 #10
0
        public SchemaMapping(MapForceMapping mapForceMapping, XmlSchemaSet xmlSchemaSet, ICcLibrary ccLibrary, ICctsRepository cctsRepository)
        {
            sourceItemStore = new MapForceSourceItemTree(mapForceMapping, xmlSchemaSet);

            targetElementStore = new TargetElementStore(mapForceMapping, ccLibrary, cctsRepository);

            mappingFunctionStore = new MappingFunctionStore(mapForceMapping, targetElementStore);

            RootElementMapping = MapElement(sourceItemStore.RootSourceItem, "/" + sourceItemStore.RootSourceItem.Name, new Stack <XmlQualifiedName>());

            elementMappings.Add(RootElementMapping);

            elementMappings = new List <ElementMapping>(ResolveTypeMappings(elementMappings));

            foreach (KeyValuePair <string, List <ComplexTypeMapping> > pair in complexTypeMappings)
            {
                foreach (ComplexTypeMapping complexTypeMapping in pair.Value)
                {
                    complexTypeMapping.RemoveInvalidAsmaMappings();
                }
            }

            Dictionary <string, List <ComplexTypeMapping> > relevantComplexTypeMappings = new Dictionary <string, List <ComplexTypeMapping> >();

            foreach (KeyValuePair <string, List <ComplexTypeMapping> > pair in complexTypeMappings)
            {
                string             complexTypeName = pair.Key;
                ComplexTypeMapping relevantMapping = GetComplexTypeMappingWithMostChildren(pair.Value);
                if (relevantMapping is ComplexTypeToMaMapping)
                {
                    relevantMapping = CreateComplexTypeMappingForChildMappings(relevantMapping.Children, complexTypeName, relevantMapping.SourceElementName);
                }
                if (relevantMapping != null)
                {
                    relevantComplexTypeMappings[complexTypeName] = new List <ComplexTypeMapping> {
                        relevantMapping
                    };
                }
            }
            complexTypeMappings = relevantComplexTypeMappings;

            foreach (ElementMapping elementMapping in elementMappings)
            {
                if (elementMapping is AsmaMapping)
                {
                    AsmaMapping        asmaMapping        = (AsmaMapping)elementMapping;
                    ComplexTypeMapping complexTypeMapping = CreateComplexTypeMappingForChildMappings(asmaMapping.TargetMapping.Children, asmaMapping.TargetMapping.ComplexTypeName, asmaMapping.TargetMapping.SourceElementName);
                    asmaMapping.TargetMapping = complexTypeMapping;
                }
            }

            foreach (KeyValuePair <string, List <ComplexTypeMapping> > pair in complexTypeMappings)
            {
                foreach (ComplexTypeMapping complexTypeMapping in pair.Value)
                {
                    complexTypeMapping.RemoveInvalidAsmaMappings();
                }
            }


            // The following lines of code were used for the CEC 2010 paper evaluation.

            //Console.Out.WriteLine("Kennzahl 3 (implizite Mappings): haendisch");
            //Console.Out.WriteLine("Kennzahl 4 (Anzahl der gemappten Elemente)): " + (elementMappings.Count + simpleTypeMappings.Count + complexTypeMappings.Count));

            //Console.Out.WriteLine("Importer Kennzahl 3a (anhand elementMapping variable): " + elementMappings.Count);
            //Console.Out.WriteLine("Importer Kennzahl 3b (anhand simpleTypeMappings): " + simpleTypeMappings.Count);
            //Console.Out.WriteLine("Importer Kennzahl 3c (anhand complexTypeMappings): " + complexTypeMappings.Count);
        }
コード例 #11
0
 public ACCResolver(ICcLibrary ccLibrary)
 {
     this.ccLibrary = ccLibrary;
 }
コード例 #12
0
        private static void ImportCCL(string cclVersion)
        {
            var    eaRepository     = new Repository();
            string originalRepoPath = Directory.GetCurrentDirectory() + string.Format(@"\..\..\resources\{0}\Repository-with-CDTs.eap", cclVersion);
            string targetRepoPath   = originalRepoPath.WithoutSuffix(".eap") + "-and-CCs.eap";

            File.Copy(originalRepoPath, targetRepoPath, true);
            eaRepository.OpenFile(targetRepoPath);
            ICctsRepository cctsRepository = CctsRepositoryFactory.CreateCctsRepository(eaRepository);
            var             bLibrary       = cctsRepository.GetBLibraryByPath((Path)"Model" / "bLibrary");
            var             cdtLibrary     = bLibrary.GetCdtLibraryByName("CDTLibrary");

            var cdts = new Dictionary <string, ICdt>();

            foreach (ICdt cdt in cdtLibrary.Cdts)
            {
                cdts[cdt.Name] = cdt;
            }

            ICcLibrary ccLibrary = bLibrary.CreateCcLibrary(new CcLibrarySpec
            {
                Name = "CCLibrary",
                VersionIdentifier = cclVersion
            });

            StreamReader reader = File.OpenText(string.Format(@"..\..\resources\{0}\{0}-CCs.txt", cclVersion));
            String       line;
            var          accSpecs  = new List <AccSpec>();
            var          asccSpecs = new Dictionary <string, List <AsccSpecWithAssociatedAccName> >();
            AccSpec      accSpec   = null;

            while ((line = reader.ReadLine()) != null)
            {
                LineNumber++;
                if (LineNumber < 2)
                {
                    continue;
                }

                if (Debug)
                {
                    if (LineNumber > 150)
                    {
                        break;
                    }
                }

                Record record = GetRecord(line);

                switch (record.ElementType)
                {
                case "ACC":
                    CheckACCRecord(record);
                    accSpec = new AccSpec
                    {
                        UniqueIdentifier  = record.UniqueUNAssignedID,
                        Name              = GetACCName(record),
                        Definition        = record.Definition.LimitTo(MaximumTaggedValueLength),
                        BusinessTerms     = ToArray(record.BusinessTerms.LimitTo(MaximumTaggedValueLength)),
                        UsageRules        = ToArray(record.UsageRules.LimitTo(MaximumTaggedValueLength)),
                        VersionIdentifier = record.Version,
                        Bccs              = new List <BccSpec>(),
                        Asccs             = new List <AsccSpec>(),
                    };
                    accSpecs.Add(accSpec);
                    break;

                case "BCC":
                    if (accSpec == null)
                    {
                        throw new Exception("The first record must specify an ACC.");
                    }
                    CheckBCCRecord(record, accSpec.Name);
                    var bccSpec = new BccSpec
                    {
                        UniqueIdentifier    = record.UniqueUNAssignedID,
                        Definition          = record.Definition.LimitTo(MaximumTaggedValueLength),
                        DictionaryEntryName = record.DictionaryEntryName,
                        Name              = QualifiedName(record.PropertyTermQualifiers, record.PropertyTerm),
                        BusinessTerms     = ToArray(record.BusinessTerms.LimitTo(MaximumTaggedValueLength)),
                        UsageRules        = ToArray(record.UsageRules.LimitTo(MaximumTaggedValueLength)),
                        SequencingKey     = record.SequenceNumber,
                        LowerBound        = MapOccurrence(record.OccurrenceMin),
                        UpperBound        = MapOccurrence(record.OccurrenceMax),
                        VersionIdentifier = record.Version,
                        Cdt = FindCDT(record.RepresentationTerm.AsName(), cdts)
                    };
                    if (bccSpec.Cdt == null)
                    {
                        Console.WriteLine("WARNING: Skipping line {0}: CDT not found: <{1}>.", LineNumber, record.RepresentationTerm);
                        continue;
                    }
                    accSpec.Bccs.Add(bccSpec);
                    break;

                case "ASCC":
                    if (accSpec == null)
                    {
                        throw new Exception("The first record must specify an ACC.");
                    }
                    CheckASCCRecord(record, accSpec.Name);
                    var asccSpec = new AsccSpecWithAssociatedAccName
                    {
                        UniqueIdentifier  = record.UniqueUNAssignedID,
                        Definition        = record.Definition.LimitTo(MaximumTaggedValueLength),
                        Name              = QualifiedName(record.PropertyTermQualifiers, record.PropertyTerm),
                        BusinessTerms     = ToArray(record.BusinessTerms.LimitTo(MaximumTaggedValueLength)),
                        UsageRules        = ToArray(record.UsageRules.LimitTo(MaximumTaggedValueLength)),
                        SequencingKey     = record.SequenceNumber,
                        LowerBound        = MapOccurrence(record.OccurrenceMin),
                        UpperBound        = MapOccurrence(record.OccurrenceMax),
                        VersionIdentifier = record.Version,
                        AssociatedAccName = record.AssociatedObjectClass.AsName(),
                    };
                    asccSpecs.GetAndCreate(accSpec.Name).Add(asccSpec);
                    break;

                default:
                    Console.WriteLine("WARNING: Skipping line {0}.", LineNumber);
                    break;
                }
            }
            reader.Close();

            try
            {
                ACCImporter.ImportACCs(ccLibrary, accSpecs, asccSpecs);
            }
            finally
            {
                eaRepository.CloseFile();
            }
            Console.WriteLine("INFO: Number of ACCs: " + accSpecs.Count);
            Console.WriteLine("Press a key to continue...");
            Console.ReadKey();
        }
コード例 #13
0
 public CandidateCcLibrary(ICcLibrary ccLibrary)
 {
     mOriginalCcLibrary = ccLibrary;
     mSelected          = false;
     mCandidateAccs     = null;
 }
コード例 #14
0
 internal CacheItemCcLibrary(ICcLibrary library)
 {
     CcLibrary = library;
 }
コード例 #15
0
 /// <summary>
 /// Removes a CcLibrary from this bLibrary.
 /// <param name="ccLibrary">A CcLibrary.</param>
 /// </summary>
 public void RemoveCcLibrary(ICcLibrary ccLibrary)
 {
     UmlPackage.RemovePackage(((UpccCcLibrary)ccLibrary).UmlPackage);
 }
コード例 #16
0
 /// <summary>
 /// Updates a CCLibrary to match the given <paramref name="specification"/>.
 /// <param name="ccLibrary">A CCLibrary.</param>
 /// <param name="specification">A new specification for the given CCLibrary.</param>
 /// <returns>The updated CCLibrary. Depending on the implementation, this might be the same updated instance or a new instance!</returns>
 /// </summary>
 public ICcLibrary UpdateCcLibrary(ICcLibrary ccLibrary, CcLibrarySpec specification)
 {
     return(new UpccCcLibrary(UmlPackage.UpdatePackage(((UpccCcLibrary)ccLibrary).UmlPackage, CcLibrarySpecConverter.Convert(specification))));
 }