@Override
public void populateItem(final Item<ICellPopulator<UserRequestTO>> cellItem, final String componentId,
final IModel<UserRequestTO> model) {
final UserRequestTO request = model.getObject();
final ActionLinksPanel panel = new ActionLinksPanel(componentId, model, getPageReference());
panel.add(new ActionLink() {
private static final long serialVersionUID = -3722207913631435501L;
@Override
public void onClick(final AjaxRequestTarget target) {
editUserRequestWin.setPageCreator(new ModalWindow.PageCreator() {
private static final long serialVersionUID = -7834632442532690940L;
@Override
public Page createPage() {
return new UserRequestModalPage(Todo.this.getPageReference(), editUserRequestWin,
model.getObject(), UserModalPage.Mode.ADMIN);
}
});
editUserRequestWin.show(target);
}
}, ActionLink.ActionType.EDIT, "UserRequest", "read",
model.getObject().getType() != UserRequestType.DELETE);
panel.add(new ActionLink() {
private static final long serialVersionUID = -3722207913631435501L;
@Override
public void onClick(final AjaxRequestTarget target) {
try {
userRestClient.delete(model.getObject().getUserId());
userRequestRestClient.delete(model.getObject().getId());
} catch (SyncopeClientCompositeErrorException e) {
LOG.error("While deleting an user", e);
error(e.getMessage());
return;
}
info(getString("operation_succeded"));
target.add(feedbackPanel);
target.add(userRequestContainer);
}
}, ActionLink.ActionType.DELETE, "Users", "delete",
model.getObject().getType() == UserRequestType.DELETE);
panel.add(new ActionLink() {
private static final long serialVersionUID = -3722207913631435501L;
@Override
public void onClick(final AjaxRequestTarget target) {
try {
userRequestRestClient.delete(request.getId());
} catch (SyncopeClientCompositeErrorException e) {
LOG.error("While deleting an user request", e);
error(e.getMessage());
return;
}