bug 9782: hardcoded default page size to be 500 for listConfigurations

status 9782: resolved fixed
This commit is contained in:
alena 2011-05-09 09:31:04 -07:00
parent a6fac0d768
commit 753cafa472

View File

@ -31,26 +31,25 @@ import com.cloud.api.response.ConfigurationResponse;
import com.cloud.api.response.ListResponse; import com.cloud.api.response.ListResponse;
import com.cloud.configuration.Configuration; 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 class ListCfgsByCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(ListCfgsByCmd.class.getName()); public static final Logger s_logger = Logger.getLogger(ListCfgsByCmd.class.getName());
private static final String s_name = "listconfigurationsresponse"; 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; 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; private String configName;
// ///////////////////////////////////////////////////
///////////////////////////////////////////////////// // ///////////////// Accessors ///////////////////////
/////////////////// Accessors /////////////////////// // ///////////////////////////////////////////////////
/////////////////////////////////////////////////////
public String getCategory() { public String getCategory() {
return category; return category;
@ -60,18 +59,27 @@ public class ListCfgsByCmd extends BaseListCmd {
return configName; 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 @Override
public String getCommandName() { public String getCommandName() {
return s_name; return s_name;
} }
@Override @Override
public void execute(){ public void execute() {
List<? extends Configuration> result = _mgr.searchForConfigurations(this); List<? extends Configuration> result = _mgr.searchForConfigurations(this);
ListResponse<ConfigurationResponse> response = new ListResponse<ConfigurationResponse>(); ListResponse<ConfigurationResponse> response = new ListResponse<ConfigurationResponse>();
List<ConfigurationResponse> configResponses = new ArrayList<ConfigurationResponse>(); List<ConfigurationResponse> configResponses = new ArrayList<ConfigurationResponse>();