Idp Pagination required fixes
@@ -1034,11 +1034,6 @@ public class IdentityProviderManager implements IdpManager {
throws IdentityProviderManagementServerException, IdentityProviderManagementClientException {
validateSearchArguments(limit, offset);
- if (limit < 0) {
- String message = "Given limit: " + limit + " is a negative value.";
- throw IdPManagementUtil.handleClientException(IdPManagementConstants.ErrorMessage.ERROR_CODE_RETRIEVE_IDP,
- message);
- }
IdpSearchResult result = new IdpSearchResult();
List<ExpressionNode> expressionNodes = getExpressionNodes(filter);
setParameters(limit, offset, sortOrder, sortBy, filter, result);
@@ -1056,7 +1051,8 @@ public class IdentityProviderManager implements IdpManager {
* @param offset offset value.
* @throws IdentityProviderManagementClientException Error while limit and offset getting null.
*/
- private void validateSearchArguments(Integer limit, Integer offset) throws IdentityProviderManagementClientException {
+ private void validateSearchArguments(Integer limit, Integer offset)
+ throws IdentityProviderManagementClientException {
if (limit == null) {
String message = "Limit should not null";
@@ -1064,6 +1060,11 @@ public class IdentityProviderManager implements IdpManager {
message);
}
+ if (limit < 0) {
+ String message = "Given limit: " + limit + " is a negative value.";
+ throw IdPManagementUtil.handleClientException(IdPManagementConstants.ErrorMessage.ERROR_CODE_RETRIEVE_IDP,
+ message);
+ }
if (offset == null) {
String message = "Offset should not null";
throw IdPManagementUtil.handleClientException(IdPManagementConstants.ErrorMessage.ERROR_CODE_RETRIEVE_IDP,
@@ -1160,7 +1161,7 @@ public class IdentityProviderManager implements IdpManager {
IdPManagementConstants.DEFAULT_SORT_BY);
}
return IdPManagementConstants.DEFAULT_SORT_BY;
- } else {
+ }
switch (sortBy) {
case IdPManagementConstants.IDP_NAME:
sortBy = IdPManagementConstants.NAME;
@@ -1178,7 +1179,6 @@ public class IdentityProviderManager implements IdpManager {
}
return sortBy;
}
- }
/**
* Validate sortOrder.
@@ -1227,7 +1227,7 @@ public class IdentityProviderManager implements IdpManager {
if (StringUtils.isNotBlank(itemsPerPagePropertyValue)) {
limit = Integer.parseInt(itemsPerPagePropertyValue);
} else {
- limit = IdPManagementConstants.MAXIMUM_LIMIT_PER_PAGE;
+ limit = IdPManagementConstants.DEFAULT_RESULTS_PER_PAGE;
if (log.isDebugEnabled()) {
log.debug("limit is incorrect. Therefore we set the default limit. limit:" + limit);
}
