Fixed ALF-3085: UI Bootstrap - No root 'Web Projects' folder exists (is WCM enabled ?)

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@22904 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Gavin Cornwell
2010-10-06 08:46:11 +00:00
parent 843e1b27b3
commit 4446ea6a9e
3 changed files with 46 additions and 0 deletions

View File

@@ -112,6 +112,14 @@ public interface WebProjectService
@NotAuditable
public WebProjectInfo createWebProject(WebProjectInfo wpInfo);
/**
* Determines whether the "Web Projects" container node is present.
*
* @return true if the "Web Projects" container node is present
*/
@NotAuditable
public boolean hasWebProjectsRoot();
/**
* Returns the Web Projects container
*

View File

@@ -438,7 +438,39 @@ public class WebProjectServiceImpl extends WCMUtil implements WebProjectService
throw new AccessDeniedException("Only content managers may delete webapp '"+webAppName+"' (web project: "+wpNodeRef+")");
}
}
/*
* @see org.alfresco.wcm.webproject.WebProjectService#hasWebProjectsRoot()
*/
public boolean hasWebProjectsRoot()
{
boolean hasRoot = false;
// Get the root 'web projects' folder
ResultSet resultSet = null;
try
{
resultSet = this.searchService.query(WEBPROJECT_STORE, SearchService.LANGUAGE_LUCENE, "PATH:\""+getWebProjectsPath()+"\"");
if (resultSet.length() == 1)
{
hasRoot = true;
}
else if (resultSet.length() > 1 && logger.isWarnEnabled())
{
logger.warn("More than one root 'Web Projects' folder exists");
}
}
finally
{
if (resultSet != null)
{
resultSet.close();
}
}
return hasRoot;
}
/**
* Get the node reference that is the web projects root
*

View File

@@ -142,6 +142,12 @@ public class WebProjectServiceImplTest extends AbstractWCMServiceImplTest
}
}
public void testHasWebProjectsRoot()
{
// make sure there is a "Web Projects" container node
assertTrue(wpService.hasWebProjectsRoot());
}
public void testCreateWebProjectSimple()
{
// Create a web project