]> gerrit.simantics Code Review - simantics/district.git/blob - org.simantics.district.network/src/org/simantics/district/network/techtype/requests/TechTypeTableKeyName.java
Tech type table content validation
[simantics/district.git] / org.simantics.district.network / src / org / simantics / district / network / techtype / requests / TechTypeTableKeyName.java
1 package org.simantics.district.network.techtype.requests;
2
3 import org.simantics.db.ReadGraph;
4 import org.simantics.db.Resource;
5 import org.simantics.db.common.procedure.adapter.TransientCacheListener;
6 import org.simantics.db.common.request.ResourceRead;
7 import org.simantics.db.exception.DatabaseException;
8 import org.simantics.district.network.ontology.DistrictNetworkResource;
9
10 public class TechTypeTableKeyName extends ResourceRead<String> {
11         
12         public TechTypeTableKeyName(Resource table) {
13                 super(table);
14         }
15
16         @Override
17         public String perform(ReadGraph graph) throws DatabaseException {
18                 DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
19                 
20                 Resource type = graph.getPossibleObject(resource, DN.TechType_TechTypeTable_HasComponentType);
21                 return type != null ? graph.syncRequest(new PossibleTechTypeKeyName(type), TransientCacheListener.instance()) : null;
22         }
23 }