package org.simantics.document.server.request;
+import java.util.Collections;
import java.util.Map;
import org.simantics.databoard.Bindings;
return Pair.make(type, root);
} else {
Resource doc = graph.syncRequest(new PossibleTypedParent(component, DocumentationResource.getInstance(graph).Document));
- Resource componentType = graph.getSingleType(doc);
- Resource root = graph.syncRequest(new IndexRoot(doc));
- // System.err.println("getComponentTypeAndRoot4 " + graph.getPossibleURI(component) + " => " + graph.getPossibleURI(componentType) + " " + graph.getPossibleURI(root));
- return Pair.make(componentType, root);
+ if(doc != null) {
+ Resource componentType = graph.getSingleType(doc);
+ Resource root = graph.syncRequest(new IndexRoot(doc));
+ return Pair.make(componentType, root);
+ } else {
+ System.err.println("component = " + component);
+ Resource root = graph.syncRequest(new IndexRoot(component));
+// Resource componentType = graph.getSingleType(doc);
+ return Pair.make(null, root);
+ }
}
}
throw new IllegalStateException();
public CompilationContext perform(ReadGraph graph)
throws DatabaseException {
RuntimeEnvironment runtimeEnvironment = graph.syncRequest(getRuntimeEnvironmentRequest(parameter.first, parameter.second));
- Map<String, ComponentTypeProperty> propertyMap =
- graph.syncRequest(new ReadComponentTypeInterfaceRequest(parameter.first, runtimeEnvironment.getEnvironment()),
- TransientCacheListener.<Map<String, ComponentTypeProperty>>instance());
- return new CompilationContext(runtimeEnvironment, propertyMap);
+ if(parameter.first != null) {
+ Map<String, ComponentTypeProperty> propertyMap =
+ graph.syncRequest(new ReadComponentTypeInterfaceRequest(parameter.first, runtimeEnvironment.getEnvironment()),
+ TransientCacheListener.<Map<String, ComponentTypeProperty>>instance());
+ return new CompilationContext(runtimeEnvironment, propertyMap);
+ } else {
+ return new CompilationContext(runtimeEnvironment, Collections.emptyMap());
+ }
}
});
}