import org.simantics.db.layer0.variable.VariableMap;
import org.simantics.db.layer0.variable.VariableMapImpl;
import org.simantics.db.layer0.variable.VariableNode;
+import org.simantics.db.layer0.variable.Variables;
import org.simantics.db.service.CollectionSupport;
import org.simantics.issues.common.IssueUtils;
import org.simantics.layer0.Layer0;
public static List<SubstructureElement> getProceduralDesc(ReadGraph graph, final Variable context) throws DatabaseException {
StructuralResource2 STR = StructuralResource2.getInstance(graph);
- final Resource type = context.getPossibleType(graph);
+ Variable config = Variables.getConfigurationVariable(graph, context);
+ final Resource type = config.getPossibleType(graph);
if(type != null) {
if(graph.isInstanceOf(type, STR.ProceduralComponentType)) {
- return graph.syncRequest(new SubstructureRequest(context));
+ return graph.syncRequest(new SubstructureRequest(config));
}
}
return null;
}
throw new DatabaseException("No type for " + variable.getURI(graph));
} else {
- Resource possibleType = graph.getPossibleType(represents, Layer0.getInstance(graph).Entity);
- if (graph.syncRequest(new IsInstanceOf(possibleType, StructuralResource2.getInstance(graph).ReplaceableDefinedComponentType), TransientCacheListener.instance()) ) {
+ StructuralResource2 STR = StructuralResource2.getInstance(graph);
+ Resource possibleType = graph.getPossibleType(represents, STR.Component);
+ if (possibleType == null) {
+ possibleType = graph.getPossibleType(represents, Layer0.getInstance(graph).Entity);
+ if (possibleType == null)
+ return null;
+ }
+ if (graph.syncRequest(new IsInstanceOf(possibleType, STR.ReplaceableDefinedComponentType), TransientCacheListener.instance()) ) {
return graph.syncRequest(new StructuralOverrideDataWalkRequest(variable, represents, possibleType), TransientCacheListener.instance());
} else {
return null;
@Override
public Variable getVariable(ReadGraph graph, Variable context, String name) throws DatabaseException {
-
- Resource type = context.getPossibleType(graph);
+ StructuralResource2 STR = StructuralResource2.getInstance(graph);
+ Resource type = context.getPossibleType(graph, STR.Component);
if(type == null) return null;
Tuple2 result = graph.syncRequest(new StructureTypeAndChildMapRequest(type), TransientCacheListener.instance());
for(Resource req : requiredConnections) {
if(!connections.contains(req)) {
- result.add(new StandardIssue(sr.ConnectionConstraint_ErrorIssue, component, req));
+ result.add(new StandardIssue(sr.ConnectionValidationConstraint_ErrorIssue, component, req));
}
}