org.hibernate.event.spi.PostUpdateEvent Java Examples
The following examples show how to use
org.hibernate.event.spi.PostUpdateEvent.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EntityUpdateAction.java From lams with GNU General Public License v2.0 | 6 votes |
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 ); } }
Example #2
Source File: EntityCrudEventListener.java From mojito with Apache License 2.0 | 6 votes |
@Override public void onPostUpdate(PostUpdateEvent event) { Repository repository = null; Object entity = event.getEntity(); if (entity instanceof RepositoryLocale) { RepositoryLocale repositoryLocale = (RepositoryLocale) entity; repository = repositoryLocale.getRepository(); logger.debug("Repository statistics is outdated because locale is updated"); } else if (entity instanceof Asset) { Asset asset = (Asset) entity; repository = asset.getRepository(); logger.debug("Repository statistics is outdated because asset is updated"); } setRepositoryStatistisOutOfDate(repository); }
Example #3
Source File: EntityUpdateAction.java From lams with GNU General Public License v2.0 | 5 votes |
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 ); } } }
Example #4
Source File: PostUpdateAuditListener.java From dhis2-core with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public void onPostUpdate( PostUpdateEvent postUpdateEvent ) { Object entity = postUpdateEvent.getEntity(); getAuditable( entity, "update" ).ifPresent( auditable -> auditManager.send( Audit.builder() .auditType( getAuditType() ) .auditScope( auditable.scope() ) .createdAt( LocalDateTime.now() ) .createdBy( getCreatedBy() ) .object( entity ) .auditableEntity( new AuditableEntity( entity ) ) .build() ) ); }
Example #5
Source File: CollectionCacheInvalidator.java From lams with GNU General Public License v2.0 | 4 votes |
@Override public void onPostUpdate(PostUpdateEvent event) { evictCache( event.getEntity(), event.getPersister(), event.getSession(), event.getOldState() ); }
Example #6
Source File: PostUpdateEventListenerStandardImpl.java From lams with GNU General Public License v2.0 | 4 votes |
@Override public void onPostUpdate(PostUpdateEvent event) { Object entity = event.getEntity(); EventSource eventSource = event.getSession(); handlePostUpdate(entity, eventSource); }
Example #7
Source File: EntityCrudEventListener.java From mojito with Apache License 2.0 | 4 votes |
@Override public void onPostUpdateCommitFailed(PostUpdateEvent pue) { }
Example #8
Source File: ClosureEventTriggeringInterceptor.java From gorm-hibernate5 with Apache License 2.0 | 4 votes |
public void onPostUpdate(PostUpdateEvent hibernateEvent) { Object entity = hibernateEvent.getEntity(); activateDirtyChecking(entity); publishEvent(hibernateEvent, new org.grails.datastore.mapping.engine.event.PostUpdateEvent( this.datastore, entity)); }
Example #9
Source File: PostUpdateAuditListener.java From dhis2-core with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public void onPostUpdateCommitFailed( PostUpdateEvent event ) { log.warn( "onPostUpdateCommitFailed: " + event ); }