use of io.jmix.dashboardsui.DashboardException in project jmix by jmix-framework.
the class PersistentDashboardEdit method uploadJson.
protected void uploadJson() {
try (InputStream fileContent = importJsonField.getFileContent()) {
String json = IOUtils.toString(Objects.requireNonNull(fileContent), UTF_8);
DashboardModel newDashboardModel = metadata.create(DashboardModel.class);
BeanUtils.copyProperties(converter.dashboardFromJson(json), newDashboardModel);
dashboardDc.setItem(newDashboardModel);
initParametersFragment();
initPaletteFragment();
canvasFragment.updateLayout(newDashboardModel);
} catch (Exception e) {
throw new DashboardException("Cannot import data from a file", e);
}
}
Aggregations