]> gerrit.simantics Code Review - simantics/sysdyn.git/blob
653aa2e1e46d514474c7b779e1163419d7fb821c
[simantics/sysdyn.git] /
1 /*******************************************************************************\r
2  * Copyright (c) 2010 Association for Decentralized Information Management in\r
3  * Industry THTH ry.\r
4  * All rights reserved. This program and the accompanying materials\r
5  * are made available under the terms of the Eclipse Public License v1.0\r
6  * which accompanies this distribution, and is available at\r
7  * http://www.eclipse.org/legal/epl-v10.html\r
8  *\r
9  * Contributors:\r
10  *     VTT Technical Research Centre of Finland - initial API and implementation\r
11  *******************************************************************************/\r
12 package org.simantics.sysdyn.ui.project;\r
13 \r
14 import org.simantics.db.Resource;\r
15 import org.simantics.db.Session;\r
16 import org.simantics.db.VirtualGraphContext;\r
17 import org.simantics.db.WriteGraph;\r
18 import org.simantics.db.exception.DatabaseException;\r
19 import org.simantics.db.layer0.realization.RealizationVirtualGraph;\r
20 import org.simantics.db.layer0.realization.ResourceData;\r
21 import org.simantics.simulation.ontology.SimulationResource;\r
22 import org.simantics.sysdyn.SysdynResource;\r
23 \r
24 public class DefaultRealizationVirtualGraph extends RealizationVirtualGraph {\r
25 \r
26         public DefaultRealizationVirtualGraph(Session session, Resource model) throws DatabaseException {\r
27                 super(session, model, SysdynResource.getInstance(session).DefaultRealization);\r
28         }\r
29         \r
30         @Override\r
31         public void initialize(final VirtualGraphContext context, WriteGraph graph) throws DatabaseException {\r
32                 \r
33                 Resource configuration = graph.getSingleObject(model, SimulationResource.getInstance(graph).HasConfiguration);\r
34 \r
35                 Resource defaultsResource = graph.newResource();\r
36                 int modelNode = context.getIndex(model);\r
37                 int defaultsNode = context.getIndex(defaultsResource);\r
38                 graph.claim(model, L0.ConsistsOf, null, defaultsResource);\r
39                 graph.claim(model, L0X.HasBaseRealization, null, defaultsResource);\r
40                 \r
41 //              undiscovered.put(defaultsNode, new ResourceData(modelNode, configuration, L0.Realization, "BaseRealization", null, null));\r
42                 \r
43         }\r
44         \r
45 \r
46 }\r