maxResults

This commit is contained in:
Bill Burke 2014-07-31 17:41:38 -04:00
parent 9f6c206078
commit 64589bc807
4 changed files with 5 additions and 4 deletions

View file

@ -151,7 +151,7 @@ public class LDAPFederationProvider implements UserFederationProvider {
}
@Override
public List<UserModel> searchByAttributes(Map<String, String> attributes, RealmModel realm) {
public List<UserModel> searchByAttributes(Map<String, String> attributes, RealmModel realm, int maxResults) {
IdentityManager identityManager = getIdentityManager();
List<UserModel> searchResults =new LinkedList<UserModel>();
try {
@ -170,6 +170,7 @@ public class LDAPFederationProvider implements UserFederationProvider {
if (attributes.containsKey(LAST_NAME)) {
query.setParameter(User.LAST_NAME, attributes.get(LAST_NAME));
}
query.setLimit(maxResults);
List<User> agents = query.getResultList();
for (User user : agents) {
results.put(user.getLoginName(), user);

View file

@ -225,7 +225,7 @@ public class UserFederationManager implements UserProvider {
void federationLoad(RealmModel realm, Map<String, String> attributes) {
for (UserFederationProviderModel federation : realm.getUserFederationProviders()) {
UserFederationProvider fed = getFederationProvider(federation);
fed.searchByAttributes(attributes, realm);
fed.searchByAttributes(attributes, realm, 30);
}
}

View file

@ -89,7 +89,7 @@ public interface UserFederationProvider extends Provider {
* @param realm
* @return
*/
List<UserModel> searchByAttributes(Map<String, String> attributes, RealmModel realm);
List<UserModel> searchByAttributes(Map<String, String> attributes, RealmModel realm, int maxResults);
void preRemove(RealmModel realm);
void preRemove(RealmModel realm, RoleModel role);

View file

@ -47,7 +47,7 @@ public class DummyUserFederationProvider implements UserFederationProvider {
}
@Override
public List<UserModel> searchByAttributes(Map<String, String> attributes, RealmModel realm) {
public List<UserModel> searchByAttributes(Map<String, String> attributes, RealmModel realm, int maxResults) {
return Collections.emptyList();
}