]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.db.common/src/org/simantics/db/common/request/PossibleNearestOwner.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.db.common / src / org / simantics / db / common / request / PossibleNearestOwner.java
1 package org.simantics.db.common.request;\r
2 \r
3 import org.simantics.db.ReadGraph;\r
4 import org.simantics.db.Resource;\r
5 import org.simantics.db.exception.DatabaseException;\r
6 \r
7 public class PossibleNearestOwner extends ResourceRead2<Resource> {\r
8 \r
9     public PossibleNearestOwner(Resource resource, Resource type) {\r
10         super(resource, type);\r
11     }\r
12 \r
13     @Override\r
14     public Resource perform(ReadGraph graph) throws DatabaseException {\r
15         Resource owner = graph.syncRequest(new PossibleOwner(resource));\r
16         if(owner == null) return null;\r
17         if(graph.isInstanceOf(owner, resource2)) return owner;\r
18         return graph.syncRequest(new PossibleNearestOwner(owner, resource2));\r
19     }\r
20     \r
21 }