Author: clopes
Date: 2012-05-04 14:30:54 -0700 (Fri, 04 May 2012)
New Revision: 29121
Modified:
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/session/Cy3SessionReaderImpl.java
Log:
Fixes #955 : Error restoring "non-core" network tables from session files
Modified:
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/session/Cy3SessionReaderImpl.java
===================================================================
---
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/session/Cy3SessionReaderImpl.java
2012-05-04 21:18:45 UTC (rev 29120)
+++
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/session/Cy3SessionReaderImpl.java
2012-05-04 21:30:54 UTC (rev 29121)
@@ -74,12 +74,12 @@
import org.cytoscape.io.read.VizmapReaderManager;
import org.cytoscape.model.CyColumn;
import org.cytoscape.model.CyEdge;
+import org.cytoscape.model.CyIdentifiable;
import org.cytoscape.model.CyNetwork;
import org.cytoscape.model.CyNetworkTableManager;
import org.cytoscape.model.CyNode;
import org.cytoscape.model.CyRow;
import org.cytoscape.model.CyTable;
-import org.cytoscape.model.CyIdentifiable;
import org.cytoscape.model.CyTableMetadata;
import org.cytoscape.model.subnetwork.CyRootNetwork;
import org.cytoscape.model.subnetwork.CyRootNetworkManager;
@@ -460,10 +460,6 @@
throw new RuntimeException("Cannot merge
network tables: Cannot find network " + oldId);
for (CyTableMetadataBuilder builder : builders) {
- if ("VIEW".equals(builder.getNamespace())) {
- continue; // TODO: disabled due to
timing conflicts with Ding (The VIEW tables are not created yet).
- }
-
builder.setNetwork(network);
mergeNetworkTable(network, builder);
CyTableMetadata metadata = builder.build();
@@ -478,14 +474,19 @@
@SuppressWarnings("unchecked")
private void mergeNetworkTable(CyNetwork network,
CyTableMetadataBuilder builder) {
- Class<? extends CyIdentifiable> type = (Class<? extends
CyIdentifiable>) builder.getType();
- String namespace = builder.getNamespace();
- Map<String, CyTable> tableMap =
networkTableMgr.getTables(network, type);
- CyTable targetTable = tableMap.get(namespace);
- CyTable sourceTable = builder.getTable();
+ final Class<? extends CyIdentifiable> type = (Class<? extends
CyIdentifiable>) builder.getType();
+ final String namespace = builder.getNamespace();
+ final CyTable src = builder.getTable();
+ final CyTable tgt = networkTableMgr.getTable(network, type,
namespace);
- mergeTables(sourceTable, targetTable, type);
- builder.setCyTable(targetTable);
+ if (tgt == null) {
+ // Just use the source table
+ networkTableMgr.setTable(network, type, namespace, src);
+ builder.setCyTable(src);
+ } else {
+ mergeTables(src, tgt, type);
+ builder.setCyTable(tgt);
+ }
}
private void mergeTables(CyTable source, CyTable target, Class<?
extends CyIdentifiable> type) {
--
You received this message because you are subscribed to the Google Groups
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/cytoscape-cvs?hl=en.