]> gerrit.simantics Code Review - simantics/district.git/blob - org.simantics.district.network/src/org/simantics/district/network/techtype/requests/PossibleTechTypeTableData.java
Move tech type table-related request from UI plug-in
[simantics/district.git] / org.simantics.district.network / src / org / simantics / district / network / techtype / requests / PossibleTechTypeTableData.java
1 package org.simantics.district.network.techtype.requests;
2
3 import org.simantics.databoard.Bindings;
4 import org.simantics.db.ReadGraph;
5 import org.simantics.db.Resource;
6 import org.simantics.db.common.procedure.adapter.TransientCacheListener;
7 import org.simantics.db.common.request.ResourceRead2;
8 import org.simantics.db.exception.DatabaseException;
9 import org.simantics.district.network.ontology.DistrictNetworkResource;
10
11 public class PossibleTechTypeTableData extends ResourceRead2<String> {
12         public PossibleTechTypeTableData(Resource model, Resource componentType) {
13                 super(model, componentType);
14         }
15
16         @Override
17         public String perform(ReadGraph graph) throws DatabaseException {
18                 DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
19
20                 Resource ttt = graph.syncRequest(new PossibleTechTypeTable(resource, resource2), TransientCacheListener.instance());
21                 return ttt != null ? graph.getPossibleRelatedValue2(ttt, DN.TechType_TechTypeTable_HasData, Bindings.STRING) : null;
22         }
23 }