? "fakerootFrag"
: "roleFrag", this);
fragment.setOutputMarkupId(true);
final AjaxLink createRoleLink = new ClearIndicatingAjaxLink("createRoleLink", pageRef) {
private static final long serialVersionUID = -7978723352517770644L;
@Override
protected void onClickInternal(final AjaxRequestTarget target) {
window.setPageCreator(new ModalWindow.PageCreator() {
private static final long serialVersionUID = -7834632442532690940L;
@Override
public Page createPage() {
RoleTO roleTO = new RoleTO();
roleTO.setParent(idRole);
RoleModalPage form = new RoleModalPage(pageRef, window, roleTO);
return form;
}
});
window.show(target);
}
};
MetaDataRoleAuthorizationStrategy.authorize(createRoleLink, ENABLE, xmlRolesReader.getAllAllowedRoles("Roles",
"create"));
createRoleLink.setOutputMarkupId(true);
fragment.add(createRoleLink);
if (idRole != 0) {
final AjaxLink updateRoleLink = new ClearIndicatingAjaxLink("updateRoleLink", pageRef) {
private static final long serialVersionUID = -7978723352517770644L;
@Override
protected void onClickInternal(final AjaxRequestTarget target) {
window.setPageCreator(new ModalWindow.PageCreator() {
private static final long serialVersionUID = -7834632442532690940L;
@Override
public Page createPage() {
RoleTO roleTO = restClient.read(idRole);
RoleModalPage form = new RoleModalPage(pageRef, window, roleTO);
return form;
}
});
window.show(target);
}
};
MetaDataRoleAuthorizationStrategy.authorize(updateRoleLink, ENABLE, xmlRolesReader.getAllAllowedRoles(
"Roles", "read"));
updateRoleLink.setOutputMarkupId(true);
fragment.add(updateRoleLink);
final AjaxLink dropRoleLink = new IndicatingDeleteOnConfirmAjaxLink("dropRoleLink", pageRef) {
private static final long serialVersionUID = -7978723352517770644L;
@Override
protected void onClickInternal(final AjaxRequestTarget target) {
try {
final RoleTO roleTO = (RoleTO) restClient.delete(idRole);
((Roles) pageRef.getPage()).setModalResult(true);
window.setPageCreator(new ModalWindow.PageCreator() {
private static final long serialVersionUID = -7834632442532690940L;
@Override
public Page createPage() {
return new ResultStatusModalPage(window, roleTO);
}
});
window.show(target);
} catch (SyncopeClientCompositeErrorException scce) {
error(getString("operation_error") + ": " + scce.getMessage());
target.add(((Roles) pageRef.getPage()).getFeedbackPanel());
}
}
};
MetaDataRoleAuthorizationStrategy.authorize(dropRoleLink, ENABLE, xmlRolesReader.getAllAllowedRoles(
"Roles", "delete"));
dropRoleLink.setOutputMarkupId(true);
fragment.add(dropRoleLink);
}
add(fragment);
}