Author: jm
Date: 2011-07-19 14:05:12 -0700 (Tue, 19 Jul 2011)
New Revision: 26215
Added:
core3/io-impl/trunk/src/main/java/org/cytoscape/io/internal/util/session/
core3/io-impl/trunk/src/main/java/org/cytoscape/io/internal/util/session/SessionUtil.java
core3/io-impl/trunk/src/main/java/org/cytoscape/io/internal/util/session/VirtualColumnSerializer.java
Modified:
core3/io-impl/trunk/src/main/java/org/cytoscape/io/internal/read/datatable/CSVCyReader.java
core3/io-impl/trunk/src/main/java/org/cytoscape/io/internal/read/session/CyTableMetadataImpl.java
core3/io-impl/trunk/src/main/java/org/cytoscape/io/internal/read/session/SessionReaderFactoryImpl.java
core3/io-impl/trunk/src/main/java/org/cytoscape/io/internal/read/session/SessionReaderImpl.java
core3/io-impl/trunk/src/main/java/org/cytoscape/io/internal/write/datatable/csv/CSVCyWriter.java
core3/io-impl/trunk/src/main/resources/META-INF/spring/bundle-context.xml
Log:
Fixes #269: Implemented virtual column serialization/deserialization
Modified:
core3/io-impl/trunk/src/main/java/org/cytoscape/io/internal/read/datatable/CSVCyReader.java
===================================================================
---
core3/io-impl/trunk/src/main/java/org/cytoscape/io/internal/read/datatable/CSVCyReader.java
2011-07-19 21:00:43 UTC (rev 26214)
+++
core3/io-impl/trunk/src/main/java/org/cytoscape/io/internal/read/datatable/CSVCyReader.java
2011-07-19 21:05:12 UTC (rev 26215)
@@ -62,7 +62,7 @@
final ColumnInfo[] columns = info.getColumns();
final CyTable table = tableFactory.createTable(info.getTitle(),
columns[0].getName(),
columns[0].getType(), info.isPublic(),
-
info.isMutable());
+ true);
final Map<String, Class<?>> variableNameToTypeMap = new
HashMap<String, Class<?>>();
for (final ColumnInfo colInfo : columns)
Modified:
core3/io-impl/trunk/src/main/java/org/cytoscape/io/internal/read/session/CyTableMetadataImpl.java
===================================================================
---
core3/io-impl/trunk/src/main/java/org/cytoscape/io/internal/read/session/CyTableMetadataImpl.java
2011-07-19 21:00:43 UTC (rev 26214)
+++
core3/io-impl/trunk/src/main/java/org/cytoscape/io/internal/read/session/CyTableMetadataImpl.java
2011-07-19 21:05:12 UTC (rev 26215)
@@ -40,7 +40,7 @@
return namespace;
}
- public static class CyTableMetadataBuilder {
+ public static class CyTableMetadataBuilder implements CyTableMetadata {
private Class<?> type;
private CyTable table;
private Set<CyNetwork> networks;
@@ -69,5 +69,25 @@
public CyTableMetadata build() {
return new CyTableMetadataImpl(this);
}
+
+ @Override
+ public CyTable getCyTable() {
+ return table;
+ }
+
+ @Override
+ public String getNamespace() {
+ return namespace;
+ }
+
+ @Override
+ public Set<CyNetwork> getCyNetworks() {
+ return networks;
+ }
+
+ @Override
+ public Class<?> getType() {
+ return type;
+ }
}
}
Modified:
core3/io-impl/trunk/src/main/java/org/cytoscape/io/internal/read/session/SessionReaderFactoryImpl.java
===================================================================
---
core3/io-impl/trunk/src/main/java/org/cytoscape/io/internal/read/session/SessionReaderFactoryImpl.java
2011-07-19 21:00:43 UTC (rev 26214)
+++
core3/io-impl/trunk/src/main/java/org/cytoscape/io/internal/read/session/SessionReaderFactoryImpl.java
2011-07-19 21:05:12 UTC (rev 26215)
@@ -35,6 +35,7 @@
import org.cytoscape.io.read.CyPropertyReaderManager;
import org.cytoscape.io.read.InputStreamTaskFactory;
import org.cytoscape.io.read.VizmapReaderManager;
+import org.cytoscape.model.CyTableManager;
import org.cytoscape.work.TaskIterator;
public class SessionReaderFactoryImpl implements InputStreamTaskFactory {
@@ -44,6 +45,7 @@
private final CyPropertyReaderManager propertyReaderMgr;
private final VizmapReaderManager vizmapReaderMgr;
private final CSVCyReaderFactory csvCyReaderFactory;
+ private final CyTableManager tableManager;
private InputStream inputStream;
private String inputName;
@@ -52,12 +54,14 @@
final
CyNetworkReaderManager networkReaderMgr,
final
CyPropertyReaderManager propertyReaderMgr,
final
VizmapReaderManager vizmapReaderMgr,
- final
CSVCyReaderFactory csvCyReaderFactory) {
+ final
CSVCyReaderFactory csvCyReaderFactory,
+ final
CyTableManager tableManager) {
this.filter = filter;
this.networkReaderMgr = networkReaderMgr;
this.propertyReaderMgr = propertyReaderMgr;
this.vizmapReaderMgr = vizmapReaderMgr;
this.csvCyReaderFactory = csvCyReaderFactory;
+ this.tableManager = tableManager;
}
public void setInputStream(InputStream is, String in) {
@@ -72,6 +76,6 @@
public TaskIterator getTaskIterator() {
return new TaskIterator(new SessionReaderImpl(inputStream,
networkReaderMgr, propertyReaderMgr,
-
vizmapReaderMgr, csvCyReaderFactory));
+
vizmapReaderMgr, csvCyReaderFactory, tableManager));
}
}
Modified:
core3/io-impl/trunk/src/main/java/org/cytoscape/io/internal/read/session/SessionReaderImpl.java
===================================================================
---
core3/io-impl/trunk/src/main/java/org/cytoscape/io/internal/read/session/SessionReaderImpl.java
2011-07-19 21:00:43 UTC (rev 26214)
+++
core3/io-impl/trunk/src/main/java/org/cytoscape/io/internal/read/session/SessionReaderImpl.java
2011-07-19 21:05:12 UTC (rev 26215)
@@ -28,6 +28,19 @@
package org.cytoscape.io.internal.read.session;
+import static
org.cytoscape.io.internal.util.session.SessionUtil.BOOKMARKS_FILE;
+import static org.cytoscape.io.internal.util.session.SessionUtil.CYSESSION;
+import static
org.cytoscape.io.internal.util.session.SessionUtil.CYTABLE_METADATA_FILE;
+import static org.cytoscape.io.internal.util.session.SessionUtil.CY_PROPS;
+import static
org.cytoscape.io.internal.util.session.SessionUtil.GLOBAL_TABLE_PATTERN;
+import static
org.cytoscape.io.internal.util.session.SessionUtil.NETWORK_PATTERN;
+import static org.cytoscape.io.internal.util.session.SessionUtil.NETWORK_ROOT;
+import static
org.cytoscape.io.internal.util.session.SessionUtil.NETWORK_TABLE_PATTERN;
+import static org.cytoscape.io.internal.util.session.SessionUtil.TABLE_EXT;
+import static org.cytoscape.io.internal.util.session.SessionUtil.VIZMAP_PROPS;
+import static org.cytoscape.io.internal.util.session.SessionUtil.VIZMAP_XML;
+import static org.cytoscape.io.internal.util.session.SessionUtil.XGMML_EXT;
+
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
@@ -44,11 +57,10 @@
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.Map.Entry;
import java.util.Properties;
import java.util.Set;
-import java.util.Map.Entry;
import java.util.regex.Matcher;
-import java.util.regex.Pattern;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
@@ -56,6 +68,8 @@
import org.cytoscape.io.internal.read.datatable.CSVCyReaderFactory;
import
org.cytoscape.io.internal.read.session.CyTableMetadataImpl.CyTableMetadataBuilder;
import org.cytoscape.io.internal.read.xgmml.XGMMLNetworkReader;
+import org.cytoscape.io.internal.util.session.SessionUtil;
+import org.cytoscape.io.internal.util.session.VirtualColumnSerializer;
import org.cytoscape.io.read.CyNetworkReader;
import org.cytoscape.io.read.CyNetworkReaderManager;
import org.cytoscape.io.read.CyPropertyReader;
@@ -70,7 +84,7 @@
import org.cytoscape.model.CyNode;
import org.cytoscape.model.CyRow;
import org.cytoscape.model.CyTable;
-import org.cytoscape.model.CyTableEntry;
+import org.cytoscape.model.CyTableManager;
import org.cytoscape.model.CyTableMetadata;
import org.cytoscape.property.bookmark.Bookmarks;
import org.cytoscape.property.session.Cysession;
@@ -84,23 +98,11 @@
import org.cytoscape.work.TaskMonitor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-
/**
*/
public class SessionReaderImpl extends AbstractTask implements CySessionReader
{
- public static final String CYSESSION = "cysession.xml";
- public static final String VIZMAP_PROPS = "vizmap.props";
- public static final String VIZMAP_XML = "vizmap.xml";
- public static final String CY_PROPS = "cytoscape.props";
- public static final String XGMML_EXT = ".xgmml";
- public static final String BOOKMARKS_FILE = "session_bookmarks.xml";
- private static final String TABLE_EXT = ".cytable";
- public static final String NETWORK_ROOT = "Network Root";
public static final int MAJOR_DOC_VERSION = 3;
- public static final Pattern NETWORK_PATTERN =
Pattern.compile(".*/([^/]+)[.]xgmml");
- public static final Pattern NETWORK_TABLE_PATTERN =
Pattern.compile(".*/([^/]+)/([^/]+)-([^/]+)-([^/]+)[.]table");
- public static final Pattern GLOBAL_TABLE_PATTERN =
Pattern.compile(".*/(\\d+)-([^/]+)[.]table");
private static final Logger logger =
LoggerFactory.getLogger(SessionReaderImpl.class);
@@ -115,20 +117,28 @@
private final CyPropertyReaderManager propertyReaderMgr;
private final VizmapReaderManager vizmapReaderMgr;
private final CSVCyReaderFactory csvCyReaderFactory;
+ private final CyTableManager tableManager;
private Cysession cysession;
private Bookmarks bookmarks;
private TaskMonitor taskMonitor;
private Properties cytoscapeProps;
private Set<VisualStyle> visualStyles;
+ private Map<String, CyTable> filenameTableMap;
+ private Map<CyTableMetadataBuilder, String> builderFilenameMap;
+ private List<VirtualColumnSerializer> virtualColumns;
+
+
+
/**
*/
public SessionReaderImpl(final InputStream sourceInputStream,
final
CyNetworkReaderManager networkReaderMgr,
final
CyPropertyReaderManager propertyReaderMgr,
final
VizmapReaderManager vizmapReaderMgr,
- final
CSVCyReaderFactory csvCyReaderFactory) {
+ final
CSVCyReaderFactory csvCyReaderFactory,
+ final CyTableManager
tableManager) {
if (sourceInputStream == null) throw new
NullPointerException("input stream is null!");
this.sourceInputStream = sourceInputStream;
@@ -144,6 +154,12 @@
if (csvCyReaderFactory == null) throw new
NullPointerException("table reader manager is null!");
this.csvCyReaderFactory = csvCyReaderFactory;
+
+ if (tableManager == null) throw new NullPointerException("table
manager is null!");
+ this.tableManager = tableManager;
+
+ filenameTableMap = new HashMap<String, CyTable>();
+ builderFilenameMap = new HashMap<CyTableMetadataBuilder,
String>();
}
@@ -156,6 +172,7 @@
extractEntries();
processNetworks();
mergeNetworkTables();
+ restoreVirtualColumns();
}
public CySession getCySession() {
@@ -212,6 +229,8 @@
//System.out.println("
extracting bookmarks");
} else if
(entryName.endsWith(TABLE_EXT)) {
extractTable(tmpIs, entryName);
+ } else if
(entryName.endsWith(CYTABLE_METADATA_FILE)) {
+ extractCyTableMetadata(tmpIs,
entryName);
} else {
logger.warn("Unknown entry
found in session zip file!\n" + entryName);
}
@@ -231,8 +250,38 @@
}
}
+ private void extractCyTableMetadata(InputStream tmpIs, String
entryName) throws IOException {
+ BufferedReader reader = new BufferedReader(new
InputStreamReader(tmpIs, "UTF-8"));
+ virtualColumns = new ArrayList<VirtualColumnSerializer>();
+ try {
+ String line = reader.readLine();
+ while (line != null) {
+ virtualColumns.add(new
VirtualColumnSerializer(line));
+ line = reader.readLine();
+ }
+ } finally {
+ reader.close();
+ }
+ }
- private void mergeNetworkTables() {
+ private void restoreVirtualColumns() {
+ if (virtualColumns == null) {
+ return;
+ }
+
+ for (VirtualColumnSerializer columnData : virtualColumns) {
+ CyTable targetTable =
filenameTableMap.get(columnData.getTargetTable());
+ CyTable sourceTable =
filenameTableMap.get(columnData.getSourceTable());
+ targetTable.addVirtualColumn(columnData.getName(),
+
columnData.getSourceColumn(),
+
sourceTable,
+
columnData.getSourceJoinKey(),
+
columnData.getTargetJoinKey(),
+
columnData.isImmutable());
+ }
+ }
+
+ private void mergeNetworkTables() throws UnsupportedEncodingException {
for (Entry<String, CyNetworkView[]> entry :
networkViews.entrySet()) {
String entryName = entry.getKey();
Matcher matcher = NETWORK_PATTERN.matcher(entryName);
@@ -251,24 +300,22 @@
for (CyTableMetadataBuilder builder : builders) {
final Set<CyNetwork> networks = new
HashSet<CyNetwork>();
networks.add(network);
- CyTableMetadata metadata =
builder.setNetworks(networks).build();
- mergeNetworkTable(network, metadata);
+ builder.setNetworks(networks);
+ mergeNetworkTable(network, builder);
+ CyTableMetadata metadata = builder.build();
tableMetadata.add(metadata);
+
+ // Update filename<->table maps
+ String filename =
builderFilenameMap.get(builder);
+ filenameTableMap.put(filename,
metadata.getCyTable());
}
- // Delete original id columns
- CyTable netTable =
network.getCyRow(CyNetwork.HIDDEN_ATTRS).getTable();
- deleteOriginalIdColumn(netTable);
-
- if (network.getNodeCount() > 0) {
- CyTable nodeTable =
network.getNodeList().get(0).getCyRow(CyNetwork.HIDDEN_ATTRS).getTable();
- deleteOriginalIdColumn(nodeTable);
+ // Delete mapping columns after merging everything.
+ for (CyTableMetadataBuilder builder : builders) {
+ if
(builder.getNamespace().equals(CyNetwork.HIDDEN_ATTRS)) {
+
deleteOriginalIdColumn(builder.getCyTable());
+ }
}
-
- if (network.getEdgeCount() > 0) {
- CyTable edgeTable =
network.getEdgeList().get(0).getCyRow(CyNetwork.HIDDEN_ATTRS).getTable();
- deleteOriginalIdColumn(edgeTable);
- }
}
}
@@ -278,53 +325,43 @@
table.deleteColumn(XGMMLNetworkReader.ORIGINAL_ID_COLUMN);
}
- private void mergeNetworkTable(CyNetwork network, CyTableMetadata
metadata) {
- Class<?> type = metadata.getType();
-
- if (type.equals(CyNetwork.class)) {
- CyTable sourceTable = metadata.getCyTable();
- String keyName = sourceTable.getPrimaryKey().getName();
- // Network tables should only have one row.
- CyRow sourceRow = null;
-
- if (sourceTable.getRowCount() > 0) {
- sourceRow =
sourceTable.getAllRows().iterator().next();
- CyRow targetRow =
network.getCyRow(metadata.getNamespace());
- mergeRow(keyName, sourceRow, targetRow);
- } else {
- logger.error("Cannot merge Network table \"" +
sourceTable.getTitle() +
- "\": The source table
has no rows.");
- }
- } else {
- CyTableEntry entry = null;
-
- if (type.equals(CyNode.class) && network.getNodeCount()
> 0) {
- entry = network.getNodeList().iterator().next();
- } else if (type.equals(CyEdge.class) &&
network.getEdgeCount() > 0) {
- entry = network.getEdgeList().iterator().next();
- }
-
- if (entry != null) {
- if ("VIEW".equals(metadata.getNamespace()))
return; // TODO: disabled due to timing conflicts with Ding.
-
- CyRow row =
entry.getCyRow(metadata.getNamespace()); // so we can get the target table
- CyRow hidenRow =
entry.getCyRow(CyNetwork.HIDDEN_ATTRS); // so we can get the mapping table
-
- Map<Long, Long> mappings =
createSUIDMappings(hidenRow.getTable());
- mergeTables(metadata.getCyTable(),
row.getTable(), mappings);
- }
+ void mergeNetworkTable(CyNetwork network, CyTableMetadataBuilder
builder) {
+ Class<?> type = builder.getType();
+ String namespace = builder.getNamespace();
+ if ("VIEW".equals(namespace)) {
+ return; // TODO: disabled due to timing conflicts with
Ding.
}
+
+ Map<String, CyTable> tableMap = tableManager.getTableMap(type,
network);
+ CyTable targetTable = tableMap.get(namespace);
+ CyTable mappingTable = tableMap.get(CyNetwork.HIDDEN_ATTRS);
+ CyTable sourceTable = builder.getCyTable();
+ Map<Long, Long> mappings = createSUIDMappings(type, network,
sourceTable, mappingTable, targetTable);
+ mergeTables(sourceTable, targetTable, mappings);
+ builder.setCyTable(targetTable);
+
+ tableManager.deleteTable(sourceTable.getSUID());
}
- private Map<Long, Long> createSUIDMappings(CyTable mapping) {
- if (mapping == null) {
+ private Map<Long, Long> createSUIDMappings(Class<?> type, CyNetwork
network, CyTable sourceTable, CyTable mappingTable, CyTable targetTable) {
+ if (mappingTable == null) {
return Collections.emptyMap();
}
Map<Long, Long> mappings = new HashMap<Long, Long>();
- String key = mapping.getPrimaryKey().getName();
+ String key = mappingTable.getPrimaryKey().getName();
+
+ if (type.equals(CyNetwork.class)) {
+ if (sourceTable.getRowCount() == 0) {
+ return Collections.emptyMap();
+ }
+ Long oldSUID =
sourceTable.getAllRows().iterator().next().get(key, Long.class);
+ Long newSUID = network.getSUID();
+ mappings.put(oldSUID, newSUID);
+ }
+
- for (CyRow row : mapping.getAllRows()) {
+ for (CyRow row : mappingTable.getAllRows()) {
Long oldSUID =
row.get(XGMMLNetworkReader.ORIGINAL_ID_COLUMN, Long.class);
Long newSUID = row.get(key, Long.class);
mappings.put(oldSUID, newSUID);
@@ -394,10 +431,10 @@
Matcher matcher = NETWORK_TABLE_PATTERN.matcher(entryName);
if (matcher.matches()) {
- String networkName = matcher.group(1);
- String namespace = matcher.group(2);
- Class<?> type = Class.forName(matcher.group(3));
- String title = URLDecoder.decode(matcher.group(4),
"UTF-8");
+ String networkName =
SessionUtil.unescape(matcher.group(2));
+ String namespace =
SessionUtil.unescape(matcher.group(3));
+ Class<?> type =
Class.forName(SessionUtil.unescape(matcher.group(4)));
+ String title = SessionUtil.unescape(matcher.group(5));
table.setTitle(title);
CyTableMetadataBuilder builder = new
CyTableMetadataBuilder().setCyTable(table).setNamespace(namespace)
.setType(type);
@@ -407,18 +444,24 @@
networkTableMap.put(networkName, builders);
}
builders.add(builder);
+
+ String filename = matcher.group(1);
+ filenameTableMap.put(filename, table);
+ builderFilenameMap.put(builder, filename);
return;
}
matcher = GLOBAL_TABLE_PATTERN.matcher(entryName);
if (matcher.matches()) {
- // table SUID is in group(1); we may need it when
restoring
- // equations/virtual columns
- String title = URLDecoder.decode(matcher.group(2),
"UTF-8");
+ String title = SessionUtil.unescape(matcher.group(3));
table.setTitle(title);
Set<CyNetwork> networks = Collections.emptySet();
CyTableMetadataBuilder builder = new
CyTableMetadataBuilder().setCyTable(table).setNetworks(networks);
tableMetadata.add(builder.build());
+
+ String filename = matcher.group(1);
+ filenameTableMap.put(filename, table);
+ builderFilenameMap.put(builder, filename);
}
}
Added:
core3/io-impl/trunk/src/main/java/org/cytoscape/io/internal/util/session/SessionUtil.java
===================================================================
---
core3/io-impl/trunk/src/main/java/org/cytoscape/io/internal/util/session/SessionUtil.java
(rev 0)
+++
core3/io-impl/trunk/src/main/java/org/cytoscape/io/internal/util/session/SessionUtil.java
2011-07-19 21:05:12 UTC (rev 26215)
@@ -0,0 +1,55 @@
+package org.cytoscape.io.internal.util.session;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.net.URLEncoder;
+import java.util.regex.Pattern;
+
+import org.cytoscape.model.CyNetwork;
+import org.cytoscape.model.CyTable;
+import org.cytoscape.model.CyTableMetadata;
+
+public class SessionUtil {
+ public static final String CYSESSION = "cysession.xml";
+ public static final String VIZMAP_PROPS = "vizmap.props";
+ public static final String VIZMAP_XML = "vizmap.xml";
+ public static final String CY_PROPS = "cytoscape.props";
+ public static final String XGMML_EXT = ".xgmml";
+ public static final String BOOKMARKS_FILE = "session_bookmarks.xml";
+ public static final String TABLE_EXT = ".cytable";
+ public static final String CYTABLE_METADATA_FILE = "cytable.metadata";
+ public static final String NETWORK_ROOT = "Network Root";
+
+ public static final Pattern NETWORK_PATTERN =
Pattern.compile(".*/([^/]+)[.]xgmml");
+ public static final Pattern NETWORK_TABLE_PATTERN =
Pattern.compile(".*/(([^/]+)/([^/]+)-([^/]+)-([^/]+)[.]cytable)");
+ public static final Pattern GLOBAL_TABLE_PATTERN =
Pattern.compile(".*/(global/(\\d+)-([^/]+)[.]cytable)");
+
+ public static String escape(String text) {
+ try {
+ return URLEncoder.encode(text, "UTF-8").replace("-",
"%2D");
+ } catch (UnsupportedEncodingException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public static String unescape(String escapedText) {
+ try {
+ return URLDecoder.decode(escapedText, "UTF-8");
+ } catch (UnsupportedEncodingException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public static String getNetworkTableFilename(CyNetwork network,
CyTableMetadata metadata) throws UnsupportedEncodingException {
+ CyTable table = metadata.getCyTable();
+ String networkFileName = getNetworkFileName(network);
+ String namespace = escape(metadata.getNamespace());
+ String type = escape(metadata.getType().getCanonicalName());
+ String tableTitle = escape(table.getTitle());
+ return String.format("%s/%s-%s-%s.cytable", networkFileName,
namespace, type, tableTitle );
+ }
+
+ public static String getNetworkFileName(CyNetwork network) throws
UnsupportedEncodingException {
+ return escape(network.getCyRow().get("name", String.class));
+ }
+}
Property changes on:
core3/io-impl/trunk/src/main/java/org/cytoscape/io/internal/util/session/SessionUtil.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
core3/io-impl/trunk/src/main/java/org/cytoscape/io/internal/util/session/VirtualColumnSerializer.java
===================================================================
---
core3/io-impl/trunk/src/main/java/org/cytoscape/io/internal/util/session/VirtualColumnSerializer.java
(rev 0)
+++
core3/io-impl/trunk/src/main/java/org/cytoscape/io/internal/util/session/VirtualColumnSerializer.java
2011-07-19 21:05:12 UTC (rev 26215)
@@ -0,0 +1,103 @@
+package org.cytoscape.io.internal.util.session;
+
+import java.io.PrintWriter;
+
+
+public class VirtualColumnSerializer {
+ String name;
+ String sourceTable;
+ String targetTable;
+ String sourceColumn;
+ String sourceJoinKey;
+ String targetJoinKey;
+ boolean isImmutable;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getSourceTable() {
+ return sourceTable;
+ }
+
+ public void setSourceTable(String sourceTable) {
+ this.sourceTable = sourceTable;
+ }
+
+ public String getTargetTable() {
+ return targetTable;
+ }
+
+ public void setTargetTable(String targetTable) {
+ this.targetTable = targetTable;
+ }
+
+ public String getSourceColumn() {
+ return sourceColumn;
+ }
+
+ public void setSourceColumn(String sourceColumn) {
+ this.sourceColumn = sourceColumn;
+ }
+
+ public String getSourceJoinKey() {
+ return sourceJoinKey;
+ }
+
+ public void setSourceJoinKey(String sourceJoinKey) {
+ this.sourceJoinKey = sourceJoinKey;
+ }
+
+ public String getTargetJoinKey() {
+ return targetJoinKey;
+ }
+
+ public void setTargetJoinKey(String targetJoinKey) {
+ this.targetJoinKey = targetJoinKey;
+ }
+
+ public boolean isImmutable() {
+ return isImmutable;
+ }
+
+ public void setImmutable(boolean isImmutable) {
+ this.isImmutable = isImmutable;
+ }
+
+ public VirtualColumnSerializer(String name, String sourceTable, String
targetTable, String sourceColumn, String sourceJoinKey, String targetJoinKey,
boolean isImmutable) {
+ this.name = name;
+ this.sourceTable = sourceTable;
+ this.targetTable = targetTable;
+ this.sourceColumn = sourceColumn;
+ this.sourceJoinKey = sourceJoinKey;
+ this.targetJoinKey = targetJoinKey;
+ this.isImmutable = isImmutable;
+ }
+
+ public VirtualColumnSerializer(String line) {
+ String[] data = line.split("\t");
+ targetTable = data[0];
+ name = SessionUtil.unescape(data[1]);
+ sourceTable = data[2];
+ sourceColumn = SessionUtil.unescape(data[3]);
+ sourceJoinKey = SessionUtil.unescape(data[4]);
+ targetJoinKey = SessionUtil.unescape(data[5]);
+ isImmutable = data[6].equals("true");
+ }
+
+ public void serialize(PrintWriter writer) {
+ writer.printf("%s\t%s\t%s\t%s\t%s\t%s\t%s\n",
+ targetTable,
+ SessionUtil.escape(name),
+ sourceTable,
+ SessionUtil.escape(sourceColumn),
+ SessionUtil.escape(sourceJoinKey),
+ SessionUtil.escape(targetJoinKey),
+ String.valueOf(isImmutable));
+
+ }
+}
\ No newline at end of file
Property changes on:
core3/io-impl/trunk/src/main/java/org/cytoscape/io/internal/util/session/VirtualColumnSerializer.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified:
core3/io-impl/trunk/src/main/java/org/cytoscape/io/internal/write/datatable/csv/CSVCyWriter.java
===================================================================
---
core3/io-impl/trunk/src/main/java/org/cytoscape/io/internal/write/datatable/csv/CSVCyWriter.java
2011-07-19 21:00:43 UTC (rev 26214)
+++
core3/io-impl/trunk/src/main/java/org/cytoscape/io/internal/write/datatable/csv/CSVCyWriter.java
2011-07-19 21:05:12 UTC (rev 26215)
@@ -44,7 +44,13 @@
public void run(TaskMonitor taskMonitor) throws Exception {
CSVWriter writer = new CSVWriter(new
OutputStreamWriter(outputStream), ',', '"', "\r\n");
try {
- List<CyColumn> columns = new
ArrayList<CyColumn>(table.getColumns());
+ List<CyColumn> columns = new ArrayList<CyColumn>();
+ for (CyColumn column : table.getColumns()) {
+ if (column.getVirtualColumnInfo().isVirtual()) {
+ continue;
+ }
+ columns.add(column);
+ }
Collections.sort(columns, new Comparator<CyColumn>() {
@Override
public int compare(CyColumn o1, CyColumn o2) {
Modified:
core3/io-impl/trunk/src/main/resources/META-INF/spring/bundle-context.xml
===================================================================
--- core3/io-impl/trunk/src/main/resources/META-INF/spring/bundle-context.xml
2011-07-19 21:00:43 UTC (rev 26214)
+++ core3/io-impl/trunk/src/main/resources/META-INF/spring/bundle-context.xml
2011-07-19 21:05:12 UTC (rev 26215)
@@ -428,6 +428,7 @@
<constructor-arg ref="cyPropertyReaderManager" />
<constructor-arg ref="vizmapReaderManager" />
<constructor-arg ref="sessionTableReaderFactory" />
+ <constructor-arg ref="cyTableManagerServiceRef"/>
</bean>
<bean id="cysessionReaderFactory"
--
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.