Search in sources :

Example 1 with ListTemplatesCmdByAdmin

use of com.cloud.api.command.admin.template.ListTemplatesCmdByAdmin 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)1 ListTemplatesCmdByAdmin (com.cloud.api.command.admin.template.ListTemplatesCmdByAdmin)1 TemplateJoinVO (com.cloud.api.query.vo.TemplateJoinVO)1 ListResponse (com.cloud.api.response.ListResponse)1 TemplateResponse (com.cloud.api.response.TemplateResponse)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1