private void manage()
        {
            if (this.model == null)
            {
                return;
            }
            this.managedPackage = (TSF_EA.Package) this.Model.selectedTreePackage;
            if (this._mainControl != null)
            {
                switch (this.mainControl.selectedTab)
                {
                case GlossaryTab.BusinessItems:
                    this.showBusinessItems((TSF_EA.Package) this.Model.selectedTreePackage, null);
                    break;

                case GlossaryTab.DataItems:
                    this.showDataItems((TSF_EA.Package) this.Model.selectedTreePackage, null);
                    break;

                case GlossaryTab.Columns:
                    this.showColumns(this.getDataItems((TSF_EA.Package) this.model.selectedTreePackage, null), null);
                    break;
                }
            }
            else
            {
                //default show business items
                this.showBusinessItems((TSF_EA.Package) this.Model.selectedTreePackage, null);
            }
        }
 public PackageMappingSet(Package wrappedPackage, bool source)
 {
     this.wrappedPackage = wrappedPackage;
     this.source = source;
     base.name = wrappedPackage.name;
     base.mappings = this.getMappings().Cast<MP.Mapping>().ToList();;
 }
Esempio n. 3
0
        private List <T> list <T>(TSF_EA.Package package) where T : GlossaryItem
        {
            List <T> items = new List <T>();

            if (package != null)
            {
                foreach (TSF_EA.Class clazz in package.ownedElements.OfType <TSF_EA.Class>())
                {
                    try
                    {
                        T item = GlossaryItemFactory <T> .FromClass(clazz);

                        if (item != null)
                        {
                            items.Add(item);
                        }
                    }
                    catch (Exception e)
                    {
                        MessageBox.Show(e.ToString());
                    }
                }
            }
            return(items);
        }
        public List <MagicDrawCorrector> createCorrectors(string mdzipPath, TSF_EA.Package mdPackage)
        {
            //var mdPackage = getMagicDrawPackage();
            var magicDrawReader = new MagicDrawReader(mdzipPath, this.model);

            if (mdPackage != null)
            {
                correctors.Add(new SetStructureCorrector(magicDrawReader, model, mdPackage));
                correctors.Add(new NotesCorrector(magicDrawReader, model, mdPackage));
                correctors.Add(new RelationsCorrector(magicDrawReader, model, mdPackage));
                correctors.Add(new AssociationCorrector(magicDrawReader, model, mdPackage));
                correctors.Add(new CrossMDzipAttributeCorrector(magicDrawReader, model, mdPackage));
                correctors.Add(new OCLConstraintsCorrector(magicDrawReader, model, mdPackage));
                correctors.Add(new AssociationTableCorrector(magicDrawReader, model, mdPackage));
                correctors.Add(new FixCallBehaviorActionCorrector(magicDrawReader, model, mdPackage));
                correctors.Add(new ConvertPropertiesToAttributes(magicDrawReader, model, mdPackage));
                correctors.Add(new SetStatesOnObjects(magicDrawReader, model, mdPackage));
                correctors.Add(new AttributeSequenceCorrector(magicDrawReader, model, mdPackage));
                correctors.Add(new AddClassifiersToPartitions(magicDrawReader, model, mdPackage));
                correctors.Add(new SequenceDiagramCorrector(magicDrawReader, model, mdPackage));
                correctors.Add(new DiagramLayoutCorrector(magicDrawReader, model, mdPackage));
                correctors.Add(new CorrectStereotypesAndTaggedValues(magicDrawReader, model, mdPackage));
                correctors.Add(new MigrateDependencyMatrix(magicDrawReader, model, mdPackage));
                correctors.Add(new AddGuardConditions(magicDrawReader, model, mdPackage));
                correctors.Add(new TimeEventsCorrector(magicDrawReader, model, mdPackage));
            }
            return(correctors);
        }
        // support for listing and indexing a/the selected package


        private List <T> list <T>(TSF_EA.Package package, GlossaryItemSearchCriteria criteria) where T : GlossaryItem, new()
        {
            if (package == null)
            {
                return(new List <T>());
            }
            return(this.factory.getGlossaryItemsFromPackage <T>(package, criteria));
        }
Esempio n. 6
0
 private void manage()
 {
     if (this.model == null)
     {
         return;
     }
     this.managedPackage = (TSF_EA.Package) this.Model.selectedTreePackage;
     this.refresh();
 }
 private void manage()
 {
     if (this.model == null)
     {
         return;
     }
     this.managedPackage = (TSF_EA.Package) this.Model.selectedTreePackage;
     this.mainControl.clear();
     this.mainControl.selectedDomain = Domain.getDomain(this.managedPackage);
 }
Esempio n. 8
0
        private UML.Diagrams.ClassDiagram createDiagram(TSF_EA.Package package,
                                                        string name)
        {
            var diagram = this.model.factory.createNewDiagram <UML.Diagrams.ClassDiagram>(
                package, name
                );

            diagram.save();
            return(diagram);
        }
Esempio n. 9
0
        private UML.Classes.Kernel.Class createClass(string name,
                                                     TSF_EA.Package package,
                                                     string uid)
        {
            var clazz = this.model.factory.createNewElement <UML.Classes.Kernel.Class>(
                package, name
                );

            clazz.save();
            return(clazz);
        }
 private void showDataItems(TSF_EA.Package package, Domain domain)
 {
     if (domain == null)
     {
         domain = Domain.getDomain(package);
     }
     if (domain?.dataItemsPackage != null)
     {
         package = (TSF_EA.Package)domain.dataItemsPackage;
     }
     this.mainControl.setDataItems(this.getDataItems(package, domain), domain);
 }
 public TSF_EA.Package getPackage(TSF_EA.Package package, TSF_EA.Package inDataPackage)
 {
     TSF_EA.Package target = null;
     foreach (TSF_EA.Package res in inDataPackage.nestedPackages)
     {
         if (res.name == package.name && res.guid != package.guid)
         {
             target = res;
         }
     }
     return(target);
 }
 private List <DataItem> getDataItems(TSF_EA.Package package, Domain domain)
 {
     if (domain == null)
     {
         domain = Domain.getDomain(package);
     }
     if (domain?.dataItemsPackage != null)
     {
         package = (TSF_EA.Package)domain.dataItemsPackage;
     }
     return(this.list <DataItem>(package));
 }
 private void showBusinessItems(TSF_EA.Package package, Domain domain, GlossaryItemSearchCriteria searchCriteria)
 {
     if (domain == null)
     {
         domain = Domain.getDomain(package);
     }
     if (domain?.businessItemsPackage != null)
     {
         package = (TSF_EA.Package)domain.businessItemsPackage;
     }
     this.mainControl.setBusinessItems(this.list <BusinessItem>(package, searchCriteria), domain);
 }
        public bool hasDiagram(string diagramName, TSF_EA.Package importPackage)
        {
            bool contains = false;

            foreach (var res in importPackage.ownedDiagrams)
            {
                if (res.name == diagramName)
                {
                    contains = true;
                }
            }
            return(contains);
        }
        public bool hasElement(string elementName, TSF_EA.Package importPackage)
        {
            bool contains = false;

            foreach (var res in importPackage.ownedElements)
            {
                if (res.name == elementName)
                {
                    contains = true;
                }
            }
            return(contains);
        }
        public bool hasPackage(TSF_EA.Package package, TSF_EA.Package importPackage)         // Checks if Data has already this package, with another ID
        {
            bool contains = false;

            foreach (TSF_EA.Package res in importPackage.nestedPackages)
            {
                if (res.name == package.name && res.guid != package.guid)
                {
                    contains = true;
                }
            }
            return(contains);
        }
Esempio n. 17
0
        private Dictionary <string, TSF_EA.Class> index <T>(TSF_EA.Package package)
            where T : GlossaryItem
        {
            Dictionary <string, TSF_EA.Class> map =
                new Dictionary <string, TSF_EA.Class>();

            foreach (TSF_EA.Class clazz in package.ownedElements.OfType <TSF_EA.Class>())
            {
                if (GlossaryItemFactory <T> .IsA(clazz))
                {
                    map.Add(clazz.guid, clazz);
                }
            }
            return(map);
        }
Esempio n. 18
0
        public List <T> getGlossaryItemsFromPackage <T>(TSF_EA.Package package, GlossaryItemSearchCriteria criteria) where T : GlossaryItem, new()
        {
            T dummy = new T(); // needed to get the stereotype
            //build a search string
            var    sqlTop = criteria.showAll ? string.Empty : "top 50";
            string sqlGetGlossaryItems = string.Format(@"select " + sqlTop + @" o.[Object_ID] from t_object o
                                                        where ( o.[Name] like '%{0}%' or o.[Name] is null )
                                                        and ( o.[Note] like '%{1}%' or o.[Note] is null )
                                                        and o.[Stereotype] = '{2}'
                                                        and o.[Package_ID] in ({3})",
                                                       criteria.nameSearchTerm,
                                                       criteria.descriptionSearchTerm,
                                                       dummy.Stereotype,
                                                       package.getPackageTreeIDString());


            return(this.getGlossaryItemsFromQuery <T>(sqlGetGlossaryItems));
        }
Esempio n. 19
0
        public List <T> getGlossaryItemsFromPackage <T>(TSF_EA.Package package) where T : GlossaryItem, new()
        {
            T   dummy         = new T(); // needed to get the stereotype
            var glossaryItems = new List <T>();

            if (package != null)
            {
                foreach (var classElement in package.getOwnedElementWrappers <TSF_EA.Class>(dummy.Stereotype, true))
                {
                    var item = this.CreateFrom <T>(classElement);
                    if (item != null)
                    {
                        glossaryItems.Add(item);
                    }
                }
            }
            return(glossaryItems);
        }
        public UML.Classes.Kernel.Class AsClassIn(TSF_EA.Package package)
        {
            var clazz = package.EAModel.factory.createNewElement <UML.Classes.Kernel.Class>(
                package, this.Name
                );

            var stereotypes = new HashSet <UML.Profiles.Stereotype>();

            stereotypes.Add(new TSF_EA.Stereotype(
                                package.EAModel, clazz as TSF_EA.Element, this.Stereotype
                                ));
            clazz.stereotypes = stereotypes;

            this.origin = clazz as TSF_EA.ElementWrapper;
            this.update();

            return(clazz);
        }
Esempio n. 21
0
        internal void import <T>(TSF_EA.Package package) where T : GlossaryItem
        {
            var file = this.getFileFor <T>(CSV.Loading);

            if (file == null)
            {
                return;
            }

            this.log("importing in package " + package.ToString());

            Dictionary <string, TSF_EA.Class> index = this.index <T>(package);
            List <T> items = GlossaryItem.Load <T>(file);

            foreach (T item in items)
            {
                if (item.GUID == "")                      // create
                {
                    this.log("importing " + item.ToString());
                    item.AsClassIn(package);
                }
                else
                {
                    if (index.ContainsKey(item.GUID))
                    {
                        if (item.Delete)                  // delete
                        {
                            this.log("removing " + item.Name);
                            package.deleteOwnedElement(index[item.GUID]);
                        }
                        else                              // update
                        {
                            this.log("updating " + item.Name);
                            item.Update(index[item.GUID]);
                        }
                    }
                    else
                    {
                        this.log("WARNING: item (" + item.GUID + ") is not part of this package.");
                    }
                }
            }
            this.refresh();
        }
        public void moveContent(TSF_EA.Package subPackage, TSF_EA.Package newData)
        {
            foreach (TSF_EA.Package p in subPackage.nestedPackages)             // de packages onder 'Data' package
            {
                p.owningPackage = newData;
                p.save();
            }
            foreach (TSF_EA.Diagram d in subPackage.ownedDiagrams)             // de diagrams onder 'Data' package
            {
                d.owningPackage = newData;
                d.save();
            }

            foreach (TSF_EA.Element e in subPackage.ownedElements.Where(x => !(x is UML.Classes.Kernel.Package)))             // de elementen onder 'Data' package
            {
                e.owningPackage = newData;
                e.save();
            }
        }
        public List <T> getGlossaryItemsFromPackage <T>(TSF_EA.Package package, GlossaryItemSearchCriteria criteria) where T : GlossaryItem, new()
        {
            T dummy = new T(); // needed to get the stereotype
            //build a search string
            var sqlTop     = criteria.showAll ? string.Empty : "top 50";
            var nameClause = string.IsNullOrEmpty(criteria.nameSearchTerm) ?
                             $"(o.[Name] like '%{criteria.nameSearchTerm}%' or o.[Name] is null )"
                : $"o.[Name] like '%{criteria.nameSearchTerm}%'";
            var descriptionClause = string.IsNullOrEmpty(criteria.descriptionSearchTerm) ?
                                    $"(o.[Note] like '%{criteria.descriptionSearchTerm}%' or o.[Note] is null )"
                : $"o.[Note] like '%{criteria.descriptionSearchTerm}%'";
            string sqlGetGlossaryItems = $"select {sqlTop} o.[Object_ID] from t_object o"
                                         + $" where {nameClause} "
                                         + $" and {descriptionClause} "
                                         + $" and o.[Stereotype] = '{dummy.Stereotype}' "
                                         + $" and o.[Package_ID] in ({ package.packageTreeIDString})";

            return(this.getGlossaryItemsFromQuery <T>(sqlGetGlossaryItems));
        }
Esempio n. 24
0
        private void generateJSONSchemas(TSF_EA.Package package)
        {
            //inform user
            EAOutputLogger.log(this.model, outputName
                               , $"{DateTime.Now.ToLongTimeString()} Generating Schema's in package '{package.name}'"
                               , package.id
                               , LogTypeEnum.log);
            //get the «JSONSchema» elements in this package recursively
            var sqlGetJSONSchemas = "select o.Object_ID from t_object o                                                " + Environment.NewLine +
                                    " inner join t_xref x on x.Client = o.ea_guid                                      " + Environment.NewLine +
                                    $" where o.Package_ID in ({package.packageTreeIDString})                           " + Environment.NewLine +
                                    "                and x.Name = 'Stereotypes'                                        " + Environment.NewLine +
                                    $"               and x.Description like '%Name={EAJSONSchema.schemaStereotype};%'  ";
            var jsonSchemaElements = this.model.getElementWrappersByQuery(sqlGetJSONSchemas);

            foreach (var jsonSchemaElement in jsonSchemaElements)
            {
                generateJSONSchema(jsonSchemaElement);
            }
        }
Esempio n. 25
0
        private AddinConfig getContextConfig(TSF_EA.Package contextPackage)
        {
            //check if tag exists at this package
            var configTag = contextPackage.getTaggedValue(this.currentConfig.tagName);

            if (configTag != null)
            {
                //found the tag, return new config
                return(new AddinConfig(contextPackage, this.configurationsDirectoryPath, this.defaultConfigFilePath, this.addinName));
            }
            //check parent
            var parentPackage = contextPackage.owningPackage as TSF_EA.Package;

            if (parentPackage is TSF_EA.RootPackage)
            {
                //root packages can't have tagged values, no need to check further
                return(null);
            }
            //go up a level
            return(getContextConfig(parentPackage));
        }
Esempio n. 26
0
 public void createMissingPackage()
 {
     if (this.dataItemsPackage == null)
     {
         TSF_EA.Package parentPackage = null;
         if (this.parentDomain != null)
         {
             if (this.parentDomain.dataItemsPackage == null)
             {
                 this.parentDomain.createMissingPackage();
             }
             parentPackage = (TSF_EA.Package) this.parentDomain.dataItemsPackage;
         }
         else
         {
             parentPackage = (TSF_EA.Package) this.dataItemsTopLevelPackage;
         }
         this.dataItemsPackage = parentPackage.addOwnedElement <TSF_EA.Package>(this.name);
         this.dataItemsPackage.save();
     }
     else if (this.businessItemsPackage == null)
     {
         TSF_EA.Package parentPackage = null;
         if (this.parentDomain != null)
         {
             if (this.parentDomain.businessItemsPackage == null)
             {
                 this.parentDomain.createMissingPackage();
             }
             parentPackage = (TSF_EA.Package) this.parentDomain.businessItemsPackage;
         }
         else
         {
             parentPackage = (TSF_EA.Package) this.businessItemsTopLevelPackage;
         }
         this.businessItemsPackage = parentPackage.addOwnedElement <TSF_EA.Package>(this.name);
         this.businessItemsPackage.save();
     }
 }
Esempio n. 27
0
 public SequenceDiagramCorrector(MagicDrawReader magicDrawReader, TSF_EA.Model model, TSF_EA.Package mdPackage) : base(magicDrawReader, model, mdPackage)
 {
 }
 private List<Table> getTablesFromPackage(Package package)
 {
     var foundTables = new List<Table>();
     if (package != null)
     {
         var ownedElements = package.ownedElements;
         foreach( Class tableElement in ownedElements
                             .Where(x => x is Class
                             && x.stereotypes.Any( y => y.name.Equals("table", StringComparison.CurrentCultureIgnoreCase))))
         {
             foundTables.Add(new Table(this, tableElement));
         }
         //also check subPackages
         foreach (Package ownedPackage in ownedElements.OfType<Package>())
         {
             foundTables.AddRange(getTablesFromPackage(ownedPackage));
         }
     }
     return foundTables;
 }
Esempio n. 29
0
        private void importCopybook(string source, TSF_EA.Package package)
        {
            // parse copybook into OO data-representation
            var mapped = new Mapper();

            try
            {
                mapped.Parse(source);
            }
            catch (ParseException e)
            {
                // recurse down the Exception tree, to reach the most specific one
                this.log("!!! IMPORT FAILED");
                do
                {
                    foreach (var line in e.Message.Split('\n'))
                    {
                        this.log(line);
                    }
                    e = e.InnerException as ParseException;
                } while (e != null);
                return;
            }

            // import mapped OO data-representation

            // prepare cache
            this.classes = new Dictionary <string, UML.Classes.Kernel.Class>();

            // step 1: create diagram
            this.log("*** creating diagram");
            var diagram = this.createDiagram(package, package.name);

            // step 2: classes with properties
            this.log("*** importing classes+properties");
            foreach (var clazz in mapped.Model.Classes)
            {
                var eaClass = this.createClass(clazz.Name, package, clazz.Id);
                this.classes.Add(clazz.Id, eaClass);
                foreach (var property in clazz.Properties)
                {
                    this.addProperty(
                        eaClass, property.Name, property.Type, property.Stereotype
                        );
                }
                diagram.addToDiagram(eaClass);
            }
            // step 3: generalisations and associations
            this.log("*** importing generalisations and associations");
            foreach (var clazz in mapped.Model.Classes)
            {
                foreach (var association in clazz.Associations)
                {
                    this.addAssociation(
                        this.classes[association.Source.Id],
                        this.classes[association.Target.Id],
                        association.Multiplicity,
                        association.DependsOn
                        );
                }
                if (clazz.Super != null)
                {
                    this.addGeneralization(
                        this.classes[clazz.Super.Id],
                        this.classes[clazz.Id]
                        );
                }
            }
            //layout diagram
            diagram.autoLayout();
        }
Esempio n. 30
0
 public CorrectStereotypesAndTaggedValues(MagicDrawReader magicDrawReader, TSF_EA.Model model, TSF_EA.Package mdPackage) : base(magicDrawReader, model, mdPackage)
 {
 }
 public Database(Package package,DatabaseFactory factory)
 {
     this._wrappedPackage = package;
     this.__factory = factory;
 }
Esempio n. 32
0
 public ASMAAssociationCorrector(MagicDrawReader magicDrawReader, TSF_EA.Model model, TSF_EA.Package mdPackage) : base(magicDrawReader, model, mdPackage)
 {
 }
 public Database createDataBase(Package package)
 {
     return new Database(package, this);
 }
 public AddClassifiersToPartitions(MagicDrawReader magicDrawReader, TSF_EA.Model model, TSF_EA.Package mdPackage) : base(magicDrawReader, model, mdPackage)
 {
 }
 public Project(Package wrappedPackage)
 {
     this._wrappedPackage = wrappedPackage;
 }