@Override protected void onEvent(final AjaxRequestTarget target) { ImplementationTO impl = implementationClient.read(implementationType, conf.getModelObject()); rule.setImplementationEngine(impl.getEngine()); if (impl.getEngine() == ImplementationEngine.JAVA) { try { RuleConf ruleConf = MAPPER.readValue(impl.getBody(), RuleConf.class); rule.setConf(ruleConf); } catch (Exception e) { LOG.error("During deserialization", e); } } } });
@Override protected void onEvent(final AjaxRequestTarget target) { ImplementationTO impl = implementationClient.read( ImplementationType.REPORTLET, conf.getModelObject()); reportlet.setImplementationEngine(impl.getEngine()); if (impl.getEngine() == ImplementationEngine.JAVA) { try { ReportletConf conf = MAPPER.readValue(impl.getBody(), ReportletConf.class); reportlet.setConf(conf); } catch (Exception e) { LOG.error("During deserialization", e); } } } });
private List<ReportletWrapper> getReportletWrappers(final ReportTO reportTO) { return reportTO.getReportlets().stream().map(reportlet -> { ImplementationTO impl = implementationClient.read(ImplementationType.REPORTLET, reportlet); ReportletWrapper wrapper = new ReportletWrapper(false). setImplementationKey(impl.getKey()). setImplementationEngine(impl.getEngine()); if (impl.getEngine() == ImplementationEngine.JAVA) { try { ReportletConf reportletConf = MAPPER.readValue(impl.getBody(), ReportletConf.class); wrapper.setConf(reportletConf); } catch (Exception e) { LOG.error("During deserialization", e); } } return wrapper; }).filter(wrapper -> wrapper != null).collect(Collectors.toList()); }
@Override public void onSubmit(final AjaxRequestTarget target) { try { getItem().getCorrelationRules().clear(); model.getObject().forEach(rule -> { getItem().getCorrelationRules().put(rule.getAnyType(), rule.getImplKey()); if (rule.getImpl().getEngine() == ImplementationEngine.JAVA && rule.getDefaultRuleConf() != null) { try { implRestClient.update(rule.getImpl()); } catch (Exception e) { throw new RuntimeException(e); } } }); restClient.updatePolicy(getItem() instanceof PullPolicyTO ? PolicyType.PULL : PolicyType.PUSH, getItem()); SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED)); this.modal.close(target); } catch (Exception e) { LOG.error("While creating/updating policy", e); SyncopeConsoleSession.get().error( StringUtils.isBlank(e.getMessage()) ? e.getClass().getName() : e.getMessage()); } ((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target); }
implementation.setEngine(implementationTO.getEngine()); implementation.setType(implementationTO.getType()); implementation.setBody(implementationTO.getBody());