Package org.hibernate.envers.internal.entities

Examples of org.hibernate.envers.internal.entities.PropertyData


        propertyAuditingData.getName(), referencedEntityName, relMapper, insertable,
        MappingTools.ignoreNotFound( value )
    );

    // Adding mapper for the id
    final PropertyData propertyData = propertyAuditingData.getPropertyData();
    mapper.addComposite(
        propertyData,
        new OneToOnePrimaryKeyJoinColumnMapper( entityName, referencedEntityName, propertyData )
    );
  }
View Full Code Here


      fakeBidirectionalRelationMapper = new ToOneIdMapper(
          relMapper,
          // The mapper will only be used to map from entity to map, so no need to provide other details
          // when constructing the PropertyData.
          new PropertyData( auditMappedBy, null, null, null ),
          referencingEntityName, false
      );

      // Checking if there's an index defined. If so, adding a mapper for it.
      if ( propertyAuditingData.getPositionMappedBy() != null ) {
        final String positionMappedBy = propertyAuditingData.getPositionMappedBy();
        fakeBidirectionalRelationIndexMapper = new SinglePropertyMapper(
            new PropertyData(
                positionMappedBy,
                null,
                null,
                null
            )
View Full Code Here

    return new IdMappingData( mapper, origIdMapping, relIdMapping );
  }

  private PropertyData getIdPropertyData(Property property) {
    return new PropertyData(
        property.getName(), property.getName(), property.getPropertyAccessorName(),
        ModificationStore.FULL
    );
  }
View Full Code Here

      revisionInfoEntityName = "org.hibernate.envers.DefaultRevisionEntity";
    }
    else {
      revisionInfoEntityName = "org.hibernate.envers.enhanced.SequenceIdRevisionEntity";
    }
    revisionInfoIdData = new PropertyData( "id", "id", "field", null );
    revisionInfoTimestampData = new PropertyData( "timestamp", "timestamp", "field", null );
    modifiedEntityNamesData = new PropertyData( "modifiedEntityNames", "modifiedEntityNames", "field", null );
    revisionInfoTimestampType = new LongType();

    revisionPropType = "integer";
  }
View Full Code Here

        }

        final XClass revisionNumberClass = property.getType();
        if ( reflectionManager.equals( revisionNumberClass, Integer.class ) ||
            reflectionManager.equals( revisionNumberClass, Integer.TYPE ) ) {
          revisionInfoIdData = new PropertyData( property.getName(), property.getName(), accessType, null );
          revisionNumberFound.set();
        }
        else if ( reflectionManager.equals( revisionNumberClass, Long.class ) ||
            reflectionManager.equals( revisionNumberClass, Long.TYPE ) ) {
          revisionInfoIdData = new PropertyData( property.getName(), property.getName(), accessType, null );
          revisionNumberFound.set();

          // The default is integer
          revisionPropType = "long";
        }
        else {
          throw new MappingException(
              "The field annotated with @RevisionNumber must be of type " +
                  "int, Integer, long or Long"
          );
        }

        // Getting the @Column definition of the revision number property, to later use that info to
        // generate the same mapping for the relation from an audit table's revision number to the
        // revision entity revision number.
        final Column revisionPropColumn = property.getAnnotation( Column.class );
        if ( revisionPropColumn != null ) {
          revisionPropSqlType = revisionPropColumn.columnDefinition();
        }
      }

      if ( revisionTimestamp != null ) {
        if ( revisionTimestampFound.isSet() ) {
          throw new MappingException( "Only one property may be annotated with @RevisionTimestamp!" );
        }

        final XClass revisionTimestampClass = property.getType();
        if ( reflectionManager.equals( revisionTimestampClass, Long.class ) ||
            reflectionManager.equals( revisionTimestampClass, Long.TYPE ) ||
            reflectionManager.equals( revisionTimestampClass, Date.class ) ||
            reflectionManager.equals( revisionTimestampClass, java.sql.Date.class ) ) {
          revisionInfoTimestampData = new PropertyData(
              property.getName(),
              property.getName(),
              accessType,
              null
          );
          revisionTimestampFound.set();
        }
        else {
          throw new MappingException(
              "The field annotated with @RevisionTimestamp must be of type " +
                  "long, Long, java.util.Date or java.sql.Date"
          );
        }
      }

      if ( modifiedEntityNames != null ) {
        if ( modifiedEntityNamesFound.isSet() ) {
          throw new MappingException( "Only one property may be annotated with @ModifiedEntityNames!" );
        }
        final XClass modifiedEntityNamesClass = property.getType();
        if ( reflectionManager.equals( modifiedEntityNamesClass, Set.class ) &&
            reflectionManager.equals( property.getElementClass(), String.class ) ) {
          modifiedEntityNamesData = new PropertyData(
              property.getName(),
              property.getName(),
              accessType,
              null
          );
View Full Code Here

  public void setAccessType(String accessType) {
    this.accessType = accessType;
  }

  public PropertyData getPropertyData() {
    return new PropertyData(
        name, beanName, accessType, store,
        usingModifiedFlag, modifiedFlagName
    );
  }
View Full Code Here

      revisionInfoEntityName = "org.hibernate.envers.DefaultRevisionEntity";
    }
    else {
      revisionInfoEntityName = "org.hibernate.envers.enhanced.SequenceIdRevisionEntity";
    }
    revisionInfoIdData = new PropertyData( "id", "id", "field", null );
    revisionInfoTimestampData = new PropertyData( "timestamp", "timestamp", "field", null );
    modifiedEntityNamesData = new PropertyData( "modifiedEntityNames", "modifiedEntityNames", "field", null );
    revisionInfoTimestampType = new LongType();

    revisionPropType = "integer";
  }
View Full Code Here

        }

        final XClass revisionNumberClass = property.getType();
        if ( reflectionManager.equals( revisionNumberClass, Integer.class ) ||
            reflectionManager.equals( revisionNumberClass, Integer.TYPE ) ) {
          revisionInfoIdData = new PropertyData( property.getName(), property.getName(), accessType, null );
          revisionNumberFound.set();
        }
        else if ( reflectionManager.equals( revisionNumberClass, Long.class ) ||
            reflectionManager.equals( revisionNumberClass, Long.TYPE ) ) {
          revisionInfoIdData = new PropertyData( property.getName(), property.getName(), accessType, null );
          revisionNumberFound.set();

          // The default is integer
          revisionPropType = "long";
        }
        else {
          throw new MappingException(
              "The field annotated with @RevisionNumber must be of type " +
                  "int, Integer, long or Long"
          );
        }

        // Getting the @Column definition of the revision number property, to later use that info to
        // generate the same mapping for the relation from an audit table's revision number to the
        // revision entity revision number.
        final Column revisionPropColumn = property.getAnnotation( Column.class );
        if ( revisionPropColumn != null ) {
          revisionPropSqlType = revisionPropColumn.columnDefinition();
        }
      }

      if ( revisionTimestamp != null ) {
        if ( revisionTimestampFound.isSet() ) {
          throw new MappingException( "Only one property may be annotated with @RevisionTimestamp!" );
        }

        final XClass revisionTimestampClass = property.getType();
        if ( reflectionManager.equals( revisionTimestampClass, Long.class ) ||
            reflectionManager.equals( revisionTimestampClass, Long.TYPE ) ||
            reflectionManager.equals( revisionTimestampClass, Date.class ) ||
            reflectionManager.equals( revisionTimestampClass, java.sql.Date.class ) ) {
          revisionInfoTimestampData = new PropertyData(
              property.getName(),
              property.getName(),
              accessType,
              null
          );
          revisionTimestampFound.set();
        }
        else {
          throw new MappingException(
              "The field annotated with @RevisionTimestamp must be of type " +
                  "long, Long, java.util.Date or java.sql.Date"
          );
        }
      }

      if ( modifiedEntityNames != null ) {
        if ( modifiedEntityNamesFound.isSet() ) {
          throw new MappingException( "Only one property may be annotated with @ModifiedEntityNames!" );
        }
        final XClass modifiedEntityNamesClass = property.getType();
        if ( reflectionManager.equals( modifiedEntityNamesClass, Set.class ) &&
            reflectionManager.equals( property.getElementClass(), String.class ) ) {
          modifiedEntityNamesData = new PropertyData(
              property.getName(),
              property.getName(),
              accessType,
              null
          );
View Full Code Here

      element.setParent( null );
      parent.add( element );
    }

    // Adding mapper for the id
    final PropertyData propertyData = propertyAuditingData.getPropertyData();
    mapper.addComposite(
        propertyData,
        new ToOneIdMapper( relMapper, propertyData, referencedEntityName, nonInsertableFake )
    );
  }
View Full Code Here

        propertyAuditingData.getName(), owningReferencePropertyName, referencedEntityName,
        ownedIdMapper, MappingTools.ignoreNotFound( value )
    );

    // Adding mapper for the id
    final PropertyData propertyData = propertyAuditingData.getPropertyData();
    mapper.addComposite(
        propertyData,
        new OneToOneNotOwningMapper( entityName, referencedEntityName, owningReferencePropertyName, propertyData )
    );
  }
View Full Code Here

TOP

Related Classes of org.hibernate.envers.internal.entities.PropertyData

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.