@Override
public final void onFinish() {
AjaxRequestTarget target = RequestCycle.get().find(AjaxRequestTarget.class).orElse(null);
try {
final Serializable res = onApply(target);
if (eventSink == null) {
send(this, Broadcast.BUBBLE, new NewItemFinishEvent<>(item, target).setResult(res));
} else {
send(eventSink, Broadcast.EXACT, new NewItemFinishEvent<>(item, target).setResult(res));
}
} catch (TimeoutException te) {
LOG.warn("Operation applying took to long", te);
if (eventSink == null) {
send(this, Broadcast.BUBBLE, new NewItemCancelEvent<>(item, target));
} else {
send(eventSink, Broadcast.EXACT, new NewItemCancelEvent<>(item, target));
}
SyncopeConsoleSession.get().warn(getString("timeout"));
((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target);
} catch (Exception e) {
LOG.error("Wizard error on finish", e);
SyncopeConsoleSession.get().error(StringUtils.isBlank(e.getMessage())
? e.getClass().getName() : e.getMessage());
((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target);
}
}