]> gerrit.simantics Code Review - simantics/district.git/blob
a29b311ed2098788e126666276d3d3d36b9d8809
[simantics/district.git] /
1 package org.simantics.district.network.profile;
2
3 import org.simantics.db.ReadGraph;
4 import org.simantics.db.Resource;
5 import org.simantics.db.common.procedure.adapter.TransientCacheAsyncListener;
6 import org.simantics.db.common.request.ResourceRead;
7 import org.simantics.db.exception.DatabaseException;
8 import org.simantics.diagram.stubs.DiagramResource;
9 import org.simantics.district.network.visualisations.model.DynamicVisualisation;
10
11 /**
12  * @author Jani Simomaa
13  */
14 public class RuntimeDynamicVisualisationsRequest extends ResourceRead<DynamicVisualisation> {
15
16     public RuntimeDynamicVisualisationsRequest(Resource runtimeDiagram) {
17         super(runtimeDiagram);
18     }
19
20     @Override
21     public DynamicVisualisation perform(ReadGraph graph) throws DatabaseException {
22         DiagramResource DIA = DiagramResource.getInstance(graph);
23         Resource diagram = graph.getPossibleObject(resource, DIA.RuntimeDiagram_HasConfiguration);
24         if (diagram != null) {
25             return graph.syncRequest(new DynamicVisualisationsRequest(diagram), TransientCacheAsyncListener.instance());
26         }
27         return null;
28     }
29
30 }