Package org.hibernate.event

Examples of org.hibernate.event.EventListeners


    propertyReferences = new ArrayList();
    secondPasses = new ArrayList();
    interceptor = EmptyInterceptor.INSTANCE;
    properties = Environment.getProperties();
    entityResolver = XMLHelper.DEFAULT_DTD_RESOLVER;
    eventListeners = new EventListeners();
    filterDefinitions = new HashMap();
//    extendsQueue = new ArrayList();
    extendsQueue = new HashMap();
    auxiliaryDatabaseObjects = new ArrayList();
    tableNameBinding = new HashMap();
View Full Code Here


        getInitializedEventListeners()
      );
  }

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

     * @throws org.hibernate.envers.exception.AuditException When the given required listeners aren't installed.
     */
    public static VersionsReader get(Session session) throws VersionsException {
        SessionImplementor sessionImpl = (SessionImplementor) session;

        EventListeners listeners = sessionImpl.getListeners();

        for (PostInsertEventListener listener : listeners.getPostInsertEventListeners()) {
            if (listener instanceof AuditEventListener) {
                if (arrayIncludesInstanceOf(listeners.getPostUpdateEventListeners(), AuditEventListener.class) &&
                        arrayIncludesInstanceOf(listeners.getPostDeleteEventListeners(), AuditEventListener.class)) {
                    return new AuditReaderImpl(((AuditEventListener) listener).getVerCfg(), session,
                            sessionImpl);
                }
            }
        }
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

      sessionImpl = (SessionImplementor) session.getSessionFactory().getCurrentSession();
    } else {
      sessionImpl = (SessionImplementor) session;
    }

        EventListeners listeners = sessionImpl.getListeners();

        for (PostInsertEventListener listener : listeners.getPostInsertEventListeners()) {
            if (listener instanceof AuditEventListener) {
                if (arrayIncludesInstanceOf(listeners.getPostUpdateEventListeners(), AuditEventListener.class) &&
                        arrayIncludesInstanceOf(listeners.getPostDeleteEventListeners(), AuditEventListener.class)) {
                    return new AuditReaderImpl(((AuditEventListener) listener).getVerCfg(), session,
                            sessionImpl);
                }
            }
        }
View Full Code Here

                    "Hibernate interceptor already set in persistence.xml ("
                                + configured.getInterceptor() + ")");
            }
        }
        if (this.postLoadEventListeners != null) {
            EventListeners el = configured.getEventListeners();
            List<PostLoadEventListener> listeners = new LinkedList(Arrays.asList(el.getPostLoadEventListeners()));
            listeners.addAll(this.postLoadEventListeners);
            el.setPostLoadEventListeners(listeners.toArray(new PostLoadEventListener[listeners.size()]));
        }
    }
View Full Code Here

    propertyReferences = new ArrayList();
    secondPasses = new ArrayList();
    interceptor = EmptyInterceptor.INSTANCE;
    properties = Environment.getProperties();
    entityResolver = XMLHelper.DEFAULT_DTD_RESOLVER;
    eventListeners = new EventListeners();
    filterDefinitions = new HashMap();
//    extendsQueue = new ArrayList();
    extendsQueue = new HashMap();
    auxiliaryDatabaseObjects = new ArrayList();
    tableNameBinding = new HashMap();
View Full Code Here

        getInitializedEventListeners()
      );
  }

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

  }

  public void injectLifecycle(SessionFactory sessionFactory, Esi4JBatchedEventProcessor batchedEventProcessor) {

    SessionFactoryImpl sessionFactoryImpl = (SessionFactoryImpl) sessionFactory;
    EventListeners eventListeners = sessionFactoryImpl.getEventListeners();

    Object listener = doCreateListener(sessionFactoryImpl, batchedEventProcessor);

    if (listener instanceof PostInsertEventListener) {
      if (registerPostCommitListeneres) {
        PostInsertEventListener[] listeners = eventListeners.getPostCommitInsertEventListeners();
        listeners = ArrayUtils.append(listeners, (PostInsertEventListener) listener);
        eventListeners.setPostCommitInsertEventListeners(listeners);
      } else {
        PostInsertEventListener[] listeners = eventListeners.getPostInsertEventListeners();
        listeners = ArrayUtils.append(listeners, (PostInsertEventListener) listener);
        eventListeners.setPostInsertEventListeners(listeners);
      }
    }

    if (listener instanceof PostUpdateEventListener) {
      if (registerPostCommitListeneres) {
        PostUpdateEventListener[] listeners = eventListeners.getPostCommitUpdateEventListeners();
        listeners = ArrayUtils.append(listeners, (PostUpdateEventListener) listener);
        eventListeners.setPostCommitUpdateEventListeners(listeners);
      } else {
        PostUpdateEventListener[] listeners = eventListeners.getPostUpdateEventListeners();
        listeners = ArrayUtils.append(listeners, (PostUpdateEventListener) listener);
        eventListeners.setPostUpdateEventListeners(listeners);
      }
    }

    if (listener instanceof PostDeleteEventListener) {
      if (registerPostCommitListeneres) {
        PostDeleteEventListener[] listeners = eventListeners.getPostCommitDeleteEventListeners();
        listeners = ArrayUtils.append(listeners, (PostDeleteEventListener) listener);
        eventListeners.setPostCommitDeleteEventListeners(listeners);
      } else {
        PostDeleteEventListener[] listeners = eventListeners.getPostDeleteEventListeners();
        listeners = ArrayUtils.append(listeners, (PostDeleteEventListener) listener);
        eventListeners.setPostDeleteEventListeners(listeners);
      }
    }

    // collections
    if (registerPostCommitListeneres) {
      return;
    }

    if (listener instanceof PostCollectionRecreateEventListener) {
      PostCollectionRecreateEventListener[] listeners = eventListeners.getPostCollectionRecreateEventListeners();
      listeners = ArrayUtils.append(listeners, (PostCollectionRecreateEventListener) listener);
      eventListeners.setPostCollectionRecreateEventListeners(listeners);
    }

    if (listener instanceof PostCollectionRemoveEventListener) {
      PostCollectionRemoveEventListener[] listeners = eventListeners.getPostCollectionRemoveEventListeners();
      listeners = ArrayUtils.append(listeners, (PostCollectionRemoveEventListener) listener);
      eventListeners.setPostCollectionRemoveEventListeners(listeners);
    }

    if (listener instanceof PostCollectionUpdateEventListener) {
      PostCollectionUpdateEventListener[] listeners = eventListeners.getPostCollectionUpdateEventListeners();
      listeners = ArrayUtils.append(listeners, (PostCollectionUpdateEventListener) listener);
      eventListeners.setPostCollectionUpdateEventListeners(listeners);
    }
  }
View Full Code Here

TOP

Related Classes of org.hibernate.event.EventListeners

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.