this.taskDbid = Long.parseLong(taskId);
this.deleteHistory = deleteHistory;
}
public Void execute(Environment environment) throws Exception {
DbSession dbSession = environment.get(DbSession.class);
TaskImpl task = (TaskImpl) dbSession.get(TaskImpl.class, taskDbid);
if (task!=null) {
task.delete(reason);
dbSession.delete(task);
if (deleteHistory) {
HistoryTaskImpl historyTask = (HistoryTaskImpl) dbSession.get(HistoryTaskImpl.class, taskDbid);
if (historyTask!=null) {
dbSession.delete(historyTask);
}
}
} else {
throw new JbpmException("task "+taskDbid+" doesn't exist");
}