ALFCOM-2310: Creating a space under Sites (web client) breaks the sites search in share

- list site method on site service now filters out non-site nodes found



git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@12710 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Roy Wetherall
2009-01-13 16:30:06 +00:00
parent e150188167
commit 0be11fe808
2 changed files with 20 additions and 2 deletions

View File

@@ -37,6 +37,7 @@ import org.alfresco.repo.activities.ActivityType;
import org.alfresco.repo.security.authentication.AuthenticationComponent;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.service.cmr.activities.ActivityService;
import org.alfresco.service.cmr.dictionary.DictionaryService;
import org.alfresco.service.cmr.model.FileFolderService;
import org.alfresco.service.cmr.model.FileInfo;
import org.alfresco.service.cmr.model.FileNotFoundException;
@@ -91,6 +92,7 @@ public class SiteServiceImpl implements SiteService, SiteModel
private AuthenticationComponent authenticationComponent;
private TaggingService taggingService;
private AuthorityService authorityService;
private DictionaryService dictionaryService;
/**
* Set the path to the location of the sites root folder. For example:
@@ -185,6 +187,16 @@ public class SiteServiceImpl implements SiteService, SiteModel
this.authorityService = authorityService;
}
/**
* Set the dictionary service
*
* @param dictionaryService dictionary service
*/
public void setDictionaryService(DictionaryService dictionaryService)
{
this.dictionaryService = dictionaryService;
}
/**
* Checks that all necessary properties and services have been provided.
*/
@@ -430,7 +442,6 @@ public class SiteServiceImpl implements SiteService, SiteModel
// - take into consideration that the sites may not just be in a flat
// list under the site root
// TODO
// For now just return the list of sites present under the site root
NodeRef siteRoot = getSiteRoot();
List<ChildAssociationRef> assocs = this.nodeService.getChildAssocs(
@@ -439,7 +450,13 @@ public class SiteServiceImpl implements SiteService, SiteModel
List<SiteInfo> result = new ArrayList<SiteInfo>(assocs.size());
for (ChildAssociationRef assoc : assocs)
{
result.add(createSiteInfo(assoc.getChildRef()));
// Ignore any node that is not a "site"
NodeRef site = assoc.getChildRef();
QName siteClassName = this.nodeService.getType(site);
if (this.dictionaryService.isSubClass(siteClassName, SiteModel.TYPE_SITE) == true)
{
result.add(createSiteInfo(site));
}
}
return result;