public String getImplKey() { return impl == null ? null : impl.getKey(); }
@Override public Response create(final ImplementationTO implementationTO) { ImplementationTO created = logic.create(implementationTO); URI location = uriInfo.getAbsolutePathBuilder().path(String.valueOf(created.getKey())).build(); return Response.created(location). header(RESTHeaders.RESOURCE_KEY, created.getKey()). build(); }
@PreAuthorize("hasRole('" + StandardEntitlement.IMPLEMENTATION_UPDATE + "')") public ImplementationTO update(final ImplementationTO implementationTO) { Implementation implementation = implementationDAO.find(implementationTO.getKey()); if (implementation == null) { LOG.error("Could not find implementation '" + implementationTO.getKey() + "'"); throw new NotFoundException(implementationTO.getKey()); } binder.update(implementation, implementationTO); implementation = implementationDAO.save(implementation); return binder.getImplementationTO(implementation); }
@PreAuthorize("hasRole('" + StandardEntitlement.IMPLEMENTATION_CREATE + "')") public ImplementationTO create(final ImplementationTO implementationTO) { if (StringUtils.isBlank(implementationTO.getKey())) { SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.RequiredValuesMissing); sce.getElements().add("Implementation key"); throw sce; } Implementation implementation = implementationDAO.find(implementationTO.getKey()); if (implementation != null) { throw new DuplicateException(implementationTO.getKey()); } return binder.getImplementationTO(implementationDAO.save(binder.create(implementationTO))); }
@Override public void setObject(final List<CorrelationRule> object) { policyTO.getCorrelationRules().clear(); rules.forEach(rule -> { policyTO.getCorrelationRules().put(rule.getAnyType(), rule.getImpl().getKey()); }); } };
@Override public void onClick(final AjaxRequestTarget target, final ImplementationTO ignore) { try { restClient.delete(model.getObject().getType(), model.getObject().getKey()); SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED)); target.add(container); } catch (SyncopeClientException e) { LOG.error("While deleting object {}", model.getObject().getKey(), e); SyncopeConsoleSession.get().error( StringUtils.isBlank(e.getMessage()) ? e.getClass().getName() : e.getMessage()); } ((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target); } }, ActionLink.ActionType.DELETE, StandardEntitlement.IMPLEMENTATION_DELETE, true);
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 ImplementationTO resolveReference(final Method method, final Object... args) throws UnresolvedReferenceException { String key = null; if (ArrayUtils.isNotEmpty(args)) { for (int i = 0; key == null && i < args.length; i++) { if (args[i] instanceof String) { key = (String) args[i]; } else if (args[i] instanceof ImplementationTO) { key = ((ImplementationTO) args[i]).getKey(); } } } if (StringUtils.isNotBlank(key)) { try { return binder.getImplementationTO(implementationDAO.find(key)); } catch (Throwable ignore) { LOG.debug("Unresolved reference", ignore); throw new UnresolvedReferenceException(ignore); } } throw new UnresolvedReferenceException(); }
implementation.setKey(implementationTO.getKey()); implementation.setEngine(implementationTO.getEngine()); implementation.setType(implementationTO.getType());
? ViewMode.JSON_BODY : ViewMode.JAVA_CLASS; this.create = implementation.getKey() == null;