I want to prevent editing of task with status ‘Completed’. I used this row level role and it is working fine.
@PredicateRowLevelPolicy(entityClass = Task.class, actions = RowLevelPolicyAction.UPDATE)
default RowLevelBiPredicate<Task, ApplicationContext> taskPredicate() {
return (task, applicationContext) → {
return !task.getStatus().equals(EnumTaskStatus.COMPLETED);
};
}
Now i am changing the status of taks programitacally by this code and it is also woking fine if row level role as shown above is absent.
if (tasksDataGrid.getSingleSelectedItem() != null) {
Task cm = tasksDataGrid.getSingleSelectedItem();
cm.setState(“Completed”);
cm.setStatus(EnumTaskStatus.COMPLETED);
dataManager.save(cm);
btnComplete.setEnabled(false);
}
But this code gives access denied error (and viewbecome inactive) if row level role is defined.
Please advice