First cut of hooking Alfresco JavaScript into jBPM process definition.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@3486 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
David Caruana
2006-08-11 18:01:56 +00:00
parent 17ab601380
commit cddf5ac2ab
4 changed files with 256 additions and 6 deletions

View File

@@ -38,6 +38,7 @@ import org.alfresco.service.namespace.QName;
import org.apache.log4j.Logger;
import org.mozilla.javascript.Context;
import org.mozilla.javascript.ImporterTopLevel;
import org.mozilla.javascript.NativeJavaObject;
import org.mozilla.javascript.Scriptable;
import org.mozilla.javascript.ScriptableObject;
@@ -252,6 +253,12 @@ public class RhinoScriptService implements ScriptService
// execute the script
Object result = cx.evaluateReader(scope, reader, "AlfrescoScript", 1, null);
// extract java object result if wrapped by rhinoscript
if (result != null && result.getClass().equals(NativeJavaObject.class))
{
result = Context.jsToJava(result, Object.class);
}
return result;
}
catch (Throwable err)
@@ -260,7 +267,7 @@ public class RhinoScriptService implements ScriptService
}
finally
{
cx.exit();
Context.exit();
if (logger.isDebugEnabled())
{