new PropertyModel<Boolean>(schema, "readonly"));
final AjaxCheckBoxPanel uniqueConstraint = new AjaxCheckBoxPanel("uniqueConstraint",
getString("uniqueConstraint"), new PropertyModel<Boolean>(schema, "uniqueConstraint"));
final AjaxButton submit = new IndicatingAjaxButton(APPLY, new ResourceModel(SUBMIT)) {
private static final long serialVersionUID = -958724007591692537L;
@Override
protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
final SchemaTO schemaTO = (SchemaTO) form.getDefaultModelObject();
schemaTO.setEnumerationValues(getEnumValuesAsString(enumerationValues.getView().getModelObject()));
schemaTO.setEnumerationKeys(getEnumValuesAsString(enumerationKeys.getView().getModelObject()));
if (schemaTO.isMultivalue() && schemaTO.isUniqueConstraint()) {
error(getString("multivalueAndUniqueConstr.validation"));
target.add(feedbackPanel);
return;
}
try {
if (createFlag) {
schemaRestClient.createSchema(kind, schemaTO);
} else {
schemaRestClient.updateSchema(kind, schemaTO);
}
if (pageRef.getPage() instanceof BasePage) {
((BasePage) pageRef.getPage()).setModalResult(true);
}
window.close(target);
} catch (SyncopeClientCompositeErrorException e) {
error(getString(Constants.ERROR) + ":" + e.getMessage());
target.add(feedbackPanel);
}
}
@Override
protected void onError(final AjaxRequestTarget target, final Form<?> form) {
target.add(feedbackPanel);
}
};
final AjaxButton cancel = new IndicatingAjaxButton(CANCEL, new ResourceModel(CANCEL)) {
private static final long serialVersionUID = -958724007591692537L;
@Override
protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
window.close(target);
}
};
cancel.setDefaultFormProcessing(false);
String allowedRoles = createFlag
? xmlRolesReader.getAllAllowedRoles("Schema", "create")
: xmlRolesReader.getAllAllowedRoles("Schema", "update");