Build fix

- Corrected lookup of root groups
- Improved root group search in the process
- Spent ages trying to work out why GROUP_BUFFY wasn't being deleted!

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@19210 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Dave Ward
2010-03-11 09:58:47 +00:00
parent 3e650f2f70
commit f2b334b68a

View File

@@ -279,12 +279,25 @@ public class AuthorityDAOImpl implements AuthorityDAO, NodeServicePolicies.Befor
Pattern pattern = displayNamePattern == null ? null : Pattern.compile(SearchLanguageConversion.convert(
SearchLanguageConversion.DEF_LUCENE, SearchLanguageConversion.DEF_REGEX, displayNamePattern),
Pattern.CASE_INSENSITIVE);
// Use SQL to determine root authorities
Set<String> rootAuthorities = null;
if (parentAuthority == null && immediate)
{
return getRootAuthoritiesUnderContainer(zoneName == null ? getAuthorityContainer() : getZone(zoneName),
type, pattern);
NodeRef container = zoneName == null ? getAuthorityContainer() : getZone(zoneName);
if (container == null)
{
// The zone doesn't even exist so there are no root authorities
return Collections.emptySet();
}
rootAuthorities = getRootAuthoritiesUnderContainer(container, type, pattern);
if (pattern == null)
{
return rootAuthorities;
}
}
// Use a Lucene search for other criteria
Set<String> authorities = new TreeSet<String>();
SearchParameters sp = new SearchParameters();
sp.addStore(this.storeRef);
@@ -358,6 +371,12 @@ public class AuthorityDAOImpl implements AuthorityDAO, NodeServicePolicies.Befor
addAuthorityNameIfMatches(authorities, DefaultTypeConverter.INSTANCE.convert(String.class, nodeService
.getProperty(nodeRef, idProp)), type, pattern);
}
// If we asked for root authorities, we must do an intersection with the set of root authorities
if (rootAuthorities != null)
{
authorities.retainAll(rootAuthorities);
}
return authorities;
}
finally