mirror of
				https://github.com/apache/cloudstack.git
				synced 2025-10-26 08:42:29 +01:00 
			
		
		
		
	Fixed list* api commands.
This commit is contained in:
		
							parent
							
								
									d4bc7c8d2e
								
							
						
					
					
						commit
						af4459f24f
					
				| @ -27,7 +27,6 @@ import com.cloud.api.ApiConstants; | ||||
| import com.cloud.api.BaseListCmd; | ||||
| import com.cloud.api.Implementation; | ||||
| import com.cloud.api.Parameter; | ||||
| import com.cloud.api.BaseCmd.CommandType; | ||||
| import com.cloud.api.response.HostResponse; | ||||
| import com.cloud.api.response.ListResponse; | ||||
| import com.cloud.async.AsyncJob; | ||||
|  | ||||
| @ -39,7 +39,6 @@ public class ListHypervisorsCmd extends BaseCmd { | ||||
| 		return s_name; | ||||
| 	} | ||||
| 
 | ||||
| 
 | ||||
|     ///////////////////////////////////////////////////// | ||||
|     //////////////// API parameters ///////////////////// | ||||
|     ///////////////////////////////////////////////////// | ||||
|  | ||||
| @ -6,7 +6,6 @@ import com.cloud.api.ResponseObject; | ||||
| 
 | ||||
| public class ListResponse<T extends ResponseObject> extends BaseResponse { | ||||
|     List<T> responses; | ||||
|     Integer count; | ||||
| 
 | ||||
|     public List<T> getResponses() { | ||||
|         return responses; | ||||
| @ -17,10 +16,11 @@ public class ListResponse<T extends ResponseObject> extends BaseResponse { | ||||
|     } | ||||
| 
 | ||||
|     public Integer getCount() { | ||||
|         return count; | ||||
|         if (responses != null) { | ||||
|             return responses.size(); | ||||
|         } else { | ||||
|             return null; | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     public void setCount(Integer count) { | ||||
|         this.count = count; | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -445,10 +445,6 @@ public class ApiServer implements HttpRequestHandler { | ||||
|         if (responses != null && responses.size() > defaultPageLimit && command.getPage() == null && command.getPageSize() == null) { | ||||
|             throw new ServerApiException(BaseCmd.PAGE_LIMIT_EXCEED, "Number of returned objects per page exceed default page limit " + defaultPageLimit + "; please specify \"page\"/\"pagesize\" parameters"); | ||||
|         } | ||||
|          | ||||
|         if (responses.size() > 0) { | ||||
|             ((ListResponse<ResponseObject>)command.getResponseObject()).setCount(responses.size());    | ||||
|         } | ||||
|     } | ||||
|      | ||||
|     private void buildAsyncListResponse(BaseListCmd command, Account account) { | ||||
|  | ||||
| @ -93,12 +93,10 @@ public class ApiResponseSerializer { | ||||
|         sb.append("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>"); | ||||
|         sb.append("<" + result.getResponseName() + " cloud-stack-version=\""+ApiDBUtils.getVersion()+ "\">"); | ||||
| 
 | ||||
|         if (result instanceof ListResponse) { | ||||
|             if (((ListResponse)result).getCount() != null) { | ||||
|                 sb.append("<" + ApiConstants.COUNT + ">" + ((ListResponse)result).getCount() + "</" + ApiConstants.COUNT + ">"); | ||||
| 
 | ||||
|             } | ||||
| 
 | ||||
|         if (result instanceof ListResponse) { | ||||
|             List<? extends ResponseObject> responses = ((ListResponse)result).getResponses(); | ||||
|             if ((responses != null) && !responses.isEmpty()) { | ||||
|                 for (ResponseObject obj : responses) { | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user