通过系统管理员账号可以正常取消流程,但其他用户就会出现实体访问拒绝,图图所示:
实现方式如下:
public void onRevokeBtnClick() {
if(billsTable.getSingleSelected()!=null){
if(billsTable.getSingleSelected().getReportStatus()==Status.SUBMIT){
billsTable.getSingleSelected().setReportStatus(Status.WITHDRAW);
processService.processCancel(procActionsFragment.getProcInstance(),"撤回成功");
dataManager.commit(billsTable.getSingleSelected());
notifications.create()
.withCaption("已撤回!")
.withType(Notifications.NotificationType.HUMANIZED)
.withPosition(Notifications.Position.BOTTOM_RIGHT)
.show();
}
else if(billsTable.getSingleSelected().getReportStatus()==Status.AUDIT){
notifications.create()
.withCaption("已提交审核,无法撤回!")
.withType(Notifications.NotificationType.HUMANIZED)
.withPosition(Notifications.Position.BOTTOM_RIGHT)
.show();
}
}
billsDl.load();
}
@Service(ProcessService.NAME)
public class ProcessServiceBean implements ProcessService {
@Inject
private ProcessRuntimeManager processRuntimeManager;
public void processCancel(ProcInstance procInstance, String comment){
processRuntimeManager.cancelProcess(procInstance,comment);
}
}