Author: Christian Lopes
Date: 2011-06-28 12:59:04 -0700 (Tue, 28 Jun 2011)
New Revision: 25963

Modified:
   
core3/io-impl/trunk/src/main/java/org/cytoscape/io/internal/write/session/SessionWriterImpl.java
Log:
Checking the SavePolicy before saving global CyTables.

Modified: 
core3/io-impl/trunk/src/main/java/org/cytoscape/io/internal/write/session/SessionWriterImpl.java
===================================================================
--- 
core3/io-impl/trunk/src/main/java/org/cytoscape/io/internal/write/session/SessionWriterImpl.java
    2011-06-28 19:27:41 UTC (rev 25962)
+++ 
core3/io-impl/trunk/src/main/java/org/cytoscape/io/internal/write/session/SessionWriterImpl.java
    2011-06-28 19:59:04 UTC (rev 25963)
@@ -60,6 +60,7 @@
 import org.cytoscape.model.CyNetwork;
 import org.cytoscape.model.CyTable;
 import org.cytoscape.model.CyTableMetadata;
+import org.cytoscape.model.CyTable.SavePolicy;
 import org.cytoscape.property.session.Cysession;
 import org.cytoscape.session.CySession;
 import org.cytoscape.view.model.CyNetworkView;
@@ -324,35 +325,43 @@
 
        private void zipGlobalTables() throws Exception {
                Set<CyNetworkView> views = session.getNetworkViews();
-               Set<Long> excludedTables = new HashSet<Long>();
                Set<CyNetwork> includedNetworks = new HashSet<CyNetwork>();
+               
                for (CyNetworkView view : views) {
                        CyNetwork network = view.getModel();
                        includedNetworks.add(network);
                }
+               
                Set<CyTableMetadata> tableData = session.getTables();
+               
                for (CyTableMetadata metadata : tableData) {
                        CyTable table = metadata.getCyTable();
-                       if (excludedTables.contains(table.getSUID())) {
+                       
+                       if (table.getSavePolicy() == SavePolicy.DO_NOT_SAVE) {
                                continue;
                        }
 
                        String tableTitle = escape(table.getTitle());
                        String fileName;
                        Set<CyNetwork> networks = metadata.getCyNetworks();
+                       
                        if (networks.size() == 0) {
                                fileName = 
String.format("global/%d-%s.cytable", table.getSUID(), tableTitle);
                        } else {
                                CyNetwork network = 
findIntersection(includedNetworks, networks);
+                               
                                if (network == null) {
                                        continue;
                                }
+                               
                                String networkFileName = 
getNetworkFileName(network);
                                String namespace = 
escape(metadata.getNamespace());
                                String type = 
escape(metadata.getType().getCanonicalName());
                                fileName = String.format("%s/%s-%s-%s.cytable", 
networkFileName, namespace, type, tableTitle);
                        }
+                       
                        zos.putNextEntry(new ZipEntry(sessionDir + fileName));
+                       
                        try {
                                CyWriter writer = 
tableWriterMgr.getWriter(table, tableFilter, zos);
                                writer.run(taskMonitor);

-- 
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.

Reply via email to