@Override public void getReport(final Report report, final ReportTO reportTO) { report.setName(reportTO.getName()); report.setCronExpression(reportTO.getCronExpression()); report.setActive(reportTO.isActive()); ReportTemplate template = reportTemplateDAO.find(reportTO.getTemplate()); if (template == null) { SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.RequiredValuesMissing); sce.getElements().add("template"); throw sce; } report.setTemplate(template); reportTO.getReportlets().forEach(reportletKey -> { Implementation reportlet = implementationDAO.find(reportletKey); if (reportlet == null) { LOG.debug("Invalid " + Implementation.class.getSimpleName() + " {}, ignoring...", reportletKey); } else { report.add(reportlet); } }); // remove all implementations not contained in the TO report.getReportlets().removeIf(reportlet -> !reportTO.getReportlets().contains(reportlet.getKey())); }