Java 类org.hibernate.event.spi.PostCommitDeleteEventListener 实例源码

项目:lams    文件:PostCommitEventListenerGroupImpl.java   
public PostCommitEventListenerGroupImpl(EventType<T> eventType) {
    super( eventType );

    if ( eventType == EventType.POST_COMMIT_DELETE ) {
        this.extendedListenerContract = PostCommitDeleteEventListener.class;
    }
    else if ( eventType == EventType.POST_COMMIT_INSERT ) {
        this.extendedListenerContract = PostCommitInsertEventListener.class;
    }
    else if ( eventType == EventType.POST_COMMIT_UPDATE ) {
        this.extendedListenerContract = PostCommitUpdateEventListener.class;
    }
    else {
        throw new IllegalStateException( "Unexpected usage of PostCommitEventListenerGroupImpl" );
    }
}
项目:lams    文件:EntityDeleteAction.java   
private void postCommitDelete(boolean success) {
    final EventListenerGroup<PostDeleteEventListener> listenerGroup = listenerGroup( EventType.POST_COMMIT_DELETE );
    if ( listenerGroup.isEmpty() ) {
        return;
    }
    final PostDeleteEvent event = new PostDeleteEvent(
            getInstance(),
            getId(),
            state,
            getPersister(),
            eventSource()
    );
    for ( PostDeleteEventListener listener : listenerGroup.listeners() ) {
        if ( PostCommitDeleteEventListener.class.isInstance( listener ) ) {
            if ( success ) {
                listener.onPostDelete( event );
            }
            else {
                ((PostCommitDeleteEventListener) listener).onPostDeleteCommitFailed( event );
            }
        }
        else {
            //default to the legacy implementation that always fires the event
            listener.onPostDelete( event );
        }
    }
}
项目:jersey2-toolkit    文件:HibernateSessionFactoryFactoryTest.java   
@Override
protected void configure() {
    bind(TestEventListener.class)
            .to(PostDeleteEventListener.class)
            .to(PreDeleteEventListener.class)
            .to(PreInsertEventListener.class)
            .to(PostInsertEventListener.class)
            .to(PreUpdateEventListener.class)
            .to(PostUpdateEventListener.class)
            .to(PostCommitInsertEventListener.class)
            .to(PostCommitUpdateEventListener.class)
            .to(PostCommitDeleteEventListener.class)
            .in(PerThread.class);
}