use of org.cytoscape.io.internal.util.cytables.model.CyTables in project cytoscape-impl by cytoscape.
the class CyTablesXMLWriter method run.
@Override
public void run(TaskMonitor taskMonitor) throws Exception {
final JAXBContext jc = JAXBContext.newInstance(CyTables.class.getPackage().getName(), this.getClass().getClassLoader());
Marshaller m = jc.createMarshaller();
taskMonitor.setProgress(0.25);
m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
taskMonitor.setProgress(0.5);
CyTables model = buildModel();
taskMonitor.setProgress(0.75);
m.marshal(model, outputStream);
taskMonitor.setProgress(1.0);
}
use of org.cytoscape.io.internal.util.cytables.model.CyTables 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;
}
Aggregations