public final void setImpl(final ImplementationTO impl) { this.impl = impl; if (impl != null) { this.defaultRuleConf = null; try { this.defaultRuleConf = OBJECT_MAPPER.readValue(impl.getBody(), ruleConfClass); } catch (Exception e) { LOG.debug("Could not deserialize {} as {}", impl.getBody(), ruleConfClass.getName()); } } }
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 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); } } } });
jsonClass.setOutputMarkupId(true).setOutputMarkupPlaceholderTag(true); jsonClass.setVisible(viewMode == ViewMode.JSON_BODY); if (viewMode == ViewMode.JSON_BODY && StringUtils.isNotBlank(implementation.getBody())) { try { JsonNode node = MAPPER.readTree(implementation.getBody()); if (node.has("@class")) { jsonClass.setModelObject(node.get("@class").asText()); LOG.error("Could not parse as JSON payload: {}", implementation.getBody(), e); add(groovyClassContainer); if (StringUtils.isBlank(implementation.getBody()) && implementation.getEngine() == ImplementationEngine.GROOVY) {