use of com.cloud.api.response.ListResponse in project CloudStack-archive by CloudStack-extras.
the class ListNetworksCmd method execute.
@Override
public void execute() {
List<? extends Network> networks = _networkService.searchForNetworks(this);
ListResponse<NetworkResponse> response = new ListResponse<NetworkResponse>();
List<NetworkResponse> networkResponses = new ArrayList<NetworkResponse>();
for (Network network : networks) {
NetworkResponse networkResponse = _responseGenerator.createNetworkResponse(network);
networkResponses.add(networkResponse);
}
response.setResponses(networkResponses);
response.setResponseName(getCommandName());
this.setResponseObject(response);
}
use of com.cloud.api.response.ListResponse in project CloudStack-archive by CloudStack-extras.
the class ListPhysicalNetworksCmd method execute.
@Override
public void execute() {
List<? extends PhysicalNetwork> result = _networkService.searchPhysicalNetworks(getId(), getZoneId(), this.getKeyword(), this.getStartIndex(), this.getPageSizeVal(), getNetworkName());
if (result != null) {
ListResponse<PhysicalNetworkResponse> response = new ListResponse<PhysicalNetworkResponse>();
List<PhysicalNetworkResponse> networkResponses = new ArrayList<PhysicalNetworkResponse>();
for (PhysicalNetwork network : result) {
PhysicalNetworkResponse networkResponse = _responseGenerator.createPhysicalNetworkResponse(network);
networkResponses.add(networkResponse);
}
response.setResponses(networkResponses);
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to search for physical networks");
}
}
use of com.cloud.api.response.ListResponse in project CloudStack-archive by CloudStack-extras.
the class ListPodsByCmd method execute.
@Override
public void execute() {
List<? extends Pod> result = _mgr.searchForPods(this);
ListResponse<PodResponse> response = new ListResponse<PodResponse>();
List<PodResponse> podResponses = new ArrayList<PodResponse>();
for (Pod pod : result) {
PodResponse podResponse = _responseGenerator.createPodResponse(pod, showCapacities);
podResponse.setObjectName("pod");
podResponses.add(podResponse);
}
response.setResponses(podResponses);
response.setResponseName(getCommandName());
this.setResponseObject(response);
}
use of com.cloud.api.response.ListResponse in project CloudStack-archive by CloudStack-extras.
the class ListProjectInvitationsCmd method execute.
// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////
@Override
public void execute() {
List<? extends ProjectInvitation> invites = _projectService.listProjectInvitations(id, projectId, this.getAccountName(), this.getDomainId(), state, activeOnly, this.getStartIndex(), this.getPageSizeVal(), this.isRecursive(), this.listAll());
ListResponse<ProjectInvitationResponse> response = new ListResponse<ProjectInvitationResponse>();
List<ProjectInvitationResponse> projectInvitationResponses = new ArrayList<ProjectInvitationResponse>();
for (ProjectInvitation invite : invites) {
ProjectInvitationResponse projectResponse = _responseGenerator.createProjectInvitationResponse(invite);
projectInvitationResponses.add(projectResponse);
}
response.setResponses(projectInvitationResponses);
response.setResponseName(getCommandName());
this.setResponseObject(response);
}
use of com.cloud.api.response.ListResponse in project CloudStack-archive by CloudStack-extras.
the class ListAccountsCmd method execute.
@Override
public void execute() {
List<? extends Account> accounts = _accountService.searchForAccounts(this);
ListResponse<AccountResponse> response = new ListResponse<AccountResponse>();
List<AccountResponse> accountResponses = new ArrayList<AccountResponse>();
for (Account account : accounts) {
AccountResponse acctResponse = _responseGenerator.createAccountResponse(account);
acctResponse.setObjectName("account");
accountResponses.add(acctResponse);
}
response.setResponses(accountResponses);
response.setResponseName(getCommandName());
this.setResponseObject(response);
}
Aggregations