1 package org.simantics.structural2.modelingRules;
3 import java.util.Collection;
4 import java.util.HashSet;
7 import org.simantics.db.ReadGraph;
8 import org.simantics.db.Resource;
9 import org.simantics.db.common.request.ResourceRead;
10 import org.simantics.db.exception.DatabaseException;
11 import org.simantics.structural.stubs.StructuralResource2;
13 public class AllowedConnectionTypes extends ResourceRead<Collection<Resource>> {
15 public AllowedConnectionTypes(Resource connectionPoint) {
16 super(connectionPoint);
20 public Collection<Resource> perform(ReadGraph graph) throws DatabaseException {
21 StructuralResource2 STR = StructuralResource2.getInstance(graph);
22 Collection<Resource> types = graph.getObjects(resource, STR.AllowsConnectionType);
23 Set<Resource> result = new HashSet<Resource>(types);
24 for(Resource type : types)
25 for(Resource override : graph.getObjects(type, STR.OverridesConnectionType))
26 result.remove(override);