Search in sources :

Example 1 with DTClient

use of ca.corefacility.bioinformatics.irida.ria.web.models.datatables.DTClient in project irida by phac-nml.

the class ClientsController method getAjaxClientsList.

/**
 * Get a {@link DataTablesResponse} for the Clients page.
 *
 * @param params
 * 		{@link DataTablesParams} for the current DataTable.
 *
 * @return {@link DataTablesResponse}
 */
@RequestMapping(value = "/ajax/list", produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
public DataTablesResponse getAjaxClientsList(@DataTablesRequest DataTablesParams params) {
    Specification<IridaClientDetails> specification = IridaClientDetailsSpecification.searchClient(params.getSearchValue());
    Page<IridaClientDetails> page = clientDetailsService.search(specification, new PageRequest(params.getCurrentPage(), params.getLength(), params.getSort()));
    List<DataTablesResponseModel> models = new ArrayList<>();
    for (IridaClientDetails client : page.getContent()) {
        models.add(new DTClient(client, clientDetailsService.countActiveTokensForClient(client)));
    }
    return new DataTablesResponse(params, page, models);
}
Also used : PageRequest(org.springframework.data.domain.PageRequest) DataTablesResponseModel(ca.corefacility.bioinformatics.irida.ria.web.components.datatables.models.DataTablesResponseModel) DTClient(ca.corefacility.bioinformatics.irida.ria.web.models.datatables.DTClient) DataTablesResponse(ca.corefacility.bioinformatics.irida.ria.web.components.datatables.DataTablesResponse) IridaClientDetails(ca.corefacility.bioinformatics.irida.model.IridaClientDetails) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Aggregations

IridaClientDetails (ca.corefacility.bioinformatics.irida.model.IridaClientDetails)1 DataTablesResponse (ca.corefacility.bioinformatics.irida.ria.web.components.datatables.DataTablesResponse)1 DataTablesResponseModel (ca.corefacility.bioinformatics.irida.ria.web.components.datatables.models.DataTablesResponseModel)1 DTClient (ca.corefacility.bioinformatics.irida.ria.web.models.datatables.DTClient)1 PageRequest (org.springframework.data.domain.PageRequest)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)1