From 753cafa4726506ffcaa40deb504009cc29d8c473 Mon Sep 17 00:00:00 2001 From: alena Date: Mon, 9 May 2011 09:31:04 -0700 Subject: [PATCH] bug 9782: hardcoded default page size to be 500 for listConfigurations status 9782: resolved fixed --- .../com/cloud/api/commands/ListCfgsByCmd.java | 38 +++++++++++-------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/api/src/com/cloud/api/commands/ListCfgsByCmd.java b/api/src/com/cloud/api/commands/ListCfgsByCmd.java index 5b143f3ca1b..26725aed5f3 100644 --- a/api/src/com/cloud/api/commands/ListCfgsByCmd.java +++ b/api/src/com/cloud/api/commands/ListCfgsByCmd.java @@ -31,26 +31,25 @@ import com.cloud.api.response.ConfigurationResponse; import com.cloud.api.response.ListResponse; import com.cloud.configuration.Configuration; -@Implementation(description="Lists all configurations.", responseObject=ConfigurationResponse.class) +@Implementation(description = "Lists all configurations.", responseObject = ConfigurationResponse.class) public class ListCfgsByCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListCfgsByCmd.class.getName()); private static final String s_name = "listconfigurationsresponse"; - ///////////////////////////////////////////////////// - //////////////// API parameters ///////////////////// - ///////////////////////////////////////////////////// + // /////////////////////////////////////////////////// + // ////////////// API parameters ///////////////////// + // /////////////////////////////////////////////////// - @Parameter(name=ApiConstants.CATEGORY, type=CommandType.STRING, description="lists configurations by category") + @Parameter(name = ApiConstants.CATEGORY, type = CommandType.STRING, description = "lists configurations by category") private String category; - @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="lists configuration by name") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "lists configuration by name") private String configName; - - ///////////////////////////////////////////////////// - /////////////////// Accessors /////////////////////// - ///////////////////////////////////////////////////// + // /////////////////////////////////////////////////// + // ///////////////// Accessors /////////////////////// + // /////////////////////////////////////////////////// public String getCategory() { return category; @@ -60,18 +59,27 @@ public class ListCfgsByCmd extends BaseListCmd { return configName; } + @Override + public Long getPageSizeVal() { + Long pageSizeVal = 500L; + Integer pageSize = getPageSize(); + if (pageSize != null) { + pageSizeVal = pageSize.longValue(); + } + return pageSizeVal; + } - ///////////////////////////////////////////////////// - /////////////// API Implementation/////////////////// - ///////////////////////////////////////////////////// + // /////////////////////////////////////////////////// + // ///////////// API Implementation/////////////////// + // /////////////////////////////////////////////////// @Override public String getCommandName() { return s_name; } - + @Override - public void execute(){ + public void execute() { List result = _mgr.searchForConfigurations(this); ListResponse response = new ListResponse(); List configResponses = new ArrayList();