Updated Branches: refs/heads/4.2 60d5d7a99 -> bd0cfd9c0
CLOUDSTACK-1948: fixed pagesize to support -1 (unlimited) value Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/bd0cfd9c Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/bd0cfd9c Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/bd0cfd9c Branch: refs/heads/4.2 Commit: bd0cfd9c0614bd7ff837bf1d0872db6935c541d6 Parents: 60d5d7a Author: Alena Prokharchyk <[email protected]> Authored: Mon Jul 15 11:32:18 2013 -0700 Committer: Alena Prokharchyk <[email protected]> Committed: Mon Jul 15 11:51:59 2013 -0700 ---------------------------------------------------------------------- api/src/org/apache/cloudstack/api/BaseListCmd.java | 12 ++++++------ .../api/command/admin/config/ListCfgsByCmd.java | 14 +++++++++----- 2 files changed, 15 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bd0cfd9c/api/src/org/apache/cloudstack/api/BaseListCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/BaseListCmd.java b/api/src/org/apache/cloudstack/api/BaseListCmd.java index bc0b2b8..4915dba 100644 --- a/api/src/org/apache/cloudstack/api/BaseListCmd.java +++ b/api/src/org/apache/cloudstack/api/BaseListCmd.java @@ -54,7 +54,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()); } @@ -85,12 +85,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; } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bd0cfd9c/api/src/org/apache/cloudstack/api/command/admin/config/ListCfgsByCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/admin/config/ListCfgsByCmd.java b/api/src/org/apache/cloudstack/api/command/admin/config/ListCfgsByCmd.java index a11904e..dce87c3 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/config/ListCfgsByCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/config/ListCfgsByCmd.java @@ -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; } // ///////////////////////////////////////////////////
