Search in sources :

Example 1 with JsonKPI

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());
}
Also used : JSONOptions(de.metas.ui.web.window.datatypes.json.JSONOptions) JsonKPI(de.metas.ui.web.dashboard.json.JsonKPI) JsonKPI(de.metas.ui.web.dashboard.json.JsonKPI) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Aggregations

JsonKPI (de.metas.ui.web.dashboard.json.JsonKPI)1 JSONOptions (de.metas.ui.web.window.datatypes.json.JSONOptions)1 GetMapping (org.springframework.web.bind.annotation.GetMapping)1