Author: nfilotto
Date: 2011-05-17 05:47:29 -0400 (Tue, 17 May 2011)
New Revision: 4383
Modified:
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/hierarchy/impl/NodeHierarchyCreatorImpl.java
Log:
EXOJCR-1349: Duplicate content of other workspaces in default workspace
Modified:
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/hierarchy/impl/NodeHierarchyCreatorImpl.java
===================================================================
---
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/hierarchy/impl/NodeHierarchyCreatorImpl.java 2011-05-17
08:47:34 UTC (rev 4382)
+++
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/hierarchy/impl/NodeHierarchyCreatorImpl.java 2011-05-17
09:47:29 UTC (rev 4383)
@@ -129,7 +129,7 @@
*/
public void init(String repository) throws Exception
{
- init();
+ initBasePath(repository);
}
/**
@@ -137,7 +137,7 @@
*/
public void init() throws Exception
{
- initBasePath();
+ initBasePath(null);
}
private void createNode(Node rootNode, String path, String nodeType,
List<String> mixinTypes,
@@ -150,14 +150,13 @@
private void processAddPathPlugin() throws Exception
{
Session session = null;
- ManageableRepository currentRepo = jcrService_.getCurrentRepository();
for (AddPathPlugin pathPlugin : pathPlugins_)
{
HierarchyConfig hierarchyConfig = pathPlugin.getPaths();
if (hierarchyConfig == null)
{
continue;
- }
+ }
List<JcrPath> jcrPaths = hierarchyConfig.getJcrPaths();
if (jcrPaths == null)
{
@@ -168,13 +167,17 @@
{
workspaceNames.addAll(hierarchyConfig.getWorkspaces());
}
- workspaceNames.add(currentRepo.getConfiguration().getDefaultWorkspaceName());
+ String repositoryName = hierarchyConfig.getRepository();
+ ManageableRepository repository = repositoryName == null ||
repositoryName.isEmpty() ?
+ jcrService_.getCurrentRepository() :
+ jcrService_.getRepository(repositoryName);
+
for (String workspaceName : workspaceNames)
{
JcrPath currentjcrPath = null;
try
{
- session = currentRepo.getSystemSession(workspaceName);
+ session = repository.getSystemSession(workspaceName);
Node rootNode = session.getRootNode();
for (JcrPath jcrPath : jcrPaths)
{
@@ -205,13 +208,15 @@
}
}
- private void initBasePath() throws Exception
+ private void initBasePath(String repositoryName) throws Exception
{
Session session = null;
- ManageableRepository manageableRepository = jcrService_.getCurrentRepository();
+ ManageableRepository manageableRepository =
+ repositoryName == null || repositoryName.isEmpty() ?
jcrService_.getCurrentRepository() : jcrService_
+ .getRepository(repositoryName);
String defaultWorkspace =
manageableRepository.getConfiguration().getDefaultWorkspaceName();
String systemWorkspace =
manageableRepository.getConfiguration().getSystemWorkspaceName();
- boolean isSameWorksapce = defaultWorkspace.equalsIgnoreCase(systemWorkspace);
+ boolean isSameWorkspace = defaultWorkspace.equalsIgnoreCase(systemWorkspace);
String[] workspaceNames = manageableRepository.getWorkspaceNames();
for (AddPathPlugin pathPlugin : pathPlugins_)
{
@@ -227,7 +232,7 @@
}
for (String workspaceName : workspaceNames)
{
- if (!isSameWorksapce &&
workspaceName.equalsIgnoreCase(systemWorkspace))
+ if (!isSameWorkspace &&
workspaceName.equalsIgnoreCase(systemWorkspace))
continue;
JcrPath currentjcrPath = null;
try
Show replies by date