public DataItem selectDataItem()
        {
            //let the user select a logical datatype
            var defaultSelectionID = this.dataItem == null ?
                                     this.settings.dataItemsPackage.uniqueID :
                                     this.dataItem.GUID;
            var dataItemclass = this.table.model.getUserSelectedElement(new List <string>()
            {
                "Class"
            }
                                                                        , new List <string>()
            {
                new DataItem().Stereotype
            }
                                                                        , defaultSelectionID) as UML.Classes.Kernel.Class;

            if (dataItemclass != null)
            {
                return(GlossaryItemFactory.getFactory(this.table.model, this.settings).FromClass <DataItem>(dataItemclass));
            }
            else
            {
                return(null);
            }
        }
 public override void EA_FileOpen(EA.Repository repository)
 {
     this.model       = new TSF_EA.Model(repository);
     this.settings    = new GlossaryManagerSettings(this.model);
     this.factory     = new GlossaryItemFactory(this.settings);
     this.fullyLoaded = true;
 }
Example #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 override void EA_FileOpen(EA.Repository repository)
 {
     this.model    = new TSF_EA.Model(repository);
     this.settings = new GlossaryManagerSettings(this.model);
     this.factory  = new GlossaryItemFactory(this.settings);
     Domain.getAllDomains(this.settings.businessItemsPackage, this.settings.dataItemsPackage);
     this.fullyLoaded = true;
 }
Example #5
0
        private IEnumerable <DataItem> getLinkedDataItems()
        {
            var foundDataItems = new List <DataItem>();
            //get the EA elements
            var sqlGetLinkedDataItems = $@"select tv.[Object_ID] from t_objectproperties tv
                                        where tv.[Property] = 'business item'
                                        and tv.VALUE like '{this.origin.guid}'";

            return(GlossaryItemFactory.getFactory(this.origin.EAModel, this.settings).getGlossaryItemsFromQuery <DataItem>(sqlGetLinkedDataItems));
        }
Example #6
0
        public static GlossaryItemFactory getFactory(TSF_EA.Model model, GlossaryManagerSettings settings)
        {
            GlossaryItemFactory factory;

            if (!factories.TryGetValue(model.projectGUID, out factory))
            {
                factory = new GlossaryItemFactory(model, settings);
                factories.Add(model.projectGUID, factory);
            }
            return(factory);
        }
 private DataItem getDataItem(TSF_EA.Attribute attribute)
 {
     if (attribute == null)
     {
         return(null);
     }
     TSF_EA.TaggedValue tv = attribute.getTaggedValue("EDD::dataitem");
     if (tv == null || tv.tagValue == null)
     {
         return(null);
     }
     return(GlossaryItemFactory <DataItem> .FromClass(tv.tagValue as TSF_EA.Class));
 }
        /// <summary>
        /// allows the user to select a business item and return it
        /// </summary>
        /// <returns>the business item selected by the user</returns>
        internal BusinessItem selectBusinessItem()
        {
            //let the user select a business item
            var businessItemOrigin = this.origin.model.getUserSelectedElement(new List <string>()
            {
                "Class"
            }
                                                                              , new List <string>()
            {
                new BusinessItem().Stereotype
            }
                                                                              , this.businessItem?.GUID) as UML.Classes.Kernel.Class;

            return(GlossaryItemFactory.getFactory(this.origin.EAModel, this.settings).FromClass <BusinessItem>(businessItemOrigin));
        }
Example #9
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);
        }
Example #10
0
 public override void EA_FileOpen(EA.Repository repository)
 {
     base.EA_FileOpen(repository);
     //close the tab if still open
     this.model.closeTab(appTitle);
     this._mainControl = null;
     //get settings
     this.settings = new GlossaryManagerSettings(this.model);
     //get the logical datatypes
     this.logicalDatatypes = LogicalDatatype.getAllLogicalDatatypes(this.model);
     //(re)-initialize
     if (this.settings.showWindowAtStartup)
     {
         this.initialiseMainControl();
     }
     this.factory = GlossaryItemFactory.getFactory(this.model, this.settings);
 }
        public static T FromClass(UML.Classes.Kernel.Class clazz)
        {
            if (clazz == null)
            {
                return(null);
            }
            if (clazz.stereotypes.Count != 1)
            {
                return(null);
            }

            GlossaryItem item = GlossaryItemFactory <T> .CreateFrom(clazz);

            if (item == null)
            {
                return(null);
            }

            return((T)item);
        }
Example #12
0
        public DataItem selectDataItem()
        {
            //let the user select a logical datatype
            var dataItemclass = this._wrappedColumn.wrappedattribute.model.getUserSelectedElement(new List <string>()
            {
                "Class"
            }
                                                                                                  , new List <string>()
            {
                new DataItem().Stereotype
            }
                                                                                                  , this.dataItem?.GUID) as UML.Classes.Kernel.Class;

            if (dataItemclass != null)
            {
                return(GlossaryItemFactory.getFactory(this._wrappedColumn.wrappedattribute.EAModel, this.settings).FromClass <DataItem>(dataItemclass));
            }
            else
            {
                return(null);
            }
        }
        private bool notInSync(TSF_EA.Attribute column, TSF_EA.Class clazz)
        {
            DataItem di = GlossaryItemFactory <DataItem> .FromClass(clazz);

            if (di == null)
            {
                return(true);
            }                         // ???
            if (column.name != di.Label)
            {
                return(true);
            }
            // TODO DataType
            if (column.length != di.Size)
            {
                return(true);
            }
            // TODO Format
            if (column.defaultValue.ToString() != di.InitialValue)
            {
                return(true);
            }
            return(false);
        }
 public static bool IsA(UML.Classes.Kernel.Class clazz)
 {
     return(GlossaryItemFactory <T> .CreateFrom(clazz) != null);
 }