use of io.jmix.emailtemplatesui.dto.ReportWithParamField in project jmix by jmix-framework.
the class EmailTemplateParametersFragment method collectParameters.
public List<ReportWithParams> collectParameters() {
List<ReportWithParams> reportDataList = new ArrayList<>();
for (ReportWithParamField fieldValue : parameterComponents) {
ReportWithParams reportData = new ReportWithParams(fieldValue.getReport());
for (String paramName : fieldValue.getFields().keySet()) {
Field parameterField = fieldValue.getFields().get(paramName);
Object value = parameterField.getValue();
reportData.put(paramName, value);
}
reportDataList.add(reportData);
}
return reportDataList;
}
use of io.jmix.emailtemplatesui.dto.ReportWithParamField in project jmix by jmix-framework.
the class EmailTemplateParametersFragment method createComponents.
public EmailTemplateParametersFragment createComponents() {
clearComponents();
try {
List<ReportWithParams> parameters = getTemplateDefaultValues();
List<Report> reports = parameters.stream().map(ReportWithParams::getReport).collect(Collectors.toList());
parametersGrid.setRows(getRowCountForParameters(reports));
int currentGridRow = 0;
for (ReportWithParams reportData : parameters) {
Report report = reportData.getReport();
if (report != null && !report.getIsTmp()) {
report = dataManager.load(Report.class).id(report.getId()).fetchPlan("report.edit").one();
}
if (report != null) {
if (CollectionUtils.isNotEmpty(report.getInputParameters())) {
if (BooleanUtils.isNotTrue(hideReportCaption)) {
createReportNameLabel(report, currentGridRow);
currentGridRow++;
}
Map<String, Field> componentsMap = new HashMap<>();
for (ReportInputParameter parameter : report.getInputParameters()) {
if (BooleanUtils.isNotTrue(parameter.getHidden())) {
componentsMap.put(parameter.getAlias(), createComponent(parameter, reportData.getParams(), currentGridRow));
currentGridRow++;
}
}
parameterComponents.add(new ReportWithParamField(report, componentsMap));
}
}
}
} catch (ReportParameterTypeChangedException e) {
notifications.create(Notifications.NotificationType.ERROR).withCaption(e.getMessage()).show();
}
return this;
}
Aggregations