Search in sources :

Example 21 with GraphNode

use of au.gov.asd.tac.constellation.graph.node.GraphNode in project constellation by constellation-app.

the class SetGraph method callService.

@Override
public void callService(final PluginParameters parameters, InputStream in, OutputStream out) throws IOException {
    final String graphId = parameters.getStringValue(GRAPH_ID_PARAMETER_ID);
    final GraphNode graphNode = GraphNode.getGraphNode(graphId);
    if (graphNode != null) {
        try {
            SwingUtilities.invokeAndWait(() -> graphNode.getTopComponent().requestActive());
        } catch (final InterruptedException ex) {
            Thread.currentThread().interrupt();
            throw new RestServiceException(ex);
        } catch (final InvocationTargetException ex) {
            throw new RestServiceException(ex);
        }
    } else {
        throw new RestServiceException(HTTP_UNPROCESSABLE_ENTITY, "No graph with id " + graphId);
    }
}
Also used : RestServiceException(au.gov.asd.tac.constellation.webserver.restapi.RestServiceException) GraphNode(au.gov.asd.tac.constellation.graph.node.GraphNode) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Aggregations

GraphNode (au.gov.asd.tac.constellation.graph.node.GraphNode)21 ReadableGraph (au.gov.asd.tac.constellation.graph.ReadableGraph)11 TopComponent (org.openide.windows.TopComponent)9 Test (org.testng.annotations.Test)9 GraphAttribute (au.gov.asd.tac.constellation.graph.GraphAttribute)8 AdvancedFindPlugin (au.gov.asd.tac.constellation.views.find.advanced.AdvancedFindPlugin)8 FindResult (au.gov.asd.tac.constellation.views.find.advanced.FindResult)8 FindRule (au.gov.asd.tac.constellation.views.find.advanced.FindRule)8 ArrayList (java.util.ArrayList)8 HashMap (java.util.HashMap)8 Graph (au.gov.asd.tac.constellation.graph.Graph)6 File (java.io.File)5 IOException (java.io.IOException)5 VisualManager (au.gov.asd.tac.constellation.utilities.visual.VisualManager)3 RestServiceException (au.gov.asd.tac.constellation.webserver.restapi.RestServiceException)2 BufferedImage (java.awt.image.BufferedImage)2 Semaphore (java.util.concurrent.Semaphore)2 GraphReadMethods (au.gov.asd.tac.constellation.graph.GraphReadMethods)1 WritableGraph (au.gov.asd.tac.constellation.graph.WritableGraph)1 GraphDataObject (au.gov.asd.tac.constellation.graph.file.GraphDataObject)1