Fix for ETHREEOH-221 - Undefined Root Scoped Objects in JavaScript API.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@11119 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2008-10-01 11:23:59 +00:00
parent 07fbee8bf6
commit 807940fe03
2 changed files with 12 additions and 6 deletions

View File

@@ -441,7 +441,7 @@ public class RhinoScriptProcessor extends BaseProcessor implements ScriptProcess
} }
else else
{ {
newModel = new HashMap<String, Object>(0); newModel = new HashMap<String, Object>(1, 1.0f);
} }
return newModel; return newModel;
} }
@@ -464,5 +464,4 @@ public class RhinoScriptProcessor extends BaseProcessor implements ScriptProcess
return super.wrapAsJavaObject(cx, scope, javaObject, staticType); return super.wrapAsJavaObject(cx, scope, javaObject, staticType);
} }
} }
} }

View File

@@ -29,6 +29,7 @@ import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.alfresco.error.AlfrescoRuntimeException; import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.model.ContentModel; import org.alfresco.model.ContentModel;
@@ -83,6 +84,7 @@ public class Repository implements ApplicationContextAware, ApplicationListener,
private StoreRef companyHomeStore; private StoreRef companyHomeStore;
private String companyHomePath; private String companyHomePath;
private Map<String, NodeRef> companyHomeRefs; private Map<String, NodeRef> companyHomeRefs;
private NodeRef rootRef;
/** /**
@@ -205,7 +207,7 @@ public class Repository implements ApplicationContextAware, ApplicationListener,
if (companyHomeRefs == null) if (companyHomeRefs == null)
{ {
companyHomeRefs = new HashMap<String, NodeRef>(1); companyHomeRefs = new ConcurrentHashMap<String, NodeRef>(4);
} }
getCompanyHome(); getCompanyHome();
@@ -219,7 +221,11 @@ public class Repository implements ApplicationContextAware, ApplicationListener,
*/ */
public NodeRef getRootHome() public NodeRef getRootHome()
{ {
return nodeService.getRootNode(companyHomeStore); if (rootRef == null)
{
rootRef = nodeService.getRootNode(companyHomeStore);
}
return rootRef;
} }
/** /**
@@ -281,9 +287,10 @@ public class Repository implements ApplicationContextAware, ApplicationListener,
*/ */
public NodeRef getUserHome(NodeRef person) public NodeRef getUserHome(NodeRef person)
{ {
return (NodeRef)nodeService.getProperty(person, ContentModel.PROP_HOMEFOLDER); NodeRef homeFolderRef = (NodeRef)nodeService.getProperty(person, ContentModel.PROP_HOMEFOLDER);
return nodeService.exists(homeFolderRef) ? homeFolderRef : null;
} }
/** /**
* Helper to convert a Web Script Request URL to a Node Ref * Helper to convert a Web Script Request URL to a Node Ref
* *