]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Fixed broken validation of document SCL Handler expressions 46/2646/1
authorJussi Koskela <jussi.koskela@semantum.fi>
Fri, 8 Feb 2019 13:13:31 +0000 (15:13 +0200)
committerJussi Koskela <jussi.koskela@semantum.fi>
Fri, 8 Feb 2019 13:13:31 +0000 (15:13 +0200)
The implementation was originally in Simupedia but was obviously lost
while moving the validation implementation to Simantics Platform.

gitlab #255

Change-Id: I81c92620631caa352daa5a7380733a4edb91e938

bundles/org.simantics.document.base.ontology/graph/Components.pgraph
bundles/org.simantics.document.server/scl/Document/All.scl
bundles/org.simantics.document.server/src/org/simantics/document/server/Functions.java

index 65a75d288777bc3556ef802cfa1d0219828aba9f..e89d7458926dfff6dac5e30b8f077498a47b9e53 100644 (file)
@@ -54,6 +54,7 @@ DOC.SCLValue <T L0.SCLValue
     DOC.Functions.sclValue : L0.ExternalValue
 
 DOC.HandlerSCLValue <T L0.SCLValue
+  @L0.scl L0.SCLValueType.validator """\self -> compileSimupediaSCLHandlerValueExpression self""" "Variable -> <ReadGraph> String"
   @L0.assert L0.ConvertsToValueWith
     DOC.Functions.sclHandlerValue : L0.ExternalValue
 
index 6eaf328a32d64cd67ba13e64ded08f915cc31a02..a90a24bcb62c30c55cad163eb3d242f869bec690 100644 (file)
@@ -144,6 +144,7 @@ importJava "org.simantics.document.server.Functions" where
     stateVariable :: Variable -> <ReadGraph> Variable
     
     compileDocumentSCLValueExpression :: Variable -> <ReadGraph> String
+    compileDocumentSCLHandlerValueExpression :: Variable -> <ReadGraph> String
 
     primitiveProperties :: <Proc> DocumentProperties
     
index 186edd25247fa9e67aa506404600cf18fb785ed6..d5a727ffae324f3219af714288bce219aa58f2ec 100644 (file)
@@ -1381,6 +1381,15 @@ public class Functions {
         }
     }
     
+    public static String compileDocumentSCLHandlerValueExpression(ReadGraph graph, Variable context) {
+        try {
+            ServerSCLHandlerValueRequest.compile(graph, context);
+            return "";
+        } catch (Exception e) {
+            return resolveIssueMessage(e);
+        }
+    }
+
     private static String resolveIssueMessage(Exception e) {
         if (e instanceof ImportFailureException)
             return "";