mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged V3.4-BUG-FIX to HEAD
32561: Fix for ALF-11830 - Incorrect behavior while managing groups via Explorer. Reimplemented child group browsing. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@32562 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -112,8 +112,10 @@ public class GroupsDialog extends BaseDialogBean
|
|||||||
|
|
||||||
private static Log logger = LogFactory.getLog(GroupsDialog.class);
|
private static Log logger = LogFactory.getLog(GroupsDialog.class);
|
||||||
|
|
||||||
/** Groups search criteria */
|
/** Groups search criteria */
|
||||||
private String groupsSearchCriteria = null;
|
private String groupsSearchCriteria = null;
|
||||||
|
private boolean searchAll = false;
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------
|
||||||
// Construction
|
// Construction
|
||||||
@@ -354,7 +356,7 @@ public class GroupsDialog extends BaseDialogBean
|
|||||||
*/
|
*/
|
||||||
public boolean isAllowSearchGroups()
|
public boolean isAllowSearchGroups()
|
||||||
{
|
{
|
||||||
return this.group == null;
|
return (this.group == null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -362,20 +364,7 @@ public class GroupsDialog extends BaseDialogBean
|
|||||||
*/
|
*/
|
||||||
public List<Map<String,String>> getGroups()
|
public List<Map<String,String>> getGroups()
|
||||||
{
|
{
|
||||||
if (this.group == null)
|
displayGroups();
|
||||||
{
|
|
||||||
if (this.groups == null)
|
|
||||||
{
|
|
||||||
searchGroups();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (this.groups == null)
|
|
||||||
{
|
|
||||||
showAllGroups();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return this.groups;
|
return this.groups;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -384,7 +373,7 @@ public class GroupsDialog extends BaseDialogBean
|
|||||||
*/
|
*/
|
||||||
public String getGroupsSearchCriteria()
|
public String getGroupsSearchCriteria()
|
||||||
{
|
{
|
||||||
return groupsSearchCriteria;
|
return this.groupsSearchCriteria;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -394,7 +383,10 @@ public class GroupsDialog extends BaseDialogBean
|
|||||||
*/
|
*/
|
||||||
public String searchGroups()
|
public String searchGroups()
|
||||||
{
|
{
|
||||||
searchGroups(false);
|
// clear group context as search is global
|
||||||
|
this.group = null;
|
||||||
|
this.searchAll = false;
|
||||||
|
displayGroups();
|
||||||
// return null to stay on the same page
|
// return null to stay on the same page
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -406,85 +398,96 @@ public class GroupsDialog extends BaseDialogBean
|
|||||||
*/
|
*/
|
||||||
public String showAllGroups()
|
public String showAllGroups()
|
||||||
{
|
{
|
||||||
searchGroups(true);
|
// clear group context as search is global
|
||||||
|
this.group = null;
|
||||||
|
this.searchAll = true;
|
||||||
|
displayGroups();
|
||||||
// return null to stay on the same page
|
// return null to stay on the same page
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Searches groups
|
* Searches for groups or lists groups of the current group context
|
||||||
*
|
|
||||||
* @param all if true searches all groups and doesn't take account of search term
|
|
||||||
*/
|
*/
|
||||||
private void searchGroups(boolean all)
|
private void displayGroups()
|
||||||
{
|
{
|
||||||
groupsRichList.setValue(null);
|
// empty the list before we begin the search for a new list
|
||||||
String search = null;
|
this.groupsRichList.setValue(null);
|
||||||
|
|
||||||
// Use the search criteria if we are not searching for everything
|
List<String> authorities;
|
||||||
if (!all)
|
if (this.group == null)
|
||||||
{
|
{
|
||||||
if (this.groupsSearchCriteria == null)
|
// Use the search criteria if we are not searching for everything
|
||||||
|
String search = null;
|
||||||
|
if (!this.searchAll)
|
||||||
{
|
{
|
||||||
search = null;
|
if (this.groupsSearchCriteria == null)
|
||||||
}
|
{
|
||||||
else
|
|
||||||
{
|
|
||||||
search = groupsSearchCriteria.trim();
|
|
||||||
if (search.length() == 0)
|
|
||||||
{
|
|
||||||
search = null;
|
search = null;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Let's make it search on the short name/display name prefix
|
search = groupsSearchCriteria.trim();
|
||||||
search = search + "*";
|
if (search.length() == 0)
|
||||||
|
{
|
||||||
|
search = null;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Let's make it search on the short name/display name prefix
|
||||||
|
search = search + "*";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (!all && search == null)
|
|
||||||
{
|
|
||||||
// Do not allow empty searches
|
|
||||||
this.groups = Collections.<Map<String,String>> emptyList();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
List<String> authorities;
|
|
||||||
|
|
||||||
if (search != null && search.startsWith("*"))
|
if (!this.searchAll && search == null)
|
||||||
{
|
{
|
||||||
// if the search term starts with a wildcard use Lucene based search to find groups (results will be inconsistent)
|
// Do not allow empty searches
|
||||||
boolean immediate = (this.filterMode.equals(FILTER_CHILDREN));
|
this.groups = Collections.<Map<String,String>> emptyList();
|
||||||
Set<String> results = this.authService.findAuthorities(AuthorityType.GROUP, this.group, immediate, search, AuthorityService.ZONE_APP_DEFAULT);
|
return;
|
||||||
authorities = new ArrayList<String>(results);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// all other searches use the canned query so search results are consistent
|
if (search != null && search.startsWith("*"))
|
||||||
PagingResults<String> pagedResults = this.authService.getAuthorities(AuthorityType.GROUP,
|
|
||||||
AuthorityService.ZONE_APP_DEFAULT, search, true, true, new PagingRequest(10000));
|
|
||||||
authorities = pagedResults.getPage();
|
|
||||||
}
|
|
||||||
|
|
||||||
groups = new ArrayList<Map<String,String>>(authorities.size());
|
|
||||||
for (String authority : authorities)
|
|
||||||
{
|
|
||||||
Map<String, String> authMap = new HashMap<String, String>(11);
|
|
||||||
|
|
||||||
String name = this.authService.getAuthorityDisplayName(authority);
|
|
||||||
if (name == null)
|
|
||||||
{
|
{
|
||||||
name = this.authService.getShortName(name);
|
// if the search term starts with a wildcard use Lucene based search to find groups (results will be inconsistent)
|
||||||
|
boolean immediate = (this.filterMode.equals(FILTER_CHILDREN));
|
||||||
|
Set<String> results = this.authService.findAuthorities(AuthorityType.GROUP, this.group, immediate, search, AuthorityService.ZONE_APP_DEFAULT);
|
||||||
|
authorities = new ArrayList<String>(results);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// all other searches use the canned query so search results are consistent
|
||||||
|
PagingResults<String> pagedResults = this.authService.getAuthorities(AuthorityType.GROUP,
|
||||||
|
AuthorityService.ZONE_APP_DEFAULT, search, true, true, new PagingRequest(10000));
|
||||||
|
authorities = pagedResults.getPage();
|
||||||
}
|
}
|
||||||
authMap.put("name", name);
|
|
||||||
authMap.put("id", authority);
|
|
||||||
authMap.put("group", authority);
|
|
||||||
authMap.put("groupName", name);
|
|
||||||
|
|
||||||
groups.add(authMap);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// child groups of the current group
|
||||||
|
Set<String> results = this.getAuthorityService().getContainedAuthorities(AuthorityType.GROUP, this.group, true);
|
||||||
|
authorities = new ArrayList<String>(results);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.groups = new ArrayList<Map<String,String>>(authorities.size());
|
||||||
|
for (String authority : authorities)
|
||||||
|
{
|
||||||
|
Map<String, String> authMap = new HashMap<String, String>(8);
|
||||||
|
|
||||||
|
String name = this.authService.getAuthorityDisplayName(authority);
|
||||||
|
if (name == null)
|
||||||
|
{
|
||||||
|
name = this.authService.getShortName(name);
|
||||||
|
}
|
||||||
|
authMap.put("name", name);
|
||||||
|
authMap.put("id", authority);
|
||||||
|
authMap.put("group", authority);
|
||||||
|
authMap.put("groupName", name);
|
||||||
|
|
||||||
|
this.groups.add(authMap);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -557,6 +560,9 @@ public class GroupsDialog extends BaseDialogBean
|
|||||||
this.group = group;
|
this.group = group;
|
||||||
this.groupName = groupName;
|
this.groupName = groupName;
|
||||||
|
|
||||||
|
// reset search context
|
||||||
|
this.searchAll = false;
|
||||||
|
|
||||||
// inform that the UI needs updating after this change
|
// inform that the UI needs updating after this change
|
||||||
contextUpdated();
|
contextUpdated();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user