1 package org.simantics.db.layer0.request;
3 import java.util.Collection;
5 import org.simantics.db.ReadGraph;
6 import org.simantics.db.Resource;
7 import org.simantics.db.common.request.ResourceRead2;
8 import org.simantics.db.exception.DatabaseException;
9 import org.simantics.layer0.Layer0;
11 public class IsLinkedTo extends ResourceRead2<Boolean> {
13 public IsLinkedTo(Resource resource, Resource resource2) {
14 super(resource, resource2);
18 public Boolean perform(ReadGraph graph) throws DatabaseException {
19 if(resource.equals(resource2)) return true;
20 Layer0 L0 = Layer0.getInstance(graph);
21 Collection<Resource> links = graph.getObjects(resource, L0.IsLinkedTo);
22 for(Resource link : links) {
23 if(link.equals(resource2)) return true;
25 for(Resource link : links) {
26 if(graph.syncRequest(new IsLinkedTo(link, resource2))) return true;