Search in sources :

Example 6 with ResponseView

use of org.apache.cloudstack.api.ResponseObject.ResponseView in project cloudstack by apache.

the class QueryManagerImpl method listIsos.

@Override
public ListResponse<TemplateResponse> listIsos(ListIsosCmd cmd) {
    Pair<List<TemplateJoinVO>, Integer> result = searchForIsosInternal(cmd);
    ListResponse<TemplateResponse> response = new ListResponse<TemplateResponse>();
    ResponseView respView = ResponseView.Restricted;
    if (cmd instanceof ListIsosCmdByAdmin) {
        respView = ResponseView.Full;
    }
    List<TemplateResponse> templateResponses = ViewResponseHelper.createIsoResponse(respView, result.first().toArray(new TemplateJoinVO[result.first().size()]));
    response.setResponses(templateResponses, result.second());
    return response;
}
Also used : ResponseView(org.apache.cloudstack.api.ResponseObject.ResponseView) ListResponse(org.apache.cloudstack.api.response.ListResponse) TemplateJoinVO(com.cloud.api.query.vo.TemplateJoinVO) ArrayList(java.util.ArrayList) List(java.util.List) TemplateResponse(org.apache.cloudstack.api.response.TemplateResponse) ListIsosCmdByAdmin(org.apache.cloudstack.api.command.admin.iso.ListIsosCmdByAdmin)

Example 7 with ResponseView

use of org.apache.cloudstack.api.ResponseObject.ResponseView in project cloudstack by apache.

the class QueryManagerImpl method searchForDomains.

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

Aggregations

ArrayList (java.util.ArrayList)7 List (java.util.List)7 ResponseView (org.apache.cloudstack.api.ResponseObject.ResponseView)7 ListResponse (org.apache.cloudstack.api.response.ListResponse)7 TemplateJoinVO (com.cloud.api.query.vo.TemplateJoinVO)2 TemplateResponse (org.apache.cloudstack.api.response.TemplateResponse)2 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 ListAccountsCmdByAdmin (org.apache.cloudstack.api.command.admin.account.ListAccountsCmdByAdmin)1 ListDomainsCmdByAdmin (org.apache.cloudstack.api.command.admin.domain.ListDomainsCmdByAdmin)1 ListIsosCmdByAdmin (org.apache.cloudstack.api.command.admin.iso.ListIsosCmdByAdmin)1 ListTemplatesCmdByAdmin (org.apache.cloudstack.api.command.admin.template.ListTemplatesCmdByAdmin)1 ListVMsCmdByAdmin (org.apache.cloudstack.api.command.admin.vm.ListVMsCmdByAdmin)1 ListVolumesCmdByAdmin (org.apache.cloudstack.api.command.admin.volume.ListVolumesCmdByAdmin)1 ListZonesCmdByAdmin (org.apache.cloudstack.api.command.admin.zone.ListZonesCmdByAdmin)1