]> gerrit.simantics Code Review - simantics/district.git/blob
bef2afada7c91021afb1660a793f329fa8e5cff9
[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.IndexRoot;
7 import org.simantics.db.common.request.ResourceRead;
8 import org.simantics.db.exception.DatabaseException;
9 import org.simantics.diagram.stubs.DiagramResource;
10 import org.simantics.district.network.visualisations.model.DynamicVisualisation;
11
12 /**
13  * @author Jani Simomaa
14  */
15 public class RuntimeDynamicVisualisationsRequest extends ResourceRead<DynamicVisualisation> {
16
17     public RuntimeDynamicVisualisationsRequest(Resource runtimeDiagram) {
18         super(runtimeDiagram);
19     }
20
21     @Override
22     public DynamicVisualisation perform(ReadGraph graph) throws DatabaseException {
23         DiagramResource DIA = DiagramResource.getInstance(graph);
24         Resource diagram = graph.getPossibleObject(resource, DIA.RuntimeDiagram_HasConfiguration);
25         if (diagram != null) {
26             Resource model = graph.syncRequest(new IndexRoot(diagram));
27             return graph.syncRequest(new ActiveDynamicVisualisationsRequest(model));
28         }
29         return null;
30     }
31
32 }