1 package org.simantics.structural2.scl;
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 import org.simantics.structural.stubs.StructuralResource2;
10 public class FindPossibleComponentTypeRequest extends ResourceRead<Resource> {
12 public FindPossibleComponentTypeRequest(Resource resource) {
17 public Resource perform(ReadGraph graph) throws DatabaseException {
18 StructuralResource2 STR = StructuralResource2.getInstance(graph);
19 Resource type = graph.getPossibleObject(resource, STR.Defines);
23 Layer0 L0 = Layer0.getInstance(graph);
24 Resource parent = graph.getPossibleObject(resource, L0.PartOf);
25 if(parent != null && graph.isInstanceOf(parent, STR.Composite))
26 return graph.syncRequest(new FindPossibleComponentTypeRequest(parent));