留言板
RE: Retrieve full user list
Hi, just wondering if there's any better solution to access the list of registered users than this:
or is this the standard way?
List<user> users = UserLocalServiceUtil.getUsers(0, Integer.MAX_VALUE);</user>
or is this the standard way?
Hi,
Looking at the search method of the Directory portlet (com.liferay.portlet.directory.util.DirectoryOpenSearchImpl) which looks for users as well, it seems to me that paged results are preferred for search functions. Which is reasonable, since otherwise these functions could return a quite large number of entities.
If you intend to get all users in one go, you might consider using UserLocalServiceUtil.getUsersCount() instead of Integer.MAX_VALUE.
Looking at the search method of the Directory portlet (com.liferay.portlet.directory.util.DirectoryOpenSearchImpl) which looks for users as well, it seems to me that paged results are preferred for search functions. Which is reasonable, since otherwise these functions could return a quite large number of entities.
If you intend to get all users in one go, you might consider using UserLocalServiceUtil.getUsersCount() instead of Integer.MAX_VALUE.