mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
ALF-8805 (RINF 40) - PersonService getPeople
- return PagingResults<PersonInfo> (follow CQ results pattern) git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@28627 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
* Copyright (C) 2005-2011 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
@@ -37,8 +37,8 @@ import org.alfresco.repo.transaction.RetryingTransactionHelper;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.security.AuthorityService;
|
||||
import org.alfresco.service.cmr.security.PagingPersonResults;
|
||||
import org.alfresco.service.cmr.security.PersonService;
|
||||
import org.alfresco.service.cmr.security.PersonService.PersonInfo;
|
||||
import org.alfresco.web.app.Application;
|
||||
import org.alfresco.web.bean.dialog.BaseDialogBean;
|
||||
import org.alfresco.web.bean.groups.GroupsDialog.UserAuthorityDetails;
|
||||
@@ -206,22 +206,21 @@ public class AddUsersDialog extends BaseDialogBean
|
||||
String term = contains.trim();
|
||||
if (term.length() != 0)
|
||||
{
|
||||
PagingPersonResults people = getPersonService().getPeople(
|
||||
List<PersonInfo> persons = getPersonService().getPeople(
|
||||
Utils.generatePersonFilter(contains.trim()),
|
||||
true,
|
||||
Utils.generatePersonSort(),
|
||||
new PagingRequest(Utils.getPersonMaxResults(), null)
|
||||
);
|
||||
List<NodeRef> nodes = people.getPage();
|
||||
).getPage();
|
||||
|
||||
ArrayList<SelectItem> itemList = new ArrayList<SelectItem>(nodes.size());
|
||||
for (NodeRef personRef : nodes)
|
||||
ArrayList<SelectItem> itemList = new ArrayList<SelectItem>(persons.size());
|
||||
for (PersonInfo person : persons)
|
||||
{
|
||||
String username = (String)getNodeService().getProperty(personRef, ContentModel.PROP_USERNAME);
|
||||
String username = person.getUserName();
|
||||
if (AuthenticationUtil.getGuestUserName().equals(username) == false)
|
||||
{
|
||||
String firstName = (String)getNodeService().getProperty(personRef, ContentModel.PROP_FIRSTNAME);
|
||||
String lastName = (String)getNodeService().getProperty(personRef, ContentModel.PROP_LASTNAME);
|
||||
String firstName = person.getFirstName();
|
||||
String lastName = person.getLastName();
|
||||
|
||||
// build a sensible label for display
|
||||
String name = (firstName != null ? firstName : "") + ' ' + (lastName != null ? lastName : "");
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
* Copyright (C) 2005-2011 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
@@ -33,8 +33,8 @@ import org.alfresco.query.PagingRequest;
|
||||
import org.alfresco.service.cmr.repository.InvalidNodeRefException;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.security.AuthenticationService;
|
||||
import org.alfresco.service.cmr.security.PagingPersonResults;
|
||||
import org.alfresco.service.cmr.security.PersonService;
|
||||
import org.alfresco.service.cmr.security.PersonService.PersonInfo;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.util.ISO9075;
|
||||
import org.alfresco.util.Pair;
|
||||
@@ -129,26 +129,28 @@ public class DeleteUserDialog extends BaseDialogBean
|
||||
filter.add(new Pair<QName, String>(ContentModel.PROP_LASTNAME, search));
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Query filter: " + filter);
|
||||
}
|
||||
|
||||
// Perform the search
|
||||
PagingPersonResults people = getPersonService().getPeople(
|
||||
List<PersonInfo> persons = getPersonService().getPeople(
|
||||
filter,
|
||||
true,
|
||||
Utils.generatePersonSort(),
|
||||
new PagingRequest(Utils.getPersonMaxResults(), null)
|
||||
);
|
||||
List<NodeRef> nodes = people.getPage();
|
||||
).getPage();
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Found " + nodes.size() + " users");
|
||||
{
|
||||
logger.debug("Found " + persons.size() + " users");
|
||||
}
|
||||
|
||||
this.users = new ArrayList<Node>(nodes.size());
|
||||
this.users = new ArrayList<Node>(persons.size());
|
||||
|
||||
for (NodeRef nodeRef : nodes)
|
||||
for (PersonInfo person : persons)
|
||||
{
|
||||
// create our Node representation
|
||||
MapNode node = new MapNode(nodeRef);
|
||||
MapNode node = new MapNode(person.getNodeRef());
|
||||
|
||||
// set data binding properties
|
||||
// this will also force initialisation of the props now during the UserTransaction
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
* Copyright (C) 2005-2011 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
@@ -33,7 +33,7 @@ import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.query.PagingRequest;
|
||||
import org.alfresco.service.cmr.repository.InvalidNodeRefException;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.security.PagingPersonResults;
|
||||
import org.alfresco.service.cmr.security.PersonService.PersonInfo;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.web.app.Application;
|
||||
import org.alfresco.web.app.context.IContextListener;
|
||||
@@ -296,25 +296,28 @@ public class UsersDialog extends BaseDialogBean implements IContextListener, Cha
|
||||
// define the query to find people by their first or last name
|
||||
String search = properties.getSearchCriteria();
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Query term: " + search);
|
||||
{
|
||||
logger.debug("Query filter: " + search);
|
||||
}
|
||||
|
||||
PagingPersonResults people = properties.getPersonService().getPeople(
|
||||
List<PersonInfo> persons = properties.getPersonService().getPeople(
|
||||
Utils.generatePersonFilter(search),
|
||||
true,
|
||||
Utils.generatePersonSort(),
|
||||
new PagingRequest(Utils.getPersonMaxResults(), null)
|
||||
);
|
||||
List<NodeRef> nodes = people.getPage();
|
||||
).getPage();
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Found " + nodes.size() + " users");
|
||||
{
|
||||
logger.debug("Found " + persons.size() + " users");
|
||||
}
|
||||
|
||||
this.users = new ArrayList<Node>(nodes.size());
|
||||
this.users = new ArrayList<Node>(persons.size());
|
||||
|
||||
for (NodeRef nodeRef : nodes)
|
||||
for (PersonInfo person : persons)
|
||||
{
|
||||
// create our Node representation
|
||||
MapNode node = new MapNode(nodeRef);
|
||||
MapNode node = new MapNode(person.getNodeRef());
|
||||
|
||||
// set data binding properties
|
||||
// this will also force initialisation of the props now during the UserTransaction
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
* Copyright (C) 2005-2011 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
@@ -44,9 +44,9 @@ import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.security.AuthorityService;
|
||||
import org.alfresco.service.cmr.security.AuthorityType;
|
||||
import org.alfresco.service.cmr.security.PagingPersonResults;
|
||||
import org.alfresco.service.cmr.security.PermissionService;
|
||||
import org.alfresco.service.cmr.security.PersonService;
|
||||
import org.alfresco.service.cmr.security.PersonService.PersonInfo;
|
||||
import org.alfresco.web.app.Application;
|
||||
import org.alfresco.web.bean.repository.Repository;
|
||||
import org.alfresco.web.ui.common.SortableSelectItem;
|
||||
@@ -254,21 +254,19 @@ public class SetPermissionsDialog extends UpdatePermissionsDialog
|
||||
|
||||
if (filterIndex == 0)
|
||||
{
|
||||
// Use lucene search to retrieve user details
|
||||
PagingPersonResults people = getPersonService().getPeople(
|
||||
List<PersonInfo> persons = getPersonService().getPeople(
|
||||
Utils.generatePersonFilter(contains.trim()),
|
||||
true,
|
||||
Utils.generatePersonSort(),
|
||||
new PagingRequest(Utils.getPersonMaxResults(), null)
|
||||
);
|
||||
List<NodeRef> nodes = people.getPage();
|
||||
).getPage();
|
||||
|
||||
for (int index = 0; index < nodes.size(); index++)
|
||||
for (int index = 0; index < persons.size(); index++)
|
||||
{
|
||||
NodeRef personRef = nodes.get(index);
|
||||
String firstName = (String) getNodeService().getProperty(personRef, ContentModel.PROP_FIRSTNAME);
|
||||
String lastName = (String) getNodeService().getProperty(personRef, ContentModel.PROP_LASTNAME);
|
||||
String username = (String) getNodeService().getProperty(personRef, ContentModel.PROP_USERNAME);
|
||||
PersonInfo person = persons.get(index);
|
||||
String firstName = person.getFirstName();
|
||||
String lastName = person.getLastName();
|
||||
String username = person.getUserName();
|
||||
if (username != null)
|
||||
{
|
||||
SelectItem item = new SortableSelectItem(username, firstName + " " + lastName + " [" + username + "]", lastName);
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
* Copyright (C) 2005-2011 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
@@ -44,9 +44,9 @@ import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.security.AuthorityService;
|
||||
import org.alfresco.service.cmr.security.AuthorityType;
|
||||
import org.alfresco.service.cmr.security.PagingPersonResults;
|
||||
import org.alfresco.service.cmr.security.PermissionService;
|
||||
import org.alfresco.service.cmr.security.PersonService;
|
||||
import org.alfresco.service.cmr.security.PersonService.PersonInfo;
|
||||
import org.alfresco.service.namespace.NamespaceService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.util.Pair;
|
||||
@@ -460,22 +460,21 @@ public abstract class BaseInviteUsersWizard extends BaseWizardBean
|
||||
logger.debug("Using query filter to find users: " + filter);
|
||||
}
|
||||
|
||||
PagingPersonResults people = getPersonService().getPeople(
|
||||
List<PersonInfo> persons = getPersonService().getPeople(
|
||||
filter,
|
||||
true,
|
||||
Utils.generatePersonSort(),
|
||||
new PagingRequest(maxResults, null)
|
||||
);
|
||||
List<NodeRef> nodes = people.getPage();
|
||||
).getPage();
|
||||
|
||||
results = new ArrayList<SelectItem>(nodes.size());
|
||||
for (int index=0; index<nodes.size(); index++)
|
||||
results = new ArrayList<SelectItem>(persons.size());
|
||||
for (int index=0; index<persons.size(); index++)
|
||||
{
|
||||
NodeRef personRef = nodes.get(index);
|
||||
PersonInfo person = persons.get(index);
|
||||
|
||||
String firstName = (String)this.getNodeService().getProperty(personRef, ContentModel.PROP_FIRSTNAME);
|
||||
String lastName = (String)this.getNodeService().getProperty(personRef, ContentModel.PROP_LASTNAME);
|
||||
String username = (String)this.getNodeService().getProperty(personRef, ContentModel.PROP_USERNAME);
|
||||
String firstName = person.getFirstName();
|
||||
String lastName = person.getLastName();
|
||||
String username = person.getUserName();
|
||||
if (username != null)
|
||||
{
|
||||
String name = (firstName != null ? firstName : "") + ' ' + (lastName != null ? lastName : "");
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
* Copyright (C) 2005-2011 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
@@ -28,13 +28,11 @@ import javax.faces.context.FacesContext;
|
||||
import javax.faces.model.SelectItem;
|
||||
import javax.transaction.UserTransaction;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.query.PagingRequest;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.search.ResultSet;
|
||||
import org.alfresco.service.cmr.security.PagingPersonResults;
|
||||
import org.alfresco.service.cmr.security.PersonService;
|
||||
import org.alfresco.service.cmr.security.PersonService.PersonInfo;
|
||||
import org.alfresco.service.cmr.workflow.WorkflowService;
|
||||
import org.alfresco.web.app.Application;
|
||||
import org.alfresco.web.bean.dialog.BaseDialogBean;
|
||||
@@ -50,7 +48,12 @@ import org.alfresco.web.ui.common.Utils;
|
||||
*/
|
||||
public abstract class BaseReassignDialog extends BaseDialogBean
|
||||
{
|
||||
private static final String MSG_SEARCH_MINIMUM = "picker_search_min";
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 3392941403282035753L;
|
||||
|
||||
private static final String MSG_SEARCH_MINIMUM = "picker_search_min";
|
||||
|
||||
transient private WorkflowService workflowService;
|
||||
transient private PersonService personService;
|
||||
@@ -144,23 +147,21 @@ public abstract class BaseReassignDialog extends BaseDialogBean
|
||||
maxResults = Utils.getPersonMaxResults();
|
||||
}
|
||||
|
||||
// Use lucene search to retrieve user details
|
||||
PagingPersonResults people = getPersonService().getPeople(
|
||||
List<PersonInfo> persons = getPersonService().getPeople(
|
||||
Utils.generatePersonFilter(contains.trim()),
|
||||
true,
|
||||
Utils.generatePersonSort(),
|
||||
new PagingRequest(maxResults, null)
|
||||
);
|
||||
List<NodeRef> nodes = people.getPage();
|
||||
).getPage();
|
||||
|
||||
ArrayList<SelectItem> itemList = new ArrayList<SelectItem>(nodes.size());
|
||||
for (NodeRef personRef : nodes)
|
||||
ArrayList<SelectItem> itemList = new ArrayList<SelectItem>(persons.size());
|
||||
for (PersonInfo person : persons)
|
||||
{
|
||||
String username = (String)getNodeService().getProperty(personRef, ContentModel.PROP_USERNAME);
|
||||
String username = person.getUserName();
|
||||
if (AuthenticationUtil.getGuestUserName().equals(username) == false)
|
||||
{
|
||||
String firstName = (String)this.getNodeService().getProperty(personRef, ContentModel.PROP_FIRSTNAME);
|
||||
String lastName = (String)this.getNodeService().getProperty(personRef, ContentModel.PROP_LASTNAME);
|
||||
String firstName = person.getFirstName();
|
||||
String lastName = person.getLastName();
|
||||
String name = (firstName != null ? firstName : "") + ' ' + (lastName != null ? lastName : "");
|
||||
SelectItem item = new SortableSelectItem(username, name + " [" + username + "]", lastName != null ? lastName : username);
|
||||
itemList.add(item);
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
* Copyright (C) 2005-2011 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
@@ -51,8 +51,8 @@ import org.alfresco.service.cmr.search.SearchParameters;
|
||||
import org.alfresco.service.cmr.search.SearchService;
|
||||
import org.alfresco.service.cmr.security.AuthorityService;
|
||||
import org.alfresco.service.cmr.security.AuthorityType;
|
||||
import org.alfresco.service.cmr.security.PagingPersonResults;
|
||||
import org.alfresco.service.cmr.security.PermissionService;
|
||||
import org.alfresco.service.cmr.security.PersonService.PersonInfo;
|
||||
import org.alfresco.service.namespace.NamespaceService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.util.Pair;
|
||||
@@ -930,7 +930,6 @@ public abstract class BaseAssociationEditor extends UIInput
|
||||
* @param context Faces Context
|
||||
* @param contains The contains part of the query
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
protected void getAvailableOptions(FacesContext context, String contains)
|
||||
{
|
||||
AssociationDefinition assocDef = getAssociationDefinition(context);
|
||||
@@ -1044,16 +1043,19 @@ public abstract class BaseAssociationEditor extends UIInput
|
||||
maxResults = Utils.getPersonMaxResults();
|
||||
}
|
||||
|
||||
// Perform the search
|
||||
PagingPersonResults people = Repository.getServiceRegistry(context).getPersonService().getPeople(
|
||||
List<PersonInfo> persons = Repository.getServiceRegistry(context).getPersonService().getPeople(
|
||||
filter,
|
||||
true,
|
||||
sort,
|
||||
new PagingRequest(maxResults, null)
|
||||
);
|
||||
).getPage();
|
||||
|
||||
// Save the results
|
||||
List<NodeRef> nodes = people.getPage();
|
||||
List<NodeRef> nodes = new ArrayList<NodeRef>(persons.size());
|
||||
for (PersonInfo person : persons)
|
||||
{
|
||||
nodes.add(person.getNodeRef());
|
||||
}
|
||||
this.availableOptions = nodes;
|
||||
}
|
||||
else
|
||||
|
Reference in New Issue
Block a user