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

项目:lams    文件:EntityInsertAction.java   
private void postInsert() {
    final EventListenerGroup<PostInsertEventListener> listenerGroup = listenerGroup( EventType.POST_INSERT );
    if ( listenerGroup.isEmpty() ) {
        return;
    }
    final PostInsertEvent event = new PostInsertEvent(
            getInstance(),
            getId(),
            getState(),
            getPersister(),
            eventSource()
    );
    for ( PostInsertEventListener listener : listenerGroup.listeners() ) {
        listener.onPostInsert( event );
    }
}
项目:lams    文件:EntityIdentityInsertAction.java   
private void postInsert() {
    if ( isDelayed ) {
        getSession().getPersistenceContext().replaceDelayedEntityIdentityInsertKeys( delayedEntityKey, generatedId );
    }

    final EventListenerGroup<PostInsertEventListener> listenerGroup = listenerGroup( EventType.POST_INSERT );
    if ( listenerGroup.isEmpty() ) {
        return;
    }
    final PostInsertEvent event = new PostInsertEvent(
            getInstance(),
            generatedId,
            getState(),
            getPersister(),
            eventSource()
    );
    for ( PostInsertEventListener listener : listenerGroup.listeners() ) {
        listener.onPostInsert( event );
    }
}
项目:mojito    文件:EntityCrudEventListener.java   
@Override
public void onPostInsert(PostInsertEvent 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 added");
    } else if (entity instanceof TMTextUnitVariant) {
        TMTextUnitVariant tmTextUnitVariant = (TMTextUnitVariant) entity;
        TMTextUnit tmTextUnit = tmTextUnitVariant.getTmTextUnit();
        repository = tmTextUnit.getAsset().getRepository();
        logger.debug("Repository statistics is outdated because string/translation is added");
    }

    setRepositoryStatistisOutOfDate(repository);
}
项目:lams    文件:EntityInsertAction.java   
private void postCommitInsert(boolean success) {
    final EventListenerGroup<PostInsertEventListener> listenerGroup = listenerGroup( EventType.POST_COMMIT_INSERT );
    if ( listenerGroup.isEmpty() ) {
        return;
    }
    final PostInsertEvent event = new PostInsertEvent(
            getInstance(),
            getId(),
            getState(),
            getPersister(),
            eventSource()
    );
    for ( PostInsertEventListener listener : listenerGroup.listeners() ) {
        if ( PostCommitInsertEventListener.class.isInstance( listener ) ) {
            if ( success ) {
                listener.onPostInsert( event );
            }
            else {
                ((PostCommitInsertEventListener) listener).onPostInsertCommitFailed( event );
            }
        }
        else {
            //default to the legacy implementation that always fires the event
            listener.onPostInsert( event );
        }
    }
}
项目:lams    文件:EntityIdentityInsertAction.java   
private void postCommitInsert(boolean success) {
    final EventListenerGroup<PostInsertEventListener> listenerGroup = listenerGroup( EventType.POST_COMMIT_INSERT );
    if ( listenerGroup.isEmpty() ) {
        return;
    }
    final PostInsertEvent event = new PostInsertEvent(
            getInstance(),
            generatedId,
            getState(),
            getPersister(),
            eventSource()
    );
    for ( PostInsertEventListener listener : listenerGroup.listeners() ) {
        if ( PostCommitInsertEventListener.class.isInstance( listener ) ) {
            if ( success ) {
                listener.onPostInsert( event );
            }
            else {
                ((PostCommitInsertEventListener) listener).onPostInsertCommitFailed( event );
            }
        }
        else {
            //default to the legacy implementation that always fires the event
            listener.onPostInsert( event );
        }
    }
}
项目:Audit4j-Hibernate    文件:AuditPostInsertEventListenerImpl.java   
@Override
public void onPostInsert(PostInsertEvent event) {
    // TODO
    // Repository check, get from Audit annotation, get from entoity table
    // name.

    if (event.getEntity().getClass().isAnnotationPresent(Audit.class)) {
        if (event.getEntity().getClass().isAnnotationPresent(Table.class)) {

        }
        AuditManager.getInstance().audit(new EventBuilder()
                .addAction("save " + event.getEntity().getClass().toString())
                .addField(event.getEntity().getClass().toString(), event.getEntity()).build());
    }
}
项目:cibet    文件:CibetPostInsertEventListener.java   
public void onPostInsert(PostInsertEvent event) {
   String entityName = event.getPersister().getEntityName();
   if (!Context.internalRequestScope().isAuditedByEnvers()) {
      log.debug(entityName + " NOT audited by Cibet configuration");
      return;
   } else {
      log.debug(entityName + " audited by Cibet configuration");
   }

   super.onPostInsert(event);
}
项目:bygle-ldp    文件:DBEventInsertListener.java   
@Override
public void onPostInsert(PostInsertEvent arg0) {
    if (arg0.getEntity() instanceof Records) {
        Records records = (Records) arg0.getEntity();
        try {
            if (records.getRecordTypes().getIdRecordType() != BygleSystemUtils.RESOURCE_TYPE_BINARY) {
                EndPointManagerInterface endPointManager = endPointManagerProvider.getEndPointManager();
                endPointManager.publishRecord(records.getRdf(), records.getRdfAbout(), records.getHost());
            }
        } catch (Exception e) {
            e.printStackTrace();
        }

    }
}
项目:Hibernate-Search-GenericJPA    文件:HibernateUpdateSource.java   
@Override
public void onPostInsert(PostInsertEvent event) {
    if ( disabled ) {
        return;
    }

    final Object entity = event.getEntity();
    if ( getDocumentBuilder( entity ) != null ) {
        Serializable id = event.getId();
        processWork( entity, id, WorkType.ADD, event, false );
    }
}
项目:lams    文件:CollectionCacheInvalidator.java   
@Override
public void onPostInsert(PostInsertEvent event) {
    evictCache( event.getEntity(), event.getPersister(), event.getSession(), null );
}
项目:rpb    文件:AuditLogListener.java   
@Override
public void onPostInsert(PostInsertEvent event) {
    audit(event, Creation, event.getEntity());
}
项目:mojito    文件:EntityCrudEventListener.java   
@Override
public void onPostInsertCommitFailed(PostInsertEvent pie) {
}
项目:UMLS-Terminology-Server    文件:EmptyEnversPostInsertEventListenerImpl.java   
@Override
public void onPostInsert(PostInsertEvent event) {
  // Do Nothing
}
项目:rpb    文件:AuditLogListener.java   
@Override
public void onPostInsert(PostInsertEvent event) {
    audit(event, Creation, event.getEntity());
}
项目:AgileAlligators    文件:HibernateEventListenerWiring.java   
@Override
public void onPostInsert( PostInsertEvent event )
{
    updateIdentifiableObjects();
}
项目:spring-entity-listener    文件:HibernateEntityListenersAdapter.java   
/**
 * @see org.hibernate.event.spi.PostInsertEventListener#onPostInsert(org.hibernate
 *      .event.spi.PostInsertEvent)
 */
@Override
public void onPostInsert(PostInsertEvent event) {
    execute(postInsert, event.getEntity());
}
项目:hibernate-examples    文件:PersistentObjectListener.java   
@Override
public void onPostInsert(PostInsertEvent event) {
    if (event.getEntity() instanceof PersistentObject) {
        ((PersistentObject) event.getEntity()).onSave();
    }
}
项目:ix3    文件:EventListenerImplRuleEngine.java   
@Override
public void onPostInsert(PostInsertEvent pie) {
    autowired();
    EntityMode entityMode = pie.getPersister().getEntityMode();

    RuleContext ruleContext = new RuleContextImplNoPrincipal(pie.getEntity(), null);

    fireRules(ruleContext, pie.getPersister(), pie.getState(), entityMode, RuleGroupPredefined.PostInsert.class, RuleGroupPredefined.PostInsertOrUpdate.class, RuleGroupPredefined.PostInsertOrUpdateOrDelete.class);

}
项目:jersey2-toolkit    文件:HibernateSessionFactoryFactoryTest.java   
@Override
public void onPostInsert(final PostInsertEvent event) {

}
项目:jersey2-toolkit    文件:HibernateSessionFactoryFactoryTest.java   
@Override
public void onPostInsertCommitFailed(final PostInsertEvent event) {

}