Examples of AuditProcess


Examples of org.hibernate.envers.synchronization.AuditProcess

    private void onCollectionAction(AbstractCollectionEvent event, PersistentCollection newColl, Serializable oldColl,
                                    CollectionEntry collectionEntry) {
        String entityName = event.getAffectedOwnerEntityName();

        if (verCfg.getEntCfg().isVersioned(entityName)) {
            AuditProcess auditProcess = verCfg.getSyncManager().get(event.getSession());

            String ownerEntityName = ((AbstractCollectionPersister) collectionEntry.getLoadedPersister()).getOwnerEntityName();
            String referencingPropertyName = collectionEntry.getRole().substring(ownerEntityName.length() + 1);

            // Checking if this is not a "fake" many-to-one bidirectional relation. The relation description may be
            // null in case of collections of non-entities.
            RelationDescription rd = verCfg.getEntCfg().get(entityName).getRelationDescription(referencingPropertyName);
            if (rd != null && rd.getMappedByPropertyName() != null) {
                generateFakeBidirecationalRelationWorkUnits(auditProcess, newColl, oldColl, entityName,
                        referencingPropertyName, event, rd);
            } else {
                PersistentCollectionChangeWorkUnit workUnit = new PersistentCollectionChangeWorkUnit(event.getSession(),
                        entityName, verCfg, newColl, collectionEntry, oldColl, event.getAffectedOwnerIdOrNull(),
                        referencingPropertyName);
                auditProcess.addWorkUnit(workUnit);

                if (workUnit.containsWork()) {
                    // There are some changes: a revision needs also be generated for the collection owner
                    auditProcess.addWorkUnit(new CollectionChangeWorkUnit(event.getSession(), event.getAffectedOwnerEntityName(),
                            verCfg, event.getAffectedOwnerIdOrNull(), event.getAffectedOwnerOrNull()));

                    generateBidirectionalCollectionChangeWorkUnits(auditProcess, event, workUnit, rd);
                }
            }
View Full Code Here

Examples of org.hibernate.envers.synchronization.AuditProcess

    if (!(session instanceof EventSource)) {
      throw new IllegalArgumentException("The provided session is not an EventSource!");
    }

    // Obtaining the current audit sync
    AuditProcess auditProcess = verCfg.getSyncManager().get((EventSource) session);

    // And getting the current revision data
    return (T) auditProcess.getCurrentRevisionData(session, persist);
  }
View Full Code Here

Examples of org.hibernate.envers.synchronization.AuditProcess

  @Override
  public void onPostDelete(PostDeleteEvent event) {
        String entityName = event.getPersister().getEntityName();

        if ( getAuditConfiguration().getEntCfg().isVersioned( entityName ) ) {
            AuditProcess auditProcess = getAuditConfiguration().getSyncManager().get( event.getSession() );

            AuditWorkUnit workUnit = new DelWorkUnit(
          event.getSession(),
          event.getPersister().getEntityName(),
          getAuditConfiguration(),
                    event.getId(),
          event.getPersister(),
          event.getDeletedState()
      );
            auditProcess.addWorkUnit( workUnit );

            if ( workUnit.containsWork() ) {
                generateBidirectionalCollectionChangeWorkUnits(
            auditProcess,
            event.getPersister(),
View Full Code Here

Examples of org.hibernate.envers.synchronization.AuditProcess

    if (!(session instanceof EventSource)) {
      throw new IllegalArgumentException("The provided session is not an EventSource!");
    }

    // Obtaining the current audit sync
    AuditProcess auditProcess = verCfg.getSyncManager().get((EventSource) session);

    // And getting the current revision data
    return (T) auditProcess.getCurrentRevisionData(session, persist);
  }
View Full Code Here

Examples of org.hibernate.envers.synchronization.AuditProcess

        String entityName = event.getAffectedOwnerEntityName();
        if ( ! getAuditConfiguration().getGlobalCfg().isGenerateRevisionsForCollections() ) {
            return;
        }
        if ( getAuditConfiguration().getEntCfg().isVersioned( entityName ) ) {
            AuditProcess auditProcess = getAuditConfiguration().getSyncManager().get(event.getSession());

            String ownerEntityName = ((AbstractCollectionPersister) collectionEntry.getLoadedPersister()).getOwnerEntityName();
            String referencingPropertyName = collectionEntry.getRole().substring(ownerEntityName.length() + 1);

            // Checking if this is not a "fake" many-to-one bidirectional relation. The relation description may be
            // null in case of collections of non-entities.
            RelationDescription rd = searchForRelationDescription( entityName, referencingPropertyName );
            if ( rd != null && rd.getMappedByPropertyName() != null ) {
                generateFakeBidirecationalRelationWorkUnits(
            auditProcess,
            newColl,
            oldColl,
            entityName,
                        referencingPropertyName,
            event,
            rd
        );
            }
      else {
                PersistentCollectionChangeWorkUnit workUnit = new PersistentCollectionChangeWorkUnit(
            event.getSession(),
            entityName,
            getAuditConfiguration(),
            newColl,
            collectionEntry,
            oldColl,
            event.getAffectedOwnerIdOrNull(),
            referencingPropertyName
        );
        auditProcess.addWorkUnit( workUnit );

                if (workUnit.containsWork()) {
                    // There are some changes: a revision needs also be generated for the collection owner
                    auditProcess.addWorkUnit(
              new CollectionChangeWorkUnit(
                  event.getSession(),
                  event.getAffectedOwnerEntityName(),
                  getAuditConfiguration(),
                  event.getAffectedOwnerIdOrNull(),
View Full Code Here

Examples of org.hibernate.envers.synchronization.AuditProcess

    public void onPostInsert(PostInsertEvent event) {
        String entityName = event.getPersister().getEntityName();

        if ( getAuditConfiguration().getEntCfg().isVersioned( entityName ) ) {
            AuditProcess auditProcess = getAuditConfiguration().getSyncManager().get(event.getSession());

            AuditWorkUnit workUnit = new AddWorkUnit(
          event.getSession(),
          event.getPersister().getEntityName(),
          getAuditConfiguration(),
                    event.getId(),
          event.getPersister(),
          event.getState()
      );
            auditProcess.addWorkUnit( workUnit );

            if ( workUnit.containsWork() ) {
                generateBidirectionalCollectionChangeWorkUnits(
            auditProcess,
            event.getPersister(),
View Full Code Here

Examples of org.hibernate.envers.synchronization.AuditProcess

  @Override
  public void onPostUpdate(PostUpdateEvent event) {
        String entityName = event.getPersister().getEntityName();

        if ( getAuditConfiguration().getEntCfg().isVersioned(entityName) ) {
            AuditProcess auditProcess = getAuditConfiguration().getSyncManager().get(event.getSession());

            AuditWorkUnit workUnit = new ModWorkUnit(
          event.getSession(),
          event.getPersister().getEntityName(),
          getAuditConfiguration(),
                    event.getId(),
          event.getPersister(),
          event.getState(),
          event.getOldState()
      );
            auditProcess.addWorkUnit( workUnit );

            if ( workUnit.containsWork() ) {
                generateBidirectionalCollectionChangeWorkUnits(
            auditProcess,
            event.getPersister(),
View Full Code Here

Examples of org.hibernate.envers.synchronization.AuditProcess

    if (!(session instanceof EventSource)) {
      throw new IllegalArgumentException("The provided session is not an EventSource!");
    }

    // Obtaining the current audit sync
    AuditProcess auditProcess = verCfg.getSyncManager().get((EventSource) session);

    // And getting the current revision data
    return (T) auditProcess.getCurrentRevisionData(session, persist);
  }
View Full Code Here

Examples of org.hibernate.envers.synchronization.AuditProcess

        String entityName = event.getAffectedOwnerEntityName();
        if ( ! getAuditConfiguration().getGlobalCfg().isGenerateRevisionsForCollections() ) {
            return;
        }
        if ( getAuditConfiguration().getEntCfg().isVersioned( entityName ) ) {
            AuditProcess auditProcess = getAuditConfiguration().getSyncManager().get(event.getSession());

            String ownerEntityName = ((AbstractCollectionPersister) collectionEntry.getLoadedPersister()).getOwnerEntityName();
            String referencingPropertyName = collectionEntry.getRole().substring(ownerEntityName.length() + 1);

            // Checking if this is not a "fake" many-to-one bidirectional relation. The relation description may be
            // null in case of collections of non-entities.
            RelationDescription rd = searchForRelationDescription( entityName, referencingPropertyName );
            if ( rd != null && rd.getMappedByPropertyName() != null ) {
                generateFakeBidirecationalRelationWorkUnits(
            auditProcess,
            newColl,
            oldColl,
            entityName,
                        referencingPropertyName,
            event,
            rd
        );
            }
      else {
                PersistentCollectionChangeWorkUnit workUnit = new PersistentCollectionChangeWorkUnit(
            event.getSession(),
            entityName,
            getAuditConfiguration(),
            newColl,
            collectionEntry,
            oldColl,
            event.getAffectedOwnerIdOrNull(),
            referencingPropertyName
        );
        auditProcess.addWorkUnit( workUnit );

                if (workUnit.containsWork()) {
                    // There are some changes: a revision needs also be generated for the collection owner
                    auditProcess.addWorkUnit(
              new CollectionChangeWorkUnit(
                  event.getSession(),
                  event.getAffectedOwnerEntityName(),
                  getAuditConfiguration(),
                  event.getAffectedOwnerIdOrNull(),
View Full Code Here

Examples of org.hibernate.envers.synchronization.AuditProcess

    if (!(session instanceof EventSource)) {
      throw new IllegalArgumentException("The provided session is not an EventSource!");
    }

    // Obtaining the current audit sync
    AuditProcess auditProcess = verCfg.getSyncManager().get((EventSource) session);

    // And getting the current revision data
    return (T) auditProcess.getCurrentRevisionData(session, persist);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.