@Override public void onClick(final AjaxRequestTarget target) { try { connectorRestClient.reload(); SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED)); } catch (Exception e) { LOG.error("While reloading all connectors", e); SyncopeConsoleSession.get().error( StringUtils.isBlank(e.getMessage()) ? e.getClass().getName() : e.getMessage()); } ((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target); } };
private Serializable onApply(final AjaxRequestTarget target) throws TimeoutException { try { Future<Pair<Serializable, Serializable>> executor = SyncopeConsoleSession.get().execute(new ApplyFuture(target)); Pair<Serializable, Serializable> res = executor.get(SyncopeWebApplication.get().getMaxWaitTimeInSeconds(), TimeUnit.SECONDS); if (res.getLeft() != null) { send(pageRef.getPage(), Broadcast.BUBBLE, res.getLeft()); } return res.getRight(); } catch (InterruptedException | ExecutionException e) { throw new RuntimeException(e); } }
protected DateFieldPanel(final String id, final String name, final IModel<Date> model, final String datePattern) { super(id, name, model); fmt = datePattern == null ? SyncopeConsoleSession.get().getDateFormat() : FastDateFormat.getInstance(datePattern); }
@Override public void onClick(final AjaxRequestTarget target) { SyncopeConsoleSession.get().setAttribute(Constants.MENU_COLLAPSE, SyncopeConsoleSession.get().getAttribute(Constants.MENU_COLLAPSE) == null ? true : !(Boolean) SyncopeConsoleSession.get().getAttribute(Constants.MENU_COLLAPSE)); } });
public List<ConnBundleTO> getAllBundles() { List<ConnBundleTO> bundles = Collections.<ConnBundleTO>emptyList(); try { bundles = getService(ConnectorService.class).getBundles(SyncopeConsoleSession.get().getLocale().toString()); } catch (SyncopeClientException e) { LOG.error("While getting connector bundles", e); } return bundles; }
@Override public void onClick(final AjaxRequestTarget target, final UserTO ignore) { try { SyncopeConsoleSession.get().getAnonymousClient().getService(UserSelfService.class). requestPasswordReset(model.getObject().getUsername(), null); SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED)); target.add(container); } catch (Exception e) { LOG.error("While actioning object {}", model.getObject().getKey(), e); SyncopeConsoleSession.get().error( StringUtils.isBlank(e.getMessage()) ? e.getClass().getName() : e.getMessage()); } ((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target); } }, ActionType.REQUEST_PASSWORD_RESET, StandardEntitlement.USER_UPDATE).
@Override protected void onSubmit(final AjaxRequestTarget target) { try { restClient.changePassword(passwordField.getModelObject()); SyncopeConsoleSession.get().invalidate(); setResponsePage(getApplication().getHomePage()); } catch (Exception e) { LOG.error("While changing password for {}", SyncopeConsoleSession.get().getSelfTO().getUsername(), e); SyncopeConsoleSession.get().error(StringUtils.isBlank(e.getMessage()) ? e.getClass().getName() : e.getMessage()); notificationPanel.refresh(target); } }
Serializable leftMenuCollapse = SyncopeConsoleSession.get().getAttribute(Constants.MENU_COLLAPSE); if ((leftMenuCollapse instanceof Boolean) && ((Boolean) leftMenuCollapse)) { body.add(new AttributeAppender("class", " sidebar-collapse")); body.add(new Label("username", SyncopeConsoleSession.get().getSelfTO().getUsername())); PlatformInfo platformInfo = SyncopeConsoleSession.get().getPlatformInfo(); Label version = new Label("version", platformInfo.getVersion()); String versionLink = StringUtils.isNotBlank(platformInfo.getBuildNumber()) body.add(version); SystemInfo systemInfo = SyncopeConsoleSession.get().getSystemInfo(); body.add(new Label("hostname", systemInfo.getHostname())); body.add(new Label("processors", systemInfo.getAvailableProcessors())); body.add(new Label("domain", SyncopeConsoleSession.get().getDomain())); final Class<? extends WebPage> beforeLogout = (Class<? extends WebPage>) SyncopeConsoleSession.get(). getAttribute(Constants.BEFORE_LOGOUT_PAGE); if (beforeLogout == null) { body.add(new BookmarkablePageLink<>("logout", Logout.class));
@Override protected Pair<List<URI>, List<URI>> load() { final List<URI> connectorServers = new ArrayList<>(); final List<URI> filePaths = new ArrayList<>(); SyncopeConsoleSession.get().getPlatformInfo().getConnIdLocations().forEach(location -> { if (location.startsWith(CONNECTOR_SERVER_LOCATION_PREFIX)) { connectorServers.add(URI.create(location)); } else { filePaths.add(URI.create(location)); } }); return Pair.of(connectorServers, filePaths); } };
@Override public void onClick(final AjaxRequestTarget target, final ReportletWrapper ignore) { ReportletDirectoryPanel.this.getTogglePanel().close(target); if (model.getObject().getConf() == null) { SyncopeConsoleSession.get().info(getString("noConf")); } else { send(ReportletDirectoryPanel.this, Broadcast.EXACT, new AjaxWizard.EditItemActionEvent<>(model.getObject(), target)); } } }, ActionLink.ActionType.EDIT, StandardEntitlement.REPORT_UPDATE);
protected static <E extends JAXRSService, T> T getObject( final E service, final URI location, final Class<T> resultClass) { WebClient webClient = WebClient.fromClient(WebClient.client(service)); webClient.accept(SyncopeConsoleSession.get().getMediaType()).to(location.toASCIIString(), false); return webClient. header(RESTHeaders.DOMAIN, SyncopeConsoleSession.get().getDomain()). header(HttpHeaders.AUTHORIZATION, "Bearer " + SyncopeConsoleSession.get().getJWT()). get(resultClass); }
add(container); availableRealms = SyncopeConsoleSession.get().getAuthRealms();
public Logout(final PageParameters parameters) { super(parameters); SyncopeConsoleSession.get().invalidate(); setResponsePage(getApplication().getHomePage()); }
@Override public void onSubmit(final AjaxRequestTarget target) { try { onApply(target); } catch (TimeoutException te) { LOG.warn("Operation applying took to long", te); send(eventSink, Broadcast.EXACT, new NewItemCancelEvent<>(item, target)); SyncopeConsoleSession.get().warn(getString("timeout")); ((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target); } }
public FastDateFormat getDateFormat() { return FastDateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, getLocale()); } }
@Override public List<RemediationTO> getObject() { List<RemediationTO> updatedRemediations; if (SyncopeConsoleSession.get().owns(StandardEntitlement.REMEDIATION_LIST) && SyncopeConsoleSession.get().owns(StandardEntitlement.REMEDIATION_READ)) { updatedRemediations = restClient.getRemediations(1, MAX_SIZE, new SortParam<>("instant", true)); } else { updatedRemediations = Collections.<RemediationTO>emptyList(); } return updatedRemediations; } };
public List<ConnInstanceTO> getAllConnectors() { List<ConnInstanceTO> connectors = Collections.<ConnInstanceTO>emptyList(); try { connectors = getService(ConnectorService.class).list(SyncopeConsoleSession.get().getLocale().toString()); } catch (Exception e) { LOG.error("While reading connectors", e); } return connectors; }