Package org.hibernate.event

Examples of org.hibernate.event.EventListeners$ListenerProcesser


          Assert.isTrue(entry.getKey() instanceof String, "Event listener key needs to be of type String");
          String listenerType = (String) entry.getKey();
          Object listenerObject = entry.getValue();
          if (listenerObject instanceof Collection) {
            Collection listeners = (Collection) listenerObject;
            EventListeners listenerRegistry = config.getEventListeners();
            Object[] listenerArray =
                (Object[]) Array.newInstance(listenerRegistry.getListenerClassFor(listenerType), listeners.size());
            listenerArray = listeners.toArray(listenerArray);
            config.setListeners(listenerType, listenerArray);
          }
          else {
            config.setListener(listenerType, listenerObject);
View Full Code Here


          Assert.isTrue(entry.getKey() instanceof String, "Event listener key needs to be of type String");
          String listenerType = (String) entry.getKey();
          Object listenerObject = entry.getValue();
          if (listenerObject instanceof Collection) {
            Collection listeners = (Collection) listenerObject;
            EventListeners listenerRegistry = config.getEventListeners();
            Object[] listenerArray =
                (Object[]) Array.newInstance(listenerRegistry.getListenerClassFor(listenerType), listeners.size());
            listenerArray = listeners.toArray(listenerArray);
            config.setListeners(listenerType, listenerArray);
          }
          else {
            config.setListener(listenerType, listenerObject);
View Full Code Here

          Assert.isTrue(entry.getKey() instanceof String, "Event listener key needs to be of type String");
          String listenerType = (String) entry.getKey();
          Object listenerObject = entry.getValue();
          if (listenerObject instanceof Collection) {
            Collection listeners = (Collection) listenerObject;
            EventListeners listenerRegistry = config.getEventListeners();
            Object[] listenerArray =
                (Object[]) Array.newInstance(listenerRegistry.getListenerClassFor(listenerType), listeners.size());
            listenerArray = listeners.toArray(listenerArray);
            config.setListeners(listenerType, listenerArray);
          }
          else {
            config.setListener(listenerType, listenerObject);
View Full Code Here

    namingStrategy = DefaultNamingStrategy.INSTANCE;
    xmlHelper = new XMLHelper();
    interceptor = EmptyInterceptor.INSTANCE;
    properties = Environment.getProperties();
    entityResolver = XMLHelper.DEFAULT_DTD_RESOLVER;
    eventListeners = new EventListeners();

    sqlFunctions = new HashMap();

    entityTuplizerFactory = new EntityTuplizerFactory();
//    componentTuplizerFactory = new ComponentTuplizerFactory();
View Full Code Here

        sessionFactoryObserver
      );
  }

  private EventListeners getInitializedEventListeners() {
    EventListeners result = (EventListeners) eventListeners.shallowCopy();
    result.initializeListeners( this );
    return result;
  }
View Full Code Here

    EventListenerRegister.enableHibernateSearch( evListeners, makeConfiguration( false ) );
    assertPresence( false, evListeners );
  }
 
  public void testRegisterOnEmptyListeners_CfgEnabled() {
    EventListeners evListeners = new EventListeners();
    //tests registering multiple times is idempotent:
    EventListenerRegister.enableHibernateSearch( evListeners, makeConfiguration( true ) );
    EventListenerRegister.enableHibernateSearch( evListeners, makeConfiguration( true ) );
    assertPresence( true, evListeners );
  }
View Full Code Here

    EventListenerRegister.enableHibernateSearch( evListeners, makeConfiguration( true ) );
    assertPresence( true, evListeners );
  }
 
  public void testRegisterOnEmptyListeners_CfgAuto() {
    EventListeners evListeners = new EventListeners();
    EventListenerRegister.enableHibernateSearch( evListeners, new Properties() );
    EventListenerRegister.enableHibernateSearch( evListeners, new Properties() );
    assertPresence( true, evListeners );
  }
View Full Code Here

  public void testOnAlreadyRegisteredDeprecated() {
    helperOnAlreadyRegistered( new FullTextIndexCollectionEventListener() );
  }
 
  public void testOnPopulatedEventListeners() {
    EventListeners evListeners = makeSomeEventListeners();
    EventListenerRegister.enableHibernateSearch( evListeners, new Properties() );
    EventListenerRegister.enableHibernateSearch( evListeners, new Properties() );
    assertPresence( true, evListeners );
  }
View Full Code Here

  private void helperOnAlreadyRegistered(FullTextIndexEventListener listenerFullText) {
   
    AnotherListener listenerA = new AnotherListener();
    AnotherListener listenerB = new AnotherListener();
   
    EventListeners evListeners = new EventListeners();
    evListeners.setPostInsertEventListeners(
        new PostInsertEventListener[]{ listenerA, listenerB, listenerFullText }  );
    evListeners.setPostUpdateEventListeners(
        new PostUpdateEventListener[]{ listenerA, listenerB, listenerFullText } );
    evListeners.setPostDeleteEventListeners(
        new PostDeleteEventListener[]{ listenerA, listenerB, listenerFullText } );
    evListeners.setPostCollectionRecreateEventListeners(
        new PostCollectionRecreateEventListener[]{ listenerA, listenerB, listenerFullText } );
    evListeners.setPostCollectionRemoveEventListeners(
        new PostCollectionRemoveEventListener[]{ listenerA, listenerB, listenerFullText } );
    evListeners.setPostCollectionUpdateEventListeners(
        new PostCollectionUpdateEventListener[]{ listenerA, listenerB, listenerFullText } );
   
    EventListenerRegister.enableHibernateSearch( evListeners, makeConfiguration( false ) );
    EventListenerRegister.enableHibernateSearch( evListeners, makeConfiguration( false ) );
    EventListenerRegister.enableHibernateSearch( evListeners, makeConfiguration( false ) );
View Full Code Here

   
    AnotherListener listenerA = new AnotherListener();
    AnotherListener listenerB = new AnotherListener();
    AnotherListener listenerC = new AnotherListener();
   
    EventListeners evListeners = new EventListeners();
    evListeners.setPostInsertEventListeners(
        new PostInsertEventListener[]{ listenerA, listenerB, listenerC }  );
    evListeners.setPostUpdateEventListeners(
        new PostUpdateEventListener[]{ listenerA, listenerB, listenerC } );
    evListeners.setPostDeleteEventListeners(
        new PostDeleteEventListener[]{ listenerA, listenerB, listenerC } );
    evListeners.setPostCollectionRecreateEventListeners(
        new PostCollectionRecreateEventListener[]{ listenerA, listenerB, listenerC } );
    evListeners.setPostCollectionRemoveEventListeners(
        new PostCollectionRemoveEventListener[]{ listenerA, listenerB, listenerC } );
    evListeners.setPostCollectionUpdateEventListeners(
        new PostCollectionUpdateEventListener[]{ listenerA, listenerB, listenerC } );
   
    return evListeners;
  }
View Full Code Here

TOP

Related Classes of org.hibernate.event.EventListeners$ListenerProcesser

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.