improve manager sort api

This commit is contained in:
Sebastian Sdorra
2011-06-09 22:10:30 +02:00
parent cef6d27c99
commit 1edd0e8768
4 changed files with 77 additions and 5 deletions

View File

@@ -69,6 +69,7 @@ import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.LinkedList;
@@ -395,16 +396,35 @@ public class XmlUserManager extends AbstractUserManager
*/
@Override
public Collection<User> getAll()
{
return getAll(null);
}
/**
* Method description
*
*
* @param comparator
*
* @return
*/
@Override
public Collection<User> getAll(Comparator<User> comparator)
{
SecurityUtil.assertIsAdmin(scurityContextProvider);
LinkedList<User> users = new LinkedList<User>();
List<User> users = new ArrayList<User>();
for (User user : userDB.values())
{
users.add(user.clone());
}
if (comparator != null)
{
Collections.sort(users, comparator);
}
return users;
}