public ImplementationTO getImpl() { if (defaultRuleConf != null) { try { this.impl.setBody(OBJECT_MAPPER.writeValueAsString(defaultRuleConf)); } catch (Exception e) { LOG.error("Could not serialize {}", defaultRuleConf); } } return impl; }
@Override protected Serializable onApplyInternal(final PolicyRuleWrapper modelObject) { PolicyTO policyTO = restClient.getPolicy(type, policy); ComposablePolicy composable; if (policyTO instanceof ComposablePolicy) { composable = (ComposablePolicy) policyTO; } else { throw new IllegalStateException("Non composable policy"); } if (modelObject.getImplementationEngine() == ImplementationEngine.JAVA) { ImplementationTO rule = implementationClient.read(implementationType, modelObject.getImplementationKey()); try { rule.setBody(MAPPER.writeValueAsString(modelObject.getConf())); implementationClient.update(rule); } catch (Exception e) { throw new RuntimeException(e); } } if (modelObject.isNew()) { composable.getRules().add(modelObject.getImplementationKey()); } restClient.updatePolicy(type, policyTO); return modelObject; }
@Override protected Serializable onApplyInternal(final ReportletWrapper modelObject) { if (modelObject.getImplementationEngine() == ImplementationEngine.JAVA) { ImplementationTO reportlet = implementationClient.read( ImplementationType.REPORTLET, modelObject.getImplementationKey()); try { reportlet.setBody(MAPPER.writeValueAsString(modelObject.getConf())); implementationClient.update(reportlet); } catch (Exception e) { throw new RuntimeException(e); } } ReportTO reportTO = restClient.read(report); if (modelObject.isNew()) { reportTO.getReportlets().add(modelObject.getImplementationKey()); } restClient.update(reportTO); return modelObject; }
@Override public ImplementationTO getImplementationTO(final Implementation implementation) { ImplementationTO implementationTO = new ImplementationTO(); implementationTO.setKey(implementation.getKey()); implementationTO.setEngine(implementation.getEngine()); implementationTO.setType(implementation.getType()); implementationTO.setBody(implementation.getBody()); return implementationTO; } }
@Override protected void onSubmit(final ImplementationEngine engine, final AjaxRequestTarget target) { implementation.setKey(null); implementation.setBody(null); target.add(ImplementationDirectoryPanel.this.modal.setContent(new ImplementationModalPanel( ImplementationDirectoryPanel.this.modal, implementation, pageRef))); ImplementationDirectoryPanel.this.modal.header( new StringResourceModel("any.new", Model.of(implementation))); ImplementationDirectoryPanel.this.modal.show(true); } };
implementation.setBody(StringUtils.substringAfter(IOUtils.toString(getClass(). getResourceAsStream( "/org/apache/syncope/client/console/implementations/" + templateClassName