private static final long serialVersionUID = -958724007591692537L;
@Override
protected void onSubmit(final AjaxRequestTarget target, final Form form) {
ReportTO reportTO = (ReportTO) form.getModelObject();
reportTO.setCronExpression(StringUtils.hasText(reportTO.getCronExpression())
? crontab.getCronExpression()
: null);
try {
if (reportTO.getId() > 0) {
restClient.update(reportTO);
} else {
restClient.create(reportTO);
}
((BasePage) callerPageRef.getPage()).setModalResult(true);
window.close(target);
} catch (SyncopeClientCompositeErrorException e) {
LOG.error("While creating or updating report", e);
error(getString("error") + ":" + e.getMessage());
target.add(feedbackPanel);
}
}
@Override
protected void onError(final AjaxRequestTarget target, final Form form) {
target.add(feedbackPanel);
}
};
if (reportTO.getId() > 0) {
MetaDataRoleAuthorizationStrategy.authorize(submit, RENDER, xmlRolesReader.getAllAllowedRoles("Reports",
"update"));
} else {
MetaDataRoleAuthorizationStrategy.authorize(submit, RENDER, xmlRolesReader.getAllAllowedRoles("Reports",
"create"));