X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.document.server%2Fsrc%2Forg%2Fsimantics%2Fdocument%2Fserver%2Frequest%2FServerSCLValueRequest.java;h=b2dc03b73f3fee14c847a686f9b7fe6c6229d886;hb=1f8b50d81a1aa1bbd67a77f7cbc1060f2eb805d4;hp=77cd9b4f4a3a8cfe175b27c40508819dc3cfa880;hpb=3850fec72035293b9a4ede780d01aedc5fbc9056;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.document.server/src/org/simantics/document/server/request/ServerSCLValueRequest.java b/bundles/org.simantics.document.server/src/org/simantics/document/server/request/ServerSCLValueRequest.java index 77cd9b4f4..b2dc03b73 100644 --- a/bundles/org.simantics.document.server/src/org/simantics/document/server/request/ServerSCLValueRequest.java +++ b/bundles/org.simantics.document.server/src/org/simantics/document/server/request/ServerSCLValueRequest.java @@ -1,5 +1,6 @@ package org.simantics.document.server.request; +import java.util.Collections; import java.util.Map; import org.simantics.databoard.Bindings; @@ -80,6 +81,7 @@ public class ServerSCLValueRequest extends AbstractExpressionCompilationRequest< Resource type = graph.syncRequest(new FindPossibleComponentTypeRequest(represents)); if(type != null) { Resource root = graph.syncRequest(new IndexRoot(type)); + //System.err.println("getComponentTypeAndRoot1 " + property.getURI(graph) + " => " + graph.getPossibleURI(type) + " " + graph.getPossibleURI(root)); return Pair.make(type, root); } } @@ -87,8 +89,11 @@ public class ServerSCLValueRequest extends AbstractExpressionCompilationRequest< parent = parent.getParent(graph); represents = parent.getPossibleRepresents(graph); } - Resource root = graph.syncRequest(new IndexRoot(property.getRepresents(graph))); - return Pair.make(parent.getType(graph), root); +// Resource root = graph.syncRequest(new IndexRoot(property.getRepresents(graph))); + Resource componentType = parent.getType(graph); + Resource root = graph.syncRequest(new IndexRoot(parent.getRepresents(graph))); + //System.err.println("getComponentTypeAndRoot2 " + property.getURI(graph) + " => " + graph.getPossibleURI(componentType) + " " + graph.getPossibleURI(root)); + return Pair.make(componentType, root); } private static Pair getComponentTypeAndRoot(ReadGraph graph, Resource component) throws DatabaseException { @@ -96,11 +101,20 @@ public class ServerSCLValueRequest extends AbstractExpressionCompilationRequest< Resource type = graph.syncRequest(new FindPossibleComponentTypeRequest(component)); if(type != null) { Resource root = graph.syncRequest(new IndexRoot(type)); + // System.err.println("getComponentTypeAndRoot3 " + graph.getPossibleURI(component) + " => " + graph.getPossibleURI(type) + " " + graph.getPossibleURI(root)); return Pair.make(type, root); } else { Resource doc = graph.syncRequest(new PossibleTypedParent(component, DocumentationResource.getInstance(graph).Document)); - Resource root = graph.syncRequest(new IndexRoot(component)); - return Pair.make(graph.getSingleType(doc), 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(); @@ -154,10 +168,14 @@ public class ServerSCLValueRequest extends AbstractExpressionCompilationRequest< public CompilationContext perform(ReadGraph graph) throws DatabaseException { RuntimeEnvironment runtimeEnvironment = graph.syncRequest(getRuntimeEnvironmentRequest(parameter.first, parameter.second)); - Map propertyMap = - graph.syncRequest(new ReadComponentTypeInterfaceRequest(parameter.first, runtimeEnvironment.getEnvironment()), - TransientCacheListener.>instance()); - return new CompilationContext(runtimeEnvironment, propertyMap); + if(parameter.first != null) { + Map propertyMap = + graph.syncRequest(new ReadComponentTypeInterfaceRequest(parameter.first, runtimeEnvironment.getEnvironment()), + TransientCacheListener.>instance()); + return new CompilationContext(runtimeEnvironment, propertyMap); + } else { + return new CompilationContext(runtimeEnvironment, Collections.emptyMap()); + } } }); }