Package org.hibernate.envers

Examples of org.hibernate.envers.Audited


  protected boolean checkAudited(
      XProperty property,
      PropertyAuditingData propertyData,
      Audited allClassAudited) {
    // Checking if this property is explicitly audited or if all properties are.
    final Audited aud = property.getAnnotation( Audited.class );
    if ( aud != null ) {
      propertyData.setStore( aud.modStore() );
      propertyData.setRelationTargetAuditMode( aud.targetAuditMode() );
      propertyData.setUsingModifiedFlag( checkUsingModifiedFlag( aud ) );
    }
    else {
      propertyData.setStore( ModificationStore.FULL );
    }
View Full Code Here


   *
   * @param clazz Class that is being processed. Currently mapped entity shall be passed during first invocation.
   */
  private void readAuditOverrides(XClass clazz) {
    /* TODO: Code to remove with @Audited.auditParents - start. */
    final Audited allClassAudited = clazz.getAnnotation( Audited.class );
    if ( allClassAudited != null && allClassAudited.auditParents().length > 0 ) {
      for ( Class c : allClassAudited.auditParents() ) {
        final XClass parentClass = reflectionManager.toXClass( c );
        checkSuperclass( clazz, parentClass );
        if ( !overriddenNotAuditedClasses.contains( parentClass ) ) {
          // If the class has not been marked as not audited by the subclass.
          overriddenAuditedClasses.add( parentClass );
View Full Code Here

   *         In case of success, {@link Audited} configuration of currently mapped entity is returned, otherwise
   *         {@code null}. If processed type exists in {@link AuditedPropertiesReader#overriddenNotAuditedClasses}
   *         collection, the result is also {@code null}.
   */
  private Audited computeAuditConfiguration(XClass clazz) {
    Audited allClassAudited = clazz.getAnnotation( Audited.class );
    // If processed class is not explicitly marked with @Audited annotation, check whether auditing is
    // forced by any of its child entities configuration (@AuditedOverride.forClass).
    if ( allClassAudited == null && overriddenAuditedClasses.contains( clazz ) ) {
      // Declared audited parent copies @Audited.modStore and @Audited.targetAuditMode configuration from
      // currently mapped entity.
View Full Code Here

    }
    return allClassAudited;
  }

  private void addPropertiesFromDynamicComponent(DynamicComponentSource dynamicComponentSource) {
    Audited audited = computeAuditConfiguration( dynamicComponentSource.getXClass() );
    if ( !fieldAccessedPersistentProperties.isEmpty() ) {
      throw new MappingException(
          "Audited dynamic component cannot have properties with access=\"field\" for properties: " + fieldAccessedPersistentProperties + ". \n Change properties access=\"property\", to make it work)"
      );
    }
View Full Code Here

   * Recursively adds all audited properties of entity class and its superclasses.
   *
   * @param clazz Currently processed class.
   */
  private void addPropertiesFromClass(XClass clazz) {
    final Audited allClassAudited = computeAuditConfiguration( clazz );

    //look in the class
    addFromProperties(
        clazz.getDeclaredProperties( "field" ),
        "field",
View Full Code Here

  protected boolean checkAudited(
      XProperty property,
      PropertyAuditingData propertyData, Audited allClassAudited) {
    // Checking if this property is explicitly audited or if all properties are.
    Audited aud = ( property.isAnnotationPresent( Audited.class ) )
        ? property.getAnnotation( Audited.class )
        : allClassAudited;
    if ( aud == null
        && overriddenAuditedProperties.contains( property )
        && !overriddenNotAuditedProperties.contains( property ) ) {
      // Assigning @Audited defaults. If anyone needs to customize those values in the future,
      // appropriate fields shall be added to @AuditOverride annotation.
      aud = DEFAULT_AUDITED;
    }
    if ( aud != null ) {
      propertyData.setStore( aud.modStore() );
      propertyData.setRelationTargetAuditMode( aud.targetAuditMode() );
      propertyData.setUsingModifiedFlag( checkUsingModifiedFlag( aud ) );
      return true;
    }
    else {
      return false;
View Full Code Here

    auditData = new ClassAuditingData();
  }

  private ModificationStore getDefaultAudited(XClass clazz) {
    final Audited defaultAudited = clazz.getAnnotation( Audited.class );

    if ( defaultAudited != null ) {
      return defaultAudited.modStore();
    }
    else {
      return null;
    }
  }
View Full Code Here

    auditData = new ClassAuditingData();
  }

  private ModificationStore getDefaultAudited(XClass clazz) {
    Audited defaultAudited = clazz.getAnnotation(Audited.class);

    if (defaultAudited != null) {
      return defaultAudited.modStore();
    } else {
      return null;
    }
  }
View Full Code Here

      }
    }
  }

  private void addPropertiesFromClass(XClass clazz)  {
    Audited allClassAudited = clazz.getAnnotation(Audited.class);
    //look in the class
    addFromProperties(clazz.getDeclaredProperties("field"), "field", fieldAccessedPersistentProperties, allClassAudited);
    addFromProperties(clazz.getDeclaredProperties("property"), "property", propertyAccessedPersistentProperties, allClassAudited);
   
    if(allClassAudited != null || !auditedPropertiesHolder.isEmpty()) {
View Full Code Here

 
  protected boolean checkAudited(XProperty property,
      PropertyAuditingData propertyData, Audited allClassAudited) {
    // Checking if this property is explicitly audited or if all properties are.
    Audited aud = (property.isAnnotationPresent(Audited.class)) ? (property.getAnnotation(Audited.class)) : allClassAudited;
    //Audited aud = property.getAnnotation(Audited.class);
    if (aud != null) {
      propertyData.setStore(aud.modStore());
      propertyData.setRelationTargetAuditMode(aud.targetAuditMode());
      return true;
    } else {
      return false;
    }
  }
View Full Code Here

TOP

Related Classes of org.hibernate.envers.Audited

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.