1 package org.simantics.district.network.ui.techtype.requests;
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.district.network.ontology.DistrictNetworkResource;
10 import org.simantics.layer0.Layer0;
12 public class PossibleTechTypeTable extends ResourceRead2<Resource> {
13 public PossibleTechTypeTable(Resource model, Resource componentType) {
14 super(model, componentType);
18 public Resource perform(ReadGraph graph) throws DatabaseException {
19 Layer0 L0 = Layer0.getInstance(graph);
20 DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
22 Collection<Resource> children = graph.getObjects(resource, L0.ConsistsOf);
23 for (Resource child : children) {
24 if (!graph.isInstanceOf(child, DN.TechType_TechTypeTable))
27 if (graph.hasStatement(child, DN.TechType_TechTypeTable_HasComponentType, resource2))