Search in sources :

Example 1 with VirtualColumns

use of org.cytoscape.io.internal.util.cytables.model.VirtualColumns in project cytoscape-impl by cytoscape.

the class CyTablesXMLWriter method buildModel.

private CyTables buildModel() {
    CyTables model = new CyTables();
    VirtualColumns virtualColumns = new VirtualColumns();
    model.setVirtualColumns(virtualColumns);
    List<VirtualColumn> columns = virtualColumns.getVirtualColumn();
    for (CyTableMetadata metadata : tables) {
        CyTable table = metadata.getTable();
        String targetTable = tableFileNamesBySUID.get(table.getSUID());
        if (targetTable == null) {
            continue;
        }
        for (CyColumn cyColumn : table.getColumns()) {
            VirtualColumnInfo info = cyColumn.getVirtualColumnInfo();
            if (!info.isVirtual()) {
                continue;
            }
            String sourceTable = tableFileNamesBySUID.get(info.getSourceTable().getSUID());
            if (sourceTable == null) {
                // log this
                continue;
            }
            VirtualColumn column = new VirtualColumn();
            column.setName(cyColumn.getName());
            column.setSourceColumn(info.getSourceColumn());
            column.setSourceTable(sourceTable);
            column.setSourceJoinKey(info.getSourceJoinKey());
            column.setTargetTable(targetTable);
            column.setTargetJoinKey(info.getTargetJoinKey());
            columns.add(column);
        }
    }
    return model;
}
Also used : CyTable(org.cytoscape.model.CyTable) CyTables(org.cytoscape.io.internal.util.cytables.model.CyTables) CyColumn(org.cytoscape.model.CyColumn) CyTableMetadata(org.cytoscape.model.CyTableMetadata) VirtualColumnInfo(org.cytoscape.model.VirtualColumnInfo) VirtualColumn(org.cytoscape.io.internal.util.cytables.model.VirtualColumn) VirtualColumns(org.cytoscape.io.internal.util.cytables.model.VirtualColumns)

Aggregations

CyTables (org.cytoscape.io.internal.util.cytables.model.CyTables)1 VirtualColumn (org.cytoscape.io.internal.util.cytables.model.VirtualColumn)1 VirtualColumns (org.cytoscape.io.internal.util.cytables.model.VirtualColumns)1 CyColumn (org.cytoscape.model.CyColumn)1 CyTable (org.cytoscape.model.CyTable)1 CyTableMetadata (org.cytoscape.model.CyTableMetadata)1 VirtualColumnInfo (org.cytoscape.model.VirtualColumnInfo)1