mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged V2.2 to HEAD
7531: Merged V2.1 to V2.2 7397: Fix and improvments to all web-client People pickers - all now search on Username and build Lucene queries rather than XPath. Fixes AWC-853, AWC-935, AWC-1180, AWC-1660 Merge conflicts resolved around query strings and client session cluster changes 7532: Added action to go back to last deployment report in history panel 7533: Moved deploy actions to resources panel header in review task dialog git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@8400 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -37,10 +37,12 @@ import javax.faces.model.SelectItem;
|
||||
import javax.transaction.UserTransaction;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.search.impl.lucene.QueryParser;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.search.ResultSet;
|
||||
import org.alfresco.service.cmr.search.SearchService;
|
||||
import org.alfresco.service.cmr.security.AuthorityService;
|
||||
import org.alfresco.service.cmr.security.PermissionService;
|
||||
import org.alfresco.service.cmr.security.PersonService;
|
||||
@@ -202,15 +204,21 @@ public class AddUsersDialog extends BaseDialogBean
|
||||
{
|
||||
SelectItem[] items;
|
||||
|
||||
// build xpath to match available User/Person objects
|
||||
ServiceRegistry services = Repository.getServiceRegistry(context);
|
||||
NodeRef peopleRef = getPersonService().getPeopleContainer();
|
||||
String xpath = "*[like(@" + NamespaceService.CONTENT_MODEL_PREFIX + ":" + "firstName, '%" + contains +
|
||||
"%', false)" + " or " + "like(@" + NamespaceService.CONTENT_MODEL_PREFIX + ":" +
|
||||
"lastName, '%" + contains + "%', false)]";
|
||||
|
||||
List<NodeRef> nodes = services.getSearchService().selectNodes(peopleRef, xpath, null,
|
||||
services.getNamespaceService(), false);
|
||||
// Use lucene search to retrieve user details
|
||||
String term = QueryParser.escape(contains.trim());
|
||||
StringBuilder query = new StringBuilder(128);
|
||||
query.append("@").append(NamespaceService.CONTENT_MODEL_PREFIX).append("\\:firstName:*");
|
||||
query.append(term);
|
||||
query.append("* @").append(NamespaceService.CONTENT_MODEL_PREFIX).append("\\:lastName:*");
|
||||
query.append(term);
|
||||
query.append("* @").append(NamespaceService.CONTENT_MODEL_PREFIX).append("\\:userName:");
|
||||
query.append(term);
|
||||
query.append("*");
|
||||
ResultSet resultSet = Repository.getServiceRegistry(context).getSearchService().query(
|
||||
Repository.getStoreRef(),
|
||||
SearchService.LANGUAGE_LUCENE,
|
||||
query.toString());
|
||||
List<NodeRef> nodes = resultSet.getNodeRefs();
|
||||
|
||||
ArrayList<SelectItem> itemList = new ArrayList<SelectItem>(nodes.size());
|
||||
for (NodeRef personRef : nodes)
|
||||
@@ -221,7 +229,7 @@ public class AddUsersDialog extends BaseDialogBean
|
||||
String firstName = (String)getNodeService().getProperty(personRef, ContentModel.PROP_FIRSTNAME);
|
||||
String lastName = (String)getNodeService().getProperty(personRef, ContentModel.PROP_LASTNAME);
|
||||
|
||||
SelectItem item = new SortableSelectItem(username, firstName + " " + lastName, lastName);
|
||||
SelectItem item = new SortableSelectItem(username, firstName + " " + lastName + " [" + username + "]", lastName);
|
||||
itemList.add(item);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user