Search in sources :

Example 1 with ResponseView

use of com.cloud.api.ResponseObject.ResponseView in project cosmic by MissionCriticalCloud.

the class QueryManagerImpl method searchForDomains.

@Override
public ListResponse<DomainResponse> searchForDomains(final ListDomainsCmd cmd) {
    final Pair<List<DomainJoinVO>, Integer> result = searchForDomainsInternal(cmd);
    final ListResponse<DomainResponse> response = new ListResponse<>();
    ResponseView respView = ResponseView.Restricted;
    if (cmd instanceof ListDomainsCmdByAdmin) {
        respView = ResponseView.Full;
    }
    final List<DomainResponse> domainResponses = ViewResponseHelper.createDomainResponse(respView, result.first().toArray(new DomainJoinVO[result.first().size()]));
    response.setResponses(domainResponses, result.second());
    return response;
}
Also used : ResponseView(com.cloud.api.ResponseObject.ResponseView) ListResponse(com.cloud.api.response.ListResponse) ListDomainsCmdByAdmin(com.cloud.api.command.admin.domain.ListDomainsCmdByAdmin) DomainResponse(com.cloud.api.response.DomainResponse) ArrayList(java.util.ArrayList) List(java.util.List) DomainJoinVO(com.cloud.api.query.vo.DomainJoinVO)

Example 2 with ResponseView

use of com.cloud.api.ResponseObject.ResponseView in project cosmic by MissionCriticalCloud.

the class QueryManagerImpl method listDataCenters.

@Override
public ListResponse<ZoneResponse> listDataCenters(final ListZonesCmd cmd) {
    final Pair<List<DataCenterJoinVO>, Integer> result = listDataCentersInternal(cmd);
    final ListResponse<ZoneResponse> response = new ListResponse<>();
    ResponseView respView = ResponseView.Restricted;
    if (cmd instanceof ListZonesCmdByAdmin) {
        respView = ResponseView.Full;
    }
    final List<ZoneResponse> dcResponses = ViewResponseHelper.createDataCenterResponse(respView, cmd.getShowCapacities(), result.first().toArray(new DataCenterJoinVO[result.first().size()]));
    response.setResponses(dcResponses, result.second());
    return response;
}
Also used : ZoneResponse(com.cloud.api.response.ZoneResponse) DataCenterJoinVO(com.cloud.api.query.vo.DataCenterJoinVO) ResponseView(com.cloud.api.ResponseObject.ResponseView) ListResponse(com.cloud.api.response.ListResponse) ArrayList(java.util.ArrayList) List(java.util.List) ListZonesCmdByAdmin(com.cloud.api.command.admin.zone.ListZonesCmdByAdmin)

Example 3 with ResponseView

use of com.cloud.api.ResponseObject.ResponseView 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;
}
Also used : ResponseView(com.cloud.api.ResponseObject.ResponseView) ListResponse(com.cloud.api.response.ListResponse) TemplateJoinVO(com.cloud.api.query.vo.TemplateJoinVO) ArrayList(java.util.ArrayList) List(java.util.List) TemplateResponse(com.cloud.api.response.TemplateResponse) ListIsosCmdByAdmin(com.cloud.api.command.admin.iso.ListIsosCmdByAdmin)

Example 4 with ResponseView

use of com.cloud.api.ResponseObject.ResponseView 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;
}
Also used : ResponseView(com.cloud.api.ResponseObject.ResponseView) ListResponse(com.cloud.api.response.ListResponse) ListVMsCmdByAdmin(com.cloud.api.command.admin.vm.ListVMsCmdByAdmin) ArrayList(java.util.ArrayList) List(java.util.List) UserVmResponse(com.cloud.api.response.UserVmResponse) UserVmJoinVO(com.cloud.api.query.vo.UserVmJoinVO)

Example 5 with ResponseView

use of com.cloud.api.ResponseObject.ResponseView 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;
}
Also used : ResponseView(com.cloud.api.ResponseObject.ResponseView) ListResponse(com.cloud.api.response.ListResponse) ListTemplatesCmdByAdmin(com.cloud.api.command.admin.template.ListTemplatesCmdByAdmin) TemplateJoinVO(com.cloud.api.query.vo.TemplateJoinVO) ArrayList(java.util.ArrayList) List(java.util.List) TemplateResponse(com.cloud.api.response.TemplateResponse)

Aggregations

ResponseView (com.cloud.api.ResponseObject.ResponseView)7 ListResponse (com.cloud.api.response.ListResponse)7 ArrayList (java.util.ArrayList)7 List (java.util.List)7 TemplateJoinVO (com.cloud.api.query.vo.TemplateJoinVO)2 TemplateResponse (com.cloud.api.response.TemplateResponse)2 ListAccountsCmdByAdmin (com.cloud.api.command.admin.account.ListAccountsCmdByAdmin)1 ListDomainsCmdByAdmin (com.cloud.api.command.admin.domain.ListDomainsCmdByAdmin)1 ListIsosCmdByAdmin (com.cloud.api.command.admin.iso.ListIsosCmdByAdmin)1 ListTemplatesCmdByAdmin (com.cloud.api.command.admin.template.ListTemplatesCmdByAdmin)1 ListVMsCmdByAdmin (com.cloud.api.command.admin.vm.ListVMsCmdByAdmin)1 ListVolumesCmdByAdmin (com.cloud.api.command.admin.volume.ListVolumesCmdByAdmin)1 ListZonesCmdByAdmin (com.cloud.api.command.admin.zone.ListZonesCmdByAdmin)1 AccountJoinVO (com.cloud.api.query.vo.AccountJoinVO)1 DataCenterJoinVO (com.cloud.api.query.vo.DataCenterJoinVO)1 DomainJoinVO (com.cloud.api.query.vo.DomainJoinVO)1 ProjectAccountJoinVO (com.cloud.api.query.vo.ProjectAccountJoinVO)1 UserAccountJoinVO (com.cloud.api.query.vo.UserAccountJoinVO)1 UserVmJoinVO (com.cloud.api.query.vo.UserVmJoinVO)1 VolumeJoinVO (com.cloud.api.query.vo.VolumeJoinVO)1