]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/request/HasEnumerationRange.java
possibleObjectForType utility
[simantics/platform.git] / bundles / org.simantics.db.layer0 / src / org / simantics / db / layer0 / request / HasEnumerationRange.java
1 package org.simantics.db.layer0.request;
2
3 import org.simantics.db.ReadGraph;
4 import org.simantics.db.Resource;
5 import org.simantics.db.common.request.ResourceRead;
6 import org.simantics.db.exception.DatabaseException;
7 import org.simantics.layer0.Layer0;
8
9 public class HasEnumerationRange extends ResourceRead<Boolean> {
10
11         public HasEnumerationRange(Resource resource) {
12                 super(resource);
13         }
14
15         @Override
16         public Boolean perform(ReadGraph graph) throws DatabaseException {
17                 Layer0 L0 = Layer0.getInstance(graph);
18                 for(Resource range : graph.getObjects(resource, L0.HasRange)) {
19                         boolean enu = graph.syncRequest(new IsEnumeratedType(range));
20                         if(enu) return true;
21                 }
22                 return false;
23         }
24
25 }