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());
}