当前位置: 首页>>代码示例>>Java>>正文


Java EventListenerRegistry.prependListeners方法代码示例

本文整理汇总了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);
}
 
开发者ID:oehf,项目名称:ipf-flow-manager,代码行数:21,代码来源:CustomEventRegistration.java

示例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 ) );
    }
    
}
 
开发者ID:windup,项目名称:windup-rulesets,代码行数:26,代码来源:MyIntegrator.java

示例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() );
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:35,代码来源:JaccIntegrator.java

示例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());
}
 
开发者ID:ix3,项目名称:ix3,代码行数:11,代码来源:IntegratorImplRuleEngine.java


注:本文中的org.hibernate.event.service.spi.EventListenerRegistry.prependListeners方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。