]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/request/GlobalOntologies.java
Initial support for concurrency in databoard, bindings and serializers
[simantics/platform.git] / bundles / org.simantics.db.layer0 / src / org / simantics / db / layer0 / request / GlobalOntologies.java
1 package org.simantics.db.layer0.request;
2
3 import java.util.ArrayList;
4 import java.util.List;
5
6 import org.simantics.databoard.Bindings;
7 import org.simantics.db.ReadGraph;
8 import org.simantics.db.Resource;
9 import org.simantics.db.common.request.ResourceRead;
10 import org.simantics.db.exception.DatabaseException;
11 import org.simantics.db.layer0.util.Layer0Utils;
12 import org.simantics.layer0.Layer0;
13
14 public class GlobalOntologies extends ResourceRead<List<Resource>> {
15
16         public GlobalOntologies(Resource root) {
17                 super(root);
18         }
19
20         @Override
21         public List<Resource> perform(ReadGraph graph) throws DatabaseException {
22                 Layer0 L0 = Layer0.getInstance(graph);
23                 ArrayList<Resource> result = new ArrayList<Resource>();
24                 for(Resource ontology : Layer0Utils.listOntologies(graph)) {
25                         Boolean global = graph.getPossibleRelatedValue(ontology, L0.Ontology_global, Bindings.BOOLEAN);
26                         if(global != null && global) result.add(ontology);
27                 }
28                 return result;
29         }
30
31 }