CLOUDSTACK-1948: fixed pagesize to support -1 (unlimited) value

This commit is contained in:
Alena Prokharchyk 2013-07-15 11:32:18 -07:00
parent 0392b571f9
commit 9b521be4d0
2 changed files with 15 additions and 11 deletions

View File

@ -53,7 +53,7 @@ public abstract class BaseListCmd extends BaseCmd {
}
public Integer getPageSize() {
if (pageSize != null && MAX_PAGESIZE != null && pageSize.longValue() > MAX_PAGESIZE.longValue()) {
if (pageSize != null && MAX_PAGESIZE.longValue() != PAGESIZE_UNLIMITED && pageSize.longValue() > MAX_PAGESIZE.longValue()) {
throw new InvalidParameterValueException("Page size can't exceed max allowed page size value: " + MAX_PAGESIZE.longValue());
}
@ -84,12 +84,12 @@ public abstract class BaseListCmd extends BaseCmd {
Long defaultPageSize = MAX_PAGESIZE;
Integer pageSizeInt = getPageSize();
if (pageSizeInt != null) {
if (pageSizeInt.longValue() == PAGESIZE_UNLIMITED) {
defaultPageSize = null;
} else {
defaultPageSize = pageSizeInt.longValue();
}
defaultPageSize = pageSizeInt.longValue();
}
if (defaultPageSize.longValue() == PAGESIZE_UNLIMITED) {
defaultPageSize = null;
}
return defaultPageSize;
}

View File

@ -88,12 +88,16 @@ public class ListCfgsByCmd extends BaseListCmd {
@Override
public Long getPageSizeVal() {
Long pageSizeVal = 500L;
Integer pageSize = getPageSize();
if (pageSize != null) {
pageSizeVal = pageSize.longValue();
Long defaultPageSize = 500L;
Integer pageSizeInt = getPageSize();
if (pageSizeInt != null) {
if (pageSizeInt.longValue() == PAGESIZE_UNLIMITED) {
defaultPageSize = null;
} else {
defaultPageSize = pageSizeInt.longValue();
}
}
return pageSizeVal;
return defaultPageSize;
}
// ///////////////////////////////////////////////////