本文整理汇总了Java中org.hibernate.event.service.spi.EventListenerRegistry.prependListeners方法的典型用法代码示例。如果您正苦于以下问题:Java EventListenerRegistry.prependListeners方法的具体用法?Java EventListenerRegistry.prependListeners怎么用?Java EventListenerRegistry.prependListeners使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.hibernate.event.service.spi.EventListenerRegistry
的用法示例。
在下文中一共展示了EventListenerRegistry.prependListeners方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: integrate
import org.hibernate.event.service.spi.EventListenerRegistry; //导入方法依赖的package包/类
@Override
public void integrate(Metadata metadata, SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) {
EventListenerRegistry service = serviceRegistry.getService(org.hibernate.event.service.spi.EventListenerRegistry.class);
StandardPBEStringEncryptor encrypt = new StandardPBEStringEncryptor();
encrypt.setPassword("test_password");
RenderedMessageEncryptEventListener encryptListener = new RenderedMessageEncryptEventListener();
encryptListener.setStringEncryptor(encrypt);
RenderedMessageDecryptEventListener decryptListener = new RenderedMessageDecryptEventListener();
decryptListener.setStringEncryptor(encrypt);
FullTextIndexEventListener fullTextListener = new FullTextIndexEventListener();
service.appendListeners(EventType.PRE_UPDATE, encryptListener);
service.prependListeners(EventType.POST_UPDATE, decryptListener);
service.appendListeners(EventType.PRE_INSERT, encryptListener);
service.prependListeners(EventType.POST_INSERT, decryptListener);
service.appendListeners(EventType.POST_LOAD, decryptListener);
}
示例2: integrate
import org.hibernate.event.service.spi.EventListenerRegistry; //导入方法依赖的package包/类
@Override
public void integrate(org.hibernate.cfg.Configuration configuration,
org.hibernate.engine.spi.SessionFactoryImplementor sessionFactory,
org.hibernate.service.spi.SessionFactoryServiceRegistry serviceRegistry)
{
final EventListenerRegistry eventRegistry =
serviceRegistry.getService(EventListenerRegistry.class);
eventRegistry.prependListeners(EventType.POST_COMMIT_INSERT, listener);
final AuditConfiguration enversConfiguration = AuditConfiguration.getFor( configuration );
AuditStrategy auditStrategy = enversConfiguration.getAuditStrategy();
if (enversConfiguration.getEntCfg().hasAuditedEntities()) {
listenerRegistry.appendListeners( EventType.POST_DELETE, new EnversPostDeleteEventListenerImpl( enversConfiguration ) );
listenerRegistry.appendListeners( EventType.POST_INSERT, new EnversPostInsertEventListenerImpl( enversConfiguration ) );
listenerRegistry.appendListeners( EventType.POST_UPDATE, new EnversPostUpdateEventListenerImpl( enversConfiguration ) );
listenerRegistry.appendListeners( EventType.POST_COLLECTION_RECREATE, new EnversPostCollectionRecreateEventListenerImpl( enversConfiguration ) );
listenerRegistry.appendListeners( EventType.PRE_COLLECTION_REMOVE, new EnversPreCollectionRemoveEventListenerImpl( enversConfiguration ) );
listenerRegistry.appendListeners( EventType.PRE_COLLECTION_UPDATE, new EnversPreCollectionUpdateEventListenerImpl( enversConfiguration ) );
}
}
示例3: doIntegration
import org.hibernate.event.service.spi.EventListenerRegistry; //导入方法依赖的package包/类
private void doIntegration(
Map properties,
JaccPermissionDeclarations permissionDeclarations,
SessionFactoryServiceRegistry serviceRegistry) {
boolean isSecurityEnabled = properties.containsKey( AvailableSettings.JACC_ENABLED );
if ( ! isSecurityEnabled ) {
log.debug( "Skipping JACC integration as it was not enabled" );
return;
}
final String contextId = (String) properties.get( AvailableSettings.JACC_CONTEXT_ID );
if ( contextId == null ) {
throw new IntegrationException( "JACC context id must be specified" );
}
final JaccService jaccService = serviceRegistry.getService( JaccService.class );
if ( jaccService == null ) {
throw new IntegrationException( "JaccService was not set up" );
}
if ( permissionDeclarations != null ) {
for ( GrantedPermission declaration : permissionDeclarations.getPermissionDeclarations() ) {
jaccService.addPermission( declaration );
}
}
final EventListenerRegistry eventListenerRegistry = serviceRegistry.getService( EventListenerRegistry.class );
eventListenerRegistry.addDuplicationStrategy( DUPLICATION_STRATEGY );
eventListenerRegistry.prependListeners( EventType.PRE_DELETE, new JaccPreDeleteEventListener() );
eventListenerRegistry.prependListeners( EventType.PRE_INSERT, new JaccPreInsertEventListener() );
eventListenerRegistry.prependListeners( EventType.PRE_UPDATE, new JaccPreUpdateEventListener() );
eventListenerRegistry.prependListeners( EventType.PRE_LOAD, new JaccPreLoadEventListener() );
}
示例4: prependListeners
import org.hibernate.event.service.spi.EventListenerRegistry; //导入方法依赖的package包/类
private void prependListeners(EventListenerRegistry eventListenerRegistry) {
eventListenerRegistry.prependListeners(EventType.PRE_INSERT, new EventListenerImplRuleEngine());
eventListenerRegistry.prependListeners(EventType.PRE_LOAD, new EventListenerImplRuleEngine());
eventListenerRegistry.prependListeners(EventType.PRE_UPDATE, new EventListenerImplRuleEngine());
eventListenerRegistry.prependListeners(EventType.PRE_DELETE, new EventListenerImplRuleEngine());
eventListenerRegistry.prependListeners(EventType.POST_INSERT, new EventListenerImplRuleEngine());
eventListenerRegistry.prependListeners(EventType.POST_LOAD, new EventListenerImplRuleEngine());
eventListenerRegistry.prependListeners(EventType.POST_UPDATE, new EventListenerImplRuleEngine());
eventListenerRegistry.prependListeners(EventType.POST_DELETE, new EventListenerImplRuleEngine());
}