use of de.metas.ui.web.dashboard.KPIDataResult in project metasfresh-webui-api by metasfresh.
the class WEBUI_KPI_TestQuery method doIt.
@Override
protected String doIt() throws JsonProcessingException {
final int kpiId = getRecord_ID();
if (kpiId <= 0) {
throw new EntityNotFoundException("@NotFound@ @" + I_WEBUI_KPI.COLUMNNAME_WEBUI_KPI_ID + "@");
}
kpisRepo.invalidateKPI(kpiId);
final KPI kpi = kpisRepo.getKPI(kpiId);
final TimeRange timeRange = kpi.getTimeRangeDefaults().createTimeRange(p_DateFrom, p_DateTo);
final KPIDataResult kpiData = KPIDataLoader.newInstance(elasticsearchClient, kpi).setTimeRange(timeRange).setFormatValues(true).assertESTypesExists().retrieveData();
final String jsonData = jsonObjectMapper.writeValueAsString(kpiData);
log.info("jsonData:\n {}", jsonData);
return jsonData;
}
Aggregations