public static List <EDDTable> createColumns(TSF_EA.Model model, List <DataItem> dataItems, GlossaryManagerSettings settings)
        {
            //get the columns based on the given data items
            var    guidString    = string.Join(",", dataItems.Select(x => "'" + x.GUID + "'"));
            string sqlGetColumns = @"select a.[ea_guid] from(t_attribute a
                                    inner join[t_attributetag] tv on(tv.[ElementID] = a.[ID]
                                                                      and tv.[Property] = 'EDD::dataitem'))
                                    where tv.VALUE in (" + guidString + ")";
            List <TSF_EA.Attribute> attributes = model.getAttributesByQuery(sqlGetColumns);
            var tables = new Dictionary <string, EDDTable>();

            foreach (var attribute in attributes)
            {
                var classElement = attribute.owner as TSF_EA.Class;
                if (classElement != null)
                {
                    //for each attribute create the column
                    var dbColumn = DB_EA.DatabaseFactory.createColumn(attribute);
                    if (dbColumn != null)
                    {
                        EDDTable ownerTable = tables.ContainsKey(classElement.uniqueID) ?
                                              tables[classElement.uniqueID]
                                              : new EDDTable((DB_EA.Table)dbColumn.ownerTable, settings);
                        var newColumn = new EDDColumn(dbColumn, ownerTable, settings);
                        ownerTable.addColumn(newColumn);
                        tables[ownerTable.uniqueID] = ownerTable;
                    }
                }
            }
            //return colums
            return(tables.Values.ToList());
        }
示例#2
0
        private void getTableButtonClicked(object sender, EventArgs e)
        {
            var table = EDDTable.selectTable(this.model, this.settings);

            table.loadAllColumns();
            this._mainControl.setTable(table);
        }
        private void showColumns()
        {
            //get the databases
            var databases = this.getDatabases(this.model.selectedTreePackage);
            //get the list of columns
            var tables = new List <EDDTable>();

            foreach (var db in databases)
            {
                foreach (var table in db.tables)
                {
                    var eddTable = new EDDTable((DB_EA.Table)table, this.settings);
                    foreach (DB_EA.Column column in table.columns)
                    {
                        eddTable.addColumn(new EDDColumn(column, eddTable, this.settings));
                    }
                }
            }
            this.mainControl.setColumns(tables, null);
        }
 public EDDColumn(DB_EA.Column wrappedColumn, EDDTable table, GlossaryManagerSettings settings)
 {
     this._wrappedColumn = wrappedColumn;
     this.table          = table;
     this.settings       = settings;
 }