// Copyright 2012 Citrix Systems, Inc. Licensed under the // Apache License, Version 2.0 (the "License"); you may not use this // file except in compliance with the License. Citrix Systems, Inc. // reserves all rights not expressly granted by the License. // You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // // Automatically generated by addcopyright.py at 04/03/2012 package com.cloud.api.commands; import java.util.ArrayList; import java.util.Date; import java.util.List; import com.cloud.api.ApiConstants; import com.cloud.api.BaseListAccountResourcesCmd; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.response.AsyncJobResponse; import com.cloud.api.response.ListResponse; import com.cloud.async.AsyncJob; @Implementation(description="Lists all pending asynchronous jobs for the account.", responseObject=AsyncJobResponse.class) public class ListAsyncJobsCmd extends BaseListAccountResourcesCmd { private static final String s_name = "listasyncjobsresponse"; ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// @Parameter(name=ApiConstants.START_DATE, type=CommandType.TZDATE, description="the start date of the async job") private Date startDate; ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// public Date getStartDate() { return startDate; } ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// @Override public String getCommandName() { return s_name; } @Override public void execute(){ List<? extends AsyncJob> result = _mgr.searchForAsyncJobs(this); ListResponse<AsyncJobResponse> response = new ListResponse<AsyncJobResponse>(); List<AsyncJobResponse> jobResponses = new ArrayList<AsyncJobResponse>(); for (AsyncJob job : result) { jobResponses.add(_responseGenerator.createAsyncJobResponse(job)); } response.setResponses(jobResponses); response.setResponseName(getCommandName()); this.setResponseObject(response); } }