use of com.cloud.api.response.ListResponse in project cosmic by MissionCriticalCloud.
the class QueryManagerImpl method listIsos.
@Override
public ListResponse<TemplateResponse> listIsos(final ListIsosCmd cmd) {
final Pair<List<TemplateJoinVO>, Integer> result = searchForIsosInternal(cmd);
final ListResponse<TemplateResponse> response = new ListResponse<>();
ResponseView respView = ResponseView.Restricted;
if (cmd instanceof ListIsosCmdByAdmin) {
respView = ResponseView.Full;
}
final List<TemplateResponse> templateResponses = ViewResponseHelper.createIsoResponse(respView, result.first().toArray(new TemplateJoinVO[result.first().size()]));
response.setResponses(templateResponses, result.second());
return response;
}
use of com.cloud.api.response.ListResponse in project cosmic by MissionCriticalCloud.
the class QueryManagerImpl method searchForUserVMs.
@Override
public ListResponse<UserVmResponse> searchForUserVMs(final ListVMsCmd cmd) {
final Pair<List<UserVmJoinVO>, Integer> result = searchForUserVMsInternal(cmd);
final ListResponse<UserVmResponse> response = new ListResponse<>();
ResponseView respView = ResponseView.Restricted;
if (cmd instanceof ListVMsCmdByAdmin) {
respView = ResponseView.Full;
}
final List<UserVmResponse> vmResponses = ViewResponseHelper.createUserVmResponse(respView, "virtualmachine", cmd.getDetails(), result.first().toArray(new UserVmJoinVO[result.first().size()]));
response.setResponses(vmResponses, result.second());
return response;
}
use of com.cloud.api.response.ListResponse in project cosmic by MissionCriticalCloud.
the class QueryManagerImpl method listTemplates.
@Override
public ListResponse<TemplateResponse> listTemplates(final ListTemplatesCmd cmd) {
final Pair<List<TemplateJoinVO>, Integer> result = searchForTemplatesInternal(cmd);
final ListResponse<TemplateResponse> response = new ListResponse<>();
ResponseView respView = ResponseView.Restricted;
if (cmd instanceof ListTemplatesCmdByAdmin) {
respView = ResponseView.Full;
}
final List<TemplateResponse> templateResponses = ViewResponseHelper.createTemplateResponse(respView, result.first().toArray(new TemplateJoinVO[result.first().size()]));
response.setResponses(templateResponses, result.second());
return response;
}
use of com.cloud.api.response.ListResponse in project cosmic by MissionCriticalCloud.
the class QueryManagerImpl method searchForVolumes.
@Override
public ListResponse<VolumeResponse> searchForVolumes(final ListVolumesCmd cmd) {
final Pair<List<VolumeJoinVO>, Integer> result = searchForVolumesInternal(cmd);
final ListResponse<VolumeResponse> response = new ListResponse<>();
ResponseView respView = ResponseView.Restricted;
if (cmd instanceof ListVolumesCmdByAdmin) {
respView = ResponseView.Full;
}
final List<VolumeResponse> volumeResponses = ViewResponseHelper.createVolumeResponse(respView, result.first().toArray(new VolumeJoinVO[result.first().size()]));
for (final VolumeResponse vr : volumeResponses) {
final String poolId = vr.getStoragePoolId();
if (poolId == null) {
continue;
}
final DataStore store = dataStoreManager.getPrimaryDataStore(poolId);
if (store == null) {
continue;
}
final DataStoreDriver driver = store.getDriver();
if (driver == null) {
continue;
}
final Map<String, String> caps = driver.getCapabilities();
if (caps != null) {
final boolean quiescevm = Boolean.parseBoolean(caps.get(DataStoreCapabilities.VOLUME_SNAPSHOT_QUIESCEVM.toString()));
vr.setNeedQuiescevm(quiescevm);
}
}
response.setResponses(volumeResponses, result.second());
return response;
}
use of com.cloud.api.response.ListResponse in project CloudStack-archive by CloudStack-extras.
the class ListProjectsCmd method execute.
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@Override
public void execute() {
List<? extends Project> projects = _projectService.listProjects(id, name, displayText, state, this.getAccountName(), this.getDomainId(), this.getKeyword(), this.getStartIndex(), this.getPageSizeVal(), this.listAll(), this.isRecursive());
ListResponse<ProjectResponse> response = new ListResponse<ProjectResponse>();
List<ProjectResponse> projectResponses = new ArrayList<ProjectResponse>();
for (Project project : projects) {
ProjectResponse projectResponse = _responseGenerator.createProjectResponse(project);
projectResponses.add(projectResponse);
}
response.setResponses(projectResponses);
response.setResponseName(getCommandName());
this.setResponseObject(response);
}
Aggregations