From 34ca11c8033aaadfdf15e69d4fa1be71b4a3e7cf Mon Sep 17 00:00:00 2001 From: Jan Vonka Date: Fri, 9 Jan 2009 14:57:21 +0000 Subject: [PATCH] Merged DEV/JASONH to HEAD 12201: MT-enable (implementing ALFCOM-1892), also add ALFCOM-1809 workaround 12242: Refactor creating getRootNode method 12662: improve ALFCOM-1892, also remove ALFCOM-1809 workaround (should not be required) git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@12664 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../alfresco/web/app/servlet/BaseServlet.java | 29 +++++++++++++++++++ source/web/WEB-INF/web.xml | 21 +++++++++----- 2 files changed, 42 insertions(+), 8 deletions(-) diff --git a/source/java/org/alfresco/web/app/servlet/BaseServlet.java b/source/java/org/alfresco/web/app/servlet/BaseServlet.java index f3807598e8..3775fe61a0 100644 --- a/source/java/org/alfresco/web/app/servlet/BaseServlet.java +++ b/source/java/org/alfresco/web/app/servlet/BaseServlet.java @@ -52,6 +52,13 @@ import org.springframework.web.context.WebApplicationContext; import org.springframework.web.context.support.WebApplicationContextUtils; import org.springframework.web.jsf.FacesContextUtils; +import org.alfresco.repo.tenant.TenantService; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.cmr.repository.StoreRef; +import org.alfresco.service.cmr.search.SearchService; +import org.alfresco.service.namespace.NamespaceService; + + /** * Base servlet class containing useful constant values and common methods for Alfresco servlets. * @@ -89,6 +96,8 @@ public abstract class BaseServlet extends HttpServlet private static Log logger = LogFactory.getLog(BaseServlet.class); + // Tenant service + private static TenantService m_tenantService; /** * Return the ServiceRegistry helper instance @@ -291,6 +300,26 @@ public abstract class BaseServlet extends HttpServlet // get the company home node to start the search from nodeRef = new NodeRef(Repository.getStoreRef(), Application.getCompanyRootId()); + m_tenantService = (TenantService) wc.getBean("tenantService"); + if (m_tenantService !=null && m_tenantService.isEnabled()) + { + if (logger.isDebugEnabled()) + { + logger.debug("MT is enabled."); + } + + NodeService nodeService = (NodeService) wc.getBean("NodeService"); + SearchService searchService = (SearchService) wc.getBean("SearchService"); + NamespaceService namespaceService = (NamespaceService) wc.getBean("NamespaceService"); + + // TODO: since these constants are used more widely than just the WebDAVServlet, + // they should be defined somewhere other than in that servlet + String m_rootPath = wc.getServletContext().getInitParameter(org.alfresco.repo.webdav.WebDAVServlet.KEY_ROOT_PATH); + + // note: rootNodeRef is required (for storeRef part) + nodeRef = m_tenantService.getRootNode(nodeService, searchService, namespaceService, m_rootPath, nodeRef); + } + if (paths.size() != 0) { FileFolderService ffs = (FileFolderService)wc.getBean("FileFolderService"); diff --git a/source/web/WEB-INF/web.xml b/source/web/WEB-INF/web.xml index e4c34a5240..a03023a799 100644 --- a/source/web/WEB-INF/web.xml +++ b/source/web/WEB-INF/web.xml @@ -85,6 +85,19 @@ Spring config file locations + + + store + workspace://SpacesStore + + + rootPath + /app:company_home + + + Authentication Filter org.alfresco.web.app.servlet.AuthenticationFilter @@ -312,14 +325,6 @@ WebDAV org.alfresco.repo.webdav.WebDAVServlet - - store - workspace://SpacesStore - - - rootPath - /app:company_home - 5