Examples of CollectionChangeWorkUnit


Examples of org.hibernate.envers.synchronization.work.CollectionChangeWorkUnit

              IdMapper idMapper = verCfg.getEntCfg().get(toEntityName).getIdMapper();
                           id = (Serializable) idMapper.mapToIdFromEntity(newValue);
                      }

                        verSync.addWorkUnit(new CollectionChangeWorkUnit(session, toEntityName, verCfg, id, newValue));
                    }

                    if (oldValue != null) {
                      String toEntityName;
            Serializable id;

                      if(oldValue instanceof HibernateProxy) {
                          HibernateProxy hibernateProxy = (HibernateProxy) oldValue;
                          toEntityName = session.bestGuessEntityName(oldValue);
                          id = hibernateProxy.getHibernateLazyInitializer().getIdentifier();
              // We've got to initialize the object as we'll read it's state anyway.
              oldValue = Tools.getTargetFromProxy(session.getFactory(), hibernateProxy);
                      } else {
                        toEntityName =  session.guessEntityName(oldValue);

              IdMapper idMapper = verCfg.getEntCfg().get(toEntityName).getIdMapper();
              id = (Serializable) idMapper.mapToIdFromEntity(oldValue);
                      }
           
                        verSync.addWorkUnit(new CollectionChangeWorkUnit(session, toEntityName, verCfg, id, oldValue));
                    }
                }
            }
        }
    }
View Full Code Here

Examples of org.hibernate.envers.synchronization.work.CollectionChangeWorkUnit

           
            for (PersistentCollectionChangeData changeData : workUnit.getCollectionChanges()) {
                Object relatedObj = changeData.getChangedElement();
                Serializable relatedId = (Serializable) relatedIdMapper.mapToIdFromEntity(relatedObj);

                verSync.addWorkUnit(new CollectionChangeWorkUnit(event.getSession(), relatedEntityName, verCfg,
            relatedId, relatedObj));
            }
        }
    }
View Full Code Here

Examples of org.hibernate.envers.synchronization.work.CollectionChangeWorkUnit

          entityName, verCfg, newColl, collectionEntry, oldColl, event.getAffectedOwnerIdOrNull());
            verSync.addWorkUnit(workUnit);

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

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

Examples of org.hibernate.envers.synchronization.work.CollectionChangeWorkUnit

              IdMapper idMapper = verCfg.getEntCfg().get(toEntityName).getIdMapper();
                           id = (Serializable) idMapper.mapToIdFromEntity(newValue);
                      }

                        auditProcess.addWorkUnit(new CollectionChangeWorkUnit(session, toEntityName, verCfg, id, newValue));
                    }

                    if (oldValue != null) {
                      String toEntityName;
            Serializable id;

                      if(oldValue instanceof HibernateProxy) {
                          HibernateProxy hibernateProxy = (HibernateProxy) oldValue;
                          toEntityName = session.bestGuessEntityName(oldValue);
                          id = hibernateProxy.getHibernateLazyInitializer().getIdentifier();
              // We've got to initialize the object as we'll read it's state anyway.
              oldValue = Tools.getTargetFromProxy(session.getFactory(), hibernateProxy);
                      } else {
                        toEntityName =  session.guessEntityName(oldValue);

              IdMapper idMapper = verCfg.getEntCfg().get(toEntityName).getIdMapper();
              id = (Serializable) idMapper.mapToIdFromEntity(oldValue);
                      }
           
                        auditProcess.addWorkUnit(new CollectionChangeWorkUnit(session, toEntityName, verCfg, id, oldValue));
                    }
                }
            }
        }
    }
View Full Code Here

Examples of org.hibernate.envers.synchronization.work.CollectionChangeWorkUnit

           
            for (PersistentCollectionChangeData changeData : workUnit.getCollectionChanges()) {
                Object relatedObj = changeData.getChangedElement();
                Serializable relatedId = (Serializable) relatedIdMapper.mapToIdFromEntity(relatedObj);

                auditProcess.addWorkUnit(new CollectionChangeWorkUnit(event.getSession(), relatedEntityName, verCfg,
            relatedId, relatedObj));
            }
        }
    }
View Full Code Here

Examples of org.hibernate.envers.synchronization.work.CollectionChangeWorkUnit

            // This can be different from relatedEntityName, in case of inheritance (the real entity may be a subclass
            // of relatedEntityName).
            String realRelatedEntityName = event.getSession().bestGuessEntityName(relatedObj);

            // By default, the nested work unit is a collection change work unit.
            AuditWorkUnit nestedWorkUnit = new CollectionChangeWorkUnit(event.getSession(), realRelatedEntityName, verCfg,
                    relatedId, relatedObj);

            auditProcess.addWorkUnit(new FakeBidirectionalRelationWorkUnit(event.getSession(), realRelatedEntityName, verCfg,
                    relatedId, referencingPropertyName, event.getAffectedOwnerOrNull(), rd, revType,
                    changeData.getChangedElementIndex(), nestedWorkUnit));
        }

        // We also have to generate a collection change work unit for the owning entity.
        auditProcess.addWorkUnit(new CollectionChangeWorkUnit(event.getSession(), collectionEntityName, verCfg,
                event.getAffectedOwnerIdOrNull(), event.getAffectedOwnerOrNull()));
    }
View Full Code Here

Examples of org.hibernate.envers.synchronization.work.CollectionChangeWorkUnit

                        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.work.CollectionChangeWorkUnit

        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(),
                  referencingPropertyName,
                  getAuditConfiguration(),
                  event.getAffectedOwnerIdOrNull(),
View Full Code Here

Examples of org.hibernate.envers.synchronization.work.CollectionChangeWorkUnit

            // This can be different from relatedEntityName, in case of inheritance (the real entity may be a subclass
            // of relatedEntityName).
            String realRelatedEntityName = event.getSession().bestGuessEntityName(relatedObj);

            // By default, the nested work unit is a collection change work unit.
            AuditWorkUnit nestedWorkUnit = new CollectionChangeWorkUnit(
          event.getSession(),
          realRelatedEntityName,
          rd.getMappedByPropertyName(),
          getAuditConfiguration(),
                    relatedId,
          relatedObj
      );

            auditProcess.addWorkUnit(
          new FakeBidirectionalRelationWorkUnit(
              event.getSession(),
              realRelatedEntityName,
              getAuditConfiguration(),
              relatedId,
              referencingPropertyName,
              event.getAffectedOwnerOrNull(),
              rd,
              revType,
              changeData.getChangedElementIndex(),
              nestedWorkUnit
          )
      );
        }

        // We also have to generate a collection change work unit for the owning entity.
        auditProcess.addWorkUnit(
        new CollectionChangeWorkUnit(
            event.getSession(),
            collectionEntityName,
            referencingPropertyName,
            getAuditConfiguration(),
            event.getAffectedOwnerIdOrNull(),
View Full Code Here

Examples of org.hibernate.envers.synchronization.work.CollectionChangeWorkUnit

            for ( PersistentCollectionChangeData changeData : workUnit.getCollectionChanges() ) {
                Object relatedObj = changeData.getChangedElement();
                Serializable relatedId = (Serializable) relatedIdMapper.mapToIdFromEntity( relatedObj );

                auditProcess.addWorkUnit(
            new CollectionChangeWorkUnit(
                event.getSession(),
                event.getSession().bestGuessEntityName(relatedObj),
                toPropertyName,
                getAuditConfiguration(),
                relatedId,
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.