use of de.metas.ui.web.dashboard.json.JsonKPI in project metasfresh-webui-api by metasfresh.
the class DashboardRestController method getKPIsAvailableToAdd.
@GetMapping("/kpis/available")
public List<JsonKPI> getKPIsAvailableToAdd(@RequestParam(name = "firstRow", required = false, defaultValue = "0") final int firstRow, @RequestParam(name = "pageLength", required = false, defaultValue = "0") final int pageLength) {
userSession.assertLoggedIn();
final Collection<KPI> kpis = userDashboardRepo.getKPIsAvailableToAdd();
final JSONOptions jsonOpts = newJSONOpts();
return kpis.stream().map(kpi -> JsonKPI.of(kpi, jsonOpts)).sorted(Comparator.comparing(JsonKPI::getCaption)).skip(firstRow >= 0 ? firstRow : 0).limit(pageLength > 0 ? pageLength : Integer.MAX_VALUE).collect(ImmutableList.toImmutableList());
}
Aggregations