Added native support for Java->JavaScript Date() object conversion for Alfresco node properties

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@3415 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2006-07-26 14:53:05 +00:00
parent 0c3112b44c
commit 0003524f68
4 changed files with 108 additions and 9 deletions

View File

@@ -218,7 +218,18 @@ public class RhinoScriptService implements ScriptService
{
for (String key : model.keySet())
{
Object jsObject = Context.javaToJS(model.get(key), scope);
// set the root scope on appropriate objects
// this is used to allow native JS object creation etc.
Object obj = model.get(key);
if (obj instanceof Scopeable)
{
((Scopeable)obj).setScope(scope);
}
// convert/wrap each object to JavaScript compatible
Object jsObject = Context.javaToJS(obj, scope);
// insert into the root scope ready for access by the script
ScriptableObject.putProperty(scope, key, jsObject);
}
}