HHH-14447 Remove unneccessary type check

This commit is contained in:
Sanne Grinovero 2021-02-09 12:26:08 +00:00 committed by Andrea Boriero
parent 81a9b87ec1
commit 2eaa0f8c67
1 changed files with 1 additions and 11 deletions

View File

@ -184,23 +184,13 @@ public class EntityDeleteAction extends EntityAction {
final EventListenerGroup<PostDeleteEventListener> eventListeners = getFastSessionServices()
.eventListenerGroup_POST_COMMIT_DELETE;
if (success) {
eventListeners.fireLazyEventOnEachListener( this::newPostDeleteEvent, EntityDeleteAction::postCommitDeleteOnSuccess );
eventListeners.fireLazyEventOnEachListener( this::newPostDeleteEvent, PostDeleteEventListener::onPostDelete );
}
else {
eventListeners.fireLazyEventOnEachListener( this::newPostDeleteEvent, EntityDeleteAction::postCommitDeleteOnUnsuccessful );
}
}
private static void postCommitDeleteOnSuccess(PostDeleteEventListener listener, PostDeleteEvent event) {
if ( listener instanceof PostCommitDeleteEventListener ) {
listener.onPostDelete( event );
}
else {
//default to the legacy implementation that always fires the event
listener.onPostDelete( event );
}
}
private static void postCommitDeleteOnUnsuccessful(PostDeleteEventListener listener, PostDeleteEvent event) {
if ( listener instanceof PostCommitDeleteEventListener ) {
( (PostCommitDeleteEventListener) listener ).onPostDeleteCommitFailed( event );