Package org.cytoscape.session
Class CySession
java.lang.Object
org.cytoscape.session.CySession
A session is an immutable snapshot of the data contents of Cytoscape.
Sessions are only meant for saving and restoring the state of Cytoscape
and are not meant to be used interactively for anything besides
writing, reading, and restoring from session files.
Using the data returned from the various methods in a CySession object should be sufficient to recreate all aspects of Cytoscape at the time the session was created.
Creating an instance of CySession is done following the builder pattern. For example, the following code creates a session that only includes a list of networkViews and Cytoscape properties, but nothing else.
Using the data returned from the various methods in a CySession object should be sufficient to recreate all aspects of Cytoscape at the time the session was created.
Creating an instance of CySession is done following the builder pattern. For example, the following code creates a session that only includes a list of networkViews and Cytoscape properties, but nothing else.
CySession session = new CySession.Builder().networkViews(viewList).cytoscapeProperties(cyProps).build();
Cytoscape Backwards Compatibility (Final Class): This class is final and therefore can't be extended by users. This means that we may add methods for minor version updates. Methods will only be removed for major version updates.
Module: session-api
To use this in your app, include the following dependency in your POM:
<dependency> <groupId>org.cytoscape</groupId> <artifactId>session-api</artifactId> </dependency>
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
A implementation of the builder pattern used to construct immutable instances of CySession objects. -
Method Summary
Modifier and TypeMethodDescriptionReturns a map of app names to lists of File objects that are stored as part of the session for the specified app.Returns a set of all CyNetwork objects contained in this Session.Returns a set of all CyNetworkView objects contained in this Session.<T extends CyIdentifiable>
TWhen a session is restored, Cytoscape automatically generates new SUIDs.<T extends CyIdentifiable>
TWhen a session is restored, Cytoscape automatically generates new SUIDs.Set<CyProperty<?>>
Note: This is NOT the correct way for Apps to access CyProperty settings.Returns a set of all CyTable objects contained in this Session.Returns a set containing all table VisualStyles defined for this session.Returns a set of all CyTableView objects contained in this Session.Returns a map of CyNetworkViews to the names of the VisualStyle applied to that network view in this session.Returns a set containing all network VisualStyles defined for this session.
-
Method Details
-
getNetworks
Returns a set of all CyNetwork objects contained in this Session.- Returns:
- A set of all CyNetwork objects contained in this Session.
-
getNetworkViews
Returns a set of all CyNetworkView objects contained in this Session.- Returns:
- A set of all CyNetworkView objects contained in this Session.
-
getTableViews
Returns a set of all CyTableView objects contained in this Session.- Returns:
- A set of all CyTableView objects contained in this Session.
-
getTables
Returns a set of all CyTable objects contained in this Session.- Returns:
- A set of all CyTable objects contained in this Session.
-
getViewVisualStyleMap
Returns a map of CyNetworkViews to the names of the VisualStyle applied to that network view in this session.- Returns:
- A map of CyNetworkViews to the names of the VisualStyle applied to that network view in this session.
-
getProperties
Note: This is NOT the correct way for Apps to access CyProperty settings. Creating a CySession object is very resource intensive and is not required for accessing CyProperty objects. Instead acquire the CyPropery object as a service in the CyActivator, eg...CyProperty<Properties> cyProperty = getService(bc, CyProperty.class, "(cyPropertyName=cytoscape3.props)");
Returns a set ofCyProperty
objects defined for this session.- Returns:
- A set of session related
CyProperty
objects. defined for this session.
Cytoscape Backwards Compatibility (DO NOT USE): This method may change or be removed in future minor version upgrades of Cytoscape. It is not safe for Apps to call or override this method. -
getVisualStyles
Returns a set containing all network VisualStyles defined for this session.- Returns:
- A Set of
VisualStyle
objects
-
getTableStyles
Returns a set containing all table VisualStyles defined for this session.- Returns:
- A Set of
VisualStyle
objects
-
getAppFileListMap
Returns a map of app names to lists of File objects that are stored as part of the session for the specified app.- Returns:
- A map of app names to lists of File objects that are stored as part of the session for the specified app.
-
getObject
When a session is restored, Cytoscape automatically generates new SUIDs. This method returns an object (CyNode
,CyEdge
,CyNetwork
orCyNetworkView
) given its former SUID.
Use this method if the version of the loaded session is 3.0 or higher.- Parameters:
oldSUID
- The former SUID.type
- The Class of the object to be returned (CyNode
,CyEdge
,CyNetwork
orCyNetworkView
).- Returns:
- An object (
CyNode
,CyEdge
,CyNetwork
orCyNetworkView
) given its former SUID.
-
getObject
When a session is restored, Cytoscape automatically generates new SUIDs. This method returns an object (CyNode
,CyEdge
,CyNetwork
orCyNetworkView
) given its former identifier.
Use this method if the version of the loaded session is 2.x, because older versions of Cytoscape save String IDs, such as node names and the network titles.- Parameters:
oldId
- The former ID, from Cytocape versions prior than 3.0.type
- The Class of the object to be returned (CyNode
,CyEdge
,CyNetwork
orCyNetworkView
).- Returns:
- An object (
CyNode
,CyEdge
,CyNetwork
orCyNetworkView
) given its former identifier.
-