1 package org.simantics.tests.modelled.ontology;
\r
3 import org.simantics.db.RequestProcessor;
\r
4 import org.simantics.db.Resource;
\r
5 import org.simantics.db.ReadGraph;
\r
6 import org.simantics.db.request.Read;
\r
7 import org.simantics.db.Session;
\r
8 import org.simantics.db.exception.DatabaseException;
\r
9 import org.simantics.db.service.QueryControl;
\r
11 public class TestsResource {
\r
13 public final Resource SCLMain;
\r
14 public final Resource STSSuite;
\r
15 public final Resource STSSuite_moduleNameFilter;
\r
16 public final Resource STSSuite_moduleNameFilter_Inverse;
\r
17 public final Resource STSTest;
\r
18 public final Resource STSTest_definition;
\r
19 public final Resource STSTest_definition_Inverse;
\r
20 public final Resource STSTest_executionPriority;
\r
21 public final Resource STSTest_executionPriority_Inverse;
\r
23 public static class URIs {
\r
24 public static final String SCLMain = "http://www.simantics.org/Tests-1.0/SCLMain";
\r
25 public static final String STSSuite = "http://www.simantics.org/Tests-1.0/STSSuite";
\r
26 public static final String STSSuite_moduleNameFilter = "http://www.simantics.org/Tests-1.0/STSSuite/moduleNameFilter";
\r
27 public static final String STSSuite_moduleNameFilter_Inverse = "http://www.simantics.org/Tests-1.0/STSSuite/moduleNameFilter/Inverse";
\r
28 public static final String STSTest = "http://www.simantics.org/Tests-1.0/STSTest";
\r
29 public static final String STSTest_definition = "http://www.simantics.org/Tests-1.0/STSTest/definition";
\r
30 public static final String STSTest_definition_Inverse = "http://www.simantics.org/Tests-1.0/STSTest/definition/Inverse";
\r
31 public static final String STSTest_executionPriority = "http://www.simantics.org/Tests-1.0/STSTest/executionPriority";
\r
32 public static final String STSTest_executionPriority_Inverse = "http://www.simantics.org/Tests-1.0/STSTest/executionPriority/Inverse";
\r
35 public static Resource getResourceOrNull(ReadGraph graph, String uri) {
\r
37 return graph.getResource(uri);
\r
38 } catch(DatabaseException e) {
\r
39 System.err.println(e.getMessage());
\r
44 public TestsResource(ReadGraph graph) {
\r
45 SCLMain = getResourceOrNull(graph, URIs.SCLMain);
\r
46 STSSuite = getResourceOrNull(graph, URIs.STSSuite);
\r
47 STSSuite_moduleNameFilter = getResourceOrNull(graph, URIs.STSSuite_moduleNameFilter);
\r
48 STSSuite_moduleNameFilter_Inverse = getResourceOrNull(graph, URIs.STSSuite_moduleNameFilter_Inverse);
\r
49 STSTest = getResourceOrNull(graph, URIs.STSTest);
\r
50 STSTest_definition = getResourceOrNull(graph, URIs.STSTest_definition);
\r
51 STSTest_definition_Inverse = getResourceOrNull(graph, URIs.STSTest_definition_Inverse);
\r
52 STSTest_executionPriority = getResourceOrNull(graph, URIs.STSTest_executionPriority);
\r
53 STSTest_executionPriority_Inverse = getResourceOrNull(graph, URIs.STSTest_executionPriority_Inverse);
\r
56 public static TestsResource getInstance(ReadGraph graph) {
\r
57 Session session = graph.getSession();
\r
58 TestsResource ret = session.peekService(TestsResource.class);
\r
60 QueryControl qc = graph.getService(QueryControl.class);
\r
61 ret = new TestsResource(qc.getIndependentGraph(graph));
\r
62 session.registerService(TestsResource.class, ret);
\r
67 public static TestsResource getInstance(RequestProcessor session) throws DatabaseException {
\r
68 TestsResource ret = session.peekService(TestsResource.class);
\r
70 ret = session.syncRequest(new Read<TestsResource>() {
\r
71 public TestsResource perform(ReadGraph graph) throws DatabaseException {
\r
72 QueryControl qc = graph.getService(QueryControl.class);
\r
73 return new TestsResource(qc.getIndependentGraph(graph));
\r
76 session.registerService(TestsResource.class, ret);
\r