mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-1948: fixed pagesize to support -1 (unlimited) value
This commit is contained in:
parent
0392b571f9
commit
9b521be4d0
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
// ///////////////////////////////////////////////////
|
||||
|
|
|
|||
Loading…
Reference in New Issue