Examples of RelationDescription


Examples of org.hibernate.envers.entities.RelationDescription

     * @return A found relation description corresponding to the given entity or {@code null}, if no description can
     * be found.
     */
    private RelationDescription searchForRelationDescription(String entityName, String referencingPropertyName) {
        EntityConfiguration configuration = getAuditConfiguration().getEntCfg().get( entityName );
        RelationDescription rd = configuration.getRelationDescription(referencingPropertyName);
        if ( rd == null && configuration.getParentEntityName() != null ) {
            return searchForRelationDescription( configuration.getParentEntityName(), referencingPropertyName );
        }

        return rd;
View Full Code Here

Examples of org.hibernate.envers.entities.RelationDescription

            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,
View Full Code Here

Examples of org.hibernate.envers.entities.RelationDescription

     * @return A found relation description corresponding to the given entity or {@code null}, if no description can
     * be found.
     */
    private RelationDescription searchForRelationDescription(String entityName, String referencingPropertyName) {
        EntityConfiguration configuration = getAuditConfiguration().getEntCfg().get( entityName );
        RelationDescription rd = configuration.getRelationDescription(referencingPropertyName);
        if ( rd == null && configuration.getParentEntityName() != null ) {
            return searchForRelationDescription( configuration.getParentEntityName(), referencingPropertyName );
        }

        return rd;
View Full Code Here

Examples of org.hibernate.envers.entities.RelationDescription

    // for the related entity is generated.
    String[] propertyNames = entityPersister.getPropertyNames();

    for ( int i=0; i<propertyNames.length; i++ ) {
      String propertyName = propertyNames[i];
      RelationDescription relDesc = enversConfiguration.getEntCfg().getRelationDescription(entityName, propertyName);
      if (relDesc != null && relDesc.isBidirectional() && relDesc.getRelationType() == RelationType.TO_ONE &&
          relDesc.isInsertable()) {
        // Checking for changes
        Object oldValue = oldState == null ? null : oldState[i];
        Object newValue = newState == null ? null : newState[i];

        if (!Tools.entitiesEqual( session, relDesc.getToEntityName(), oldValue, newValue )) {
          // We have to generate changes both in the old collection (size decreses) and new collection
          // (size increases).
          if (newValue != null) {
            // relDesc.getToEntityName() doesn't always return the entity name of the value - in case
            // of subclasses, this will be root class, no the actual class. So it can't be used here.
View Full Code Here

Examples of org.hibernate.envers.entities.RelationDescription

    }

    public void addToQuery(AuditConfiguration auditCfg, String entityName, QueryBuilder qb, Parameters parameters) {
        String propertyName = propertyNameGetter.get(auditCfg);
       
        RelationDescription relatedEntity = CriteriaTools.getRelatedEntity(auditCfg, entityName, propertyName);

        if (relatedEntity == null) {
            throw new AuditException("This criterion can only be used on a property that is " +
                    "a relation to another property.");
        } else {
            relatedEntity.getIdMapper().addIdEqualsToQuery(parameters, id, propertyName, equals);
        }
    }
View Full Code Here

Examples of org.hibernate.envers.entities.RelationDescription

    }

    public void addToQuery(AuditConfiguration auditCfg, String entityName, QueryBuilder qb, Parameters parameters) {
        String propertyName = propertyNameGetter.get(auditCfg);

        RelationDescription relatedEntity = CriteriaTools.getRelatedEntity(auditCfg, entityName, propertyName);

        if (relatedEntity == null) {
            parameters.addWhereWithParam(propertyName, op, value);
        } else {
            if (!"=".equals(op) && !"<>".equals(op)) {
                throw new AuditException("This type of operation: " + op + " (" + entityName + "." + propertyName +
                        ") isn't supported and can't be used in queries.");
            }

            Object id = relatedEntity.getIdMapper().mapToIdFromEntity(value);

            relatedEntity.getIdMapper().addIdEqualsToQuery(parameters, id, propertyName, "=".equals(op));
        }
    }
View Full Code Here

Examples of org.hibernate.envers.entities.RelationDescription

        this.propertyNameGetter = propertyNameGetter;
    }

    public void addToQuery(AuditConfiguration auditCfg, String entityName, QueryBuilder qb, Parameters parameters) {
        String propertyName = propertyNameGetter.get(auditCfg);
        RelationDescription relatedEntity = CriteriaTools.getRelatedEntity(auditCfg, entityName, propertyName);

        if (relatedEntity == null) {
            parameters.addWhereWithParam(propertyName, "<>", null);
        } else {
            relatedEntity.getIdMapper().addIdEqualsToQuery(parameters, null, propertyName, false);
        }
    }
View Full Code Here

Examples of org.hibernate.envers.entities.RelationDescription

        this.propertyNameGetter = propertyNameGetter;
    }

    public void addToQuery(AuditConfiguration auditCfg, String entityName, QueryBuilder qb, Parameters parameters) {
        String propertyName = propertyNameGetter.get(auditCfg);
        RelationDescription relatedEntity = CriteriaTools.getRelatedEntity(auditCfg, entityName, propertyName);

        if (relatedEntity == null) {
            parameters.addWhereWithParam(propertyName, "=", null);
        } else {
            relatedEntity.getIdMapper().addIdEqualsToQuery(parameters, null, propertyName, true);
        }
    }
View Full Code Here

Examples of org.hibernate.envers.entities.RelationDescription

    // for the related entity is generated.
    String[] propertyNames = entityPersister.getPropertyNames();

    for ( int i=0; i<propertyNames.length; i++ ) {
      String propertyName = propertyNames[i];
      RelationDescription relDesc = enversConfiguration.getEntCfg().getRelationDescription(entityName, propertyName);
      if (relDesc != null && relDesc.isBidirectional() && relDesc.getRelationType() == RelationType.TO_ONE &&
          relDesc.isInsertable()) {
        // Checking for changes
        Object oldValue = oldState == null ? null : oldState[i];
        Object newValue = newState == null ? null : newState[i];

        if (!Tools.entitiesEqual( session, relDesc.getToEntityName(), oldValue, newValue )) {
          // We have to generate changes both in the old collection (size decreses) and new collection
          // (size increases).
          if (newValue != null) {
            addCollectionChangeWorkUnit(auditProcess, session, entityName, relDesc, newValue);
          }
View Full Code Here

Examples of org.hibernate.envers.entities.RelationDescription

            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,
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.