// prepare delete event to fire for variable delete operation. (BulkDeleteOperation is not taken into account)
if (delete instanceof CheckedDeleteOperation) {
CheckedDeleteOperation checkedDeleteOperation = (CheckedDeleteOperation) delete;
PersistentObject persistentObject = checkedDeleteOperation.getPersistentObject();
if (persistentObject instanceof VariableInstanceEntity) {
VariableInstanceEntity variableInstance = (VariableInstanceEntity) persistentObject;
Context.getProcessEngineConfiguration().getEventDispatcher().dispatchEvent(
createVariableDeleteEvent(variableInstance)
);
}
} else if (delete instanceof BulkCheckedDeleteOperation) {
BulkCheckedDeleteOperation bulkCheckedDeleteOperation = (BulkCheckedDeleteOperation) delete;
if (VariableInstanceEntity.class.isAssignableFrom(bulkCheckedDeleteOperation.getPersistentObjectClass())) {
for (PersistentObject persistentObject : bulkCheckedDeleteOperation.getPersistentObjects()) {
VariableInstanceEntity variableInstance = (VariableInstanceEntity) persistentObject;
Context.getProcessEngineConfiguration().getEventDispatcher().dispatchEvent(
createVariableDeleteEvent(variableInstance)
);
}
}