Search in sources :

Example 1 with ListTemplatesCmdByAdmin

use of org.apache.cloudstack.api.command.admin.template.ListTemplatesCmdByAdmin in project cloudstack by apache.

the class QueryManagerImpl method listTemplates.

@Override
public ListResponse<TemplateResponse> listTemplates(ListTemplatesCmd cmd) {
    Pair<List<TemplateJoinVO>, Integer> result = searchForTemplatesInternal(cmd);
    ListResponse<TemplateResponse> response = new ListResponse<TemplateResponse>();
    ResponseView respView = ResponseView.Restricted;
    if (cmd instanceof ListTemplatesCmdByAdmin) {
        respView = ResponseView.Full;
    }
    List<TemplateResponse> templateResponses = ViewResponseHelper.createTemplateResponse(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) ListTemplatesCmdByAdmin(org.apache.cloudstack.api.command.admin.template.ListTemplatesCmdByAdmin) TemplateJoinVO(com.cloud.api.query.vo.TemplateJoinVO) ArrayList(java.util.ArrayList) List(java.util.List) TemplateResponse(org.apache.cloudstack.api.response.TemplateResponse)

Aggregations

TemplateJoinVO (com.cloud.api.query.vo.TemplateJoinVO)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 ResponseView (org.apache.cloudstack.api.ResponseObject.ResponseView)1 ListTemplatesCmdByAdmin (org.apache.cloudstack.api.command.admin.template.ListTemplatesCmdByAdmin)1 ListResponse (org.apache.cloudstack.api.response.ListResponse)1 TemplateResponse (org.apache.cloudstack.api.response.TemplateResponse)1