use of com.thoughtworks.go.server.ui.SortOrder in project gocd by gocd.
the class AgentJobHistoryControllerV1 method index.
public String index(Request request, Response response) throws IOException {
String uuid = request.params(":uuid");
Integer offset = getOffset(request);
Integer pageSize = getPageSize(request);
JobInstanceService.JobHistoryColumns column = getSortColumn(request);
SortOrder sortOrder = getSortOrder(request);
Integer total = jobInstanceService.totalCompletedJobsCountOn(uuid);
Pagination pagination = Pagination.pageStartingAt(offset, total, pageSize);
AgentInstance agent = agentService.findAgent(uuid);
if (agent.isNullAgent()) {
throw new RecordNotFoundException(EntityType.Agent, uuid);
}
JobInstancesModel jobInstances = jobInstanceService.completedJobsOnAgent(uuid, column, sortOrder, pagination);
return writerForTopLevelObject(request, response, outputWriter -> AgentJobHistoryRepresenter.toJSON(outputWriter, uuid, jobInstances));
}
Aggregations