예제 #1
0
 private void postCommitUpdate(boolean success) {
   final EventListenerGroup<PostUpdateEventListener> listenerGroup =
       listenerGroup(EventType.POST_COMMIT_UPDATE);
   if (listenerGroup.isEmpty()) {
     return;
   }
   final PostUpdateEvent event =
       new PostUpdateEvent(
           getInstance(),
           getId(),
           state,
           previousState,
           dirtyFields,
           getPersister(),
           eventSource());
   for (PostUpdateEventListener listener : listenerGroup.listeners()) {
     if (PostCommitUpdateEventListener.class.isInstance(listener)) {
       if (success) {
         listener.onPostUpdate(event);
       } else {
         ((PostCommitUpdateEventListener) listener).onPostUpdateCommitFailed(event);
       }
     } else {
       // default to the legacy implementation that always fires the event
       listener.onPostUpdate(event);
     }
   }
 }
예제 #2
0
  @Override
  protected boolean hasPostCommitEventListeners() {
    final EventListenerGroup<PostUpdateEventListener> group =
        listenerGroup(EventType.POST_COMMIT_UPDATE);
    for (PostUpdateEventListener listener : group.listeners()) {
      if (listener.requiresPostCommitHanding(getPersister())) {
        return true;
      }
    }

    return false;
  }
예제 #3
0
 private void postUpdate() {
   final EventListenerGroup<PostUpdateEventListener> listenerGroup =
       listenerGroup(EventType.POST_UPDATE);
   if (listenerGroup.isEmpty()) {
     return;
   }
   final PostUpdateEvent event =
       new PostUpdateEvent(
           getInstance(),
           getId(),
           state,
           previousState,
           dirtyFields,
           getPersister(),
           eventSource());
   for (PostUpdateEventListener listener : listenerGroup.listeners()) {
     listener.onPostUpdate(event);
   }
 }