private final String getViewForVPList( final Long networkId, final Long viewId, final String objectType, Collection<VisualProperty<?>> vps) { final CyNetworkView networkView = getView(networkId, viewId); Collection<? extends View<? extends CyIdentifiable>> graphObjects = null; if (objectType.equals("nodes")) { graphObjects = networkView.getNodeViews(); } else if (objectType.equals("edges")) { graphObjects = networkView.getEdgeViews(); } else if (objectType.equals("network")) { try { return styleSerializer.serializeView(networkView, vps); } catch (IOException e) { throw getError( "Could not serialize the view object.", e, Response.Status.INTERNAL_SERVER_ERROR); } } if (graphObjects == null || graphObjects.isEmpty()) { throw getError( "Could not find views.", new IllegalArgumentException(), Response.Status.NOT_FOUND); } try { return styleSerializer.serializeViews(graphObjects, vps); } catch (IOException e) { throw getError( "Could not serialize the view object.", e, Response.Status.INTERNAL_SERVER_ERROR); } }
private void checkNetwork(final CyNetwork network) { checkNodeEdgeCount(network, 331, 362, 0, 0); // Non-default columns should not be immutable assertCy2CustomColumnsAreMutable(network); // View test Collection<CyNetworkView> views = viewManager.getNetworkViews(network); assertEquals(1, views.size()); final CyNetworkView view = views.iterator().next(); assertEquals(331, view.getNodeViews().size()); assertEquals(362, view.getEdgeViews().size()); // Check updated view final VisualStyle style = vmm.getVisualStyle(view); style.apply(view); checkView(view); }