Hibernate SVN: r15467 - entitymanager and 1 other directory.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2008-10-31 13:07:47 -0400 (Fri, 31 Oct 2008)
New Revision: 15467
Added:
core/trunk/entitymanager/
Removed:
entitymanager/trunk/
Log:
HHH-3580 : import entitymanager into core
Copied: core/trunk/entitymanager (from rev 15466, entitymanager/trunk)
16 years, 1 month
Hibernate SVN: r15466 - in validator/trunk: hibernate-validator/src/main/java/org/hibernate/validation/impl and 3 other directories.
by hibernate-commits@lists.jboss.org
Author: epbernard
Date: 2008-10-31 11:28:23 -0400 (Fri, 31 Oct 2008)
New Revision: 15466
Added:
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/impl/ConstraintViolationImpl.java
validator/trunk/validation-api/src/main/java/javax/validation/ConstraintViolation.java
Modified:
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ValidationContext.java
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ValidatorImpl.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/bootstrap/ValidationTest.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/ValidatorImplTest.java
validator/trunk/validation-api/src/main/java/javax/validation/Validator.java
Log:
BVAL-40 rename ConstraintViolation
Modified: validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ValidationContext.java
===================================================================
--- validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ValidationContext.java 2008-10-31 12:26:41 UTC (rev 15465)
+++ validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ValidationContext.java 2008-10-31 15:28:23 UTC (rev 15466)
@@ -24,7 +24,7 @@
import java.util.Set;
import java.util.Stack;
-import org.hibernate.validation.impl.InvalidConstraintImpl;
+import org.hibernate.validation.impl.ConstraintViolationImpl;
import org.hibernate.validation.util.IdentitySet;
/**
@@ -55,7 +55,7 @@
/**
* A list of all failing constraints so far.
*/
- private final List<InvalidConstraintImpl<T>> failingConstraints;
+ private final List<ConstraintViolationImpl<T>> failingConstraintViolations;
/**
* The current property path.
@@ -82,7 +82,7 @@
validatedobjectStack.push( object );
processedObjects = new HashMap<String, IdentitySet>();
propertyPath = "";
- failingConstraints = new ArrayList<InvalidConstraintImpl<T>>();
+ failingConstraintViolations = new ArrayList<ConstraintViolationImpl<T>>();
}
public Object peekValidatedObject() {
@@ -125,18 +125,18 @@
return objectsProcessedInCurrentGroups != null && objectsProcessedInCurrentGroups.contains( value );
}
- public void addConstraintFailure(InvalidConstraintImpl<T> failingConstraint) {
- int i = failingConstraints.indexOf( failingConstraint );
+ public void addConstraintFailure(ConstraintViolationImpl<T> failingConstraintViolation) {
+ int i = failingConstraintViolations.indexOf( failingConstraintViolation );
if ( i == -1 ) {
- failingConstraints.add( failingConstraint );
+ failingConstraintViolations.add( failingConstraintViolation );
}
else {
- failingConstraints.get( i ).addGroups( failingConstraint.getGroups() );
+ failingConstraintViolations.get( i ).addGroups( failingConstraintViolation.getGroups() );
}
}
- public List<InvalidConstraintImpl<T>> getFailingConstraints() {
- return failingConstraints;
+ public List<ConstraintViolationImpl<T>> getFailingConstraints() {
+ return failingConstraintViolations;
}
/**
Modified: validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ValidatorImpl.java
===================================================================
--- validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ValidatorImpl.java 2008-10-31 12:26:41 UTC (rev 15465)
+++ validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ValidatorImpl.java 2008-10-31 15:28:23 UTC (rev 15466)
@@ -31,7 +31,7 @@
import javax.validation.ConstraintDescriptor;
import javax.validation.ConstraintFactory;
import javax.validation.ElementDescriptor;
-import javax.validation.InvalidConstraint;
+import javax.validation.ConstraintViolation;
import javax.validation.MessageResolver;
import javax.validation.Validator;
@@ -39,7 +39,7 @@
import org.hibernate.validation.ValidatorConstants;
import org.hibernate.validation.impl.ConstraintDescriptorImpl;
import org.hibernate.validation.impl.ConstraintFactoryImpl;
-import org.hibernate.validation.impl.InvalidConstraintImpl;
+import org.hibernate.validation.impl.ConstraintViolationImpl;
import org.hibernate.validation.impl.ResourceBundleMessageResolver;
import org.hibernate.validation.util.ReflectionHelper;
import org.hibernate.validation.util.PropertyIterator;
@@ -66,7 +66,7 @@
}
@SuppressWarnings("unchecked")
- private final List<InvalidConstraintImpl<T>> EMPTY_CONSTRAINTS_LIST = Collections.EMPTY_LIST;
+ private final List<ConstraintViolationImpl<T>> EMPTY_CONSTRAINTS_LIST = Collections.EMPTY_LIST;
/**
* A map for caching validators for cascaded entities.
@@ -100,14 +100,14 @@
/**
* {@inheritDoc}
*/
- public Set<InvalidConstraint<T>> validate(T object, String... groups) {
+ public Set<ConstraintViolation<T>> validate(T object, String... groups) {
if ( object == null ) {
throw new IllegalArgumentException( "Validation of a null object" );
}
ValidationContext<T> context = new ValidationContext<T>( object );
- List<InvalidConstraintImpl<T>> list = validate( context, Arrays.asList( groups ) );
- return new HashSet<InvalidConstraint<T>>( list );
+ List<ConstraintViolationImpl<T>> list = validate( context, Arrays.asList( groups ) );
+ return new HashSet<ConstraintViolation<T>>( list );
}
/**
@@ -122,7 +122,7 @@
* @todo Currently we iterate the cascaded fields multiple times. Maybe we should change to an approach where we iterate the object graph only once.
* @todo Context root bean can be a different object than the current Validator<T> hence two different generics variables
*/
- private List<InvalidConstraintImpl<T>> validate(ValidationContext<T> context, List<String> groups) {
+ private List<ConstraintViolationImpl<T>> validate(ValidationContext<T> context, List<String> groups) {
if ( context.peekValidatedObject() == null ) {
return EMPTY_CONSTRAINTS_LIST;
}
@@ -178,7 +178,7 @@
constraintDescriptor,
leafBeanInstance
);
- InvalidConstraintImpl<T> failingConstraint = new InvalidConstraintImpl<T>(
+ ConstraintViolationImpl<T> failingConstraintViolation = new ConstraintViolationImpl<T>(
message,
context.getRootBean(),
metaDataProvider.getBeanClass(),
@@ -187,7 +187,7 @@
context.peekPropertyPath(), //FIXME use error.getProperty()
context.getCurrentGroup()
);
- context.addConstraintFailure( failingConstraint );
+ context.addConstraintFailure( failingConstraintViolation );
}
}
context.popProperty();
@@ -271,14 +271,14 @@
/**
* {@inheritDoc}
*/
- public Set<InvalidConstraint<T>> validateProperty(T object, String propertyName, String... groups) {
- List<InvalidConstraintImpl<T>> failingConstraints = new ArrayList<InvalidConstraintImpl<T>>();
- validateProperty( object, new PropertyIterator( propertyName ), failingConstraints, groups );
- return new HashSet<InvalidConstraint<T>>( failingConstraints );
+ public Set<ConstraintViolation<T>> validateProperty(T object, String propertyName, String... groups) {
+ List<ConstraintViolationImpl<T>> failingConstraintViolations = new ArrayList<ConstraintViolationImpl<T>>();
+ validateProperty( object, new PropertyIterator( propertyName ), failingConstraintViolations, groups );
+ return new HashSet<ConstraintViolation<T>>( failingConstraintViolations );
}
- private void validateProperty(T object, PropertyIterator propertyIter, List<InvalidConstraintImpl<T>> failingConstraints, String... groups) {
+ private void validateProperty(T object, PropertyIterator propertyIter, List<ConstraintViolationImpl<T>> failingConstraintViolations, String... groups) {
DesrciptorValueWrapper wrapper = getConstraintDescriptorAndValueForPath( this, propertyIter, object );
if ( wrapper == null ) {
@@ -311,7 +311,7 @@
wrapper.descriptor,
wrapper.value
);
- InvalidConstraintImpl<T> failingConstraint = new InvalidConstraintImpl<T>(
+ ConstraintViolationImpl<T> failingConstraintViolation = new ConstraintViolationImpl<T>(
message,
object,
( Class<T> ) object.getClass(),
@@ -320,11 +320,11 @@
propertyIter.getOriginalProperty(), //FIXME use error.getProperty()
group
);
- addFailingConstraint( failingConstraints, failingConstraint );
+ addFailingConstraint( failingConstraintViolations, failingConstraintViolation );
}
}
- if ( isGroupSequence && failingConstraints.size() > 0 ) {
+ if ( isGroupSequence && failingConstraintViolations.size() > 0 ) {
break;
}
}
@@ -334,14 +334,14 @@
/**
* {@inheritDoc}
*/
- public Set<InvalidConstraint<T>> validateValue(String propertyName, Object value, String... groups) {
- List<InvalidConstraintImpl<T>> failingConstraints = new ArrayList<InvalidConstraintImpl<T>>();
- validateValue( value, new PropertyIterator( propertyName ), failingConstraints, groups );
- return new HashSet<InvalidConstraint<T>>( failingConstraints );
+ public Set<ConstraintViolation<T>> validateValue(String propertyName, Object value, String... groups) {
+ List<ConstraintViolationImpl<T>> failingConstraintViolations = new ArrayList<ConstraintViolationImpl<T>>();
+ validateValue( value, new PropertyIterator( propertyName ), failingConstraintViolations, groups );
+ return new HashSet<ConstraintViolation<T>>( failingConstraintViolations );
}
- private void validateValue(Object object, PropertyIterator propertyIter, List<InvalidConstraintImpl<T>> failingConstraints, String... groups) {
+ private void validateValue(Object object, PropertyIterator propertyIter, List<ConstraintViolationImpl<T>> failingConstraintViolations, String... groups) {
ConstraintDescriptorImpl constraintDescriptor = getConstraintDescriptorForPath( this, propertyIter );
if ( constraintDescriptor == null ) {
@@ -373,7 +373,7 @@
constraintDescriptor,
object
);
- InvalidConstraintImpl<T> failingConstraint = new InvalidConstraintImpl<T>(
+ ConstraintViolationImpl<T> failingConstraintViolation = new ConstraintViolationImpl<T>(
message,
null,
null,
@@ -382,11 +382,11 @@
propertyIter.getOriginalProperty(), //FIXME use error.getProperty()
""
);
- addFailingConstraint( failingConstraints, failingConstraint );
+ addFailingConstraint( failingConstraintViolations, failingConstraintViolation );
}
}
- if ( isGroupSequence && failingConstraints.size() > 0 ) {
+ if ( isGroupSequence && failingConstraintViolations.size() > 0 ) {
break;
}
}
@@ -487,13 +487,13 @@
}
- private void addFailingConstraint(List<InvalidConstraintImpl<T>> failingConstraints, InvalidConstraintImpl<T> failingConstraint) {
- int i = failingConstraints.indexOf( failingConstraint );
+ private void addFailingConstraint(List<ConstraintViolationImpl<T>> failingConstraintViolations, ConstraintViolationImpl<T> failingConstraintViolation) {
+ int i = failingConstraintViolations.indexOf( failingConstraintViolation );
if ( i == -1 ) {
- failingConstraints.add( failingConstraint );
+ failingConstraintViolations.add( failingConstraintViolation );
}
else {
- failingConstraints.get( i ).addGroups( failingConstraint.getGroups() );
+ failingConstraintViolations.get( i ).addGroups( failingConstraintViolation.getGroups() );
}
}
Copied: validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/impl/ConstraintViolationImpl.java (from rev 15465, validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/impl/InvalidConstraintImpl.java)
===================================================================
--- validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/impl/ConstraintViolationImpl.java (rev 0)
+++ validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/impl/ConstraintViolationImpl.java 2008-10-31 15:28:23 UTC (rev 15466)
@@ -0,0 +1,138 @@
+// $Id$
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2008, Red Hat Middleware LLC, and individual contributors
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+* http://www.apache.org/licenses/LICENSE-2.0
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.hibernate.validation.impl;
+
+import java.util.HashSet;
+import java.util.Set;
+import javax.validation.ConstraintViolation;
+
+/**
+ * @author Emmanuel Bernard
+ * @author Hardy Ferentschik
+ */
+public class ConstraintViolationImpl<T> implements ConstraintViolation<T> {
+ private String message;
+ private T rootBean;
+ private Class<T> beanClass;
+ private Object value;
+ private String propertyPath;
+ private HashSet<String> groups;
+ private Object leafBeanInstance;
+
+
+ public ConstraintViolationImpl(String message, T rootBean, Class<T> beanClass, Object leafBeanInstance, Object value, String propertyPath, String group) {
+ this.message = message;
+ this.rootBean = rootBean;
+ this.beanClass = beanClass;
+ this.value = value;
+ this.propertyPath = propertyPath;
+ groups = new HashSet<String>();
+ groups.add( group );
+ this.leafBeanInstance = leafBeanInstance;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getMessage() {
+ return message;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public T getRootBean() {
+ return rootBean;
+ }
+
+ public Object getLeafBean() {
+ return leafBeanInstance;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Class<T> getBeanClass() {
+ return beanClass;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Object getValue() {
+ return value;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getPropertyPath() {
+ return propertyPath;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Set<String> getGroups() {
+ return groups;
+ }
+
+ public void addGroups(Set<String> groupSet) {
+ groups.addAll( groupSet );
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if ( this == o ) {
+ return true;
+ }
+ if ( !( o instanceof ConstraintViolationImpl ) ) {
+ return false;
+ }
+
+ ConstraintViolationImpl that = ( ConstraintViolationImpl ) o;
+
+ if ( beanClass != null ? !beanClass.equals( that.beanClass ) : that.beanClass != null ) {
+ return false;
+ }
+ if ( message != null ? !message.equals( that.message ) : that.message != null ) {
+ return false;
+ }
+ if ( propertyPath != null ? !propertyPath.equals( that.propertyPath ) : that.propertyPath != null ) {
+ return false;
+ }
+ if ( rootBean != null ? !rootBean.equals( that.rootBean ) : that.rootBean != null ) {
+ return false;
+ }
+ if ( value != null ? !value.equals( that.value ) : that.value != null ) {
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = message != null ? message.hashCode() : 0;
+ result = 31 * result + ( rootBean != null ? rootBean.hashCode() : 0 );
+ result = 31 * result + ( beanClass != null ? beanClass.hashCode() : 0 );
+ result = 31 * result + ( value != null ? value.hashCode() : 0 );
+ result = 31 * result + ( propertyPath != null ? propertyPath.hashCode() : 0 );
+ return result;
+ }
+}
Property changes on: validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/impl/ConstraintViolationImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/bootstrap/ValidationTest.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/bootstrap/ValidationTest.java 2008-10-31 12:26:41 UTC (rev 15465)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/bootstrap/ValidationTest.java 2008-10-31 15:28:23 UTC (rev 15466)
@@ -23,7 +23,7 @@
import javax.validation.Constraint;
import javax.validation.ConstraintDescriptor;
import javax.validation.ConstraintFactory;
-import javax.validation.InvalidConstraint;
+import javax.validation.ConstraintViolation;
import javax.validation.MessageResolver;
import javax.validation.Validation;
import javax.validation.ValidationException;
@@ -81,13 +81,13 @@
Customer customer = new Customer();
customer.setFirstName( "John" );
- Set<InvalidConstraint<Customer>> invalidConstraints = validator.validate( customer );
- assertEquals( "Wrong number of constraints", 1, invalidConstraints.size() );
+ Set<ConstraintViolation<Customer>> constraintViolations = validator.validate( customer );
+ assertEquals( "Wrong number of constraints", 1, constraintViolations.size() );
customer.setLastName( "Doe" );
- invalidConstraints = validator.validate( customer );
- assertEquals( "Wrong number of constraints", 0, invalidConstraints.size() );
+ constraintViolations = validator.validate( customer );
+ assertEquals( "Wrong number of constraints", 0, constraintViolations.size() );
}
@@ -104,10 +104,10 @@
Customer customer = new Customer();
customer.setFirstName( "John" );
- Set<InvalidConstraint<Customer>> invalidConstraints = validator.validate( customer );
- assertEquals( "Wrong number of constraints", 1, invalidConstraints.size() );
- InvalidConstraint<Customer> constraint = invalidConstraints.iterator().next();
- assertEquals( "Wrong message", "may not be null", constraint.getMessage() );
+ Set<ConstraintViolation<Customer>> constraintViolations = validator.validate( customer );
+ assertEquals( "Wrong number of constraints", 1, constraintViolations.size() );
+ ConstraintViolation<Customer> constraintViolation = constraintViolations.iterator().next();
+ assertEquals( "Wrong message", "may not be null", constraintViolation.getMessage() );
//FIXME nothing guarantee that a builder can be reused
// now we modify the builder, get a new factory and valiator and try again
@@ -120,10 +120,10 @@
);
factory = builder.build();
validator = factory.getValidator( Customer.class );
- invalidConstraints = validator.validate( customer );
- assertEquals( "Wrong number of constraints", 1, invalidConstraints.size() );
- constraint = invalidConstraints.iterator().next();
- assertEquals( "Wrong message", "my custom message", constraint.getMessage() );
+ constraintViolations = validator.validate( customer );
+ assertEquals( "Wrong number of constraints", 1, constraintViolations.size() );
+ constraintViolation = constraintViolations.iterator().next();
+ assertEquals( "Wrong message", "my custom message", constraintViolation.getMessage() );
}
@Test
@@ -138,10 +138,10 @@
Customer customer = new Customer();
customer.setFirstName( "John" );
- Set<InvalidConstraint<Customer>> invalidConstraints = validator.validate( customer );
- assertEquals( "Wrong number of constraints", 1, invalidConstraints.size() );
- InvalidConstraint<Customer> constraint = invalidConstraints.iterator().next();
- assertEquals( "Wrong message", "may not be null", constraint.getMessage() );
+ Set<ConstraintViolation<Customer>> constraintViolations = validator.validate( customer );
+ assertEquals( "Wrong number of constraints", 1, constraintViolations.size() );
+ ConstraintViolation<Customer> constraintViolation = constraintViolations.iterator().next();
+ assertEquals( "Wrong message", "may not be null", constraintViolation.getMessage() );
//FIXME nothing guarantee that a builder can be reused
// now we modify the builder, get a new factory and valiator and try again
@@ -157,8 +157,8 @@
);
factory = builder.build();
validator = factory.getValidator( Customer.class );
- invalidConstraints = validator.validate( customer );
- assertEquals( "Wrong number of constraints", 0, invalidConstraints.size() );
+ constraintViolations = validator.validate( customer );
+ assertEquals( "Wrong number of constraints", 0, constraintViolations.size() );
}
@Test
Modified: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/ValidatorImplTest.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/ValidatorImplTest.java 2008-10-31 12:26:41 UTC (rev 15465)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/ValidatorImplTest.java 2008-10-31 15:28:23 UTC (rev 15466)
@@ -19,7 +19,7 @@
import java.util.HashSet;
import java.util.Set;
-import javax.validation.InvalidConstraint;
+import javax.validation.ConstraintViolation;
import javax.validation.ValidationException;
import javax.validation.Validator;
@@ -108,49 +108,49 @@
book.setTitle( "" );
book.setAuthor( author );
- Set<InvalidConstraint<Book>> invalidConstraints = validator.validate( book, "first", "second", "last" );
- assertEquals( "Wrong number of constraints", 3, invalidConstraints.size() );
+ Set<ConstraintViolation<Book>> constraintViolations = validator.validate( book, "first", "second", "last" );
+ assertEquals( "Wrong number of constraints", 3, constraintViolations.size() );
author.setFirstName( "Gavin" );
author.setLastName( "King" );
- invalidConstraints = validator.validate( book, "first", "second", "last" );
- InvalidConstraint constraint = invalidConstraints.iterator().next();
- assertEquals( "Wrong number of constraints", 1, invalidConstraints.size() );
- assertEquals( "Wrong message", "may not be empty", constraint.getMessage() );
- assertEquals( "Wrong bean class", Book.class, constraint.getBeanClass() );
- assertEquals( "Wrong root entity", book, constraint.getRootBean() );
- assertEquals( "Wrong value", book.getTitle(), constraint.getValue() );
- assertEquals( "Wrong propertyName", "title", constraint.getPropertyPath() );
+ constraintViolations = validator.validate( book, "first", "second", "last" );
+ ConstraintViolation constraintViolation = constraintViolations.iterator().next();
+ assertEquals( "Wrong number of constraints", 1, constraintViolations.size() );
+ assertEquals( "Wrong message", "may not be empty", constraintViolation.getMessage() );
+ assertEquals( "Wrong bean class", Book.class, constraintViolation.getBeanClass() );
+ assertEquals( "Wrong root entity", book, constraintViolation.getRootBean() );
+ assertEquals( "Wrong value", book.getTitle(), constraintViolation.getValue() );
+ assertEquals( "Wrong propertyName", "title", constraintViolation.getPropertyPath() );
book.setTitle( "Hibernate Persistence with JPA" );
book.setSubtitle( "Revised Edition of Hibernate in Action" );
- invalidConstraints = validator.validate( book, "first", "second", "last" );
- constraint = invalidConstraints.iterator().next();
- assertEquals( "Wrong number of constraints", 1, invalidConstraints.size() );
- assertEquals( "Wrong message", "length must be between 0 and 30", constraint.getMessage() );
- assertEquals( "Wrong bean class", Book.class, constraint.getBeanClass() );
- assertEquals( "Wrong root entity", book, constraint.getRootBean() );
- assertEquals( "Wrong value", book.getSubtitle(), constraint.getValue() );
- assertEquals( "Wrong propertyName", "subtitle", constraint.getPropertyPath() );
+ constraintViolations = validator.validate( book, "first", "second", "last" );
+ constraintViolation = constraintViolations.iterator().next();
+ assertEquals( "Wrong number of constraints", 1, constraintViolations.size() );
+ assertEquals( "Wrong message", "length must be between 0 and 30", constraintViolation.getMessage() );
+ assertEquals( "Wrong bean class", Book.class, constraintViolation.getBeanClass() );
+ assertEquals( "Wrong root entity", book, constraintViolation.getRootBean() );
+ assertEquals( "Wrong value", book.getSubtitle(), constraintViolation.getValue() );
+ assertEquals( "Wrong propertyName", "subtitle", constraintViolation.getPropertyPath() );
book.setSubtitle( "Revised Edition" );
author.setCompany( "JBoss a divison of RedHat" );
- invalidConstraints = validator.validate( book, "first", "second", "last" );
- constraint = invalidConstraints.iterator().next();
- assertEquals( "Wrong number of constraints", 1, invalidConstraints.size() );
- assertEquals( "Wrong message", "length must be between 0 and 20", constraint.getMessage() );
- assertEquals( "Wrong bean class", Author.class, constraint.getBeanClass() );
- assertEquals( "Wrong root entity", book, constraint.getRootBean() );
- assertEquals( "Wrong value", author.getCompany(), constraint.getValue() );
- assertEquals( "Wrong propertyName", "author.company", constraint.getPropertyPath() );
+ constraintViolations = validator.validate( book, "first", "second", "last" );
+ constraintViolation = constraintViolations.iterator().next();
+ assertEquals( "Wrong number of constraints", 1, constraintViolations.size() );
+ assertEquals( "Wrong message", "length must be between 0 and 20", constraintViolation.getMessage() );
+ assertEquals( "Wrong bean class", Author.class, constraintViolation.getBeanClass() );
+ assertEquals( "Wrong root entity", book, constraintViolation.getRootBean() );
+ assertEquals( "Wrong value", author.getCompany(), constraintViolation.getValue() );
+ assertEquals( "Wrong propertyName", "author.company", constraintViolation.getPropertyPath() );
author.setCompany( "JBoss" );
- invalidConstraints = validator.validate( book, "first", "second", "last" );
- assertEquals( "Wrong number of constraints", 0, invalidConstraints.size() );
+ constraintViolations = validator.validate( book, "first", "second", "last" );
+ assertEquals( "Wrong number of constraints", 0, constraintViolations.size() );
}
@Test
@@ -163,37 +163,37 @@
Book book = new Book();
book.setAuthor( author );
- Set<InvalidConstraint<Book>> invalidConstraints = validator.validate( book, "default" );
- assertEquals( "Wrong number of constraints", 2, invalidConstraints.size() );
+ Set<ConstraintViolation<Book>> constraintViolations = validator.validate( book, "default" );
+ assertEquals( "Wrong number of constraints", 2, constraintViolations.size() );
author.setFirstName( "Gavin" );
author.setLastName( "King" );
- invalidConstraints = validator.validate( book, "default" );
- InvalidConstraint constraint = invalidConstraints.iterator().next();
- assertEquals( "Wrong number of constraints", 1, invalidConstraints.size() );
- assertEquals( "Wrong message", "may not be null", constraint.getMessage() );
- assertEquals( "Wrong bean class", Book.class, constraint.getBeanClass() );
- assertEquals( "Wrong root entity", book, constraint.getRootBean() );
- assertEquals( "Wrong value", book.getTitle(), constraint.getValue() );
- assertEquals( "Wrong propertyName", "title", constraint.getPropertyPath() );
+ constraintViolations = validator.validate( book, "default" );
+ ConstraintViolation constraintViolation = constraintViolations.iterator().next();
+ assertEquals( "Wrong number of constraints", 1, constraintViolations.size() );
+ assertEquals( "Wrong message", "may not be null", constraintViolation.getMessage() );
+ assertEquals( "Wrong bean class", Book.class, constraintViolation.getBeanClass() );
+ assertEquals( "Wrong root entity", book, constraintViolation.getRootBean() );
+ assertEquals( "Wrong value", book.getTitle(), constraintViolation.getValue() );
+ assertEquals( "Wrong propertyName", "title", constraintViolation.getPropertyPath() );
book.setTitle( "Hibernate Persistence with JPA" );
book.setSubtitle( "Revised Edition of Hibernate in Action" );
- invalidConstraints = validator.validate( book, "default" );
- assertEquals( "Wrong number of constraints", 1, invalidConstraints.size() );
+ constraintViolations = validator.validate( book, "default" );
+ assertEquals( "Wrong number of constraints", 1, constraintViolations.size() );
book.setSubtitle( "Revised Edition" );
author.setCompany( "JBoss a divison of RedHat" );
- invalidConstraints = validator.validate( book, "default" );
- assertEquals( "Wrong number of constraints", 1, invalidConstraints.size() );
+ constraintViolations = validator.validate( book, "default" );
+ assertEquals( "Wrong number of constraints", 1, constraintViolations.size() );
author.setCompany( "JBoss" );
- invalidConstraints = validator.validate( book, "default" );
- assertEquals( "Wrong number of constraints", 0, invalidConstraints.size() );
+ constraintViolations = validator.validate( book, "default" );
+ assertEquals( "Wrong number of constraints", 0, constraintViolations.size() );
}
@Test
@@ -203,13 +203,13 @@
Customer customer = new Customer();
customer.setFirstName( "John" );
- Set<InvalidConstraint<Customer>> invalidConstraints = validator.validate( customer );
- assertEquals( "Wrong number of constraints", 1, invalidConstraints.size() );
+ Set<ConstraintViolation<Customer>> constraintViolations = validator.validate( customer );
+ assertEquals( "Wrong number of constraints", 1, constraintViolations.size() );
customer.setLastName( "Doe" );
- invalidConstraints = validator.validate( customer );
- assertEquals( "Wrong number of constraints", 0, invalidConstraints.size() );
+ constraintViolations = validator.validate( customer );
+ assertEquals( "Wrong number of constraints", 0, constraintViolations.size() );
}
@Test
@@ -224,8 +224,8 @@
author.setCompany( "Langenscheidt Publ." );
dictonary.setAuthor( author );
- Set<InvalidConstraint<Dictonary>> invalidConstraints = validator.validate( dictonary, "default-alias" );
- assertEquals( "Wrong number of constraints", 0, invalidConstraints.size() );
+ Set<ConstraintViolation<Dictonary>> constraintViolations = validator.validate( dictonary, "default-alias" );
+ assertEquals( "Wrong number of constraints", 0, constraintViolations.size() );
}
@Test
@@ -235,21 +235,21 @@
elepfant.setName( "" );
elepfant.setDomain( Animal.Domain.EUKARYOTA );
- Set<InvalidConstraint<Animal>> invalidConstraints = validator.validate( elepfant, "first", "second" );
+ Set<ConstraintViolation<Animal>> constraintViolations = validator.validate( elepfant, "first", "second" );
assertEquals(
"The should be two invalid constraints since the same propertyName gets validated in both groups",
1,
- invalidConstraints.size()
+ constraintViolations.size()
);
- InvalidConstraint constraint = invalidConstraints.iterator().next();
+ ConstraintViolation constraintViolation = constraintViolations.iterator().next();
Set<String> expected = new HashSet<String>();
expected.add( "first" );
expected.add( "second" );
assertEquals(
"The constraint should be invalid for both groups",
expected,
- constraint.getGroups()
+ constraintViolation.getGroups()
);
}
@@ -267,32 +267,32 @@
address.setAddressline2( null );
address.setCity( "Llanfairpwllgwyngyllgogerychwyrndrobwyll-llantysiliogogogoch" ); //town in North Wales
- Set<InvalidConstraint<Address>> invalidConstraints = validator.validate( address );
+ Set<ConstraintViolation<Address>> constraintViolations = validator.validate( address );
assertEquals(
"we should have been 2 not null violation for addresslines and one lenth violation for city",
3,
- invalidConstraints.size()
+ constraintViolations.size()
);
- invalidConstraints = validator.validateProperty( address, "city" );
+ constraintViolations = validator.validateProperty( address, "city" );
assertEquals(
"only city should be validated",
1,
- invalidConstraints.size()
+ constraintViolations.size()
);
- invalidConstraints = validator.validateProperty( address, "city" );
+ constraintViolations = validator.validateProperty( address, "city" );
assertEquals(
"only city should be validated",
1,
- invalidConstraints.size()
+ constraintViolations.size()
);
- invalidConstraints = validator.validateValue( "city", "Paris" );
+ constraintViolations = validator.validateValue( "city", "Paris" );
assertEquals(
"Paris should be a valid city name.",
0,
- invalidConstraints.size()
+ constraintViolations.size()
);
}
@@ -304,20 +304,20 @@
customer.setFirstName( "John" );
customer.setLastName( "Doe" );
- Set<InvalidConstraint<Customer>> invalidConstraints = validator.validate( customer );
- assertEquals( "Wrong number of constraints", 0, invalidConstraints.size() );
+ Set<ConstraintViolation<Customer>> constraintViolations = validator.validate( customer );
+ assertEquals( "Wrong number of constraints", 0, constraintViolations.size() );
Order order1 = new Order();
customer.addOrder( order1 );
- invalidConstraints = validator.validate( customer );
- InvalidConstraint constraint = invalidConstraints.iterator().next();
- assertEquals( "Wrong number of constraints", 1, invalidConstraints.size() );
- assertEquals( "Wrong message", "may not be null", constraint.getMessage() );
- assertEquals( "Wrong bean class", Order.class, constraint.getBeanClass() );
- assertEquals( "Wrong root entity", customer, constraint.getRootBean() );
- assertEquals( "Wrong value", order1.getOrderNumber(), constraint.getValue() );
- assertEquals( "Wrong propertyName", "orderList[0].orderNumber", constraint.getPropertyPath() );
+ constraintViolations = validator.validate( customer );
+ ConstraintViolation constraintViolation = constraintViolations.iterator().next();
+ assertEquals( "Wrong number of constraints", 1, constraintViolations.size() );
+ assertEquals( "Wrong message", "may not be null", constraintViolation.getMessage() );
+ assertEquals( "Wrong bean class", Order.class, constraintViolation.getBeanClass() );
+ assertEquals( "Wrong root entity", customer, constraintViolation.getRootBean() );
+ assertEquals( "Wrong value", order1.getOrderNumber(), constraintViolation.getValue() );
+ assertEquals( "Wrong propertyName", "orderList[0].orderNumber", constraintViolation.getPropertyPath() );
}
@@ -330,16 +330,16 @@
Engine engine = new Engine();
engine.setSerialNumber( "mail(a)foobar.com" );
- Set<InvalidConstraint<Engine>> invalidConstraints = validator.validate( engine );
- assertEquals( "Wrong number of constraints", 2, invalidConstraints.size() );
+ Set<ConstraintViolation<Engine>> constraintViolations = validator.validate( engine );
+ assertEquals( "Wrong number of constraints", 2, constraintViolations.size() );
engine.setSerialNumber( "ABCDEFGH1234" );
- invalidConstraints = validator.validate( engine );
- assertEquals( "Wrong number of constraints", 1, invalidConstraints.size() );
+ constraintViolations = validator.validate( engine );
+ assertEquals( "Wrong number of constraints", 1, constraintViolations.size() );
engine.setSerialNumber( "ABCD-EFGH-1234" );
- invalidConstraints = validator.validate( engine );
- assertEquals( "Wrong number of constraints", 0, invalidConstraints.size() );
+ constraintViolations = validator.validate( engine );
+ assertEquals( "Wrong number of constraints", 0, constraintViolations.size() );
}
@@ -360,14 +360,14 @@
clint.addPlayedWith( morgan );
Validator<Actor> validator = new ValidatorImpl<Actor>( Actor.class );
- Set<InvalidConstraint<Actor>> invalidConstraints = validator.validate( clint );
- InvalidConstraint constraint = invalidConstraints.iterator().next();
- assertEquals( "Wrong number of constraints", 1, invalidConstraints.size() );
- assertEquals( "Wrong message", "may not be empty", constraint.getMessage() );
- assertEquals( "Wrong bean class", Actor.class, constraint.getBeanClass() );
- assertEquals( "Wrong root entity", clint, constraint.getRootBean() );
- assertEquals( "Wrong value", morgan.getLastName(), constraint.getValue() );
- assertEquals( "Wrong propertyName", "playedWith[0].playedWith[1].lastName", constraint.getPropertyPath() );
+ Set<ConstraintViolation<Actor>> constraintViolations = validator.validate( clint );
+ ConstraintViolation constraintViolation = constraintViolations.iterator().next();
+ assertEquals( "Wrong number of constraints", 1, constraintViolations.size() );
+ assertEquals( "Wrong message", "may not be empty", constraintViolation.getMessage() );
+ assertEquals( "Wrong bean class", Actor.class, constraintViolation.getBeanClass() );
+ assertEquals( "Wrong root entity", clint, constraintViolation.getRootBean() );
+ assertEquals( "Wrong value", morgan.getLastName(), constraintViolation.getValue() );
+ assertEquals( "Wrong propertyName", "playedWith[0].playedWith[1].lastName", constraintViolation.getPropertyPath() );
}
@Test
@@ -376,20 +376,20 @@
Order order = new Order();
- Set<InvalidConstraint<Customer>> invalidConstraints = validator.validateValue(
+ Set<ConstraintViolation<Customer>> constraintViolations = validator.validateValue(
"orderList[0].orderNumber", null
);
- assertEquals( "Wrong number of constraints", 1, invalidConstraints.size() );
+ assertEquals( "Wrong number of constraints", 1, constraintViolations.size() );
- InvalidConstraint constraint = invalidConstraints.iterator().next();
- assertEquals( "Wrong number of constraints", 1, invalidConstraints.size() );
- assertEquals( "Wrong message", "may not be null", constraint.getMessage() );
- assertEquals( "Wrong bean class", null, constraint.getBeanClass() );
- assertEquals( "Wrong root entity", null, constraint.getRootBean() );
- assertEquals( "Wrong value", order.getOrderNumber(), constraint.getValue() );
- assertEquals( "Wrong propertyName", "orderList[0].orderNumber", constraint.getPropertyPath() );
+ ConstraintViolation constraintViolation = constraintViolations.iterator().next();
+ assertEquals( "Wrong number of constraints", 1, constraintViolations.size() );
+ assertEquals( "Wrong message", "may not be null", constraintViolation.getMessage() );
+ assertEquals( "Wrong bean class", null, constraintViolation.getBeanClass() );
+ assertEquals( "Wrong root entity", null, constraintViolation.getRootBean() );
+ assertEquals( "Wrong value", order.getOrderNumber(), constraintViolation.getValue() );
+ assertEquals( "Wrong propertyName", "orderList[0].orderNumber", constraintViolation.getPropertyPath() );
- invalidConstraints = validator.validateValue( "orderList[0].orderNumber", "1234" );
- assertEquals( "Wrong number of constraints", 0, invalidConstraints.size() );
+ constraintViolations = validator.validateValue( "orderList[0].orderNumber", "1234" );
+ assertEquals( "Wrong number of constraints", 0, constraintViolations.size() );
}
}
Copied: validator/trunk/validation-api/src/main/java/javax/validation/ConstraintViolation.java (from rev 15465, validator/trunk/validation-api/src/main/java/javax/validation/InvalidConstraint.java)
===================================================================
--- validator/trunk/validation-api/src/main/java/javax/validation/ConstraintViolation.java (rev 0)
+++ validator/trunk/validation-api/src/main/java/javax/validation/ConstraintViolation.java 2008-10-31 15:28:23 UTC (rev 15466)
@@ -0,0 +1,73 @@
+// $Id$
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2008, Red Hat Middleware LLC, and individual contributors
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+* http://www.apache.org/licenses/LICENSE-2.0
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package javax.validation;
+
+import java.util.Set;
+
+/**
+ * Describe a constraint validation defect.
+ *
+ * @author Emmanuel Bernard
+ * @todo add pointers to the metadata?
+ * @todo the rational behind rootBean and propertyPath is to keep the context available to the user
+ */
+public interface ConstraintViolation<T> {
+
+ /**
+ * @return The error message for this constraint violation.
+ */
+ String getMessage();
+
+ /**
+ * @return The root bean being validated.
+ */
+ T getRootBean();
+
+ /**
+ * If a bean constraint, the bean instance the constraint is applied on
+ * If a property constraint, the bean instance hosting the property the constraint is applied on
+ *
+ * @return the leaf bean the constraint is applied on or null if Validator#validateValue is used
+ */
+ Object getLeafBean();
+
+ /**
+ * @return the property path to the value from <code>rootBean</code>
+ * <code>null</code> if the value is the <code>rootBean<code> itself.
+ */
+ String getPropertyPath();
+
+
+ /**
+ * @return the bean type being validated.
+ */
+ Class<T> getBeanClass();
+
+ /**
+ * @return the value failing to pass the constraint.
+ */
+ Object getValue();
+
+ /**
+ * @return the list of groups that the triggered constraint applies on and which also are
+ * within the list of groups requested for validation.
+ *
+ * TODO: considering removal, if you think it's important, speak up
+ */
+ Set<String> getGroups();
+}
Property changes on: validator/trunk/validation-api/src/main/java/javax/validation/ConstraintViolation.java
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: validator/trunk/validation-api/src/main/java/javax/validation/Validator.java
===================================================================
--- validator/trunk/validation-api/src/main/java/javax/validation/Validator.java 2008-10-31 12:26:41 UTC (rev 15465)
+++ validator/trunk/validation-api/src/main/java/javax/validation/Validator.java 2008-10-31 15:28:23 UTC (rev 15466)
@@ -38,7 +38,7 @@
*
* @throws IllegalArgumentException e if object is <code>null</code>.
*/
- Set<InvalidConstraint<T>> validate(T object, String... groups);
+ Set<ConstraintViolation<T>> validate(T object, String... groups);
/**
* validate all constraints on propertyname property of object (unless shortcut)
@@ -53,7 +53,7 @@
* @throws IllegalArgumentException e if object is <code>null</code>.
* @todo Do we keep this method?
*/
- Set<InvalidConstraint<T>> validateProperty(T object, String propertyName, String... groups);
+ Set<ConstraintViolation<T>> validateProperty(T object, String propertyName, String... groups);
/**
* Validates all constraints on propertyname property if the property value is value (unless shortcut)
@@ -68,7 +68,7 @@
* @todo Do we keep this method?
* @todo express limitations of InvalidConstraint in this case.
*/
- Set<InvalidConstraint<T>> validateValue(String propertyName, Object value, String... groups);
+ Set<ConstraintViolation<T>> validateValue(String propertyName, Object value, String... groups);
/**
* return true if at least one constraint declaration is present for the given bean
16 years, 1 month
Hibernate SVN: r15465 - in core/trunk/envers/src/main/java/org/hibernate/envers: tools and 1 other directory.
by hibernate-commits@lists.jboss.org
Author: adamw
Date: 2008-10-31 08:26:41 -0400 (Fri, 31 Oct 2008)
New Revision: 15465
Removed:
core/trunk/envers/src/main/java/org/hibernate/envers/tools/log/
Modified:
core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/AuditMetadataGenerator.java
Log:
Removing the unused logger integration (for Hibernate <3.3)
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/AuditMetadataGenerator.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/AuditMetadataGenerator.java 2008-10-31 12:23:27 UTC (rev 15464)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/AuditMetadataGenerator.java 2008-10-31 12:26:41 UTC (rev 15465)
@@ -40,8 +40,6 @@
import org.hibernate.envers.entities.mapper.MultiPropertyMapper;
import org.hibernate.envers.entities.mapper.SubclassPropertyMapper;
import org.hibernate.envers.tools.StringTools;
-import org.hibernate.envers.tools.log.YLog;
-import org.hibernate.envers.tools.log.YLogManager;
import org.hibernate.MappingException;
import org.hibernate.cfg.Configuration;
@@ -54,6 +52,8 @@
import org.hibernate.type.ManyToOneType;
import org.hibernate.type.OneToOneType;
import org.hibernate.type.Type;
+import org.slf4j.LoggerFactory;
+import org.slf4j.Logger;
/**
* @author Adam Warski (adam at warski dot org)
@@ -74,7 +74,7 @@
// Map entity name -> (join descriptor -> element describing the "versioned" join)
private final Map<String, Map<Join, Element>> entitiesJoins;
- private YLog log = YLogManager.getLogManager().getLog(AuditMetadataGenerator.class);
+ private Logger log = LoggerFactory.getLogger(AuditMetadataGenerator.class);
public AuditMetadataGenerator(Configuration cfg, GlobalConfiguration globalCfg,
AuditEntitiesConfiguration verEntCfg,
16 years, 1 month
Hibernate SVN: r15464 - in core/trunk/envers/src/main/java/org/hibernate/envers: configuration/metadata and 1 other directories.
by hibernate-commits@lists.jboss.org
Author: adamw
Date: 2008-10-31 08:23:27 -0400 (Fri, 31 Oct 2008)
New Revision: 15464
Removed:
core/trunk/envers/src/main/java/org/hibernate/envers/tools/reflection/YClass.java
core/trunk/envers/src/main/java/org/hibernate/envers/tools/reflection/YMethodsAndClasses.java
core/trunk/envers/src/main/java/org/hibernate/envers/tools/reflection/YProperty.java
core/trunk/envers/src/main/java/org/hibernate/envers/tools/reflection/YReflectionManager.java
Modified:
core/trunk/envers/src/main/java/org/hibernate/envers/configuration/AuditConfiguration.java
core/trunk/envers/src/main/java/org/hibernate/envers/configuration/EntitiesConfigurator.java
core/trunk/envers/src/main/java/org/hibernate/envers/configuration/RevisionInfoConfiguration.java
core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/AnnotationsMetadataReader.java
Log:
Removing unused Hiberntae 3.2.4.SP1 integration facilities (ReflectionManager)
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/configuration/AuditConfiguration.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/configuration/AuditConfiguration.java 2008-10-31 12:14:46 UTC (rev 15463)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/configuration/AuditConfiguration.java 2008-10-31 12:23:27 UTC (rev 15464)
@@ -31,9 +31,10 @@
import org.hibernate.envers.revisioninfo.RevisionInfoNumberReader;
import org.hibernate.envers.revisioninfo.RevisionInfoQueryCreator;
import org.hibernate.envers.synchronization.AuditSyncManager;
-import org.hibernate.envers.tools.reflection.YReflectionManager;
import org.hibernate.cfg.Configuration;
+import org.hibernate.cfg.AnnotationConfiguration;
+import org.hibernate.annotations.common.reflection.ReflectionManager;
/**
* @author Adam Warski (adam at warski dot org)
@@ -74,7 +75,7 @@
public AuditConfiguration(Configuration cfg) {
Properties properties = cfg.getProperties();
- YReflectionManager reflectionManager = YReflectionManager.get(cfg);
+ ReflectionManager reflectionManager = ((AnnotationConfiguration) cfg).getReflectionManager();
RevisionInfoConfiguration revInfoCfg = new RevisionInfoConfiguration();
RevisionInfoConfigurationResult revInfoCfgResult = revInfoCfg.configure(cfg, reflectionManager);
verEntCfg = new AuditEntitiesConfiguration(properties, revInfoCfgResult.getRevisionInfoEntityName());
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/configuration/EntitiesConfigurator.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/configuration/EntitiesConfigurator.java 2008-10-31 12:14:46 UTC (rev 15463)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/configuration/EntitiesConfigurator.java 2008-10-31 12:23:27 UTC (rev 15464)
@@ -44,9 +44,9 @@
import org.hibernate.envers.entities.EntitiesConfigurations;
import org.hibernate.envers.tools.StringTools;
import org.hibernate.envers.tools.graph.GraphTopologicalSort;
-import org.hibernate.envers.tools.reflection.YReflectionManager;
import org.hibernate.MappingException;
+import org.hibernate.annotations.common.reflection.ReflectionManager;
import org.hibernate.cfg.Configuration;
import org.hibernate.mapping.PersistentClass;
@@ -54,7 +54,7 @@
* @author Adam Warski (adam at warski dot org)
*/
public class EntitiesConfigurator {
- public EntitiesConfigurations configure(Configuration cfg, YReflectionManager reflectionManager,
+ public EntitiesConfigurations configure(Configuration cfg, ReflectionManager reflectionManager,
GlobalConfiguration globalCfg, AuditEntitiesConfiguration verEntCfg,
Document revisionInfoXmlMapping, Element revisionInfoRelationMapping) {
AuditMetadataGenerator versionsMetaGen = new AuditMetadataGenerator(cfg, globalCfg, verEntCfg,
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/configuration/RevisionInfoConfiguration.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/configuration/RevisionInfoConfiguration.java 2008-10-31 12:14:46 UTC (rev 15463)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/configuration/RevisionInfoConfiguration.java 2008-10-31 12:23:27 UTC (rev 15464)
@@ -36,11 +36,11 @@
import org.hibernate.envers.revisioninfo.RevisionInfoNumberReader;
import org.hibernate.envers.revisioninfo.RevisionInfoQueryCreator;
import org.hibernate.envers.tools.MutableBoolean;
-import org.hibernate.envers.tools.reflection.YClass;
-import org.hibernate.envers.tools.reflection.YProperty;
-import org.hibernate.envers.tools.reflection.YReflectionManager;
import org.hibernate.MappingException;
+import org.hibernate.annotations.common.reflection.XProperty;
+import org.hibernate.annotations.common.reflection.XClass;
+import org.hibernate.annotations.common.reflection.ReflectionManager;
import org.hibernate.cfg.Configuration;
import org.hibernate.mapping.PersistentClass;
@@ -92,10 +92,10 @@
return rev_rel_mapping;
}
- private void searchForRevisionInfoCfgInProperties(YClass clazz, YReflectionManager reflectionManager,
+ private void searchForRevisionInfoCfgInProperties(XClass clazz, ReflectionManager reflectionManager,
MutableBoolean revisionNumberFound, MutableBoolean revisionTimestampFound,
String accessType) {
- for (YProperty property : clazz.getDeclaredProperties(accessType)) {
+ for (XProperty property : clazz.getDeclaredProperties(accessType)) {
RevisionNumber revisionNumber = property.getAnnotation(RevisionNumber.class);
RevisionTimestamp revisionTimestamp = property.getAnnotation(RevisionTimestamp.class);
@@ -104,7 +104,7 @@
throw new MappingException("Only one property may be annotated with @RevisionNumber!");
}
- YClass revisionNumberClass = property.getType();
+ XClass revisionNumberClass = property.getType();
if (reflectionManager.equals(revisionNumberClass, Integer.class) ||
reflectionManager.equals(revisionNumberClass, Integer.TYPE)) {
revisionInfoIdName = property.getName();
@@ -127,7 +127,7 @@
throw new MappingException("Only one property may be annotated with @RevisionTimestamp!");
}
- YClass revisionTimestampClass = property.getType();
+ XClass revisionTimestampClass = property.getType();
if (reflectionManager.equals(revisionTimestampClass, Long.class) ||
reflectionManager.equals(revisionTimestampClass, Long.TYPE)) {
revisionInfoTimestampName = property.getName();
@@ -140,9 +140,9 @@
}
}
- private void searchForRevisionInfoCfg(YClass clazz, YReflectionManager reflectionManager,
+ private void searchForRevisionInfoCfg(XClass clazz, ReflectionManager reflectionManager,
MutableBoolean revisionNumberFound, MutableBoolean revisionTimestampFound) {
- YClass superclazz = clazz.getSuperclass();
+ XClass superclazz = clazz.getSuperclass();
if (!"java.lang.Object".equals(superclazz.getName())) {
searchForRevisionInfoCfg(superclazz, reflectionManager, revisionNumberFound, revisionTimestampFound);
}
@@ -154,7 +154,7 @@
}
@SuppressWarnings({"unchecked"})
- public RevisionInfoConfigurationResult configure(Configuration cfg, YReflectionManager reflectionManager) {
+ public RevisionInfoConfigurationResult configure(Configuration cfg, ReflectionManager reflectionManager) {
Iterator<PersistentClass> classes = (Iterator<PersistentClass>) cfg.getClassMappings();
boolean revisionEntityFound = false;
RevisionInfoGenerator revisionInfoGenerator = null;
@@ -163,7 +163,7 @@
while (classes.hasNext()) {
PersistentClass pc = classes.next();
- YClass clazz;
+ XClass clazz;
try {
clazz = reflectionManager.classForName(pc.getClassName(), this.getClass());
} catch (ClassNotFoundException e) {
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/AnnotationsMetadataReader.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/AnnotationsMetadataReader.java 2008-10-31 12:14:46 UTC (rev 15463)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/AnnotationsMetadataReader.java 2008-10-31 12:23:27 UTC (rev 15464)
@@ -30,11 +30,11 @@
import org.hibernate.envers.SecondaryAuditTable;
import org.hibernate.envers.*;
import org.hibernate.envers.configuration.GlobalConfiguration;
-import org.hibernate.envers.tools.reflection.YClass;
-import org.hibernate.envers.tools.reflection.YProperty;
-import org.hibernate.envers.tools.reflection.YReflectionManager;
import org.hibernate.MappingException;
+import org.hibernate.annotations.common.reflection.ReflectionManager;
+import org.hibernate.annotations.common.reflection.XClass;
+import org.hibernate.annotations.common.reflection.XProperty;
import org.hibernate.mapping.PersistentClass;
/**
@@ -44,7 +44,7 @@
*/
public final class AnnotationsMetadataReader {
private final GlobalConfiguration globalCfg;
- private final YReflectionManager reflectionManager;
+ private final ReflectionManager reflectionManager;
private final PersistentClass pc;
/**
@@ -53,7 +53,7 @@
*/
private final PersistentClassVersioningData versioningData;
- public AnnotationsMetadataReader(GlobalConfiguration globalCfg, YReflectionManager reflectionManager,
+ public AnnotationsMetadataReader(GlobalConfiguration globalCfg, ReflectionManager reflectionManager,
PersistentClass pc) {
this.globalCfg = globalCfg;
this.reflectionManager = reflectionManager;
@@ -62,21 +62,21 @@
versioningData = new PersistentClassVersioningData();
}
- private void addPropertyVersioned(YProperty property) {
+ private void addPropertyVersioned(XProperty property) {
Audited ver = property.getAnnotation(Audited.class);
if (ver != null) {
versioningData.propertyStoreInfo.propertyStores.put(property.getName(), ver.modStore());
}
}
- private void addPropertyMapKey(YProperty property) {
+ private void addPropertyMapKey(XProperty property) {
MapKey mapKey = property.getAnnotation(MapKey.class);
if (mapKey != null) {
versioningData.mapKeys.put(property.getName(), mapKey.name());
}
}
- private void addPropertyUnversioned(YProperty property) {
+ private void addPropertyUnversioned(XProperty property) {
// check if a property is declared as unversioned to exclude it
// useful if a class is versioned but some properties should be excluded
NotAudited unVer = property.getAnnotation(NotAudited.class);
@@ -94,15 +94,15 @@
}
}
- private void addPropertyJoinTables(YProperty property) {
+ private void addPropertyJoinTables(XProperty property) {
AuditJoinTable joinTable = property.getAnnotation(AuditJoinTable.class);
if (joinTable != null) {
versioningData.versionsJoinTables.put(property.getName(), joinTable);
}
}
- private void addFromProperties(Iterable<YProperty> properties) {
- for (YProperty property : properties) {
+ private void addFromProperties(Iterable<XProperty> properties) {
+ for (XProperty property : properties) {
addPropertyVersioned(property);
addPropertyUnversioned(property);
addPropertyJoinTables(property);
@@ -110,8 +110,8 @@
}
}
- private void addPropertiesFromClass(YClass clazz) {
- YClass superclazz = clazz.getSuperclass();
+ private void addPropertiesFromClass(XClass clazz) {
+ XClass superclazz = clazz.getSuperclass();
if (!"java.lang.Object".equals(superclazz.getName())) {
addPropertiesFromClass(superclazz);
}
@@ -120,7 +120,7 @@
addFromProperties(clazz.getDeclaredProperties("property"));
}
- private void addDefaultVersioned(YClass clazz) {
+ private void addDefaultVersioned(XClass clazz) {
Audited defaultVersioned = clazz.getAnnotation(Audited.class);
if (defaultVersioned != null) {
@@ -128,7 +128,7 @@
}
}
- private void addVersionsTable(YClass clazz) {
+ private void addVersionsTable(XClass clazz) {
AuditTable versionsTable = clazz.getAnnotation(AuditTable.class);
if (versionsTable != null) {
versioningData.versionsTable = versionsTable;
@@ -137,7 +137,7 @@
}
}
- private void addVersionsSecondaryTables(YClass clazz) {
+ private void addVersionsSecondaryTables(XClass clazz) {
// Getting information on secondary tables
SecondaryAuditTable secondaryVersionsTable1 = clazz.getAnnotation(SecondaryAuditTable.class);
if (secondaryVersionsTable1 != null) {
@@ -160,7 +160,7 @@
}
try {
- YClass clazz = reflectionManager.classForName(pc.getClassName(), this.getClass());
+ XClass clazz = reflectionManager.classForName(pc.getClassName(), this.getClass());
addDefaultVersioned(clazz);
addPropertiesFromClass(clazz);
Deleted: core/trunk/envers/src/main/java/org/hibernate/envers/tools/reflection/YClass.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/tools/reflection/YClass.java 2008-10-31 12:14:46 UTC (rev 15463)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/tools/reflection/YClass.java 2008-10-31 12:23:27 UTC (rev 15464)
@@ -1,98 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.envers.tools.reflection;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.hibernate.envers.exception.AuditException;
-
-/**
- * @author Adam Warski (adam at warski dot org)
- */
-public class YClass {
- private final YMethodsAndClasses ymc;
- private final Object delegate;
-
- public YClass(YMethodsAndClasses ymc, Object delegate) {
- this.ymc = ymc;
- this.delegate = delegate;
- }
-
- Object getDelegate() {
- return delegate;
- }
-
- public String getName() {
- try {
- return (String) ymc.getXClass_getNameMethod().invoke(delegate);
- } catch (IllegalAccessException e) {
- throw new AuditException(e);
- } catch (InvocationTargetException e) {
- throw new AuditException(e);
- }
- }
-
- public YClass getSuperclass() {
- try {
- return new YClass(ymc, ymc.getXClass_getSuperclassMethod().invoke(delegate));
- } catch (IllegalAccessException e) {
- throw new AuditException(e);
- } catch (InvocationTargetException e) {
- throw new AuditException(e);
- }
- }
-
- public List<YProperty> getDeclaredProperties(String accessMode) {
- List delegates;
-
- try {
- delegates = (List) ymc.getXClass_getDeclaredPropertiesMethod().invoke(delegate, accessMode);
- } catch (IllegalAccessException e) {
- throw new AuditException(e);
- } catch (InvocationTargetException e) {
- throw new AuditException(e);
- }
-
- List<YProperty> ret = new ArrayList<YProperty>();
- for (Object delegate : delegates) {
- ret.add(new YProperty(ymc, delegate));
- }
-
- return ret;
- }
-
- public <T extends Annotation> T getAnnotation(Class<T> annotation) {
- try {
- //noinspection unchecked
- return (T) ymc.getXClass_getAnnotationMethod().invoke(delegate, annotation);
- } catch (IllegalAccessException e) {
- throw new AuditException(e);
- } catch (InvocationTargetException e) {
- throw new AuditException(e);
- }
- }
-}
Deleted: core/trunk/envers/src/main/java/org/hibernate/envers/tools/reflection/YMethodsAndClasses.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/tools/reflection/YMethodsAndClasses.java 2008-10-31 12:14:46 UTC (rev 15463)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/tools/reflection/YMethodsAndClasses.java 2008-10-31 12:23:27 UTC (rev 15464)
@@ -1,121 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.envers.tools.reflection;
-
-import java.lang.reflect.Method;
-
-import org.hibernate.envers.exception.AuditException;
-
-/**
- * @author Adam Warski (adam at warski dot org)
- */
-public class YMethodsAndClasses {
- private final Method reflectionManager_classForNameMethod;
- private final Method reflectionManager_equalsMethod;
-
- private final Method xClass_getNameMethod;
- private final Method xClass_getSuperclassMethod;
- private final Method xClass_getDeclaredPropertiesMethod;
- private final Method xClass_getAnnotationMethod;
-
- private final Method xProperty_getNameMethod;
- private final Method xProperty_getAnnotationMethod;
- private final Method xProperty_getTypeMethod;
-
- public YMethodsAndClasses(Class<?> delegateClass) throws Exception {
- // Initializing classes
- ClassLoader cl = YMethodsAndClasses.class.getClassLoader();
-
- Class xClassClass;
- try {
- xClassClass = cl.loadClass("org.hibernate.annotations.common.reflection.XClass");
- } catch (ClassNotFoundException e) {
- try {
- xClassClass = cl.loadClass("org.hibernate.reflection.XClass");
- } catch (ClassNotFoundException e1) {
- throw new AuditException("No XClass found.");
- }
- }
-
- Class xPropertyClass;
- try {
- xPropertyClass = cl.loadClass("org.hibernate.annotations.common.reflection.XProperty");
- } catch (ClassNotFoundException e) {
- try {
- xPropertyClass = cl.loadClass("org.hibernate.reflection.XProperty");
- } catch (ClassNotFoundException e1) {
- throw new AuditException("No XProperty found.");
- }
- }
-
- // Initializing methods
- reflectionManager_classForNameMethod = delegateClass.getMethod("classForName", String.class, Class.class);
- reflectionManager_equalsMethod = delegateClass.getMethod("equals", xClassClass, Class.class);
-
- xClass_getNameMethod = xClassClass.getMethod("getName");
- xClass_getSuperclassMethod = xClassClass.getMethod("getSuperclass");
- xClass_getDeclaredPropertiesMethod = xClassClass.getMethod("getDeclaredProperties", String.class);
- xClass_getAnnotationMethod = xClassClass.getMethod("getAnnotation", Class.class);
-
- xProperty_getNameMethod = xPropertyClass.getMethod("getName");
- xProperty_getTypeMethod = xPropertyClass.getMethod("getType");
- xProperty_getAnnotationMethod = xPropertyClass.getMethod("getAnnotation", Class.class);
- }
-
- public Method getXClass_getNameMethod() {
- return xClass_getNameMethod;
- }
-
- public Method getXClass_getSuperclassMethod() {
- return xClass_getSuperclassMethod;
- }
-
- public Method getXClass_getDeclaredPropertiesMethod() {
- return xClass_getDeclaredPropertiesMethod;
- }
-
- public Method getXClass_getAnnotationMethod() {
- return xClass_getAnnotationMethod;
- }
-
- public Method getXProperty_getNameMethod() {
- return xProperty_getNameMethod;
- }
-
- public Method getXProperty_getAnnotationMethod() {
- return xProperty_getAnnotationMethod;
- }
-
- public Method getXProperty_getTypeMethod() {
- return xProperty_getTypeMethod;
- }
-
- public Method getReflectionManager_classForNameMethod() {
- return reflectionManager_classForNameMethod;
- }
-
- public Method getReflectionManager_equalsMethod() {
- return reflectionManager_equalsMethod;
- }
-}
Deleted: core/trunk/envers/src/main/java/org/hibernate/envers/tools/reflection/YProperty.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/tools/reflection/YProperty.java 2008-10-31 12:14:46 UTC (rev 15463)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/tools/reflection/YProperty.java 2008-10-31 12:23:27 UTC (rev 15464)
@@ -1,73 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.envers.tools.reflection;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.InvocationTargetException;
-
-import org.hibernate.envers.exception.AuditException;
-
-/**
- * @author Adam Warski (adam at warski dot org)
- */
-public class YProperty {
- private final YMethodsAndClasses ymc;
- private final Object delegate;
-
- public YProperty(YMethodsAndClasses ymc, Object delegate) {
- this.ymc = ymc;
- this.delegate = delegate;
- }
-
- public String getName() {
- try {
- return (String) ymc.getXProperty_getNameMethod().invoke(delegate);
- } catch (IllegalAccessException e) {
- throw new AuditException(e);
- } catch (InvocationTargetException e) {
- throw new AuditException(e);
- }
- }
-
- public <T extends Annotation> T getAnnotation(Class<T> annotation) {
- try {
- //noinspection unchecked
- return (T) ymc.getXProperty_getAnnotationMethod().invoke(delegate, annotation);
- } catch (IllegalAccessException e) {
- throw new AuditException(e);
- } catch (InvocationTargetException e) {
- throw new AuditException(e);
- }
- }
-
- public YClass getType() {
- try {
- return new YClass(ymc, ymc.getXProperty_getTypeMethod().invoke(delegate));
- } catch (IllegalAccessException e) {
- throw new AuditException(e);
- } catch (InvocationTargetException e) {
- throw new AuditException(e);
- }
- }
-}
Deleted: core/trunk/envers/src/main/java/org/hibernate/envers/tools/reflection/YReflectionManager.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/tools/reflection/YReflectionManager.java 2008-10-31 12:14:46 UTC (rev 15463)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/tools/reflection/YReflectionManager.java 2008-10-31 12:23:27 UTC (rev 15464)
@@ -1,83 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.envers.tools.reflection;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.hibernate.envers.exception.AuditException;
-
-import org.hibernate.MappingException;
-import org.hibernate.cfg.Configuration;
-
-/**
- * A reflection manager which proxies either to the old classes from package org.hibernate.reflection,
- * or to the new classed from package org.hibernate.annotations.common.reflection.
- * @author Adam Warski (adam at warski dot org)
- */
-public class YReflectionManager {
- private final Object delegate;
- private final YMethodsAndClasses ymc;
-
- public YReflectionManager(Configuration cfg) throws Exception {
- Object delegateTemp;
- try {
- delegateTemp = cfg.getClass().getMethod("getReflectionManager").invoke(cfg);
- } catch (NoSuchMethodException e) {
- // TODO - what if there it's a pure Hibernate envirionment?
- delegateTemp = ReflectionTools
- .loadClass("org.hibernate.cfg.annotations.reflection.EJB3ReflectionManager")
- .newInstance();
- }
- delegate = delegateTemp;
- ymc = new YMethodsAndClasses(delegate.getClass());
- }
-
- public YClass classForName(String className, Class<?> caller) throws ClassNotFoundException {
- try {
- return new YClass(ymc, ymc.getReflectionManager_classForNameMethod().invoke(delegate, className, caller));
- } catch (IllegalAccessException e) {
- throw new AuditException(e);
- } catch (InvocationTargetException e) {
- throw new AuditException(e);
- }
- }
-
- public <T> boolean equals(YClass class1, java.lang.Class<T> class2) {
- try {
- return (Boolean) ymc.getReflectionManager_equalsMethod().invoke(delegate, class1.getDelegate(), class2);
- } catch (IllegalAccessException e) {
- throw new AuditException(e);
- } catch (InvocationTargetException e) {
- throw new AuditException(e);
- }
- }
-
- public static YReflectionManager get(Configuration cfg) {
- try {
- return new YReflectionManager(cfg);
- } catch (Exception e) {
- throw new MappingException(e);
- }
- }
-}
16 years, 1 month
Hibernate SVN: r15463 - in core/trunk/envers/src: main/java/org/hibernate/envers/query/impl and 1 other directories.
by hibernate-commits@lists.jboss.org
Author: adamw
Date: 2008-10-31 08:14:46 -0400 (Fri, 31 Oct 2008)
New Revision: 15463
Modified:
core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/AuditConjunction.java
core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/AuditDisjunction.java
core/trunk/envers/src/main/java/org/hibernate/envers/query/impl/AbstractVersionsQuery.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/query/SimpleQuery.java
Log:
HHH-3575: fix with test
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/AuditConjunction.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/AuditConjunction.java 2008-10-31 12:00:22 UTC (rev 15462)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/AuditConjunction.java 2008-10-31 12:14:46 UTC (rev 15463)
@@ -48,8 +48,12 @@
public void addToQuery(AuditConfiguration verCfg, String entityName, QueryBuilder qb, Parameters parameters) {
Parameters andParameters = parameters.addSubParameters(Parameters.AND);
- for (AuditCriterion criterion : criterions) {
- criterion.addToQuery(verCfg, entityName, qb, andParameters);
+ if (criterions.size() == 0) {
+ andParameters.addWhere("1", false, "=", "1", false);
+ } else {
+ for (AuditCriterion criterion : criterions) {
+ criterion.addToQuery(verCfg, entityName, qb, andParameters);
+ }
}
}
}
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/AuditDisjunction.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/AuditDisjunction.java 2008-10-31 12:00:22 UTC (rev 15462)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/AuditDisjunction.java 2008-10-31 12:14:46 UTC (rev 15463)
@@ -48,8 +48,12 @@
public void addToQuery(AuditConfiguration verCfg, String entityName, QueryBuilder qb, Parameters parameters) {
Parameters orParameters = parameters.addSubParameters(Parameters.OR);
- for (AuditCriterion criterion : criterions) {
- criterion.addToQuery(verCfg, entityName, qb, orParameters);
+ if (criterions.size() == 0) {
+ orParameters.addWhere("0", false, "=", "1", false);
+ } else {
+ for (AuditCriterion criterion : criterions) {
+ criterion.addToQuery(verCfg, entityName, qb, orParameters);
+ }
}
}
}
\ No newline at end of file
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/query/impl/AbstractVersionsQuery.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/query/impl/AbstractVersionsQuery.java 2008-10-31 12:00:22 UTC (rev 15462)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/query/impl/AbstractVersionsQuery.java 2008-10-31 12:14:46 UTC (rev 15463)
@@ -84,6 +84,8 @@
qb.build(querySb, queryParamValues);
+ System.out.println("QUERY: " + querySb.toString());
+
Query query = versionsReader.getSession().createQuery(querySb.toString());
for (Map.Entry<String, Object> paramValue : queryParamValues.entrySet()) {
query.setParameter(paramValue.getKey(), paramValue.getValue());
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/query/SimpleQuery.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/query/SimpleQuery.java 2008-10-31 12:00:22 UTC (rev 15462)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/query/SimpleQuery.java 2008-10-31 12:14:46 UTC (rev 15463)
@@ -240,4 +240,33 @@
assert result.get(1).equals(RevisionType.MOD);
assert result.get(2).equals(RevisionType.DEL);
}
+
+ @Test
+ public void testEmptyRevisionOfEntityQuery() {
+ List result = getVersionsReader().createQuery()
+ .forRevisionsOfEntity(StrIntTestEntity.class, false, true)
+ .getResultList();
+
+ assert result.size() == 7;
+ }
+
+ @Test
+ public void testEmptyConjunctionRevisionOfEntityQuery() {
+ List result = getVersionsReader().createQuery()
+ .forRevisionsOfEntity(StrIntTestEntity.class, false, true)
+ .add(AuditRestrictions.conjunction())
+ .getResultList();
+
+ assert result.size() == 7;
+ }
+
+ @Test
+ public void testEmptyDisjunctionRevisionOfEntityQuery() {
+ List result = getVersionsReader().createQuery()
+ .forRevisionsOfEntity(StrIntTestEntity.class, false, true)
+ .add(AuditRestrictions.disjunction())
+ .getResultList();
+
+ assert result.size() == 0;
+ }
}
16 years, 1 month
Hibernate SVN: r15462 - in core/trunk/envers/src/main/java/org/hibernate/envers: configuration/metadata and 1 other directory.
by hibernate-commits@lists.jboss.org
Author: adamw
Date: 2008-10-31 08:00:22 -0400 (Fri, 31 Oct 2008)
New Revision: 15462
Removed:
core/trunk/envers/src/main/java/org/hibernate/envers/entity/
Modified:
core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/AuditMetadataGenerator.java
Log:
Removing the persister hack, as HHH-3351 has been resolved
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/AuditMetadataGenerator.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/AuditMetadataGenerator.java 2008-10-31 11:55:23 UTC (rev 15461)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/AuditMetadataGenerator.java 2008-10-31 12:00:22 UTC (rev 15462)
@@ -39,7 +39,6 @@
import org.hibernate.envers.entities.mapper.ExtendedPropertyMapper;
import org.hibernate.envers.entities.mapper.MultiPropertyMapper;
import org.hibernate.envers.entities.mapper.SubclassPropertyMapper;
-import org.hibernate.envers.entity.VersionsInheritanceEntityPersister;
import org.hibernate.envers.tools.StringTools;
import org.hibernate.envers.tools.log.YLog;
import org.hibernate.envers.tools.log.YLogManager;
@@ -240,10 +239,6 @@
}
}
- private void addPersisterHack(Element class_mapping) {
- class_mapping.addAttribute("persister", VersionsInheritanceEntityPersister.class.getName() );
- }
-
@SuppressWarnings({"unchecked"})
public void generateFirstPass(PersistentClass pc, PersistentClassVersioningData versioningData,
EntityXmlMappingData xmlMappingData) {
@@ -281,9 +276,6 @@
Element discriminator_element = class_mapping.addElement("discriminator");
MetadataTools.addColumns(discriminator_element, pc.getDiscriminator().getColumnIterator());
discriminator_element.addAttribute("type", pc.getDiscriminator().getType().getName());
-
- // If so, there is some inheritance scheme -> using the persister hack.
- addPersisterHack(class_mapping);
}
// Adding the id mapping
@@ -298,8 +290,6 @@
class_mapping = MetadataTools.createSubclassEntity(xmlMappingData.getMainXmlMapping(), versionsEntityName,
versionsTableName, schema, catalog, extendsEntityName, pc.getDiscriminatorValue());
- addPersisterHack(class_mapping);
-
// The id and revision type is already mapped in the parent
// Getting the property mapper of the parent - when mapping properties, they need to be included
16 years, 1 month
Hibernate SVN: r15461 - in core/trunk/envers/src/main/java/org/hibernate/envers: configuration/metadata and 8 other directories.
by hibernate-commits@lists.jboss.org
Author: adamw
Date: 2008-10-31 07:55:23 -0400 (Fri, 31 Oct 2008)
New Revision: 15461
Removed:
core/trunk/envers/src/main/java/org/hibernate/envers/configuration/VersionsConfiguration.java
core/trunk/envers/src/main/java/org/hibernate/envers/configuration/VersionsEntitiesConfiguration.java
core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/VersionsMetadataGenerator.java
core/trunk/envers/src/main/java/org/hibernate/envers/exception/VersionsException.java
core/trunk/envers/src/main/java/org/hibernate/envers/query/VersionsQuery.java
core/trunk/envers/src/main/java/org/hibernate/envers/query/VersionsQueryCreator.java
core/trunk/envers/src/main/java/org/hibernate/envers/query/VersionsRestrictions.java
core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/VersionsConjunction.java
core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/VersionsCriterion.java
core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/VersionsDisjunction.java
core/trunk/envers/src/main/java/org/hibernate/envers/query/order/VersionsOrder.java
core/trunk/envers/src/main/java/org/hibernate/envers/query/projection/VersionsProjection.java
core/trunk/envers/src/main/java/org/hibernate/envers/reader/VersionsReaderImpl.java
core/trunk/envers/src/main/java/org/hibernate/envers/reader/VersionsReaderImplementor.java
core/trunk/envers/src/main/java/org/hibernate/envers/synchronization/VersionsSync.java
core/trunk/envers/src/main/java/org/hibernate/envers/synchronization/VersionsSyncManager.java
core/trunk/envers/src/main/java/org/hibernate/envers/synchronization/work/AbstractVersionsWorkUnit.java
core/trunk/envers/src/main/java/org/hibernate/envers/synchronization/work/VersionsWorkUnit.java
Log:
HHH-3570: renaming versioned to audited
Deleted: core/trunk/envers/src/main/java/org/hibernate/envers/configuration/VersionsConfiguration.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/configuration/VersionsConfiguration.java 2008-10-31 11:53:38 UTC (rev 15460)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/configuration/VersionsConfiguration.java 2008-10-31 11:55:23 UTC (rev 15461)
@@ -1,106 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.envers.configuration;
-
-import java.util.Map;
-import java.util.Properties;
-import java.util.WeakHashMap;
-
-import org.hibernate.envers.entities.EntitiesConfigurations;
-import org.hibernate.envers.revisioninfo.RevisionInfoNumberReader;
-import org.hibernate.envers.revisioninfo.RevisionInfoQueryCreator;
-import org.hibernate.envers.synchronization.VersionsSyncManager;
-import org.hibernate.envers.tools.reflection.YReflectionManager;
-
-import org.hibernate.cfg.Configuration;
-
-/**
- * @author Adam Warski (adam at warski dot org)
- */
-public class VersionsConfiguration {
- private final GlobalConfiguration globalCfg;
- private final VersionsEntitiesConfiguration verEntCfg;
- private final VersionsSyncManager versionsSyncManager;
- private final EntitiesConfigurations entCfg;
- private final RevisionInfoQueryCreator revisionInfoQueryCreator;
- private final RevisionInfoNumberReader revisionInfoNumberReader;
-
- public VersionsEntitiesConfiguration getVerEntCfg() {
- return verEntCfg;
- }
-
- public VersionsSyncManager getSyncManager() {
- return versionsSyncManager;
- }
-
- public GlobalConfiguration getGlobalCfg() {
- return globalCfg;
- }
-
- public EntitiesConfigurations getEntCfg() {
- return entCfg;
- }
-
- public RevisionInfoQueryCreator getRevisionInfoQueryCreator() {
- return revisionInfoQueryCreator;
- }
-
- public RevisionInfoNumberReader getRevisionInfoNumberReader() {
- return revisionInfoNumberReader;
- }
-
- @SuppressWarnings({"unchecked"})
- public VersionsConfiguration(Configuration cfg) {
- Properties properties = cfg.getProperties();
-
- YReflectionManager reflectionManager = YReflectionManager.get(cfg);
- RevisionInfoConfiguration revInfoCfg = new RevisionInfoConfiguration();
- RevisionInfoConfigurationResult revInfoCfgResult = revInfoCfg.configure(cfg, reflectionManager);
- verEntCfg = new VersionsEntitiesConfiguration(properties, revInfoCfgResult.getRevisionInfoEntityName());
- globalCfg = new GlobalConfiguration(properties);
- versionsSyncManager = new VersionsSyncManager(revInfoCfgResult.getRevisionInfoGenerator());
- revisionInfoQueryCreator = revInfoCfgResult.getRevisionInfoQueryCreator();
- revisionInfoNumberReader = revInfoCfgResult.getRevisionInfoNumberReader();
- entCfg = new EntitiesConfigurator().configure(cfg, reflectionManager, globalCfg, verEntCfg,
- revInfoCfgResult.getRevisionInfoXmlMapping(), revInfoCfgResult.getRevisionInfoRelationMapping());
- }
-
- //
-
- private static Map<Configuration, VersionsConfiguration> cfgs
- = new WeakHashMap<Configuration, VersionsConfiguration>();
-
- public synchronized static VersionsConfiguration getFor(Configuration cfg) {
- VersionsConfiguration verCfg = cfgs.get(cfg);
-
- if (verCfg == null) {
- verCfg = new VersionsConfiguration(cfg);
- cfgs.put(cfg, verCfg);
-
- cfg.buildMappings();
- }
-
- return verCfg;
- }
-}
Deleted: core/trunk/envers/src/main/java/org/hibernate/envers/configuration/VersionsEntitiesConfiguration.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/configuration/VersionsEntitiesConfiguration.java 2008-10-31 11:53:38 UTC (rev 15460)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/configuration/VersionsEntitiesConfiguration.java 2008-10-31 11:55:23 UTC (rev 15461)
@@ -1,112 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.envers.configuration;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
-
-/**
- * Configuration of versions entities - names of fields, entities and tables created to store versioning information.
- * @author Adam Warski (adam at warski dot org)
- */
-public class VersionsEntitiesConfiguration {
- private final String versionsTablePrefix;
- private final String versionsTableSuffix;
-
- private final String originalIdPropName;
-
- private final String revisionPropName;
- private final String revisionPropPath;
-
- private final String revisionTypePropName;
- private final String revisionTypePropType;
-
- private final String revisionInfoEntityName;
-
- private final Map<String, String> customVersionsTablesNames;
-
- public VersionsEntitiesConfiguration(Properties properties, String revisionInfoEntityName) {
- this.revisionInfoEntityName = revisionInfoEntityName;
-
- versionsTablePrefix = properties.getProperty("org.hibernate.envers.versionsTablePrefix", "");
- versionsTableSuffix = properties.getProperty("org.hibernate.envers.versionsTableSuffix", "_versions");
-
- originalIdPropName = "originalId";
-
- revisionPropName = properties.getProperty("org.hibernate.envers.revisionFieldName", "_revision");
-
- revisionTypePropName = properties.getProperty("org.hibernate.envers.revisionTypeFieldName", "_revision_type");
- revisionTypePropType = "byte";
-
- customVersionsTablesNames = new HashMap<String, String>();
-
- revisionPropPath = originalIdPropName + "." + revisionPropName + ".id";
- }
-
- public String getOriginalIdPropName() {
- return originalIdPropName;
- }
-
- public String getRevisionPropName() {
- return revisionPropName;
- }
-
- public String getRevisionPropPath() {
- return revisionPropPath;
- }
-
- public String getRevisionTypePropName() {
- return revisionTypePropName;
- }
-
- public String getRevisionTypePropType() {
- return revisionTypePropType;
- }
-
- public String getRevisionInfoEntityName() {
- return revisionInfoEntityName;
- }
-
- //
-
- public void addCustomVersionsTableName(String entityName, String tableName) {
- customVersionsTablesNames.put(entityName, tableName);
- }
-
- //
-
- public String getVersionsEntityName(String entityName) {
- return versionsTablePrefix + entityName + versionsTableSuffix;
- }
-
- public String getVersionsTableName(String entityName, String tableName) {
- String customHistoryTableName = customVersionsTablesNames.get(entityName);
- if (customHistoryTableName == null) {
- return versionsTablePrefix + tableName + versionsTableSuffix;
- }
-
- return customHistoryTableName;
- }
-}
Deleted: core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/VersionsMetadataGenerator.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/VersionsMetadataGenerator.java 2008-10-31 11:53:38 UTC (rev 15460)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/VersionsMetadataGenerator.java 2008-10-31 11:55:23 UTC (rev 15461)
@@ -1,385 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.envers.configuration.metadata;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.dom4j.Element;
-import org.hibernate.envers.ModificationStore;
-import org.hibernate.envers.AuditJoinTable;
-import org.hibernate.envers.configuration.GlobalConfiguration;
-import org.hibernate.envers.configuration.VersionsEntitiesConfiguration;
-import org.hibernate.envers.entities.EntityConfiguration;
-import org.hibernate.envers.entities.IdMappingData;
-import org.hibernate.envers.entities.mapper.CompositeMapperBuilder;
-import org.hibernate.envers.entities.mapper.ExtendedPropertyMapper;
-import org.hibernate.envers.entities.mapper.MultiPropertyMapper;
-import org.hibernate.envers.entities.mapper.SubclassPropertyMapper;
-import org.hibernate.envers.entity.VersionsInheritanceEntityPersister;
-import org.hibernate.envers.tools.StringTools;
-import org.hibernate.envers.tools.log.YLog;
-import org.hibernate.envers.tools.log.YLogManager;
-
-import org.hibernate.MappingException;
-import org.hibernate.cfg.Configuration;
-import org.hibernate.mapping.Collection;
-import org.hibernate.mapping.Join;
-import org.hibernate.mapping.PersistentClass;
-import org.hibernate.mapping.Property;
-import org.hibernate.mapping.Value;
-import org.hibernate.type.CollectionType;
-import org.hibernate.type.ManyToOneType;
-import org.hibernate.type.OneToOneType;
-import org.hibernate.type.Type;
-
-/**
- * @author Adam Warski (adam at warski dot org)
- * @author Sebastian Komander
- */
-public final class VersionsMetadataGenerator {
- private final Configuration cfg;
- private final GlobalConfiguration globalCfg;
- private final VersionsEntitiesConfiguration verEntCfg;
- private final Element revisionInfoRelationMapping;
-
- private final BasicMetadataGenerator basicMetadataGenerator;
- private final IdMetadataGenerator idMetadataGenerator;
- private final ToOneRelationMetadataGenerator toOneRelationMetadataGenerator;
-
- private final Map<String, EntityConfiguration> entitiesConfigurations;
-
- // Map entity name -> (join descriptor -> element describing the "versioned" join)
- private final Map<String, Map<Join, Element>> entitiesJoins;
-
- private YLog log = YLogManager.getLogManager().getLog(VersionsMetadataGenerator.class);
-
- public VersionsMetadataGenerator(Configuration cfg, GlobalConfiguration globalCfg,
- VersionsEntitiesConfiguration verEntCfg,
- Element revisionInfoRelationMapping) {
- this.cfg = cfg;
- this.globalCfg = globalCfg;
- this.verEntCfg = verEntCfg;
- this.revisionInfoRelationMapping = revisionInfoRelationMapping;
-
- this.basicMetadataGenerator = new BasicMetadataGenerator();
- this.idMetadataGenerator = new IdMetadataGenerator(this);
- this.toOneRelationMetadataGenerator = new ToOneRelationMetadataGenerator(this);
-
- entitiesConfigurations = new HashMap<String, EntityConfiguration>();
- entitiesJoins = new HashMap<String, Map<Join, Element>>();
- }
-
- void addRevisionInfoRelation(Element any_mapping) {
- Element rev_mapping = (Element) revisionInfoRelationMapping.clone();
- rev_mapping.addAttribute("name", verEntCfg.getRevisionPropName());
- MetadataTools.addColumn(rev_mapping, verEntCfg.getRevisionPropName(), null);
-
- any_mapping.add(rev_mapping);
- }
-
- void addRevisionType(Element any_mapping) {
- Element revTypeProperty = MetadataTools.addProperty(any_mapping, verEntCfg.getRevisionTypePropName(),
- verEntCfg.getRevisionTypePropType(), true, false);
- revTypeProperty.addAttribute("type", "org.hibernate.envers.entities.RevisionTypeType");
- }
-
- private ModificationStore getStoreForProperty(Property property, PropertyStoreInfo propertyStoreInfo,
- List<String> unversionedProperties) {
- /*
- * Checks if a property is versioned, which is when:
- * - the property isn't unversioned
- * - the whole entity is versioned, then the default store is not null
- * - there is a store defined for this entity, which is when this property is annotated
- */
-
- if (unversionedProperties.contains(property.getName())) {
- return null;
- }
-
- ModificationStore store = propertyStoreInfo.propertyStores.get(property.getName());
-
- if (store == null) {
- return propertyStoreInfo.defaultStore;
- }
-
- return store;
- }
-
- @SuppressWarnings({"unchecked"})
- void addValue(Element parent, String name, Value value, CompositeMapperBuilder currentMapper,
- ModificationStore store, String entityName, EntityXmlMappingData xmlMappingData,
- AuditJoinTable joinTable, String mapKey, boolean insertable, boolean firstPass) {
- Type type = value.getType();
-
- // only first pass
- if (firstPass) {
- if (basicMetadataGenerator.addBasic(parent, name, value, currentMapper, store, entityName, insertable,
- false)) {
- // The property was mapped by the basic generator.
- return;
- }
- }
-
- if (type instanceof ManyToOneType) {
- // only second pass
- if (!firstPass) {
- toOneRelationMetadataGenerator.addToOne(parent, name, value, currentMapper, entityName);
- }
- } else if (type instanceof OneToOneType) {
- // only second pass
- if (!firstPass) {
- toOneRelationMetadataGenerator.addOneToOneNotOwning(name, value, currentMapper, entityName);
- }
- } else if (type instanceof CollectionType) {
- // only second pass
- if (!firstPass) {
- CollectionMetadataGenerator collectionMetadataGenerator = new CollectionMetadataGenerator(this,
- name, (Collection) value, currentMapper, entityName, xmlMappingData, joinTable, mapKey);
- collectionMetadataGenerator.addCollection();
- }
- } else {
- if (firstPass) {
- // If we got here in the first pass, it means the basic mapper didn't map it, and none of the
- // above branches either.
- throwUnsupportedTypeException(type, entityName, name);
- }
- }
- }
-
- @SuppressWarnings({"unchecked"})
- private void addProperties(Element parent, Iterator<Property> properties, CompositeMapperBuilder currentMapper,
- PersistentClassVersioningData versioningData, String entityName, EntityXmlMappingData xmlMappingData,
- boolean firstPass) {
- while (properties.hasNext()) {
- Property property = properties.next();
- if (!"_identifierMapper".equals(property.getName())) {
- ModificationStore store = getStoreForProperty(property, versioningData.propertyStoreInfo,
- versioningData.unversionedProperties);
-
- if (store != null) {
- addValue(parent, property.getName(), property.getValue(), currentMapper, store, entityName,
- xmlMappingData, versioningData.versionsJoinTables.get(property.getName()),
- versioningData.mapKeys.get(property.getName()), property.isInsertable(), firstPass);
- }
- }
- }
- }
-
- @SuppressWarnings({"unchecked"})
- private void createJoins(PersistentClass pc, Element parent, PersistentClassVersioningData versioningData) {
- Iterator<Join> joins = pc.getJoinIterator();
-
- Map<Join, Element> joinElements = new HashMap<Join, Element>();
- entitiesJoins.put(pc.getEntityName(), joinElements);
-
- while (joins.hasNext()) {
- Join join = joins.next();
-
- // Determining the table name. If there is no entry in the dictionary, just constructing the table name
- // as if it was an entity (by appending/prepending configured strings).
- String originalTableName = join.getTable().getName();
- String versionedTableName = versioningData.secondaryTableDictionary.get(originalTableName);
- if (versionedTableName == null) {
- versionedTableName = verEntCfg.getVersionsEntityName(originalTableName);
- }
-
- String schema = versioningData.versionsTable.schema();
- if (StringTools.isEmpty(schema)) {
- schema = join.getTable().getSchema();
- }
-
- String catalog = versioningData.versionsTable.catalog();
- if (StringTools.isEmpty(catalog)) {
- catalog = join.getTable().getCatalog();
- }
-
- Element joinElement = MetadataTools.createJoin(parent, versionedTableName, schema, catalog);
- joinElements.put(join, joinElement);
-
- Element joinKey = joinElement.addElement("key");
- MetadataTools.addColumns(joinKey, join.getKey().getColumnIterator());
- MetadataTools.addColumn(joinKey, verEntCfg.getRevisionPropName(), null);
- }
- }
-
- @SuppressWarnings({"unchecked"})
- private void addJoins(PersistentClass pc, CompositeMapperBuilder currentMapper, PersistentClassVersioningData versioningData,
- String entityName, EntityXmlMappingData xmlMappingData,boolean firstPass) {
- Iterator<Join> joins = pc.getJoinIterator();
-
- while (joins.hasNext()) {
- Join join = joins.next();
- Element joinElement = entitiesJoins.get(entityName).get(join);
-
- addProperties(joinElement, join.getPropertyIterator(), currentMapper, versioningData, entityName,
- xmlMappingData, firstPass);
- }
- }
-
- private void addPersisterHack(Element class_mapping) {
- class_mapping.addAttribute("persister", VersionsInheritanceEntityPersister.class.getName() );
- }
-
- @SuppressWarnings({"unchecked"})
- public void generateFirstPass(PersistentClass pc, PersistentClassVersioningData versioningData,
- EntityXmlMappingData xmlMappingData) {
- String schema = versioningData.versionsTable.schema();
- if (StringTools.isEmpty(schema)) {
- schema = pc.getTable().getSchema();
- }
-
- String catalog = versioningData.versionsTable.catalog();
- if (StringTools.isEmpty(catalog)) {
- catalog = pc.getTable().getCatalog();
- }
-
- String entityName = pc.getEntityName();
- String versionsEntityName = verEntCfg.getVersionsEntityName(entityName);
- String versionsTableName = verEntCfg.getVersionsTableName(entityName, pc.getTable().getName());
-
- // Generating a mapping for the id
- IdMappingData idMapper = idMetadataGenerator.addId(pc);
-
- Element class_mapping;
- ExtendedPropertyMapper propertyMapper;
-
- InheritanceType inheritanceType = InheritanceType.get(pc);
- String parentEntityName = null;
-
- switch (inheritanceType) {
- case NONE:
- class_mapping = MetadataTools.createEntity(xmlMappingData.getMainXmlMapping(), versionsEntityName, versionsTableName,
- schema, catalog, pc.getDiscriminatorValue());
- propertyMapper = new MultiPropertyMapper();
-
- // Checking if there is a discriminator column
- if (pc.getDiscriminator() != null) {
- Element discriminator_element = class_mapping.addElement("discriminator");
- MetadataTools.addColumns(discriminator_element, pc.getDiscriminator().getColumnIterator());
- discriminator_element.addAttribute("type", pc.getDiscriminator().getType().getName());
-
- // If so, there is some inheritance scheme -> using the persister hack.
- addPersisterHack(class_mapping);
- }
-
- // Adding the id mapping
- class_mapping.add((Element) idMapper.getXmlMapping().clone());
-
- // Adding the "revision type" property
- addRevisionType(class_mapping);
-
- break;
- case SINGLE:
- String extendsEntityName = verEntCfg.getVersionsEntityName(pc.getSuperclass().getEntityName());
- class_mapping = MetadataTools.createSubclassEntity(xmlMappingData.getMainXmlMapping(), versionsEntityName,
- versionsTableName, schema, catalog, extendsEntityName, pc.getDiscriminatorValue());
-
- addPersisterHack(class_mapping);
-
- // The id and revision type is already mapped in the parent
-
- // Getting the property mapper of the parent - when mapping properties, they need to be included
- parentEntityName = pc.getSuperclass().getEntityName();
- ExtendedPropertyMapper parentPropertyMapper = entitiesConfigurations.get(parentEntityName).getPropertyMapper();
- propertyMapper = new SubclassPropertyMapper(new MultiPropertyMapper(), parentPropertyMapper);
-
- break;
- case JOINED:
- throw new MappingException("Joined inheritance strategy not supported for versioning!");
- case TABLE_PER_CLASS:
- throw new MappingException("Table-per-class inheritance strategy not supported for versioning!");
- default:
- throw new AssertionError("Impossible enum value.");
- }
-
- // Mapping unjoined properties
- addProperties(class_mapping, (Iterator<Property>) pc.getUnjoinedPropertyIterator(), propertyMapper,
- versioningData, pc.getEntityName(), xmlMappingData,
- true);
-
- // Creating and mapping joins (first pass)
- createJoins(pc, class_mapping, versioningData);
- addJoins(pc, propertyMapper, versioningData, pc.getEntityName(), xmlMappingData, true);
-
- // Storing the generated configuration
- EntityConfiguration entityCfg = new EntityConfiguration(versionsEntityName, idMapper,
- propertyMapper, parentEntityName);
- entitiesConfigurations.put(pc.getEntityName(), entityCfg);
- }
-
- @SuppressWarnings({"unchecked"})
- public void generateSecondPass(PersistentClass pc, PersistentClassVersioningData versioningData,
- EntityXmlMappingData xmlMappingData) {
- String entityName = pc.getEntityName();
-
- CompositeMapperBuilder propertyMapper = entitiesConfigurations.get(entityName).getPropertyMapper();
-
- // Mapping unjoined properties
- Element parent = xmlMappingData.getMainXmlMapping().getRootElement().element("class");
- if (parent == null) {
- parent = xmlMappingData.getMainXmlMapping().getRootElement().element("subclass");
- }
-
- addProperties(parent, (Iterator<Property>) pc.getUnjoinedPropertyIterator(),
- propertyMapper, versioningData, entityName, xmlMappingData, false);
-
- // Mapping joins (second pass)
- addJoins(pc, propertyMapper, versioningData, entityName, xmlMappingData, false);
- }
-
- public Map<String, EntityConfiguration> getEntitiesConfigurations() {
- return entitiesConfigurations;
- }
-
- // Getters for generators and configuration
-
- BasicMetadataGenerator getBasicMetadataGenerator() {
- return basicMetadataGenerator;
- }
-
- Configuration getCfg() {
- return cfg;
- }
-
- GlobalConfiguration getGlobalCfg() {
- return globalCfg;
- }
-
- VersionsEntitiesConfiguration getVerEntCfg() {
- return verEntCfg;
- }
-
- void throwUnsupportedTypeException(Type type, String entityName, String propertyName) {
- String message = "Type not supported for versioning: " + type.getClass().getName() +
- ", on entity " + entityName + ", property '" + propertyName + "'.";
- if (globalCfg.isWarnOnUnsupportedTypes()) {
- log.warn(message);
- } else {
- throw new MappingException(message);
- }
- }
-}
Deleted: core/trunk/envers/src/main/java/org/hibernate/envers/exception/VersionsException.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/exception/VersionsException.java 2008-10-31 11:53:38 UTC (rev 15460)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/exception/VersionsException.java 2008-10-31 11:55:23 UTC (rev 15461)
@@ -1,43 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.envers.exception;
-
-import org.hibernate.HibernateException;
-
-/**
- * @author Adam Warski (adam at warski dot org)
- */
-public class VersionsException extends HibernateException {
- public VersionsException(String message) {
- super(message);
- }
-
- public VersionsException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public VersionsException(Throwable cause) {
- super(cause);
- }
-}
Deleted: core/trunk/envers/src/main/java/org/hibernate/envers/query/VersionsQuery.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/query/VersionsQuery.java 2008-10-31 11:53:38 UTC (rev 15460)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/query/VersionsQuery.java 2008-10-31 11:55:23 UTC (rev 15461)
@@ -1,75 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.envers.query;
-
-import java.util.List;
-import javax.persistence.NoResultException;
-import javax.persistence.NonUniqueResultException;
-
-import org.hibernate.envers.exception.VersionsException;
-import org.hibernate.envers.query.criteria.VersionsCriterion;
-import org.hibernate.envers.query.order.VersionsOrder;
-import org.hibernate.envers.query.projection.VersionsProjection;
-
-import org.hibernate.CacheMode;
-import org.hibernate.FlushMode;
-import org.hibernate.LockMode;
-
-/**
- * @author Adam Warski (adam at warski dot org)
- * @see org.hibernate.Criteria
- */
-public interface VersionsQuery {
- List getResultList() throws VersionsException;
-
- Object getSingleResult() throws VersionsException, NonUniqueResultException, NoResultException;
-
- VersionsQuery add(VersionsCriterion criterion);
-
- VersionsQuery addProjection(String function, String propertyName);
-
- VersionsQuery addProjection(VersionsProjection projection);
-
- VersionsQuery addOrder(String propertyName, boolean asc);
-
- VersionsQuery addOrder(VersionsOrder order);
-
- VersionsQuery setMaxResults(int maxResults);
-
- VersionsQuery setFirstResult(int firstResult);
-
- VersionsQuery setCacheable(boolean cacheable);
-
- VersionsQuery setCacheRegion(String cacheRegion);
-
- VersionsQuery setComment(String comment);
-
- VersionsQuery setFlushMode(FlushMode flushMode);
-
- VersionsQuery setCacheMode(CacheMode cacheMode);
-
- VersionsQuery setTimeout(int timeout);
-
- VersionsQuery setLockMode(LockMode lockMode);
-}
Deleted: core/trunk/envers/src/main/java/org/hibernate/envers/query/VersionsQueryCreator.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/query/VersionsQueryCreator.java 2008-10-31 11:53:38 UTC (rev 15460)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/query/VersionsQueryCreator.java 2008-10-31 11:55:23 UTC (rev 15461)
@@ -1,83 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.envers.query;
-
-import org.hibernate.envers.configuration.VersionsConfiguration;
-import org.hibernate.envers.query.impl.EntitiesAtRevisionQuery;
-import org.hibernate.envers.query.impl.RevisionsOfEntityQuery;
-import org.hibernate.envers.reader.VersionsReaderImplementor;
-import static org.hibernate.envers.tools.ArgumentsTools.checkNotNull;
-import static org.hibernate.envers.tools.ArgumentsTools.checkPositive;
-
-/**
- * @author Adam Warski (adam at warski dot org)
- */
-public class VersionsQueryCreator {
- private final VersionsConfiguration verCfg;
- private final VersionsReaderImplementor versionsReaderImplementor;
-
- public VersionsQueryCreator(VersionsConfiguration verCfg, VersionsReaderImplementor versionsReaderImplementor) {
- this.verCfg = verCfg;
- this.versionsReaderImplementor = versionsReaderImplementor;
- }
-
- /**
- * Creates a query, which will return entities satisfying some conditions (specified later),
- * at a given revision.
- * @param c Class of the entities for which to query.
- * @param revision Revision number at which to execute the query.
- * @return A query for entities at a given revision, to which conditions can be added and which
- * can then be executed. The result of the query will be a list of entities (beans), unless a
- * projection is added.
- */
- public VersionsQuery forEntitiesAtRevision(Class<?> c, Number revision) {
- checkNotNull(revision, "Entity revision");
- checkPositive(revision, "Entity revision");
- return new EntitiesAtRevisionQuery(verCfg, versionsReaderImplementor, c, revision);
- }
-
- /**
- * Creates a query, which selects the revisions, at which the given entity was modified.
- * Unless an explicit projection is set, the result will be a list of three-element arrays, containing:
- * <ol>
- * <li>the entity instance</li>
- * <li>revision entity, corresponding to the revision at which the entity was modified. If no custom
- * revision entity is used, this will be an instance of {@link org.hibernate.envers.DefaultRevisionEntity}</li>
- * <li>type of the revision (an enum instance of class {@link org.hibernate.envers.RevisionType})</li>.
- * </ol>
- * Additional conditions that the results must satisfy may be specified.
- * @param c Class of the entities for which to query.
- * @param selectEntitiesOnly If true, instead of a list of three-element arrays, a list of entites will be
- * returned as a result of executing this query.
- * @param selectDeletedEntities If true, also revisions where entities were deleted will be returned. The additional
- * entities will have revision type "delete", and contain no data (all fields null), except for the id field.
- * @return A query for revisions at which instances of the given entity were modified, to which
- * conditions can be added (for example - a specific id of an entity of class <code>c</code>), and which
- * can then be executed. The results of the query will be sorted in ascending order by the revision number,
- * unless an order or projection is added.
- */
- public VersionsQuery forRevisionsOfEntity(Class<?> c, boolean selectEntitiesOnly, boolean selectDeletedEntities) {
- return new RevisionsOfEntityQuery(verCfg, versionsReaderImplementor, c, selectEntitiesOnly,selectDeletedEntities);
- }
-}
Deleted: core/trunk/envers/src/main/java/org/hibernate/envers/query/VersionsRestrictions.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/query/VersionsRestrictions.java 2008-10-31 11:53:38 UTC (rev 15460)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/query/VersionsRestrictions.java 2008-10-31 11:55:23 UTC (rev 15461)
@@ -1,258 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.envers.query;
-
-import java.util.Collection;
-
-import org.hibernate.envers.query.criteria.AggregatedFieldVersionsExpression;
-import org.hibernate.envers.query.criteria.BetweenVersionsExpression;
-import org.hibernate.envers.query.criteria.IdentifierEqVersionsExpression;
-import org.hibernate.envers.query.criteria.InVersionsExpression;
-import org.hibernate.envers.query.criteria.LogicalVersionsExpression;
-import org.hibernate.envers.query.criteria.NotNullVersionsExpression;
-import org.hibernate.envers.query.criteria.NotVersionsExpression;
-import org.hibernate.envers.query.criteria.NullVersionsExpression;
-import org.hibernate.envers.query.criteria.PropertyVersionsExpression;
-import org.hibernate.envers.query.criteria.RelatedVersionsExpression;
-import org.hibernate.envers.query.criteria.SimpleVersionsExpression;
-import org.hibernate.envers.query.criteria.VersionsConjunction;
-import org.hibernate.envers.query.criteria.VersionsCriterion;
-import org.hibernate.envers.query.criteria.VersionsDisjunction;
-
-import org.hibernate.criterion.MatchMode;
-
-/**
- * TODO: ilike
- * @author Adam Warski (adam at warski dot org)
- * @see org.hibernate.criterion.Restrictions
- */
-@SuppressWarnings({"JavaDoc"})
-public class VersionsRestrictions {
- private VersionsRestrictions() { }
-
- /**
- * Apply an "equal" constraint to the identifier property.
- */
- public static VersionsCriterion idEq(Object value) {
- return new IdentifierEqVersionsExpression(value);
- }
-
- /**
- * Apply an "equal" constraint to the named property
- */
- public static VersionsCriterion eq(String propertyName, Object value) {
- return new SimpleVersionsExpression(propertyName, value, "=");
- }
-
- /**
- * Apply a "not equal" constraint to the named property
- */
- public static VersionsCriterion ne(String propertyName, Object value) {
- return new SimpleVersionsExpression(propertyName, value, "<>");
- }
-
- /**
- * Apply an "equal" constraint on an id of a related entity
- */
- public static VersionsCriterion relatedIdEq(String propertyName, Object id) {
- return new RelatedVersionsExpression(propertyName, id, true);
- }
-
- /**
- * Apply a "not equal" constraint to the named property
- */
- public static VersionsCriterion relatedIdNe(String propertyName, Object id) {
- return new RelatedVersionsExpression(propertyName, id, false);
- }
-
- /**
- * Apply a "like" constraint to the named property
- */
- public static VersionsCriterion like(String propertyName, Object value) {
- return new SimpleVersionsExpression(propertyName, value, " like ");
- }
-
- /**
- * Apply a "like" constraint to the named property
- */
- public static VersionsCriterion like(String propertyName, String value, MatchMode matchMode) {
- return new SimpleVersionsExpression(propertyName, matchMode.toMatchString(value), " like " );
- }
-
- /**
- * Apply a "greater than" constraint to the named property
- */
- public static VersionsCriterion gt(String propertyName, Object value) {
- return new SimpleVersionsExpression(propertyName, value, ">");
- }
-
- /**
- * Apply a "less than" constraint to the named property
- */
- public static VersionsCriterion lt(String propertyName, Object value) {
- return new SimpleVersionsExpression(propertyName, value, "<");
- }
-
- /**
- * Apply a "less than or equal" constraint to the named property
- */
- public static VersionsCriterion le(String propertyName, Object value) {
- return new SimpleVersionsExpression(propertyName, value, "<=");
- }
-
- /**
- * Apply a "greater than or equal" constraint to the named property
- */
- public static VersionsCriterion ge(String propertyName, Object value) {
- return new SimpleVersionsExpression(propertyName, value, ">=");
- }
-
- /**
- * Apply a "between" constraint to the named property
- */
- public static VersionsCriterion between(String propertyName, Object lo, Object hi) {
- return new BetweenVersionsExpression(propertyName, lo, hi);
- }
-
- /**
- * Apply an "in" constraint to the named property
- */
- public static VersionsCriterion in(String propertyName, Object[] values) {
- return new InVersionsExpression(propertyName, values);
- }
-
- /**
- * Apply an "in" constraint to the named property
- */
- public static VersionsCriterion in(String propertyName, Collection values) {
- return new InVersionsExpression(propertyName, values.toArray());
- }
-
- /**
- * Apply an "is null" constraint to the named property
- */
- public static VersionsCriterion isNull(String propertyName) {
- return new NullVersionsExpression(propertyName);
- }
-
- /**
- * Apply an "equal" constraint to two properties
- */
- public static VersionsCriterion eqProperty(String propertyName, String otherPropertyName) {
- return new PropertyVersionsExpression(propertyName, otherPropertyName, "=");
- }
-
- /**
- * Apply a "not equal" constraint to two properties
- */
- public static VersionsCriterion neProperty(String propertyName, String otherPropertyName) {
- return new PropertyVersionsExpression(propertyName, otherPropertyName, "<>");
- }
-
- /**
- * Apply a "less than" constraint to two properties
- */
- public static VersionsCriterion ltProperty(String propertyName, String otherPropertyName) {
- return new PropertyVersionsExpression(propertyName, otherPropertyName, "<");
- }
-
- /**
- * Apply a "less than or equal" constraint to two properties
- */
- public static VersionsCriterion leProperty(String propertyName, String otherPropertyName) {
- return new PropertyVersionsExpression(propertyName, otherPropertyName, "<=");
- }
-
- /**
- * Apply a "greater than" constraint to two properties
- */
- public static VersionsCriterion gtProperty(String propertyName, String otherPropertyName) {
- return new PropertyVersionsExpression(propertyName, otherPropertyName, ">");
- }
-
- /**
- * Apply a "greater than or equal" constraint to two properties
- */
- public static VersionsCriterion geProperty(String propertyName, String otherPropertyName) {
- return new PropertyVersionsExpression(propertyName, otherPropertyName, ">=");
- }
-
- /**
- * Apply an "is not null" constraint to the named property
- */
- public static VersionsCriterion isNotNull(String propertyName) {
- return new NotNullVersionsExpression(propertyName);
- }
-
- /**
- * Return the conjuction of two expressions
- */
- public static VersionsCriterion and(VersionsCriterion lhs, VersionsCriterion rhs) {
- return new LogicalVersionsExpression(lhs, rhs, "and");
- }
-
- /**
- * Return the disjuction of two expressions
- */
- public static VersionsCriterion or(VersionsCriterion lhs, VersionsCriterion rhs) {
- return new LogicalVersionsExpression(lhs, rhs, "or");
- }
-
- /**
- * Return the negation of an expression
- */
- public static VersionsCriterion not(VersionsCriterion expression) {
- return new NotVersionsExpression(expression);
- }
-
- /**
- * Group expressions together in a single conjunction (A and B and C...)
- */
- public static VersionsConjunction conjunction() {
- return new VersionsConjunction();
- }
-
- /**
- * Group expressions together in a single disjunction (A or B or C...)
- */
- public static VersionsDisjunction disjunction() {
- return new VersionsDisjunction();
- }
-
- /**
- * Apply a "maximalize property" constraint.
- */
- public static AggregatedFieldVersionsExpression maximizeProperty(String propertyName) {
- return new AggregatedFieldVersionsExpression(propertyName,
- AggregatedFieldVersionsExpression.AggregatedMode.MAX);
- }
-
- /**
- * Apply a "minimize property" constraint.
- */
- public static AggregatedFieldVersionsExpression minimizeProperty(String propertyName) {
- return new AggregatedFieldVersionsExpression(propertyName,
- AggregatedFieldVersionsExpression.AggregatedMode.MIN);
- }
-}
Deleted: core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/VersionsConjunction.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/VersionsConjunction.java 2008-10-31 11:53:38 UTC (rev 15460)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/VersionsConjunction.java 2008-10-31 11:55:23 UTC (rev 15461)
@@ -1,55 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.envers.query.criteria;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.hibernate.envers.configuration.VersionsConfiguration;
-import org.hibernate.envers.tools.query.Parameters;
-import org.hibernate.envers.tools.query.QueryBuilder;
-
-/**
- * @author Adam Warski (adam at warski dot org)
- */
-public class VersionsConjunction implements VersionsCriterion, ExtendableCriterion {
- private List<VersionsCriterion> criterions;
-
- public VersionsConjunction() {
- criterions = new ArrayList<VersionsCriterion>();
- }
-
- public VersionsConjunction add(VersionsCriterion criterion) {
- criterions.add(criterion);
- return this;
- }
-
- public void addToQuery(VersionsConfiguration verCfg, String entityName, QueryBuilder qb, Parameters parameters) {
- Parameters andParameters = parameters.addSubParameters(Parameters.AND);
-
- for (VersionsCriterion criterion : criterions) {
- criterion.addToQuery(verCfg, entityName, qb, andParameters);
- }
- }
-}
Deleted: core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/VersionsCriterion.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/VersionsCriterion.java 2008-10-31 11:53:38 UTC (rev 15460)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/VersionsCriterion.java 2008-10-31 11:55:23 UTC (rev 15461)
@@ -1,35 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.envers.query.criteria;
-
-import org.hibernate.envers.configuration.VersionsConfiguration;
-import org.hibernate.envers.tools.query.Parameters;
-import org.hibernate.envers.tools.query.QueryBuilder;
-
-/**
- * @author Adam Warski (adam at warski dot org)
- */
-public interface VersionsCriterion {
- void addToQuery(VersionsConfiguration verCfg, String entityName, QueryBuilder qb, Parameters parameters);
-}
Deleted: core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/VersionsDisjunction.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/VersionsDisjunction.java 2008-10-31 11:53:38 UTC (rev 15460)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/VersionsDisjunction.java 2008-10-31 11:55:23 UTC (rev 15461)
@@ -1,55 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.envers.query.criteria;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.hibernate.envers.configuration.VersionsConfiguration;
-import org.hibernate.envers.tools.query.Parameters;
-import org.hibernate.envers.tools.query.QueryBuilder;
-
-/**
- * @author Adam Warski (adam at warski dot org)
- */
-public class VersionsDisjunction implements VersionsCriterion, ExtendableCriterion {
- private List<VersionsCriterion> criterions;
-
- public VersionsDisjunction() {
- criterions = new ArrayList<VersionsCriterion>();
- }
-
- public VersionsDisjunction add(VersionsCriterion criterion) {
- criterions.add(criterion);
- return this;
- }
-
- public void addToQuery(VersionsConfiguration verCfg, String entityName, QueryBuilder qb, Parameters parameters) {
- Parameters orParameters = parameters.addSubParameters(Parameters.OR);
-
- for (VersionsCriterion criterion : criterions) {
- criterion.addToQuery(verCfg, entityName, qb, orParameters);
- }
- }
-}
\ No newline at end of file
Deleted: core/trunk/envers/src/main/java/org/hibernate/envers/query/order/VersionsOrder.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/query/order/VersionsOrder.java 2008-10-31 11:53:38 UTC (rev 15460)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/query/order/VersionsOrder.java 2008-10-31 11:55:23 UTC (rev 15461)
@@ -1,38 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.envers.query.order;
-
-import org.hibernate.envers.configuration.VersionsConfiguration;
-import org.hibernate.envers.tools.Pair;
-
-/**
- * @author Adam Warski (adam at warski dot org)
- */
-public interface VersionsOrder {
- /**
- * @param verCfg Configuration.
- * @return A pair: (property name, ascending?).
- */
- Pair<String, Boolean> getData(VersionsConfiguration verCfg);
-}
Deleted: core/trunk/envers/src/main/java/org/hibernate/envers/query/projection/VersionsProjection.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/query/projection/VersionsProjection.java 2008-10-31 11:53:38 UTC (rev 15460)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/query/projection/VersionsProjection.java 2008-10-31 11:55:23 UTC (rev 15461)
@@ -1,39 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.envers.query.projection;
-
-import org.hibernate.envers.configuration.VersionsConfiguration;
-import org.hibernate.envers.tools.Triple;
-
-/**
- * @author Adam Warski (adam at warski dot org)
- */
-public interface VersionsProjection {
- /**
- *
- * @param verCfg Configuration.
- * @return A triple: (function name - possibly null, property name, add distinct?).
- */
- Triple<String, String, Boolean> getData(VersionsConfiguration verCfg);
-}
Deleted: core/trunk/envers/src/main/java/org/hibernate/envers/reader/VersionsReaderImpl.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/reader/VersionsReaderImpl.java 2008-10-31 11:53:38 UTC (rev 15460)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/reader/VersionsReaderImpl.java 2008-10-31 11:55:23 UTC (rev 15461)
@@ -1,197 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.envers.reader;
-
-import java.util.Date;
-import java.util.List;
-import javax.persistence.NoResultException;
-
-import org.hibernate.envers.configuration.VersionsConfiguration;
-import org.hibernate.envers.exception.NotVersionedException;
-import org.hibernate.envers.exception.RevisionDoesNotExistException;
-import org.hibernate.envers.exception.VersionsException;
-import org.hibernate.envers.query.RevisionProperty;
-import org.hibernate.envers.query.VersionsQueryCreator;
-import org.hibernate.envers.query.VersionsRestrictions;
-import static org.hibernate.envers.tools.ArgumentsTools.checkNotNull;
-import static org.hibernate.envers.tools.ArgumentsTools.checkPositive;
-
-import org.hibernate.NonUniqueResultException;
-import org.hibernate.Query;
-import org.hibernate.Session;
-import org.hibernate.engine.SessionImplementor;
-
-/**
- * @author Adam Warski (adam at warski dot org)
- */
-public class VersionsReaderImpl implements VersionsReaderImplementor {
- private final VersionsConfiguration verCfg;
- private final SessionImplementor sessionImplementor;
- private final Session session;
- private final FirstLevelCache firstLevelCache;
-
- public VersionsReaderImpl(VersionsConfiguration verCfg, Session session,
- SessionImplementor sessionImplementor) {
- this.verCfg = verCfg;
- this.sessionImplementor = sessionImplementor;
- this.session = session;
-
- firstLevelCache = new FirstLevelCache();
- }
-
- private void checkSession() {
- if (!session.isOpen()) {
- throw new IllegalStateException("The associated entity manager is closed!");
- }
- }
-
- public SessionImplementor getSessionImplementor() {
- return sessionImplementor;
- }
-
- public Session getSession() {
- return session;
- }
-
- public FirstLevelCache getFirstLevelCache() {
- return firstLevelCache;
- }
-
- @SuppressWarnings({"unchecked"})
- public <T> T find(Class<T> cls, Object primaryKey, Number revision) throws
- IllegalArgumentException, NotVersionedException, IllegalStateException {
- checkNotNull(cls, "Entity class");
- checkNotNull(primaryKey, "Primary key");
- checkNotNull(revision, "Entity revision");
- checkPositive(revision, "Entity revision");
- checkSession();
-
- String entityName = cls.getName();
-
- if (!verCfg.getEntCfg().isVersioned(entityName)) {
- throw new NotVersionedException(entityName, entityName + " is not versioned!");
- }
-
- if (firstLevelCache.contains(entityName, revision, primaryKey)) {
- return (T) firstLevelCache.get(entityName, revision, primaryKey);
- }
-
- Object result;
- try {
- // The result is put into the cache by the entity instantiator called from the query
- result = createQuery().forEntitiesAtRevision(cls, revision)
- .add(VersionsRestrictions.idEq(primaryKey)).getSingleResult();
- } catch (NoResultException e) {
- result = null;
- } catch (NonUniqueResultException e) {
- throw new VersionsException(e);
- }
-
- return (T) result;
- }
-
- @SuppressWarnings({"unchecked"})
- public List<Number> getRevisions(Class<?> cls, Object primaryKey)
- throws IllegalArgumentException, NotVersionedException, IllegalStateException {
- // todo: if a class is not versioned from the beginning, there's a missing ADD rev - what then?
- checkNotNull(cls, "Entity class");
- checkNotNull(primaryKey, "Primary key");
- checkSession();
-
- String entityName = cls.getName();
-
- if (!verCfg.getEntCfg().isVersioned(entityName)) {
- throw new NotVersionedException(entityName, entityName + " is not versioned!");
- }
-
- return createQuery().forRevisionsOfEntity(cls, false, true)
- .addProjection(RevisionProperty.revisionNumber())
- .add(VersionsRestrictions.idEq(primaryKey))
- .getResultList();
- }
-
- public Date getRevisionDate(Number revision) throws IllegalArgumentException, RevisionDoesNotExistException,
- IllegalStateException{
- checkNotNull(revision, "Entity revision");
- checkPositive(revision, "Entity revision");
- checkSession();
-
- Query query = verCfg.getRevisionInfoQueryCreator().getRevisionDateQuery(session, revision);
-
- try {
- Long timestamp = (Long) query.uniqueResult();
- if (timestamp == null) {
- throw new RevisionDoesNotExistException(revision);
- }
-
- return new Date(timestamp);
- } catch (NonUniqueResultException e) {
- throw new VersionsException(e);
- }
- }
-
- public Number getRevisionNumberForDate(Date date) {
- checkNotNull(date, "Date of revision");
- checkSession();
-
- Query query = verCfg.getRevisionInfoQueryCreator().getRevisionNumberForDateQuery(session, date);
-
- try {
- Number res = (Number) query.uniqueResult();
- if (res == null) {
- throw new RevisionDoesNotExistException(date);
- }
-
- return res;
- } catch (NonUniqueResultException e) {
- throw new VersionsException(e);
- }
- }
-
- @SuppressWarnings({"unchecked"})
- public <T> T findRevision(Class<T> revisionEntityClass, Number revision) throws IllegalArgumentException,
- RevisionDoesNotExistException, IllegalStateException {
- checkNotNull(revision, "Entity revision");
- checkPositive(revision, "Entity revision");
- checkSession();
-
- Query query = verCfg.getRevisionInfoQueryCreator().getRevisionQuery(session, revision);
-
- try {
- T revisionData = (T) query.uniqueResult();
-
- if (revisionData == null) {
- throw new RevisionDoesNotExistException(revision);
- }
-
- return revisionData;
- } catch (NonUniqueResultException e) {
- throw new VersionsException(e);
- }
- }
-
- public VersionsQueryCreator createQuery() {
- return new VersionsQueryCreator(verCfg, this);
- }
-}
Deleted: core/trunk/envers/src/main/java/org/hibernate/envers/reader/VersionsReaderImplementor.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/reader/VersionsReaderImplementor.java 2008-10-31 11:53:38 UTC (rev 15460)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/reader/VersionsReaderImplementor.java 2008-10-31 11:55:23 UTC (rev 15461)
@@ -1,39 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.envers.reader;
-
-import org.hibernate.envers.AuditReader;
-
-import org.hibernate.Session;
-import org.hibernate.engine.SessionImplementor;
-
-/**
- * An interface exposed by a VersionsReader to library-facing classes.
- * @author Adam Warski (adam at warski dot org)
- */
-public interface VersionsReaderImplementor extends AuditReader {
- SessionImplementor getSessionImplementor();
- Session getSession();
- FirstLevelCache getFirstLevelCache();
-}
Deleted: core/trunk/envers/src/main/java/org/hibernate/envers/synchronization/VersionsSync.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/synchronization/VersionsSync.java 2008-10-31 11:53:38 UTC (rev 15460)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/synchronization/VersionsSync.java 2008-10-31 11:55:23 UTC (rev 15461)
@@ -1,160 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.envers.synchronization;
-
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.Map;
-import java.util.Queue;
-import javax.transaction.Synchronization;
-
-import org.hibernate.envers.revisioninfo.RevisionInfoGenerator;
-import org.hibernate.envers.synchronization.work.VersionsWorkUnit;
-import org.hibernate.envers.tools.Pair;
-
-import org.hibernate.FlushMode;
-import org.hibernate.Session;
-import org.hibernate.Transaction;
-import org.hibernate.event.EventSource;
-
-/**
- * @author Adam Warski (adam at warski dot org)
- */
-public class VersionsSync implements Synchronization {
- private final RevisionInfoGenerator revisionInfoGenerator;
- private final VersionsSyncManager manager;
- private final EventSource session;
-
- private final Transaction transaction;
- private final LinkedList<VersionsWorkUnit> workUnits;
- private final Queue<VersionsWorkUnit> undoQueue;
- private final Map<Pair<String, Object>, VersionsWorkUnit> usedIds;
-
- private Object revisionData;
-
- public VersionsSync(VersionsSyncManager manager, EventSource session, RevisionInfoGenerator revisionInfoGenerator) {
- this.manager = manager;
- this.session = session;
- this.revisionInfoGenerator = revisionInfoGenerator;
-
- transaction = session.getTransaction();
- workUnits = new LinkedList<VersionsWorkUnit>();
- undoQueue = new LinkedList<VersionsWorkUnit>();
- usedIds = new HashMap<Pair<String, Object>, VersionsWorkUnit>();
- }
-
- private void removeWorkUnit(VersionsWorkUnit vwu) {
- workUnits.remove(vwu);
- if (vwu.isPerformed()) {
- // If this work unit has already been performed, it must be deleted (undone) first.
- undoQueue.offer(vwu);
- }
- }
-
- public void addWorkUnit(VersionsWorkUnit vwu) {
- if (vwu.containsWork()) {
- Object entityId = vwu.getEntityId();
-
- if (entityId == null) {
- // Just adding the work unit - it's not associated with any persistent entity.
- workUnits.offer(vwu);
- } else {
- String entityName = vwu.getEntityName();
- Pair<String, Object> usedIdsKey = Pair.make(entityName, entityId);
-
- if (usedIds.containsKey(usedIdsKey)) {
- VersionsWorkUnit other = usedIds.get(usedIdsKey);
-
- // The entity with entityId has two work units; checking which one should be kept.
- switch (vwu.dispatch(other)) {
- case FIRST:
- // Simply not adding the second
- break;
-
- case SECOND:
- removeWorkUnit(other);
- usedIds.put(usedIdsKey, vwu);
- workUnits.offer(vwu);
- break;
-
- case NONE:
- removeWorkUnit(other);
- break;
- }
- } else {
- usedIds.put(usedIdsKey, vwu);
- workUnits.offer(vwu);
- }
- }
- }
- }
-
- private void executeInSession(Session session) {
- if (revisionData == null) {
- revisionData = revisionInfoGenerator.generate(session);
- }
-
- VersionsWorkUnit vwu;
-
- // First undoing any performed work units
- while ((vwu = undoQueue.poll()) != null) {
- vwu.undo(session);
- }
-
- while ((vwu = workUnits.poll()) != null) {
- vwu.perform(session, revisionData);
- }
- }
-
- public void beforeCompletion() {
- if (workUnits.size() == 0 && undoQueue.size() == 0) {
- return;
- }
-
- // see: http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4178431
- if (FlushMode.isManualFlushMode(session.getFlushMode()) || session.isClosed()) {
- Session temporarySession = null;
- try {
- temporarySession = session.getFactory().openTemporarySession();
-
- executeInSession(temporarySession);
-
- temporarySession.flush();
- } finally {
- if (temporarySession != null) {
- temporarySession.close();
- }
- }
- } else {
- executeInSession(session);
-
- // Explicity flushing the session, as the auto-flush may have already happened.
- session.flush();
- }
- }
-
- public void afterCompletion(int i) {
- manager.remove(transaction);
- }
-}
Deleted: core/trunk/envers/src/main/java/org/hibernate/envers/synchronization/VersionsSyncManager.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/synchronization/VersionsSyncManager.java 2008-10-31 11:53:38 UTC (rev 15460)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/synchronization/VersionsSyncManager.java 2008-10-31 11:55:23 UTC (rev 15461)
@@ -1,66 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.envers.synchronization;
-
-import java.util.Map;
-
-import org.hibernate.envers.revisioninfo.RevisionInfoGenerator;
-import org.hibernate.envers.tools.ConcurrentReferenceHashMap;
-
-import org.hibernate.Transaction;
-import org.hibernate.event.EventSource;
-
-/**
- * @author Adam Warski (adam at warski dot org)
- */
-public class VersionsSyncManager {
- private final Map<Transaction, VersionsSync> versionsSyncs;
- private final RevisionInfoGenerator revisionInfoGenerator;
-
- public VersionsSyncManager(RevisionInfoGenerator revisionInfoGenerator) {
- versionsSyncs = new ConcurrentReferenceHashMap<Transaction, VersionsSync>(10,
- ConcurrentReferenceHashMap.ReferenceType.WEAK,
- ConcurrentReferenceHashMap.ReferenceType.STRONG);
-
- this.revisionInfoGenerator = revisionInfoGenerator;
- }
-
- public VersionsSync get(EventSource session) {
- Transaction transaction = session.getTransaction();
-
- VersionsSync verSync = versionsSyncs.get(transaction);
- if (verSync == null) {
- verSync = new VersionsSync(this, session, revisionInfoGenerator);
- versionsSyncs.put(transaction, verSync);
-
- transaction.registerSynchronization(verSync);
- }
-
- return verSync;
- }
-
- public void remove(Transaction transaction) {
- versionsSyncs.remove(transaction);
- }
-}
Deleted: core/trunk/envers/src/main/java/org/hibernate/envers/synchronization/work/AbstractVersionsWorkUnit.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/synchronization/work/AbstractVersionsWorkUnit.java 2008-10-31 11:53:38 UTC (rev 15460)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/synchronization/work/AbstractVersionsWorkUnit.java 2008-10-31 11:55:23 UTC (rev 15461)
@@ -1,86 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.envers.synchronization.work;
-
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.hibernate.envers.RevisionType;
-import org.hibernate.envers.configuration.VersionsConfiguration;
-import org.hibernate.envers.configuration.VersionsEntitiesConfiguration;
-
-import org.hibernate.Session;
-
-/**
- * @author Adam Warski (adam at warski dot org)
- */
-public abstract class AbstractVersionsWorkUnit implements VersionsWorkUnit {
- protected final VersionsConfiguration verCfg;
- protected final Serializable id;
-
- private final String entityName;
-
- private Object performedData;
-
- protected AbstractVersionsWorkUnit(String entityName, VersionsConfiguration verCfg, Serializable id) {
- this.verCfg = verCfg;
- this.id = id;
- this.entityName = entityName;
- }
-
- protected void fillDataWithId(Map<String, Object> data, Object revision, RevisionType revisionType) {
- VersionsEntitiesConfiguration entitiesCfg = verCfg.getVerEntCfg();
-
- Map<String, Object> originalId = new HashMap<String, Object>();
- originalId.put(entitiesCfg.getRevisionPropName(), revision);
-
- verCfg.getEntCfg().get(getEntityName()).getIdMapper().mapToMapFromId(originalId, id);
- data.put(entitiesCfg.getRevisionTypePropName(), revisionType);
- data.put(entitiesCfg.getOriginalIdPropName(), originalId);
- }
-
- public Object getEntityId() {
- return id;
- }
-
- public boolean isPerformed() {
- return performedData != null;
- }
-
- public String getEntityName() {
- return entityName;
- }
-
- protected void setPerformed(Object performedData) {
- this.performedData = performedData;
- }
-
- public void undo(Session session) {
- if (isPerformed()) {
- session.delete(verCfg.getVerEntCfg().getVersionsEntityName(getEntityName()), performedData);
- session.flush();
- }
- }
-}
Deleted: core/trunk/envers/src/main/java/org/hibernate/envers/synchronization/work/VersionsWorkUnit.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/synchronization/work/VersionsWorkUnit.java 2008-10-31 11:53:38 UTC (rev 15460)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/synchronization/work/VersionsWorkUnit.java 2008-10-31 11:55:23 UTC (rev 15461)
@@ -1,41 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.envers.synchronization.work;
-
-import org.hibernate.Session;
-
-/**
- * @author Adam Warski (adam at warski dot org)
- */
-public interface VersionsWorkUnit extends KeepCheckVisitor, KeepCheckDispatcher {
- Object getEntityId();
- String getEntityName();
-
- boolean containsWork();
-
- boolean isPerformed();
-
- void perform(Session session, Object revisionData);
- void undo(Session session);
-}
16 years, 1 month
Hibernate SVN: r15460 - in core/trunk/envers/src: main/java/org/hibernate/envers/ant and 24 other directories.
by hibernate-commits@lists.jboss.org
Author: adamw
Date: 2008-10-31 07:53:38 -0400 (Fri, 31 Oct 2008)
New Revision: 15460
Added:
core/trunk/envers/src/main/java/org/hibernate/envers/configuration/AuditConfiguration.java
core/trunk/envers/src/main/java/org/hibernate/envers/configuration/AuditEntitiesConfiguration.java
core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/AuditMetadataGenerator.java
core/trunk/envers/src/main/java/org/hibernate/envers/exception/AuditException.java
core/trunk/envers/src/main/java/org/hibernate/envers/query/AuditQuery.java
core/trunk/envers/src/main/java/org/hibernate/envers/query/AuditQueryCreator.java
core/trunk/envers/src/main/java/org/hibernate/envers/query/AuditRestrictions.java
core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/AuditConjunction.java
core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/AuditCriterion.java
core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/AuditDisjunction.java
core/trunk/envers/src/main/java/org/hibernate/envers/query/order/AuditOrder.java
core/trunk/envers/src/main/java/org/hibernate/envers/query/projection/AuditProjection.java
core/trunk/envers/src/main/java/org/hibernate/envers/reader/AuditReaderImpl.java
core/trunk/envers/src/main/java/org/hibernate/envers/reader/AuditReaderImplementor.java
core/trunk/envers/src/main/java/org/hibernate/envers/synchronization/AuditSync.java
core/trunk/envers/src/main/java/org/hibernate/envers/synchronization/AuditSyncManager.java
core/trunk/envers/src/main/java/org/hibernate/envers/synchronization/work/AbstractAuditWorkUnit.java
core/trunk/envers/src/main/java/org/hibernate/envers/synchronization/work/AuditWorkUnit.java
Modified:
core/trunk/envers/src/main/java/org/hibernate/envers/AuditReader.java
core/trunk/envers/src/main/java/org/hibernate/envers/AuditReaderFactory.java
core/trunk/envers/src/main/java/org/hibernate/envers/ant/AnnotationConfigurationTaskWithEnvers.java
core/trunk/envers/src/main/java/org/hibernate/envers/ant/ConfigurationTaskWithEnvers.java
core/trunk/envers/src/main/java/org/hibernate/envers/ant/JPAConfigurationTaskWithEnvers.java
core/trunk/envers/src/main/java/org/hibernate/envers/configuration/EntitiesConfigurator.java
core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/CollectionMetadataGenerator.java
core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/IdMetadataGenerator.java
core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/QueryGeneratorBuilder.java
core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/ToOneRelationMetadataGenerator.java
core/trunk/envers/src/main/java/org/hibernate/envers/entities/EntityInstantiator.java
core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/MapPropertyMapper.java
core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/MultiPropertyMapper.java
core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/PropertyMapper.java
core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/SinglePropertyMapper.java
core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/SubclassPropertyMapper.java
core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/id/AbstractCompositeIdMapper.java
core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/id/EmbeddedIdMapper.java
core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/id/MultipleIdMapper.java
core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/id/SingleIdMapper.java
core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/AbstractCollectionMapper.java
core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/BasicCollectionMapper.java
core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/CommonCollectionMapperData.java
core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/ListCollectionMapper.java
core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/MapCollectionMapper.java
core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/MiddleIdData.java
core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/OneToOneNotOwningMapper.java
core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/ToOneIdMapper.java
core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/component/MiddleMapKeyIdComponentMapper.java
core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/component/MiddleSimpleComponentMapper.java
core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/lazy/ToOneDelegateSessionImplementor.java
core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/lazy/initializor/AbstractCollectionInitializor.java
core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/lazy/initializor/ArrayCollectionInitializor.java
core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/lazy/initializor/BasicCollectionInitializor.java
core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/lazy/initializor/ListCollectionInitializor.java
core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/lazy/initializor/MapCollectionInitializor.java
core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/query/OneEntityQueryGenerator.java
core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/query/OneVersionsEntityQueryGenerator.java
core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/query/RelationQueryGenerator.java
core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/query/ThreeEntityQueryGenerator.java
core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/query/TwoEntityQueryGenerator.java
core/trunk/envers/src/main/java/org/hibernate/envers/event/VersionsEventListener.java
core/trunk/envers/src/main/java/org/hibernate/envers/exception/NotVersionedException.java
core/trunk/envers/src/main/java/org/hibernate/envers/exception/RevisionDoesNotExistException.java
core/trunk/envers/src/main/java/org/hibernate/envers/query/RevisionProperty.java
core/trunk/envers/src/main/java/org/hibernate/envers/query/RevisionTypeProperty.java
core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/AggregatedFieldVersionsExpression.java
core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/BetweenVersionsExpression.java
core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/CriteriaTools.java
core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/ExtendableCriterion.java
core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/IdentifierEqVersionsExpression.java
core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/InVersionsExpression.java
core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/LogicalVersionsExpression.java
core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/NotNullVersionsExpression.java
core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/NotVersionsExpression.java
core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/NullVersionsExpression.java
core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/PropertyVersionsExpression.java
core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/RelatedVersionsExpression.java
core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/RevisionVersionsExpression.java
core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/SimpleVersionsExpression.java
core/trunk/envers/src/main/java/org/hibernate/envers/query/impl/AbstractVersionsQuery.java
core/trunk/envers/src/main/java/org/hibernate/envers/query/impl/EntitiesAtRevisionQuery.java
core/trunk/envers/src/main/java/org/hibernate/envers/query/impl/RevisionsOfEntityQuery.java
core/trunk/envers/src/main/java/org/hibernate/envers/query/order/RevisionVersionsOrder.java
core/trunk/envers/src/main/java/org/hibernate/envers/query/projection/RevisionVersionsProjection.java
core/trunk/envers/src/main/java/org/hibernate/envers/synchronization/work/AddWorkUnit.java
core/trunk/envers/src/main/java/org/hibernate/envers/synchronization/work/CollectionChangeWorkUnit.java
core/trunk/envers/src/main/java/org/hibernate/envers/synchronization/work/DelWorkUnit.java
core/trunk/envers/src/main/java/org/hibernate/envers/synchronization/work/ModWorkUnit.java
core/trunk/envers/src/main/java/org/hibernate/envers/synchronization/work/PersistentCollectionChangeWorkUnit.java
core/trunk/envers/src/main/java/org/hibernate/envers/tools/log/YLog.java
core/trunk/envers/src/main/java/org/hibernate/envers/tools/log/YLogManager.java
core/trunk/envers/src/main/java/org/hibernate/envers/tools/reflection/ReflectionTools.java
core/trunk/envers/src/main/java/org/hibernate/envers/tools/reflection/YClass.java
core/trunk/envers/src/main/java/org/hibernate/envers/tools/reflection/YMethodsAndClasses.java
core/trunk/envers/src/main/java/org/hibernate/envers/tools/reflection/YProperty.java
core/trunk/envers/src/main/java/org/hibernate/envers/tools/reflection/YReflectionManager.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/query/CustomRevEntityQuery.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/query/DeletedEntities.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/query/MaximalizePropertyQuery.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/query/RevisionConstraintQuery.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/query/SimpleQuery.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/query/ids/EmbIdOneToManyQuery.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/query/ids/MulIdOneToManyQuery.java
Log:
HHH-3570: renaming versioned to audited
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/AuditReader.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/AuditReader.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/AuditReader.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -28,7 +28,7 @@
import org.hibernate.envers.exception.NotVersionedException;
import org.hibernate.envers.exception.RevisionDoesNotExistException;
-import org.hibernate.envers.query.VersionsQueryCreator;
+import org.hibernate.envers.query.AuditQueryCreator;
/**
* @author Adam Warski (adam at warski dot org)
@@ -106,5 +106,5 @@
* created and later executed. Shouldn't be used after the associated Session or EntityManager
* is closed.
*/
- VersionsQueryCreator createQuery();
+ AuditQueryCreator createQuery();
}
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/AuditReaderFactory.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/AuditReaderFactory.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/AuditReaderFactory.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -26,8 +26,8 @@
import javax.persistence.EntityManager;
import org.hibernate.envers.event.VersionsEventListener;
-import org.hibernate.envers.exception.VersionsException;
-import org.hibernate.envers.reader.VersionsReaderImpl;
+import org.hibernate.envers.exception.AuditException;
+import org.hibernate.envers.reader.AuditReaderImpl;
import static org.hibernate.envers.tools.ArraysTools.arrayIncludesInstanceOf;
import org.hibernate.Session;
@@ -48,9 +48,9 @@
* @param session An open session.
* @return A versions reader associated with the given sesison. It shouldn't be used
* after the session is closed.
- * @throws VersionsException When the given required listeners aren't installed.
+ * @throws org.hibernate.envers.exception.AuditException When the given required listeners aren't installed.
*/
- public static AuditReader get(Session session) throws VersionsException {
+ public static AuditReader get(Session session) throws AuditException {
SessionImplementor sessionImpl = (SessionImplementor) session;
EventListeners listeners = sessionImpl.getListeners();
@@ -59,13 +59,13 @@
if (listener instanceof VersionsEventListener) {
if (arrayIncludesInstanceOf(listeners.getPostUpdateEventListeners(), VersionsEventListener.class) &&
arrayIncludesInstanceOf(listeners.getPostDeleteEventListeners(), VersionsEventListener.class)) {
- return new VersionsReaderImpl(((VersionsEventListener) listener).getVerCfg(), session,
+ return new AuditReaderImpl(((VersionsEventListener) listener).getVerCfg(), session,
sessionImpl);
}
}
}
- throw new VersionsException("You need install the org.hibernate.envers.event.VersionsEventListener " +
+ throw new AuditException("You need install the org.hibernate.envers.event.VersionsEventListener " +
"class as post insert, update and delete event listener.");
}
@@ -74,10 +74,10 @@
* @param entityManager An open entity manager.
* @return A versions reader associated with the given entity manager. It shouldn't be used
* after the entity manager is closed.
- * @throws VersionsException When the given entity manager is not based on Hibernate, or if the required
+ * @throws org.hibernate.envers.exception.AuditException When the given entity manager is not based on Hibernate, or if the required
* listeners aren't installed.
*/
- public static AuditReader get(EntityManager entityManager) throws VersionsException {
+ public static AuditReader get(EntityManager entityManager) throws AuditException {
if (entityManager.getDelegate() instanceof Session) {
return get((Session) entityManager.getDelegate());
}
@@ -88,6 +88,6 @@
}
}
- throw new VersionsException("Hibernate EntityManager not present!");
+ throw new AuditException("Hibernate EntityManager not present!");
}
}
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/ant/AnnotationConfigurationTaskWithEnvers.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/ant/AnnotationConfigurationTaskWithEnvers.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/ant/AnnotationConfigurationTaskWithEnvers.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -23,7 +23,7 @@
*/
package org.hibernate.envers.ant;
-import org.hibernate.envers.configuration.VersionsConfiguration;
+import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.cfg.Configuration;
import org.hibernate.tool.ant.AnnotationConfigurationTask;
@@ -33,7 +33,7 @@
*/
public class AnnotationConfigurationTaskWithEnvers extends AnnotationConfigurationTask {
protected void doConfiguration(Configuration configuration) {
- VersionsConfiguration.getFor(configuration);
+ AuditConfiguration.getFor(configuration);
super.doConfiguration(configuration);
}
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/ant/ConfigurationTaskWithEnvers.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/ant/ConfigurationTaskWithEnvers.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/ant/ConfigurationTaskWithEnvers.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -23,7 +23,7 @@
*/
package org.hibernate.envers.ant;
-import org.hibernate.envers.configuration.VersionsConfiguration;
+import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.cfg.Configuration;
import org.hibernate.tool.ant.ConfigurationTask;
@@ -33,7 +33,7 @@
*/
public class ConfigurationTaskWithEnvers extends ConfigurationTask {
protected void doConfiguration(Configuration configuration) {
- VersionsConfiguration.getFor(configuration);
+ AuditConfiguration.getFor(configuration);
super.doConfiguration(configuration);
}
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/ant/JPAConfigurationTaskWithEnvers.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/ant/JPAConfigurationTaskWithEnvers.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/ant/JPAConfigurationTaskWithEnvers.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -23,7 +23,7 @@
*/
package org.hibernate.envers.ant;
-import org.hibernate.envers.configuration.VersionsConfiguration;
+import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.cfg.Configuration;
import org.hibernate.tool.ant.JPAConfigurationTask;
@@ -33,7 +33,7 @@
*/
public class JPAConfigurationTaskWithEnvers extends JPAConfigurationTask {
protected void doConfiguration(Configuration configuration) {
- VersionsConfiguration.getFor(configuration);
+ AuditConfiguration.getFor(configuration);
super.doConfiguration(configuration);
}
Copied: core/trunk/envers/src/main/java/org/hibernate/envers/configuration/AuditConfiguration.java (from rev 15455, core/trunk/envers/src/main/java/org/hibernate/envers/configuration/VersionsConfiguration.java)
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/configuration/AuditConfiguration.java (rev 0)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/configuration/AuditConfiguration.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -0,0 +1,106 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.envers.configuration;
+
+import java.util.Map;
+import java.util.Properties;
+import java.util.WeakHashMap;
+
+import org.hibernate.envers.entities.EntitiesConfigurations;
+import org.hibernate.envers.revisioninfo.RevisionInfoNumberReader;
+import org.hibernate.envers.revisioninfo.RevisionInfoQueryCreator;
+import org.hibernate.envers.synchronization.AuditSyncManager;
+import org.hibernate.envers.tools.reflection.YReflectionManager;
+
+import org.hibernate.cfg.Configuration;
+
+/**
+ * @author Adam Warski (adam at warski dot org)
+ */
+public class AuditConfiguration {
+ private final GlobalConfiguration globalCfg;
+ private final AuditEntitiesConfiguration verEntCfg;
+ private final AuditSyncManager versionsSyncManager;
+ private final EntitiesConfigurations entCfg;
+ private final RevisionInfoQueryCreator revisionInfoQueryCreator;
+ private final RevisionInfoNumberReader revisionInfoNumberReader;
+
+ public AuditEntitiesConfiguration getVerEntCfg() {
+ return verEntCfg;
+ }
+
+ public AuditSyncManager getSyncManager() {
+ return versionsSyncManager;
+ }
+
+ public GlobalConfiguration getGlobalCfg() {
+ return globalCfg;
+ }
+
+ public EntitiesConfigurations getEntCfg() {
+ return entCfg;
+ }
+
+ public RevisionInfoQueryCreator getRevisionInfoQueryCreator() {
+ return revisionInfoQueryCreator;
+ }
+
+ public RevisionInfoNumberReader getRevisionInfoNumberReader() {
+ return revisionInfoNumberReader;
+ }
+
+ @SuppressWarnings({"unchecked"})
+ public AuditConfiguration(Configuration cfg) {
+ Properties properties = cfg.getProperties();
+
+ YReflectionManager reflectionManager = YReflectionManager.get(cfg);
+ RevisionInfoConfiguration revInfoCfg = new RevisionInfoConfiguration();
+ RevisionInfoConfigurationResult revInfoCfgResult = revInfoCfg.configure(cfg, reflectionManager);
+ verEntCfg = new AuditEntitiesConfiguration(properties, revInfoCfgResult.getRevisionInfoEntityName());
+ globalCfg = new GlobalConfiguration(properties);
+ versionsSyncManager = new AuditSyncManager(revInfoCfgResult.getRevisionInfoGenerator());
+ revisionInfoQueryCreator = revInfoCfgResult.getRevisionInfoQueryCreator();
+ revisionInfoNumberReader = revInfoCfgResult.getRevisionInfoNumberReader();
+ entCfg = new EntitiesConfigurator().configure(cfg, reflectionManager, globalCfg, verEntCfg,
+ revInfoCfgResult.getRevisionInfoXmlMapping(), revInfoCfgResult.getRevisionInfoRelationMapping());
+ }
+
+ //
+
+ private static Map<Configuration, AuditConfiguration> cfgs
+ = new WeakHashMap<Configuration, AuditConfiguration>();
+
+ public synchronized static AuditConfiguration getFor(Configuration cfg) {
+ AuditConfiguration verCfg = cfgs.get(cfg);
+
+ if (verCfg == null) {
+ verCfg = new AuditConfiguration(cfg);
+ cfgs.put(cfg, verCfg);
+
+ cfg.buildMappings();
+ }
+
+ return verCfg;
+ }
+}
Copied: core/trunk/envers/src/main/java/org/hibernate/envers/configuration/AuditEntitiesConfiguration.java (from rev 15455, core/trunk/envers/src/main/java/org/hibernate/envers/configuration/VersionsEntitiesConfiguration.java)
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/configuration/AuditEntitiesConfiguration.java (rev 0)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/configuration/AuditEntitiesConfiguration.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -0,0 +1,112 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.envers.configuration;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+/**
+ * Configuration of versions entities - names of fields, entities and tables created to store versioning information.
+ * @author Adam Warski (adam at warski dot org)
+ */
+public class AuditEntitiesConfiguration {
+ private final String versionsTablePrefix;
+ private final String versionsTableSuffix;
+
+ private final String originalIdPropName;
+
+ private final String revisionPropName;
+ private final String revisionPropPath;
+
+ private final String revisionTypePropName;
+ private final String revisionTypePropType;
+
+ private final String revisionInfoEntityName;
+
+ private final Map<String, String> customVersionsTablesNames;
+
+ public AuditEntitiesConfiguration(Properties properties, String revisionInfoEntityName) {
+ this.revisionInfoEntityName = revisionInfoEntityName;
+
+ versionsTablePrefix = properties.getProperty("org.hibernate.envers.versionsTablePrefix", "");
+ versionsTableSuffix = properties.getProperty("org.hibernate.envers.versionsTableSuffix", "_versions");
+
+ originalIdPropName = "originalId";
+
+ revisionPropName = properties.getProperty("org.hibernate.envers.revisionFieldName", "_revision");
+
+ revisionTypePropName = properties.getProperty("org.hibernate.envers.revisionTypeFieldName", "_revision_type");
+ revisionTypePropType = "byte";
+
+ customVersionsTablesNames = new HashMap<String, String>();
+
+ revisionPropPath = originalIdPropName + "." + revisionPropName + ".id";
+ }
+
+ public String getOriginalIdPropName() {
+ return originalIdPropName;
+ }
+
+ public String getRevisionPropName() {
+ return revisionPropName;
+ }
+
+ public String getRevisionPropPath() {
+ return revisionPropPath;
+ }
+
+ public String getRevisionTypePropName() {
+ return revisionTypePropName;
+ }
+
+ public String getRevisionTypePropType() {
+ return revisionTypePropType;
+ }
+
+ public String getRevisionInfoEntityName() {
+ return revisionInfoEntityName;
+ }
+
+ //
+
+ public void addCustomVersionsTableName(String entityName, String tableName) {
+ customVersionsTablesNames.put(entityName, tableName);
+ }
+
+ //
+
+ public String getVersionsEntityName(String entityName) {
+ return versionsTablePrefix + entityName + versionsTableSuffix;
+ }
+
+ public String getVersionsTableName(String entityName, String tableName) {
+ String customHistoryTableName = customVersionsTablesNames.get(entityName);
+ if (customHistoryTableName == null) {
+ return versionsTablePrefix + tableName + versionsTableSuffix;
+ }
+
+ return customHistoryTableName;
+ }
+}
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/configuration/EntitiesConfigurator.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/configuration/EntitiesConfigurator.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/configuration/EntitiesConfigurator.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -40,7 +40,7 @@
import org.hibernate.envers.configuration.metadata.AnnotationsMetadataReader;
import org.hibernate.envers.configuration.metadata.EntityXmlMappingData;
import org.hibernate.envers.configuration.metadata.PersistentClassVersioningData;
-import org.hibernate.envers.configuration.metadata.VersionsMetadataGenerator;
+import org.hibernate.envers.configuration.metadata.AuditMetadataGenerator;
import org.hibernate.envers.entities.EntitiesConfigurations;
import org.hibernate.envers.tools.StringTools;
import org.hibernate.envers.tools.graph.GraphTopologicalSort;
@@ -55,9 +55,9 @@
*/
public class EntitiesConfigurator {
public EntitiesConfigurations configure(Configuration cfg, YReflectionManager reflectionManager,
- GlobalConfiguration globalCfg, VersionsEntitiesConfiguration verEntCfg,
+ GlobalConfiguration globalCfg, AuditEntitiesConfiguration verEntCfg,
Document revisionInfoXmlMapping, Element revisionInfoRelationMapping) {
- VersionsMetadataGenerator versionsMetaGen = new VersionsMetadataGenerator(cfg, globalCfg, verEntCfg,
+ AuditMetadataGenerator versionsMetaGen = new AuditMetadataGenerator(cfg, globalCfg, verEntCfg,
revisionInfoRelationMapping);
DOMWriter writer = new DOMWriter();
Copied: core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/AuditMetadataGenerator.java (from rev 15459, core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/VersionsMetadataGenerator.java)
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/AuditMetadataGenerator.java (rev 0)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/AuditMetadataGenerator.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -0,0 +1,385 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.envers.configuration.metadata;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.dom4j.Element;
+import org.hibernate.envers.ModificationStore;
+import org.hibernate.envers.AuditJoinTable;
+import org.hibernate.envers.configuration.GlobalConfiguration;
+import org.hibernate.envers.configuration.AuditEntitiesConfiguration;
+import org.hibernate.envers.entities.EntityConfiguration;
+import org.hibernate.envers.entities.IdMappingData;
+import org.hibernate.envers.entities.mapper.CompositeMapperBuilder;
+import org.hibernate.envers.entities.mapper.ExtendedPropertyMapper;
+import org.hibernate.envers.entities.mapper.MultiPropertyMapper;
+import org.hibernate.envers.entities.mapper.SubclassPropertyMapper;
+import org.hibernate.envers.entity.VersionsInheritanceEntityPersister;
+import org.hibernate.envers.tools.StringTools;
+import org.hibernate.envers.tools.log.YLog;
+import org.hibernate.envers.tools.log.YLogManager;
+
+import org.hibernate.MappingException;
+import org.hibernate.cfg.Configuration;
+import org.hibernate.mapping.Collection;
+import org.hibernate.mapping.Join;
+import org.hibernate.mapping.PersistentClass;
+import org.hibernate.mapping.Property;
+import org.hibernate.mapping.Value;
+import org.hibernate.type.CollectionType;
+import org.hibernate.type.ManyToOneType;
+import org.hibernate.type.OneToOneType;
+import org.hibernate.type.Type;
+
+/**
+ * @author Adam Warski (adam at warski dot org)
+ * @author Sebastian Komander
+ */
+public final class AuditMetadataGenerator {
+ private final Configuration cfg;
+ private final GlobalConfiguration globalCfg;
+ private final AuditEntitiesConfiguration verEntCfg;
+ private final Element revisionInfoRelationMapping;
+
+ private final BasicMetadataGenerator basicMetadataGenerator;
+ private final IdMetadataGenerator idMetadataGenerator;
+ private final ToOneRelationMetadataGenerator toOneRelationMetadataGenerator;
+
+ private final Map<String, EntityConfiguration> entitiesConfigurations;
+
+ // Map entity name -> (join descriptor -> element describing the "versioned" join)
+ private final Map<String, Map<Join, Element>> entitiesJoins;
+
+ private YLog log = YLogManager.getLogManager().getLog(AuditMetadataGenerator.class);
+
+ public AuditMetadataGenerator(Configuration cfg, GlobalConfiguration globalCfg,
+ AuditEntitiesConfiguration verEntCfg,
+ Element revisionInfoRelationMapping) {
+ this.cfg = cfg;
+ this.globalCfg = globalCfg;
+ this.verEntCfg = verEntCfg;
+ this.revisionInfoRelationMapping = revisionInfoRelationMapping;
+
+ this.basicMetadataGenerator = new BasicMetadataGenerator();
+ this.idMetadataGenerator = new IdMetadataGenerator(this);
+ this.toOneRelationMetadataGenerator = new ToOneRelationMetadataGenerator(this);
+
+ entitiesConfigurations = new HashMap<String, EntityConfiguration>();
+ entitiesJoins = new HashMap<String, Map<Join, Element>>();
+ }
+
+ void addRevisionInfoRelation(Element any_mapping) {
+ Element rev_mapping = (Element) revisionInfoRelationMapping.clone();
+ rev_mapping.addAttribute("name", verEntCfg.getRevisionPropName());
+ MetadataTools.addColumn(rev_mapping, verEntCfg.getRevisionPropName(), null);
+
+ any_mapping.add(rev_mapping);
+ }
+
+ void addRevisionType(Element any_mapping) {
+ Element revTypeProperty = MetadataTools.addProperty(any_mapping, verEntCfg.getRevisionTypePropName(),
+ verEntCfg.getRevisionTypePropType(), true, false);
+ revTypeProperty.addAttribute("type", "org.hibernate.envers.entities.RevisionTypeType");
+ }
+
+ private ModificationStore getStoreForProperty(Property property, PropertyStoreInfo propertyStoreInfo,
+ List<String> unversionedProperties) {
+ /*
+ * Checks if a property is versioned, which is when:
+ * - the property isn't unversioned
+ * - the whole entity is versioned, then the default store is not null
+ * - there is a store defined for this entity, which is when this property is annotated
+ */
+
+ if (unversionedProperties.contains(property.getName())) {
+ return null;
+ }
+
+ ModificationStore store = propertyStoreInfo.propertyStores.get(property.getName());
+
+ if (store == null) {
+ return propertyStoreInfo.defaultStore;
+ }
+
+ return store;
+ }
+
+ @SuppressWarnings({"unchecked"})
+ void addValue(Element parent, String name, Value value, CompositeMapperBuilder currentMapper,
+ ModificationStore store, String entityName, EntityXmlMappingData xmlMappingData,
+ AuditJoinTable joinTable, String mapKey, boolean insertable, boolean firstPass) {
+ Type type = value.getType();
+
+ // only first pass
+ if (firstPass) {
+ if (basicMetadataGenerator.addBasic(parent, name, value, currentMapper, store, entityName, insertable,
+ false)) {
+ // The property was mapped by the basic generator.
+ return;
+ }
+ }
+
+ if (type instanceof ManyToOneType) {
+ // only second pass
+ if (!firstPass) {
+ toOneRelationMetadataGenerator.addToOne(parent, name, value, currentMapper, entityName);
+ }
+ } else if (type instanceof OneToOneType) {
+ // only second pass
+ if (!firstPass) {
+ toOneRelationMetadataGenerator.addOneToOneNotOwning(name, value, currentMapper, entityName);
+ }
+ } else if (type instanceof CollectionType) {
+ // only second pass
+ if (!firstPass) {
+ CollectionMetadataGenerator collectionMetadataGenerator = new CollectionMetadataGenerator(this,
+ name, (Collection) value, currentMapper, entityName, xmlMappingData, joinTable, mapKey);
+ collectionMetadataGenerator.addCollection();
+ }
+ } else {
+ if (firstPass) {
+ // If we got here in the first pass, it means the basic mapper didn't map it, and none of the
+ // above branches either.
+ throwUnsupportedTypeException(type, entityName, name);
+ }
+ }
+ }
+
+ @SuppressWarnings({"unchecked"})
+ private void addProperties(Element parent, Iterator<Property> properties, CompositeMapperBuilder currentMapper,
+ PersistentClassVersioningData versioningData, String entityName, EntityXmlMappingData xmlMappingData,
+ boolean firstPass) {
+ while (properties.hasNext()) {
+ Property property = properties.next();
+ if (!"_identifierMapper".equals(property.getName())) {
+ ModificationStore store = getStoreForProperty(property, versioningData.propertyStoreInfo,
+ versioningData.unversionedProperties);
+
+ if (store != null) {
+ addValue(parent, property.getName(), property.getValue(), currentMapper, store, entityName,
+ xmlMappingData, versioningData.versionsJoinTables.get(property.getName()),
+ versioningData.mapKeys.get(property.getName()), property.isInsertable(), firstPass);
+ }
+ }
+ }
+ }
+
+ @SuppressWarnings({"unchecked"})
+ private void createJoins(PersistentClass pc, Element parent, PersistentClassVersioningData versioningData) {
+ Iterator<Join> joins = pc.getJoinIterator();
+
+ Map<Join, Element> joinElements = new HashMap<Join, Element>();
+ entitiesJoins.put(pc.getEntityName(), joinElements);
+
+ while (joins.hasNext()) {
+ Join join = joins.next();
+
+ // Determining the table name. If there is no entry in the dictionary, just constructing the table name
+ // as if it was an entity (by appending/prepending configured strings).
+ String originalTableName = join.getTable().getName();
+ String versionedTableName = versioningData.secondaryTableDictionary.get(originalTableName);
+ if (versionedTableName == null) {
+ versionedTableName = verEntCfg.getVersionsEntityName(originalTableName);
+ }
+
+ String schema = versioningData.versionsTable.schema();
+ if (StringTools.isEmpty(schema)) {
+ schema = join.getTable().getSchema();
+ }
+
+ String catalog = versioningData.versionsTable.catalog();
+ if (StringTools.isEmpty(catalog)) {
+ catalog = join.getTable().getCatalog();
+ }
+
+ Element joinElement = MetadataTools.createJoin(parent, versionedTableName, schema, catalog);
+ joinElements.put(join, joinElement);
+
+ Element joinKey = joinElement.addElement("key");
+ MetadataTools.addColumns(joinKey, join.getKey().getColumnIterator());
+ MetadataTools.addColumn(joinKey, verEntCfg.getRevisionPropName(), null);
+ }
+ }
+
+ @SuppressWarnings({"unchecked"})
+ private void addJoins(PersistentClass pc, CompositeMapperBuilder currentMapper, PersistentClassVersioningData versioningData,
+ String entityName, EntityXmlMappingData xmlMappingData,boolean firstPass) {
+ Iterator<Join> joins = pc.getJoinIterator();
+
+ while (joins.hasNext()) {
+ Join join = joins.next();
+ Element joinElement = entitiesJoins.get(entityName).get(join);
+
+ addProperties(joinElement, join.getPropertyIterator(), currentMapper, versioningData, entityName,
+ xmlMappingData, firstPass);
+ }
+ }
+
+ private void addPersisterHack(Element class_mapping) {
+ class_mapping.addAttribute("persister", VersionsInheritanceEntityPersister.class.getName() );
+ }
+
+ @SuppressWarnings({"unchecked"})
+ public void generateFirstPass(PersistentClass pc, PersistentClassVersioningData versioningData,
+ EntityXmlMappingData xmlMappingData) {
+ String schema = versioningData.versionsTable.schema();
+ if (StringTools.isEmpty(schema)) {
+ schema = pc.getTable().getSchema();
+ }
+
+ String catalog = versioningData.versionsTable.catalog();
+ if (StringTools.isEmpty(catalog)) {
+ catalog = pc.getTable().getCatalog();
+ }
+
+ String entityName = pc.getEntityName();
+ String versionsEntityName = verEntCfg.getVersionsEntityName(entityName);
+ String versionsTableName = verEntCfg.getVersionsTableName(entityName, pc.getTable().getName());
+
+ // Generating a mapping for the id
+ IdMappingData idMapper = idMetadataGenerator.addId(pc);
+
+ Element class_mapping;
+ ExtendedPropertyMapper propertyMapper;
+
+ InheritanceType inheritanceType = InheritanceType.get(pc);
+ String parentEntityName = null;
+
+ switch (inheritanceType) {
+ case NONE:
+ class_mapping = MetadataTools.createEntity(xmlMappingData.getMainXmlMapping(), versionsEntityName, versionsTableName,
+ schema, catalog, pc.getDiscriminatorValue());
+ propertyMapper = new MultiPropertyMapper();
+
+ // Checking if there is a discriminator column
+ if (pc.getDiscriminator() != null) {
+ Element discriminator_element = class_mapping.addElement("discriminator");
+ MetadataTools.addColumns(discriminator_element, pc.getDiscriminator().getColumnIterator());
+ discriminator_element.addAttribute("type", pc.getDiscriminator().getType().getName());
+
+ // If so, there is some inheritance scheme -> using the persister hack.
+ addPersisterHack(class_mapping);
+ }
+
+ // Adding the id mapping
+ class_mapping.add((Element) idMapper.getXmlMapping().clone());
+
+ // Adding the "revision type" property
+ addRevisionType(class_mapping);
+
+ break;
+ case SINGLE:
+ String extendsEntityName = verEntCfg.getVersionsEntityName(pc.getSuperclass().getEntityName());
+ class_mapping = MetadataTools.createSubclassEntity(xmlMappingData.getMainXmlMapping(), versionsEntityName,
+ versionsTableName, schema, catalog, extendsEntityName, pc.getDiscriminatorValue());
+
+ addPersisterHack(class_mapping);
+
+ // The id and revision type is already mapped in the parent
+
+ // Getting the property mapper of the parent - when mapping properties, they need to be included
+ parentEntityName = pc.getSuperclass().getEntityName();
+ ExtendedPropertyMapper parentPropertyMapper = entitiesConfigurations.get(parentEntityName).getPropertyMapper();
+ propertyMapper = new SubclassPropertyMapper(new MultiPropertyMapper(), parentPropertyMapper);
+
+ break;
+ case JOINED:
+ throw new MappingException("Joined inheritance strategy not supported for versioning!");
+ case TABLE_PER_CLASS:
+ throw new MappingException("Table-per-class inheritance strategy not supported for versioning!");
+ default:
+ throw new AssertionError("Impossible enum value.");
+ }
+
+ // Mapping unjoined properties
+ addProperties(class_mapping, (Iterator<Property>) pc.getUnjoinedPropertyIterator(), propertyMapper,
+ versioningData, pc.getEntityName(), xmlMappingData,
+ true);
+
+ // Creating and mapping joins (first pass)
+ createJoins(pc, class_mapping, versioningData);
+ addJoins(pc, propertyMapper, versioningData, pc.getEntityName(), xmlMappingData, true);
+
+ // Storing the generated configuration
+ EntityConfiguration entityCfg = new EntityConfiguration(versionsEntityName, idMapper,
+ propertyMapper, parentEntityName);
+ entitiesConfigurations.put(pc.getEntityName(), entityCfg);
+ }
+
+ @SuppressWarnings({"unchecked"})
+ public void generateSecondPass(PersistentClass pc, PersistentClassVersioningData versioningData,
+ EntityXmlMappingData xmlMappingData) {
+ String entityName = pc.getEntityName();
+
+ CompositeMapperBuilder propertyMapper = entitiesConfigurations.get(entityName).getPropertyMapper();
+
+ // Mapping unjoined properties
+ Element parent = xmlMappingData.getMainXmlMapping().getRootElement().element("class");
+ if (parent == null) {
+ parent = xmlMappingData.getMainXmlMapping().getRootElement().element("subclass");
+ }
+
+ addProperties(parent, (Iterator<Property>) pc.getUnjoinedPropertyIterator(),
+ propertyMapper, versioningData, entityName, xmlMappingData, false);
+
+ // Mapping joins (second pass)
+ addJoins(pc, propertyMapper, versioningData, entityName, xmlMappingData, false);
+ }
+
+ public Map<String, EntityConfiguration> getEntitiesConfigurations() {
+ return entitiesConfigurations;
+ }
+
+ // Getters for generators and configuration
+
+ BasicMetadataGenerator getBasicMetadataGenerator() {
+ return basicMetadataGenerator;
+ }
+
+ Configuration getCfg() {
+ return cfg;
+ }
+
+ GlobalConfiguration getGlobalCfg() {
+ return globalCfg;
+ }
+
+ AuditEntitiesConfiguration getVerEntCfg() {
+ return verEntCfg;
+ }
+
+ void throwUnsupportedTypeException(Type type, String entityName, String propertyName) {
+ String message = "Type not supported for versioning: " + type.getClass().getName() +
+ ", on entity " + entityName + ", property '" + propertyName + "'.";
+ if (globalCfg.isWarnOnUnsupportedTypes()) {
+ log.warn(message);
+ } else {
+ throw new MappingException(message);
+ }
+ }
+}
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/CollectionMetadataGenerator.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/CollectionMetadataGenerator.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/CollectionMetadataGenerator.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -85,7 +85,7 @@
* @author Adam Warski (adam at warski dot org)
*/
public final class CollectionMetadataGenerator {
- private final VersionsMetadataGenerator mainGenerator;
+ private final AuditMetadataGenerator mainGenerator;
private final String propertyName;
private final Collection propertyValue;
private final CompositeMapperBuilder currentMapper;
@@ -113,7 +113,7 @@
* @param mapKey The value of the name() property of the MapKey annotation on this property. Null, if this
* property isn't annotated with this annotation.
*/
- public CollectionMetadataGenerator(VersionsMetadataGenerator mainGenerator, String propertyName,
+ public CollectionMetadataGenerator(AuditMetadataGenerator mainGenerator, String propertyName,
Collection propertyValue, CompositeMapperBuilder currentMapper,
String referencingEntityName, EntityXmlMappingData xmlMappingData,
AuditJoinTable joinTable, String mapKey) {
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/IdMetadataGenerator.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/IdMetadataGenerator.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/IdMetadataGenerator.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -47,9 +47,9 @@
* @author Adam Warski (adam at warski dot org)
*/
public final class IdMetadataGenerator {
- private final VersionsMetadataGenerator mainGenerator;
+ private final AuditMetadataGenerator mainGenerator;
- IdMetadataGenerator(VersionsMetadataGenerator versionsMetadataGenerator) {
+ IdMetadataGenerator(AuditMetadataGenerator versionsMetadataGenerator) {
mainGenerator = versionsMetadataGenerator;
}
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/QueryGeneratorBuilder.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/QueryGeneratorBuilder.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/QueryGeneratorBuilder.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -27,7 +27,7 @@
import java.util.List;
import org.hibernate.envers.configuration.GlobalConfiguration;
-import org.hibernate.envers.configuration.VersionsEntitiesConfiguration;
+import org.hibernate.envers.configuration.AuditEntitiesConfiguration;
import org.hibernate.envers.entities.mapper.relation.MiddleComponentData;
import org.hibernate.envers.entities.mapper.relation.MiddleIdData;
import org.hibernate.envers.entities.mapper.relation.query.OneEntityQueryGenerator;
@@ -42,12 +42,12 @@
*/
public final class QueryGeneratorBuilder {
private final GlobalConfiguration globalCfg;
- private final VersionsEntitiesConfiguration verEntCfg;
+ private final AuditEntitiesConfiguration verEntCfg;
private final MiddleIdData referencingIdData;
private final String versionsMiddleEntityName;
private final List<MiddleIdData> idDatas;
- QueryGeneratorBuilder(GlobalConfiguration globalCfg, VersionsEntitiesConfiguration verEntCfg,
+ QueryGeneratorBuilder(GlobalConfiguration globalCfg, AuditEntitiesConfiguration verEntCfg,
MiddleIdData referencingIdData, String versionsMiddleEntityName) {
this.globalCfg = globalCfg;
this.verEntCfg = verEntCfg;
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/ToOneRelationMetadataGenerator.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/ToOneRelationMetadataGenerator.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/ToOneRelationMetadataGenerator.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -41,9 +41,9 @@
* @author Adam Warski (adam at warski dot org)
*/
public final class ToOneRelationMetadataGenerator {
- private final VersionsMetadataGenerator mainGenerator;
+ private final AuditMetadataGenerator mainGenerator;
- ToOneRelationMetadataGenerator(VersionsMetadataGenerator versionsMetadataGenerator) {
+ ToOneRelationMetadataGenerator(AuditMetadataGenerator versionsMetadataGenerator) {
mainGenerator = versionsMetadataGenerator;
}
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/entities/EntityInstantiator.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/entities/EntityInstantiator.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/entities/EntityInstantiator.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -27,20 +27,20 @@
import java.util.List;
import java.util.Map;
-import org.hibernate.envers.configuration.VersionsConfiguration;
+import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.envers.entities.mapper.id.IdMapper;
-import org.hibernate.envers.exception.VersionsException;
-import org.hibernate.envers.reader.VersionsReaderImplementor;
+import org.hibernate.envers.exception.AuditException;
+import org.hibernate.envers.reader.AuditReaderImplementor;
import org.hibernate.envers.tools.reflection.ReflectionTools;
/**
* @author Adam Warski (adam at warski dot org)
*/
public class EntityInstantiator {
- private final VersionsConfiguration verCfg;
- private final VersionsReaderImplementor versionsReader;
+ private final AuditConfiguration verCfg;
+ private final AuditReaderImplementor versionsReader;
- public EntityInstantiator(VersionsConfiguration verCfg, VersionsReaderImplementor versionsReader) {
+ public EntityInstantiator(AuditConfiguration verCfg, AuditReaderImplementor versionsReader) {
this.verCfg = verCfg;
this.versionsReader = versionsReader;
}
@@ -82,7 +82,7 @@
Class<?> cls = ReflectionTools.loadClass(entityName);
ret = cls.newInstance();
} catch (Exception e) {
- throw new VersionsException(e);
+ throw new AuditException(e);
}
// Putting the newly created entity instance into the first level cache, in case a one-to-one bidirectional
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/MapPropertyMapper.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/MapPropertyMapper.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/MapPropertyMapper.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -29,9 +29,9 @@
import java.util.Map;
import org.hibernate.envers.ModificationStore;
-import org.hibernate.envers.configuration.VersionsConfiguration;
-import org.hibernate.envers.exception.VersionsException;
-import org.hibernate.envers.reader.VersionsReaderImplementor;
+import org.hibernate.envers.configuration.AuditConfiguration;
+import org.hibernate.envers.exception.AuditException;
+import org.hibernate.envers.reader.AuditReaderImplementor;
import org.hibernate.envers.tools.reflection.ReflectionTools;
import org.hibernate.collection.PersistentCollection;
@@ -70,7 +70,7 @@
return delegate.mapToMapFromEntity(newData, newObj, oldObj);
}
- public void mapToEntityFromMap(VersionsConfiguration verCfg, Object obj, Map data, Object primaryKey, VersionsReaderImplementor versionsReader, Number revision) {
+ public void mapToEntityFromMap(AuditConfiguration verCfg, Object obj, Map data, Object primaryKey, AuditReaderImplementor versionsReader, Number revision) {
if (data == null || obj == null) {
return;
}
@@ -83,7 +83,7 @@
setter.set(obj, subObj, null);
delegate.mapToEntityFromMap(verCfg, subObj, (Map) data.get(propertyName), primaryKey, versionsReader, revision);
} catch (Exception e) {
- throw new VersionsException(e);
+ throw new AuditException(e);
}
}
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/MultiPropertyMapper.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/MultiPropertyMapper.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/MultiPropertyMapper.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -29,8 +29,8 @@
import java.util.Map;
import org.hibernate.envers.ModificationStore;
-import org.hibernate.envers.configuration.VersionsConfiguration;
-import org.hibernate.envers.reader.VersionsReaderImplementor;
+import org.hibernate.envers.configuration.AuditConfiguration;
+import org.hibernate.envers.reader.AuditReaderImplementor;
import org.hibernate.envers.tools.reflection.ReflectionTools;
import org.hibernate.MappingException;
@@ -105,7 +105,7 @@
return ret;
}
- public void mapToEntityFromMap(VersionsConfiguration verCfg, Object obj, Map data, Object primaryKey, VersionsReaderImplementor versionsReader, Number revision) {
+ public void mapToEntityFromMap(AuditConfiguration verCfg, Object obj, Map data, Object primaryKey, AuditReaderImplementor versionsReader, Number revision) {
for (String propertyName : properties.keySet()) {
properties.get(propertyName).mapToEntityFromMap(verCfg, obj, data, primaryKey, versionsReader, revision);
}
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/PropertyMapper.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/PropertyMapper.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/PropertyMapper.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -27,8 +27,8 @@
import java.util.List;
import java.util.Map;
-import org.hibernate.envers.configuration.VersionsConfiguration;
-import org.hibernate.envers.reader.VersionsReaderImplementor;
+import org.hibernate.envers.configuration.AuditConfiguration;
+import org.hibernate.envers.reader.AuditReaderImplementor;
import org.hibernate.collection.PersistentCollection;
@@ -54,8 +54,8 @@
* @param versionsReader VersionsReader for reading relations
* @param revision Revision at which the object is read, for reading relations
*/
- void mapToEntityFromMap(VersionsConfiguration verCfg, Object obj, Map data, Object primaryKey,
- VersionsReaderImplementor versionsReader, Number revision);
+ void mapToEntityFromMap(AuditConfiguration verCfg, Object obj, Map data, Object primaryKey,
+ AuditReaderImplementor versionsReader, Number revision);
/**
* Maps collection changes
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/SinglePropertyMapper.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/SinglePropertyMapper.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/SinglePropertyMapper.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -28,9 +28,9 @@
import java.util.Map;
import org.hibernate.envers.ModificationStore;
-import org.hibernate.envers.configuration.VersionsConfiguration;
-import org.hibernate.envers.exception.VersionsException;
-import org.hibernate.envers.reader.VersionsReaderImplementor;
+import org.hibernate.envers.configuration.AuditConfiguration;
+import org.hibernate.envers.exception.AuditException;
+import org.hibernate.envers.reader.AuditReaderImplementor;
import org.hibernate.envers.tools.Tools;
import org.hibernate.envers.tools.reflection.ReflectionTools;
@@ -48,7 +48,7 @@
public void add(String propertyName, ModificationStore modStore) {
if (this.propertyName != null) {
- throw new VersionsException("Only one property can be added!");
+ throw new AuditException("Only one property can be added!");
}
this.propertyName = propertyName;
@@ -60,7 +60,7 @@
return !Tools.objectsEqual(newObj, oldObj);
}
- public void mapToEntityFromMap(VersionsConfiguration verCfg, Object obj, Map data, Object primaryKey, VersionsReaderImplementor versionsReader, Number revision) {
+ public void mapToEntityFromMap(AuditConfiguration verCfg, Object obj, Map data, Object primaryKey, AuditReaderImplementor versionsReader, Number revision) {
if (data == null || obj == null) {
return;
}
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/SubclassPropertyMapper.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/SubclassPropertyMapper.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/SubclassPropertyMapper.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -28,8 +28,8 @@
import java.util.Map;
import org.hibernate.envers.ModificationStore;
-import org.hibernate.envers.configuration.VersionsConfiguration;
-import org.hibernate.envers.reader.VersionsReaderImplementor;
+import org.hibernate.envers.configuration.AuditConfiguration;
+import org.hibernate.envers.reader.AuditReaderImplementor;
import org.hibernate.collection.PersistentCollection;
@@ -61,7 +61,7 @@
return parentDiffs || mainDiffs;
}
- public void mapToEntityFromMap(VersionsConfiguration verCfg, Object obj, Map data, Object primaryKey, VersionsReaderImplementor versionsReader, Number revision) {
+ public void mapToEntityFromMap(AuditConfiguration verCfg, Object obj, Map data, Object primaryKey, AuditReaderImplementor versionsReader, Number revision) {
parentMapper.mapToEntityFromMap(verCfg, obj, data, primaryKey, versionsReader, revision);
main.mapToEntityFromMap(verCfg, obj, data, primaryKey, versionsReader, revision);
}
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/id/AbstractCompositeIdMapper.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/id/AbstractCompositeIdMapper.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/id/AbstractCompositeIdMapper.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -27,7 +27,7 @@
import java.util.Map;
import org.hibernate.envers.ModificationStore;
-import org.hibernate.envers.exception.VersionsException;
+import org.hibernate.envers.exception.AuditException;
/**
* @author Adam Warski (adam at warski dot org)
@@ -51,7 +51,7 @@
try {
ret = Thread.currentThread().getContextClassLoader().loadClass(compositeIdClass).newInstance();
} catch (Exception e) {
- throw new VersionsException(e);
+ throw new AuditException(e);
}
for (SingleIdMapper mapper : ids.values()) {
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/id/EmbeddedIdMapper.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/id/EmbeddedIdMapper.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/id/EmbeddedIdMapper.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -28,7 +28,7 @@
import java.util.List;
import java.util.Map;
-import org.hibernate.envers.exception.VersionsException;
+import org.hibernate.envers.exception.AuditException;
import org.hibernate.envers.tools.reflection.ReflectionTools;
import org.hibernate.property.Getter;
@@ -78,7 +78,7 @@
idMapper.mapToEntityFromMap(subObj, data);
}
} catch (Exception e) {
- throw new VersionsException(e);
+ throw new AuditException(e);
}
}
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/id/MultipleIdMapper.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/id/MultipleIdMapper.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/id/MultipleIdMapper.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -28,7 +28,7 @@
import java.util.List;
import java.util.Map;
-import org.hibernate.envers.exception.VersionsException;
+import org.hibernate.envers.exception.AuditException;
/**
* @author Adam Warski (adam at warski dot org)
@@ -73,7 +73,7 @@
try {
ret = Thread.currentThread().getContextClassLoader().loadClass(compositeIdClass).newInstance();
} catch (Exception e) {
- throw new VersionsException(e);
+ throw new AuditException(e);
}
for (SingleIdMapper mapper : ids.values()) {
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/id/SingleIdMapper.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/id/SingleIdMapper.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/id/SingleIdMapper.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -28,7 +28,7 @@
import java.util.Map;
import org.hibernate.envers.ModificationStore;
-import org.hibernate.envers.exception.VersionsException;
+import org.hibernate.envers.exception.AuditException;
import org.hibernate.envers.tools.reflection.ReflectionTools;
import org.hibernate.property.Getter;
@@ -56,7 +56,7 @@
public void add(String propertyName, ModificationStore modStore) {
if (this.propertyName != null) {
- throw new VersionsException("Only one property can be added!");
+ throw new AuditException("Only one property can be added!");
}
this.propertyName = propertyName;
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/AbstractCollectionMapper.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/AbstractCollectionMapper.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/AbstractCollectionMapper.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -35,12 +35,12 @@
import java.util.Set;
import org.hibernate.envers.RevisionType;
-import org.hibernate.envers.configuration.VersionsConfiguration;
+import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.envers.entities.mapper.PersistentCollectionChangeData;
import org.hibernate.envers.entities.mapper.PropertyMapper;
import org.hibernate.envers.entities.mapper.relation.lazy.initializor.Initializor;
-import org.hibernate.envers.exception.VersionsException;
-import org.hibernate.envers.reader.VersionsReaderImplementor;
+import org.hibernate.envers.exception.AuditException;
+import org.hibernate.envers.reader.AuditReaderImplementor;
import org.hibernate.envers.tools.reflection.ReflectionTools;
import org.hibernate.collection.PersistentCollection;
@@ -63,7 +63,7 @@
try {
proxyConstructor = proxyClass.getConstructor(Initializor.class);
} catch (NoSuchMethodException e) {
- throw new VersionsException(e);
+ throw new AuditException(e);
}
}
@@ -131,22 +131,22 @@
return false;
}
- protected abstract Initializor<T> getInitializor(VersionsConfiguration verCfg,
- VersionsReaderImplementor versionsReader, Object primaryKey,
+ protected abstract Initializor<T> getInitializor(AuditConfiguration verCfg,
+ AuditReaderImplementor versionsReader, Object primaryKey,
Number revision);
- public void mapToEntityFromMap(VersionsConfiguration verCfg, Object obj, Map data, Object primaryKey,
- VersionsReaderImplementor versionsReader, Number revision) {
+ public void mapToEntityFromMap(AuditConfiguration verCfg, Object obj, Map data, Object primaryKey,
+ AuditReaderImplementor versionsReader, Number revision) {
Setter setter = ReflectionTools.getSetter(obj.getClass(),
commonCollectionMapperData.getCollectionReferencingPropertyName());
try {
setter.set(obj, proxyConstructor.newInstance(getInitializor(verCfg, versionsReader, primaryKey, revision)), null);
} catch (InstantiationException e) {
- throw new VersionsException(e);
+ throw new AuditException(e);
} catch (IllegalAccessException e) {
- throw new VersionsException(e);
+ throw new AuditException(e);
} catch (InvocationTargetException e) {
- throw new VersionsException(e);
+ throw new AuditException(e);
}
}
}
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/BasicCollectionMapper.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/BasicCollectionMapper.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/BasicCollectionMapper.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -27,11 +27,11 @@
import java.util.Collection;
import java.util.Map;
-import org.hibernate.envers.configuration.VersionsConfiguration;
+import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.envers.entities.mapper.PropertyMapper;
import org.hibernate.envers.entities.mapper.relation.lazy.initializor.BasicCollectionInitializor;
import org.hibernate.envers.entities.mapper.relation.lazy.initializor.Initializor;
-import org.hibernate.envers.reader.VersionsReaderImplementor;
+import org.hibernate.envers.reader.AuditReaderImplementor;
import org.hibernate.collection.PersistentCollection;
@@ -48,7 +48,7 @@
this.elementComponentData = elementComponentData;
}
- protected Initializor<T> getInitializor(VersionsConfiguration verCfg, VersionsReaderImplementor versionsReader,
+ protected Initializor<T> getInitializor(AuditConfiguration verCfg, AuditReaderImplementor versionsReader,
Object primaryKey, Number revision) {
return new BasicCollectionInitializor<T>(verCfg, versionsReader, commonCollectionMapperData.getQueryGenerator(),
primaryKey, revision, collectionClass, elementComponentData);
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/CommonCollectionMapperData.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/CommonCollectionMapperData.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/CommonCollectionMapperData.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -23,7 +23,7 @@
*/
package org.hibernate.envers.entities.mapper.relation;
-import org.hibernate.envers.configuration.VersionsEntitiesConfiguration;
+import org.hibernate.envers.configuration.AuditEntitiesConfiguration;
import org.hibernate.envers.entities.mapper.relation.query.RelationQueryGenerator;
/**
@@ -31,13 +31,13 @@
* @author Adam Warski (adam at warski dot org)
*/
public final class CommonCollectionMapperData {
- private final VersionsEntitiesConfiguration verEntCfg;
+ private final AuditEntitiesConfiguration verEntCfg;
private final String versionsMiddleEntityName;
private final String collectionReferencingPropertyName;
private final MiddleIdData referencingIdData;
private final RelationQueryGenerator queryGenerator;
- public CommonCollectionMapperData(VersionsEntitiesConfiguration verEntCfg, String versionsMiddleEntityName,
+ public CommonCollectionMapperData(AuditEntitiesConfiguration verEntCfg, String versionsMiddleEntityName,
String collectionReferencingPropertyName, MiddleIdData referencingIdData,
RelationQueryGenerator queryGenerator) {
this.verEntCfg = verEntCfg;
@@ -47,7 +47,7 @@
this.queryGenerator = queryGenerator;
}
- public VersionsEntitiesConfiguration getVerEntCfg() {
+ public AuditEntitiesConfiguration getVerEntCfg() {
return verEntCfg;
}
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/ListCollectionMapper.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/ListCollectionMapper.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/ListCollectionMapper.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -28,12 +28,12 @@
import java.util.List;
import java.util.Map;
-import org.hibernate.envers.configuration.VersionsConfiguration;
+import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.envers.entities.mapper.PropertyMapper;
import org.hibernate.envers.entities.mapper.relation.lazy.initializor.Initializor;
import org.hibernate.envers.entities.mapper.relation.lazy.initializor.ListCollectionInitializor;
import org.hibernate.envers.entities.mapper.relation.lazy.proxy.ListProxy;
-import org.hibernate.envers.reader.VersionsReaderImplementor;
+import org.hibernate.envers.reader.AuditReaderImplementor;
import org.hibernate.envers.tools.Pair;
import org.hibernate.envers.tools.Tools;
@@ -53,7 +53,7 @@
this.indexComponentData = indexComponentData;
}
- protected Initializor<List> getInitializor(VersionsConfiguration verCfg, VersionsReaderImplementor versionsReader,
+ protected Initializor<List> getInitializor(AuditConfiguration verCfg, AuditReaderImplementor versionsReader,
Object primaryKey, Number revision) {
return new ListCollectionInitializor(verCfg, versionsReader, commonCollectionMapperData.getQueryGenerator(),
primaryKey, revision, elementComponentData, indexComponentData);
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/MapCollectionMapper.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/MapCollectionMapper.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/MapCollectionMapper.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -27,11 +27,11 @@
import java.util.Collection;
import java.util.Map;
-import org.hibernate.envers.configuration.VersionsConfiguration;
+import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.envers.entities.mapper.PropertyMapper;
import org.hibernate.envers.entities.mapper.relation.lazy.initializor.Initializor;
import org.hibernate.envers.entities.mapper.relation.lazy.initializor.MapCollectionInitializor;
-import org.hibernate.envers.reader.VersionsReaderImplementor;
+import org.hibernate.envers.reader.AuditReaderImplementor;
import org.hibernate.collection.PersistentCollection;
@@ -50,7 +50,7 @@
this.indexComponentData = indexComponentData;
}
- protected Initializor<T> getInitializor(VersionsConfiguration verCfg, VersionsReaderImplementor versionsReader,
+ protected Initializor<T> getInitializor(AuditConfiguration verCfg, AuditReaderImplementor versionsReader,
Object primaryKey, Number revision) {
return new MapCollectionInitializor<T>(verCfg, versionsReader, commonCollectionMapperData.getQueryGenerator(),
primaryKey, revision, collectionClass, elementComponentData, indexComponentData);
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/MiddleIdData.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/MiddleIdData.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/MiddleIdData.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -23,7 +23,7 @@
*/
package org.hibernate.envers.entities.mapper.relation;
-import org.hibernate.envers.configuration.VersionsEntitiesConfiguration;
+import org.hibernate.envers.configuration.AuditEntitiesConfiguration;
import org.hibernate.envers.entities.IdMappingData;
import org.hibernate.envers.entities.mapper.id.IdMapper;
@@ -50,7 +50,7 @@
*/
private final String versionsEntityName;
- public MiddleIdData(VersionsEntitiesConfiguration verEntCfg, IdMappingData mappingData, String prefix,
+ public MiddleIdData(AuditEntitiesConfiguration verEntCfg, IdMappingData mappingData, String prefix,
String entityName) {
this.originalMapper = mappingData.getIdMapper();
this.prefixedMapper = mappingData.getIdMapper().prefixMappedProperties(prefix);
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/OneToOneNotOwningMapper.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/OneToOneNotOwningMapper.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/OneToOneNotOwningMapper.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -28,12 +28,12 @@
import java.util.Map;
import javax.persistence.NoResultException;
-import org.hibernate.envers.configuration.VersionsConfiguration;
+import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.envers.entities.mapper.PersistentCollectionChangeData;
import org.hibernate.envers.entities.mapper.PropertyMapper;
-import org.hibernate.envers.exception.VersionsException;
-import org.hibernate.envers.query.VersionsRestrictions;
-import org.hibernate.envers.reader.VersionsReaderImplementor;
+import org.hibernate.envers.exception.AuditException;
+import org.hibernate.envers.query.AuditRestrictions;
+import org.hibernate.envers.reader.AuditReaderImplementor;
import org.hibernate.envers.tools.reflection.ReflectionTools;
import org.hibernate.NonUniqueResultException;
@@ -58,7 +58,7 @@
return false;
}
- public void mapToEntityFromMap(VersionsConfiguration verCfg, Object obj, Map data, Object primaryKey, VersionsReaderImplementor versionsReader, Number revision) {
+ public void mapToEntityFromMap(AuditConfiguration verCfg, Object obj, Map data, Object primaryKey, AuditReaderImplementor versionsReader, Number revision) {
if (obj == null) {
return;
}
@@ -69,11 +69,11 @@
try {
value = versionsReader.createQuery().forEntitiesAtRevision(entityClass, revision)
- .add(VersionsRestrictions.relatedIdEq(owningReferencePropertyName, primaryKey)).getSingleResult();
+ .add(AuditRestrictions.relatedIdEq(owningReferencePropertyName, primaryKey)).getSingleResult();
} catch (NoResultException e) {
value = null;
} catch (NonUniqueResultException e) {
- throw new VersionsException("Many versions results for one-to-one relationship: (" + owningEntityName +
+ throw new AuditException("Many versions results for one-to-one relationship: (" + owningEntityName +
", " + owningReferencePropertyName + ")");
}
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/ToOneIdMapper.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/ToOneIdMapper.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/ToOneIdMapper.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -28,12 +28,12 @@
import java.util.List;
import java.util.Map;
-import org.hibernate.envers.configuration.VersionsConfiguration;
+import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.envers.entities.mapper.PersistentCollectionChangeData;
import org.hibernate.envers.entities.mapper.PropertyMapper;
import org.hibernate.envers.entities.mapper.id.IdMapper;
import org.hibernate.envers.entities.mapper.relation.lazy.ToOneDelegateSessionImplementor;
-import org.hibernate.envers.reader.VersionsReaderImplementor;
+import org.hibernate.envers.reader.AuditReaderImplementor;
import org.hibernate.envers.tools.Tools;
import org.hibernate.envers.tools.reflection.ReflectionTools;
@@ -63,8 +63,8 @@
return !Tools.objectsEqual(newObj, oldObj);
}
- public void mapToEntityFromMap(VersionsConfiguration verCfg, Object obj, Map data, Object primaryKey,
- VersionsReaderImplementor versionsReader, Number revision) {
+ public void mapToEntityFromMap(AuditConfiguration verCfg, Object obj, Map data, Object primaryKey,
+ AuditReaderImplementor versionsReader, Number revision) {
if (obj == null) {
return;
}
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/component/MiddleMapKeyIdComponentMapper.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/component/MiddleMapKeyIdComponentMapper.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/component/MiddleMapKeyIdComponentMapper.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -25,7 +25,7 @@
import java.util.Map;
-import org.hibernate.envers.configuration.VersionsEntitiesConfiguration;
+import org.hibernate.envers.configuration.AuditEntitiesConfiguration;
import org.hibernate.envers.entities.EntityInstantiator;
import org.hibernate.envers.entities.mapper.id.IdMapper;
import org.hibernate.envers.tools.query.Parameters;
@@ -37,10 +37,10 @@
* @author Adam Warski (adam at warski dot org)
*/
public final class MiddleMapKeyIdComponentMapper implements MiddleComponentMapper {
- private final VersionsEntitiesConfiguration verEntCfg;
+ private final AuditEntitiesConfiguration verEntCfg;
private final IdMapper relatedIdMapper;
- public MiddleMapKeyIdComponentMapper(VersionsEntitiesConfiguration verEntCfg, IdMapper relatedIdMapper) {
+ public MiddleMapKeyIdComponentMapper(AuditEntitiesConfiguration verEntCfg, IdMapper relatedIdMapper) {
this.verEntCfg = verEntCfg;
this.relatedIdMapper = relatedIdMapper;
}
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/component/MiddleSimpleComponentMapper.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/component/MiddleSimpleComponentMapper.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/component/MiddleSimpleComponentMapper.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -25,7 +25,7 @@
import java.util.Map;
-import org.hibernate.envers.configuration.VersionsEntitiesConfiguration;
+import org.hibernate.envers.configuration.AuditEntitiesConfiguration;
import org.hibernate.envers.entities.EntityInstantiator;
import org.hibernate.envers.tools.query.Parameters;
@@ -34,9 +34,9 @@
*/
public final class MiddleSimpleComponentMapper implements MiddleComponentMapper {
private final String propertyName;
- private final VersionsEntitiesConfiguration verEntCfg;
+ private final AuditEntitiesConfiguration verEntCfg;
- public MiddleSimpleComponentMapper(VersionsEntitiesConfiguration verEntCfg, String propertyName) {
+ public MiddleSimpleComponentMapper(AuditEntitiesConfiguration verEntCfg, String propertyName) {
this.propertyName = propertyName;
this.verEntCfg = verEntCfg;
}
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/lazy/ToOneDelegateSessionImplementor.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/lazy/ToOneDelegateSessionImplementor.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/lazy/ToOneDelegateSessionImplementor.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -23,7 +23,7 @@
*/
package org.hibernate.envers.entities.mapper.relation.lazy;
-import org.hibernate.envers.reader.VersionsReaderImplementor;
+import org.hibernate.envers.reader.AuditReaderImplementor;
import org.hibernate.HibernateException;
@@ -31,12 +31,12 @@
* @author Adam Warski (adam at warski dot org)
*/
public class ToOneDelegateSessionImplementor extends AbstractDelegateSessionImplementor {
- private final VersionsReaderImplementor versionsReader;
+ private final AuditReaderImplementor versionsReader;
private final Class<?> entityClass;
private final Object entityId;
private final Number revision;
- public ToOneDelegateSessionImplementor(VersionsReaderImplementor versionsReader,
+ public ToOneDelegateSessionImplementor(AuditReaderImplementor versionsReader,
Class<?> entityClass, Object entityId, Number revision) {
super(versionsReader.getSessionImplementor());
this.versionsReader = versionsReader;
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/lazy/initializor/AbstractCollectionInitializor.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/lazy/initializor/AbstractCollectionInitializor.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/lazy/initializor/AbstractCollectionInitializor.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -25,25 +25,25 @@
import java.util.List;
-import org.hibernate.envers.configuration.VersionsConfiguration;
+import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.envers.entities.EntityInstantiator;
import org.hibernate.envers.entities.mapper.relation.query.RelationQueryGenerator;
-import org.hibernate.envers.reader.VersionsReaderImplementor;
+import org.hibernate.envers.reader.AuditReaderImplementor;
/**
* Initializes a persistent collection.
* @author Adam Warski (adam at warski dot org)
*/
public abstract class AbstractCollectionInitializor<T> implements Initializor<T> {
- private final VersionsReaderImplementor versionsReader;
+ private final AuditReaderImplementor versionsReader;
private final RelationQueryGenerator queryGenerator;
private final Object primaryKey;
protected final Number revision;
protected final EntityInstantiator entityInstantiator;
- public AbstractCollectionInitializor(VersionsConfiguration verCfg,
- VersionsReaderImplementor versionsReader,
+ public AbstractCollectionInitializor(AuditConfiguration verCfg,
+ AuditReaderImplementor versionsReader,
RelationQueryGenerator queryGenerator,
Object primaryKey, Number revision) {
this.versionsReader = versionsReader;
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/lazy/initializor/ArrayCollectionInitializor.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/lazy/initializor/ArrayCollectionInitializor.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/lazy/initializor/ArrayCollectionInitializor.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -26,10 +26,10 @@
import java.util.List;
import java.util.Map;
-import org.hibernate.envers.configuration.VersionsConfiguration;
+import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.envers.entities.mapper.relation.MiddleComponentData;
import org.hibernate.envers.entities.mapper.relation.query.RelationQueryGenerator;
-import org.hibernate.envers.reader.VersionsReaderImplementor;
+import org.hibernate.envers.reader.AuditReaderImplementor;
/**
* Initializes a map.
@@ -39,8 +39,8 @@
private final MiddleComponentData elementComponentData;
private final MiddleComponentData indexComponentData;
- public ArrayCollectionInitializor(VersionsConfiguration verCfg,
- VersionsReaderImplementor versionsReader,
+ public ArrayCollectionInitializor(AuditConfiguration verCfg,
+ AuditReaderImplementor versionsReader,
RelationQueryGenerator queryGenerator,
Object primaryKey, Number revision,
MiddleComponentData elementComponentData,
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/lazy/initializor/BasicCollectionInitializor.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/lazy/initializor/BasicCollectionInitializor.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/lazy/initializor/BasicCollectionInitializor.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -27,11 +27,11 @@
import java.util.List;
import java.util.Map;
-import org.hibernate.envers.configuration.VersionsConfiguration;
+import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.envers.entities.mapper.relation.MiddleComponentData;
import org.hibernate.envers.entities.mapper.relation.query.RelationQueryGenerator;
-import org.hibernate.envers.exception.VersionsException;
-import org.hibernate.envers.reader.VersionsReaderImplementor;
+import org.hibernate.envers.exception.AuditException;
+import org.hibernate.envers.reader.AuditReaderImplementor;
/**
* Initializes a non-indexed java collection (set or list, eventually sorted).
@@ -41,8 +41,8 @@
private final Class<? extends T> collectionClass;
private final MiddleComponentData elementComponentData;
- public BasicCollectionInitializor(VersionsConfiguration verCfg,
- VersionsReaderImplementor versionsReader,
+ public BasicCollectionInitializor(AuditConfiguration verCfg,
+ AuditReaderImplementor versionsReader,
RelationQueryGenerator queryGenerator,
Object primaryKey, Number revision,
Class<? extends T> collectionClass,
@@ -57,9 +57,9 @@
try {
return collectionClass.newInstance();
} catch (InstantiationException e) {
- throw new VersionsException(e);
+ throw new AuditException(e);
} catch (IllegalAccessException e) {
- throw new VersionsException(e);
+ throw new AuditException(e);
}
}
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/lazy/initializor/ListCollectionInitializor.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/lazy/initializor/ListCollectionInitializor.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/lazy/initializor/ListCollectionInitializor.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -27,10 +27,10 @@
import java.util.List;
import java.util.Map;
-import org.hibernate.envers.configuration.VersionsConfiguration;
+import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.envers.entities.mapper.relation.MiddleComponentData;
import org.hibernate.envers.entities.mapper.relation.query.RelationQueryGenerator;
-import org.hibernate.envers.reader.VersionsReaderImplementor;
+import org.hibernate.envers.reader.AuditReaderImplementor;
/**
* Initializes a map.
@@ -40,8 +40,8 @@
private final MiddleComponentData elementComponentData;
private final MiddleComponentData indexComponentData;
- public ListCollectionInitializor(VersionsConfiguration verCfg,
- VersionsReaderImplementor versionsReader,
+ public ListCollectionInitializor(AuditConfiguration verCfg,
+ AuditReaderImplementor versionsReader,
RelationQueryGenerator queryGenerator,
Object primaryKey, Number revision,
MiddleComponentData elementComponentData,
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/lazy/initializor/MapCollectionInitializor.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/lazy/initializor/MapCollectionInitializor.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/lazy/initializor/MapCollectionInitializor.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -26,11 +26,11 @@
import java.util.List;
import java.util.Map;
-import org.hibernate.envers.configuration.VersionsConfiguration;
+import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.envers.entities.mapper.relation.MiddleComponentData;
import org.hibernate.envers.entities.mapper.relation.query.RelationQueryGenerator;
-import org.hibernate.envers.exception.VersionsException;
-import org.hibernate.envers.reader.VersionsReaderImplementor;
+import org.hibernate.envers.exception.AuditException;
+import org.hibernate.envers.reader.AuditReaderImplementor;
/**
* Initializes a map.
@@ -41,8 +41,8 @@
private final MiddleComponentData elementComponentData;
private final MiddleComponentData indexComponentData;
- public MapCollectionInitializor(VersionsConfiguration verCfg,
- VersionsReaderImplementor versionsReader,
+ public MapCollectionInitializor(AuditConfiguration verCfg,
+ AuditReaderImplementor versionsReader,
RelationQueryGenerator queryGenerator,
Object primaryKey, Number revision,
Class<? extends T> collectionClass,
@@ -59,9 +59,9 @@
try {
return collectionClass.newInstance();
} catch (InstantiationException e) {
- throw new VersionsException(e);
+ throw new AuditException(e);
} catch (IllegalAccessException e) {
- throw new VersionsException(e);
+ throw new AuditException(e);
}
}
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/query/OneEntityQueryGenerator.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/query/OneEntityQueryGenerator.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/query/OneEntityQueryGenerator.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -26,11 +26,11 @@
import java.util.Collections;
import org.hibernate.envers.RevisionType;
-import org.hibernate.envers.configuration.VersionsEntitiesConfiguration;
+import org.hibernate.envers.configuration.AuditEntitiesConfiguration;
import org.hibernate.envers.entities.mapper.id.QueryParameterData;
import org.hibernate.envers.entities.mapper.relation.MiddleComponentData;
import org.hibernate.envers.entities.mapper.relation.MiddleIdData;
-import org.hibernate.envers.reader.VersionsReaderImplementor;
+import org.hibernate.envers.reader.AuditReaderImplementor;
import org.hibernate.envers.tools.query.Parameters;
import org.hibernate.envers.tools.query.QueryBuilder;
@@ -44,7 +44,7 @@
private final String queryString;
private final MiddleIdData referencingIdData;
- public OneEntityQueryGenerator(VersionsEntitiesConfiguration verEntCfg,
+ public OneEntityQueryGenerator(AuditEntitiesConfiguration verEntCfg,
String versionsMiddleEntityName,
MiddleIdData referencingIdData,
MiddleComponentData... componentDatas) {
@@ -95,7 +95,7 @@
queryString = sb.toString();
}
- public Query getQuery(VersionsReaderImplementor versionsReader, Object primaryKey, Number revision) {
+ public Query getQuery(AuditReaderImplementor versionsReader, Object primaryKey, Number revision) {
Query query = versionsReader.getSession().createQuery(queryString);
query.setParameter("revision", revision);
query.setParameter("delrevisiontype", RevisionType.DEL);
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/query/OneVersionsEntityQueryGenerator.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/query/OneVersionsEntityQueryGenerator.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/query/OneVersionsEntityQueryGenerator.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -27,11 +27,11 @@
import org.hibernate.envers.RevisionType;
import org.hibernate.envers.configuration.GlobalConfiguration;
-import org.hibernate.envers.configuration.VersionsEntitiesConfiguration;
+import org.hibernate.envers.configuration.AuditEntitiesConfiguration;
import org.hibernate.envers.entities.mapper.id.IdMapper;
import org.hibernate.envers.entities.mapper.id.QueryParameterData;
import org.hibernate.envers.entities.mapper.relation.MiddleIdData;
-import org.hibernate.envers.reader.VersionsReaderImplementor;
+import org.hibernate.envers.reader.AuditReaderImplementor;
import org.hibernate.envers.tools.query.Parameters;
import org.hibernate.envers.tools.query.QueryBuilder;
@@ -45,7 +45,7 @@
private final String queryString;
private final MiddleIdData referencingIdData;
- public OneVersionsEntityQueryGenerator(GlobalConfiguration globalCfg, VersionsEntitiesConfiguration verEntCfg,
+ public OneVersionsEntityQueryGenerator(GlobalConfiguration globalCfg, AuditEntitiesConfiguration verEntCfg,
MiddleIdData referencingIdData, String referencedEntityName,
IdMapper referencedIdMapper) {
this.referencingIdData = referencingIdData;
@@ -97,7 +97,7 @@
queryString = sb.toString();
}
- public Query getQuery(VersionsReaderImplementor versionsReader, Object primaryKey, Number revision) {
+ public Query getQuery(AuditReaderImplementor versionsReader, Object primaryKey, Number revision) {
Query query = versionsReader.getSession().createQuery(queryString);
query.setParameter("revision", revision);
query.setParameter("delrevisiontype", RevisionType.DEL);
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/query/RelationQueryGenerator.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/query/RelationQueryGenerator.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/query/RelationQueryGenerator.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -23,7 +23,7 @@
*/
package org.hibernate.envers.entities.mapper.relation.query;
-import org.hibernate.envers.reader.VersionsReaderImplementor;
+import org.hibernate.envers.reader.AuditReaderImplementor;
import org.hibernate.Query;
@@ -34,5 +34,5 @@
* @author Adam Warski (adam at warski dot org)
*/
public interface RelationQueryGenerator {
- Query getQuery(VersionsReaderImplementor versionsReader, Object primaryKey, Number revision);
+ Query getQuery(AuditReaderImplementor versionsReader, Object primaryKey, Number revision);
}
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/query/ThreeEntityQueryGenerator.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/query/ThreeEntityQueryGenerator.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/query/ThreeEntityQueryGenerator.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -27,11 +27,11 @@
import org.hibernate.envers.RevisionType;
import org.hibernate.envers.configuration.GlobalConfiguration;
-import org.hibernate.envers.configuration.VersionsEntitiesConfiguration;
+import org.hibernate.envers.configuration.AuditEntitiesConfiguration;
import org.hibernate.envers.entities.mapper.id.QueryParameterData;
import org.hibernate.envers.entities.mapper.relation.MiddleComponentData;
import org.hibernate.envers.entities.mapper.relation.MiddleIdData;
-import org.hibernate.envers.reader.VersionsReaderImplementor;
+import org.hibernate.envers.reader.AuditReaderImplementor;
import org.hibernate.envers.tools.query.Parameters;
import org.hibernate.envers.tools.query.QueryBuilder;
@@ -46,7 +46,7 @@
private final MiddleIdData referencingIdData;
public ThreeEntityQueryGenerator(GlobalConfiguration globalCfg,
- VersionsEntitiesConfiguration verEntCfg,
+ AuditEntitiesConfiguration verEntCfg,
String versionsMiddleEntityName,
MiddleIdData referencingIdData,
MiddleIdData referencedIdData,
@@ -123,7 +123,7 @@
queryString = sb.toString();
}
- public Query getQuery(VersionsReaderImplementor versionsReader, Object primaryKey, Number revision) {
+ public Query getQuery(AuditReaderImplementor versionsReader, Object primaryKey, Number revision) {
Query query = versionsReader.getSession().createQuery(queryString);
query.setParameter("revision", revision);
query.setParameter("delrevisiontype", RevisionType.DEL);
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/query/TwoEntityQueryGenerator.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/query/TwoEntityQueryGenerator.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/query/TwoEntityQueryGenerator.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -27,11 +27,11 @@
import org.hibernate.envers.RevisionType;
import org.hibernate.envers.configuration.GlobalConfiguration;
-import org.hibernate.envers.configuration.VersionsEntitiesConfiguration;
+import org.hibernate.envers.configuration.AuditEntitiesConfiguration;
import org.hibernate.envers.entities.mapper.id.QueryParameterData;
import org.hibernate.envers.entities.mapper.relation.MiddleComponentData;
import org.hibernate.envers.entities.mapper.relation.MiddleIdData;
-import org.hibernate.envers.reader.VersionsReaderImplementor;
+import org.hibernate.envers.reader.AuditReaderImplementor;
import org.hibernate.envers.tools.query.Parameters;
import org.hibernate.envers.tools.query.QueryBuilder;
@@ -46,7 +46,7 @@
private final MiddleIdData referencingIdData;
public TwoEntityQueryGenerator(GlobalConfiguration globalCfg,
- VersionsEntitiesConfiguration verEntCfg,
+ AuditEntitiesConfiguration verEntCfg,
String versionsMiddleEntityName,
MiddleIdData referencingIdData,
MiddleIdData referencedIdData,
@@ -106,7 +106,7 @@
queryString = sb.toString();
}
- public Query getQuery(VersionsReaderImplementor versionsReader, Object primaryKey, Number revision) {
+ public Query getQuery(AuditReaderImplementor versionsReader, Object primaryKey, Number revision) {
Query query = versionsReader.getSession().createQuery(queryString);
query.setParameter("revision", revision);
query.setParameter("delrevisiontype", RevisionType.DEL);
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/event/VersionsEventListener.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/event/VersionsEventListener.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/event/VersionsEventListener.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -25,12 +25,12 @@
import java.io.Serializable;
-import org.hibernate.envers.configuration.VersionsConfiguration;
+import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.envers.entities.RelationDescription;
import org.hibernate.envers.entities.RelationType;
import org.hibernate.envers.entities.mapper.PersistentCollectionChangeData;
import org.hibernate.envers.entities.mapper.id.IdMapper;
-import org.hibernate.envers.synchronization.VersionsSync;
+import org.hibernate.envers.synchronization.AuditSync;
import org.hibernate.envers.synchronization.work.AddWorkUnit;
import org.hibernate.envers.synchronization.work.CollectionChangeWorkUnit;
import org.hibernate.envers.synchronization.work.DelWorkUnit;
@@ -63,9 +63,9 @@
public class VersionsEventListener implements PostInsertEventListener, PostUpdateEventListener,
PostDeleteEventListener, PreCollectionUpdateEventListener, PreCollectionRemoveEventListener,
PostCollectionRecreateEventListener, Initializable {
- private VersionsConfiguration verCfg;
+ private AuditConfiguration verCfg;
- private void generateBidirectionalCollectionChangeWorkUnits(VersionsSync verSync, EntityPersister entityPersister,
+ private void generateBidirectionalCollectionChangeWorkUnits(AuditSync verSync, EntityPersister entityPersister,
String entityName, Object[] newState, Object[] oldState) {
// Checking if this is enabled in configuration ...
if (!verCfg.getGlobalCfg().isGenerateRevisionsForCollections()) {
@@ -108,7 +108,7 @@
String entityName = event.getPersister().getEntityName();
if (verCfg.getEntCfg().isVersioned(entityName)) {
- VersionsSync verSync = verCfg.getSyncManager().get(event.getSession());
+ AuditSync verSync = verCfg.getSyncManager().get(event.getSession());
verSync.addWorkUnit(new AddWorkUnit(event.getPersister().getEntityName(), verCfg, event.getId(),
event.getPersister(), event.getState()));
@@ -121,7 +121,7 @@
String entityName = event.getPersister().getEntityName();
if (verCfg.getEntCfg().isVersioned(entityName)) {
- VersionsSync verSync = verCfg.getSyncManager().get(event.getSession());
+ AuditSync verSync = verCfg.getSyncManager().get(event.getSession());
verSync.addWorkUnit(new ModWorkUnit(event.getPersister().getEntityName(), verCfg, event.getId(),
event.getPersister(), event.getState(), event.getOldState()));
@@ -134,7 +134,7 @@
String entityName = event.getPersister().getEntityName();
if (verCfg.getEntCfg().isVersioned(entityName)) {
- VersionsSync verSync = verCfg.getSyncManager().get(event.getSession());
+ AuditSync verSync = verCfg.getSyncManager().get(event.getSession());
verSync.addWorkUnit(new DelWorkUnit(event.getPersister().getEntityName(), verCfg, event.getId()));
@@ -142,7 +142,7 @@
}
}
- private void generateBidirectionalCollectionChangeWorkUnits(VersionsSync verSync, AbstractCollectionEvent event,
+ private void generateBidirectionalCollectionChangeWorkUnits(AuditSync verSync, AbstractCollectionEvent event,
PersistentCollectionChangeWorkUnit workUnit) {
// Checking if this is enabled in configuration ...
if (!verCfg.getGlobalCfg().isGenerateRevisionsForCollections()) {
@@ -173,7 +173,7 @@
String entityName = event.getAffectedOwnerEntityName();
if (verCfg.getEntCfg().isVersioned(entityName)) {
- VersionsSync verSync = verCfg.getSyncManager().get(event.getSession());
+ AuditSync verSync = verCfg.getSyncManager().get(event.getSession());
PersistentCollectionChangeWorkUnit workUnit = new PersistentCollectionChangeWorkUnit(entityName, verCfg,
newColl, collectionEntry.getRole(), oldColl, event.getAffectedOwnerIdOrNull());
@@ -209,10 +209,10 @@
@SuppressWarnings({"unchecked"})
public void initialize(Configuration cfg) {
- verCfg = VersionsConfiguration.getFor(cfg);
+ verCfg = AuditConfiguration.getFor(cfg);
}
- public VersionsConfiguration getVerCfg() {
+ public AuditConfiguration getVerCfg() {
return verCfg;
}
}
Copied: core/trunk/envers/src/main/java/org/hibernate/envers/exception/AuditException.java (from rev 15455, core/trunk/envers/src/main/java/org/hibernate/envers/exception/VersionsException.java)
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/exception/AuditException.java (rev 0)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/exception/AuditException.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -0,0 +1,43 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.envers.exception;
+
+import org.hibernate.HibernateException;
+
+/**
+ * @author Adam Warski (adam at warski dot org)
+ */
+public class AuditException extends HibernateException {
+ public AuditException(String message) {
+ super(message);
+ }
+
+ public AuditException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public AuditException(Throwable cause) {
+ super(cause);
+ }
+}
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/exception/NotVersionedException.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/exception/NotVersionedException.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/exception/NotVersionedException.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -26,7 +26,7 @@
/**
* @author Adam Warski (adam at warski dot org)
*/
-public class NotVersionedException extends VersionsException {
+public class NotVersionedException extends AuditException {
private final String entityName;
public NotVersionedException(String entityName, String message) {
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/exception/RevisionDoesNotExistException.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/exception/RevisionDoesNotExistException.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/exception/RevisionDoesNotExistException.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -28,7 +28,7 @@
/**
* @author Adam Warski (adam at warski dot org)
*/
-public class RevisionDoesNotExistException extends VersionsException {
+public class RevisionDoesNotExistException extends AuditException {
private Number revision;
private Date date;
Copied: core/trunk/envers/src/main/java/org/hibernate/envers/query/AuditQuery.java (from rev 15455, core/trunk/envers/src/main/java/org/hibernate/envers/query/VersionsQuery.java)
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/query/AuditQuery.java (rev 0)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/query/AuditQuery.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -0,0 +1,75 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.envers.query;
+
+import java.util.List;
+import javax.persistence.NoResultException;
+import javax.persistence.NonUniqueResultException;
+
+import org.hibernate.envers.exception.AuditException;
+import org.hibernate.envers.query.criteria.AuditCriterion;
+import org.hibernate.envers.query.order.AuditOrder;
+import org.hibernate.envers.query.projection.AuditProjection;
+
+import org.hibernate.CacheMode;
+import org.hibernate.FlushMode;
+import org.hibernate.LockMode;
+
+/**
+ * @author Adam Warski (adam at warski dot org)
+ * @see org.hibernate.Criteria
+ */
+public interface AuditQuery {
+ List getResultList() throws AuditException;
+
+ Object getSingleResult() throws AuditException, NonUniqueResultException, NoResultException;
+
+ AuditQuery add(AuditCriterion criterion);
+
+ AuditQuery addProjection(String function, String propertyName);
+
+ AuditQuery addProjection(AuditProjection projection);
+
+ AuditQuery addOrder(String propertyName, boolean asc);
+
+ AuditQuery addOrder(AuditOrder order);
+
+ AuditQuery setMaxResults(int maxResults);
+
+ AuditQuery setFirstResult(int firstResult);
+
+ AuditQuery setCacheable(boolean cacheable);
+
+ AuditQuery setCacheRegion(String cacheRegion);
+
+ AuditQuery setComment(String comment);
+
+ AuditQuery setFlushMode(FlushMode flushMode);
+
+ AuditQuery setCacheMode(CacheMode cacheMode);
+
+ AuditQuery setTimeout(int timeout);
+
+ AuditQuery setLockMode(LockMode lockMode);
+}
Copied: core/trunk/envers/src/main/java/org/hibernate/envers/query/AuditQueryCreator.java (from rev 15455, core/trunk/envers/src/main/java/org/hibernate/envers/query/VersionsQueryCreator.java)
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/query/AuditQueryCreator.java (rev 0)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/query/AuditQueryCreator.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -0,0 +1,83 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.envers.query;
+
+import org.hibernate.envers.configuration.AuditConfiguration;
+import org.hibernate.envers.query.impl.EntitiesAtRevisionQuery;
+import org.hibernate.envers.query.impl.RevisionsOfEntityQuery;
+import org.hibernate.envers.reader.AuditReaderImplementor;
+import static org.hibernate.envers.tools.ArgumentsTools.checkNotNull;
+import static org.hibernate.envers.tools.ArgumentsTools.checkPositive;
+
+/**
+ * @author Adam Warski (adam at warski dot org)
+ */
+public class AuditQueryCreator {
+ private final AuditConfiguration verCfg;
+ private final AuditReaderImplementor versionsReaderImplementor;
+
+ public AuditQueryCreator(AuditConfiguration verCfg, AuditReaderImplementor versionsReaderImplementor) {
+ this.verCfg = verCfg;
+ this.versionsReaderImplementor = versionsReaderImplementor;
+ }
+
+ /**
+ * Creates a query, which will return entities satisfying some conditions (specified later),
+ * at a given revision.
+ * @param c Class of the entities for which to query.
+ * @param revision Revision number at which to execute the query.
+ * @return A query for entities at a given revision, to which conditions can be added and which
+ * can then be executed. The result of the query will be a list of entities (beans), unless a
+ * projection is added.
+ */
+ public AuditQuery forEntitiesAtRevision(Class<?> c, Number revision) {
+ checkNotNull(revision, "Entity revision");
+ checkPositive(revision, "Entity revision");
+ return new EntitiesAtRevisionQuery(verCfg, versionsReaderImplementor, c, revision);
+ }
+
+ /**
+ * Creates a query, which selects the revisions, at which the given entity was modified.
+ * Unless an explicit projection is set, the result will be a list of three-element arrays, containing:
+ * <ol>
+ * <li>the entity instance</li>
+ * <li>revision entity, corresponding to the revision at which the entity was modified. If no custom
+ * revision entity is used, this will be an instance of {@link org.hibernate.envers.DefaultRevisionEntity}</li>
+ * <li>type of the revision (an enum instance of class {@link org.hibernate.envers.RevisionType})</li>.
+ * </ol>
+ * Additional conditions that the results must satisfy may be specified.
+ * @param c Class of the entities for which to query.
+ * @param selectEntitiesOnly If true, instead of a list of three-element arrays, a list of entites will be
+ * returned as a result of executing this query.
+ * @param selectDeletedEntities If true, also revisions where entities were deleted will be returned. The additional
+ * entities will have revision type "delete", and contain no data (all fields null), except for the id field.
+ * @return A query for revisions at which instances of the given entity were modified, to which
+ * conditions can be added (for example - a specific id of an entity of class <code>c</code>), and which
+ * can then be executed. The results of the query will be sorted in ascending order by the revision number,
+ * unless an order or projection is added.
+ */
+ public AuditQuery forRevisionsOfEntity(Class<?> c, boolean selectEntitiesOnly, boolean selectDeletedEntities) {
+ return new RevisionsOfEntityQuery(verCfg, versionsReaderImplementor, c, selectEntitiesOnly,selectDeletedEntities);
+ }
+}
Copied: core/trunk/envers/src/main/java/org/hibernate/envers/query/AuditRestrictions.java (from rev 15455, core/trunk/envers/src/main/java/org/hibernate/envers/query/VersionsRestrictions.java)
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/query/AuditRestrictions.java (rev 0)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/query/AuditRestrictions.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -0,0 +1,246 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.envers.query;
+
+import java.util.Collection;
+
+import org.hibernate.envers.query.criteria.AuditCriterion;
+import org.hibernate.envers.query.criteria.*;
+
+import org.hibernate.criterion.MatchMode;
+
+/**
+ * TODO: ilike
+ * @author Adam Warski (adam at warski dot org)
+ * @see org.hibernate.criterion.Restrictions
+ */
+@SuppressWarnings({"JavaDoc"})
+public class AuditRestrictions {
+ private AuditRestrictions() { }
+
+ /**
+ * Apply an "equal" constraint to the identifier property.
+ */
+ public static AuditCriterion idEq(Object value) {
+ return new IdentifierEqVersionsExpression(value);
+ }
+
+ /**
+ * Apply an "equal" constraint to the named property
+ */
+ public static AuditCriterion eq(String propertyName, Object value) {
+ return new SimpleVersionsExpression(propertyName, value, "=");
+ }
+
+ /**
+ * Apply a "not equal" constraint to the named property
+ */
+ public static AuditCriterion ne(String propertyName, Object value) {
+ return new SimpleVersionsExpression(propertyName, value, "<>");
+ }
+
+ /**
+ * Apply an "equal" constraint on an id of a related entity
+ */
+ public static AuditCriterion relatedIdEq(String propertyName, Object id) {
+ return new RelatedVersionsExpression(propertyName, id, true);
+ }
+
+ /**
+ * Apply a "not equal" constraint to the named property
+ */
+ public static AuditCriterion relatedIdNe(String propertyName, Object id) {
+ return new RelatedVersionsExpression(propertyName, id, false);
+ }
+
+ /**
+ * Apply a "like" constraint to the named property
+ */
+ public static AuditCriterion like(String propertyName, Object value) {
+ return new SimpleVersionsExpression(propertyName, value, " like ");
+ }
+
+ /**
+ * Apply a "like" constraint to the named property
+ */
+ public static AuditCriterion like(String propertyName, String value, MatchMode matchMode) {
+ return new SimpleVersionsExpression(propertyName, matchMode.toMatchString(value), " like " );
+ }
+
+ /**
+ * Apply a "greater than" constraint to the named property
+ */
+ public static AuditCriterion gt(String propertyName, Object value) {
+ return new SimpleVersionsExpression(propertyName, value, ">");
+ }
+
+ /**
+ * Apply a "less than" constraint to the named property
+ */
+ public static AuditCriterion lt(String propertyName, Object value) {
+ return new SimpleVersionsExpression(propertyName, value, "<");
+ }
+
+ /**
+ * Apply a "less than or equal" constraint to the named property
+ */
+ public static AuditCriterion le(String propertyName, Object value) {
+ return new SimpleVersionsExpression(propertyName, value, "<=");
+ }
+
+ /**
+ * Apply a "greater than or equal" constraint to the named property
+ */
+ public static AuditCriterion ge(String propertyName, Object value) {
+ return new SimpleVersionsExpression(propertyName, value, ">=");
+ }
+
+ /**
+ * Apply a "between" constraint to the named property
+ */
+ public static AuditCriterion between(String propertyName, Object lo, Object hi) {
+ return new BetweenVersionsExpression(propertyName, lo, hi);
+ }
+
+ /**
+ * Apply an "in" constraint to the named property
+ */
+ public static AuditCriterion in(String propertyName, Object[] values) {
+ return new InVersionsExpression(propertyName, values);
+ }
+
+ /**
+ * Apply an "in" constraint to the named property
+ */
+ public static AuditCriterion in(String propertyName, Collection values) {
+ return new InVersionsExpression(propertyName, values.toArray());
+ }
+
+ /**
+ * Apply an "is null" constraint to the named property
+ */
+ public static AuditCriterion isNull(String propertyName) {
+ return new NullVersionsExpression(propertyName);
+ }
+
+ /**
+ * Apply an "equal" constraint to two properties
+ */
+ public static AuditCriterion eqProperty(String propertyName, String otherPropertyName) {
+ return new PropertyVersionsExpression(propertyName, otherPropertyName, "=");
+ }
+
+ /**
+ * Apply a "not equal" constraint to two properties
+ */
+ public static AuditCriterion neProperty(String propertyName, String otherPropertyName) {
+ return new PropertyVersionsExpression(propertyName, otherPropertyName, "<>");
+ }
+
+ /**
+ * Apply a "less than" constraint to two properties
+ */
+ public static AuditCriterion ltProperty(String propertyName, String otherPropertyName) {
+ return new PropertyVersionsExpression(propertyName, otherPropertyName, "<");
+ }
+
+ /**
+ * Apply a "less than or equal" constraint to two properties
+ */
+ public static AuditCriterion leProperty(String propertyName, String otherPropertyName) {
+ return new PropertyVersionsExpression(propertyName, otherPropertyName, "<=");
+ }
+
+ /**
+ * Apply a "greater than" constraint to two properties
+ */
+ public static AuditCriterion gtProperty(String propertyName, String otherPropertyName) {
+ return new PropertyVersionsExpression(propertyName, otherPropertyName, ">");
+ }
+
+ /**
+ * Apply a "greater than or equal" constraint to two properties
+ */
+ public static AuditCriterion geProperty(String propertyName, String otherPropertyName) {
+ return new PropertyVersionsExpression(propertyName, otherPropertyName, ">=");
+ }
+
+ /**
+ * Apply an "is not null" constraint to the named property
+ */
+ public static AuditCriterion isNotNull(String propertyName) {
+ return new NotNullVersionsExpression(propertyName);
+ }
+
+ /**
+ * Return the conjuction of two expressions
+ */
+ public static AuditCriterion and(AuditCriterion lhs, AuditCriterion rhs) {
+ return new LogicalVersionsExpression(lhs, rhs, "and");
+ }
+
+ /**
+ * Return the disjuction of two expressions
+ */
+ public static AuditCriterion or(AuditCriterion lhs, AuditCriterion rhs) {
+ return new LogicalVersionsExpression(lhs, rhs, "or");
+ }
+
+ /**
+ * Return the negation of an expression
+ */
+ public static AuditCriterion not(AuditCriterion expression) {
+ return new NotVersionsExpression(expression);
+ }
+
+ /**
+ * Group expressions together in a single conjunction (A and B and C...)
+ */
+ public static AuditConjunction conjunction() {
+ return new AuditConjunction();
+ }
+
+ /**
+ * Group expressions together in a single disjunction (A or B or C...)
+ */
+ public static AuditDisjunction disjunction() {
+ return new AuditDisjunction();
+ }
+
+ /**
+ * Apply a "maximalize property" constraint.
+ */
+ public static AggregatedFieldVersionsExpression maximizeProperty(String propertyName) {
+ return new AggregatedFieldVersionsExpression(propertyName,
+ AggregatedFieldVersionsExpression.AggregatedMode.MAX);
+ }
+
+ /**
+ * Apply a "minimize property" constraint.
+ */
+ public static AggregatedFieldVersionsExpression minimizeProperty(String propertyName) {
+ return new AggregatedFieldVersionsExpression(propertyName,
+ AggregatedFieldVersionsExpression.AggregatedMode.MIN);
+ }
+}
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/query/RevisionProperty.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/query/RevisionProperty.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/query/RevisionProperty.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -23,107 +23,107 @@
*/
package org.hibernate.envers.query;
-import org.hibernate.envers.configuration.VersionsConfiguration;
+import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.envers.query.criteria.RevisionVersionsExpression;
-import org.hibernate.envers.query.criteria.VersionsCriterion;
+import org.hibernate.envers.query.criteria.AuditCriterion;
import org.hibernate.envers.query.order.RevisionVersionsOrder;
-import org.hibernate.envers.query.order.VersionsOrder;
+import org.hibernate.envers.query.order.AuditOrder;
import org.hibernate.envers.query.projection.RevisionVersionsProjection;
-import org.hibernate.envers.query.projection.VersionsProjection;
+import org.hibernate.envers.query.projection.AuditProjection;
import org.hibernate.envers.tools.Triple;
/**
* @author Adam Warski (adam at warski dot org)
*/
@SuppressWarnings({"JavaDoc"})
-public class RevisionProperty implements VersionsProjection {
+public class RevisionProperty implements AuditProjection {
private RevisionProperty() { }
/**
* Apply a "greater than" constraint on the revision number
*/
- public static VersionsCriterion gt(Integer revision) {
+ public static AuditCriterion gt(Integer revision) {
return new RevisionVersionsExpression(revision, ">");
}
/**
* Apply a "greater than or equal" constraint on the revision number
*/
- public static VersionsCriterion ge(Integer revision) {
+ public static AuditCriterion ge(Integer revision) {
return new RevisionVersionsExpression(revision, ">=");
}
/**
* Apply a "less than" constraint on the revision number
*/
- public static VersionsCriterion lt(Integer revision) {
+ public static AuditCriterion lt(Integer revision) {
return new RevisionVersionsExpression(revision, "<");
}
/**
* Apply a "less than or equal" constraint on the revision number
*/
- public static VersionsCriterion le(Integer revision) {
+ public static AuditCriterion le(Integer revision) {
return new RevisionVersionsExpression(revision, "<=");
}
/**
* Sort the results by revision in ascending order
*/
- public static VersionsOrder asc() {
+ public static AuditOrder asc() {
return new RevisionVersionsOrder(true);
}
/**
* Sort the results by revision in descending order
*/
- public static VersionsOrder desc() {
+ public static AuditOrder desc() {
return new RevisionVersionsOrder(false);
}
/**
* Select the maximum revision
*/
- public static VersionsProjection max() {
+ public static AuditProjection max() {
return new RevisionVersionsProjection(RevisionVersionsProjection.ProjectionType.MAX);
}
/**
* Select the minimum revision
*/
- public static VersionsProjection min() {
+ public static AuditProjection min() {
return new RevisionVersionsProjection(RevisionVersionsProjection.ProjectionType.MIN);
}
/**
* Count revisions
*/
- public static VersionsProjection count() {
+ public static AuditProjection count() {
return new RevisionVersionsProjection(RevisionVersionsProjection.ProjectionType.COUNT);
}
/**
* Count distinct revisions
*/
- public static VersionsProjection countDistinct() {
+ public static AuditProjection countDistinct() {
return new RevisionVersionsProjection(RevisionVersionsProjection.ProjectionType.COUNT_DISTINCT);
}
/**
* Distinct revisions
*/
- public static VersionsProjection distinct() {
+ public static AuditProjection distinct() {
return new RevisionVersionsProjection(RevisionVersionsProjection.ProjectionType.DISTINCT);
}
/**
* Projection the revision number
*/
- public static VersionsProjection revisionNumber() {
+ public static AuditProjection revisionNumber() {
return new RevisionProperty();
}
- public Triple<String, String, Boolean> getData(VersionsConfiguration verCfg) {
+ public Triple<String, String, Boolean> getData(AuditConfiguration verCfg) {
return Triple.make(null, verCfg.getVerEntCfg().getRevisionPropPath(), false);
}
}
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/query/RevisionTypeProperty.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/query/RevisionTypeProperty.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/query/RevisionTypeProperty.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -23,25 +23,25 @@
*/
package org.hibernate.envers.query;
-import org.hibernate.envers.configuration.VersionsConfiguration;
-import org.hibernate.envers.query.projection.VersionsProjection;
+import org.hibernate.envers.configuration.AuditConfiguration;
+import org.hibernate.envers.query.projection.AuditProjection;
import org.hibernate.envers.tools.Triple;
/**
* @author Adam Warski (adam at warski dot org)
*/
@SuppressWarnings({"JavaDoc"})
-public class RevisionTypeProperty implements VersionsProjection {
+public class RevisionTypeProperty implements AuditProjection {
private RevisionTypeProperty() { }
/**
* Projection on the revision type
*/
- public static VersionsProjection revisionType() {
+ public static AuditProjection revisionType() {
return new RevisionTypeProperty();
}
- public Triple<String, String, Boolean> getData(VersionsConfiguration verCfg) {
+ public Triple<String, String, Boolean> getData(AuditConfiguration verCfg) {
return Triple.make(null, verCfg.getVerEntCfg().getRevisionTypePropName(), false);
}
}
\ No newline at end of file
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/AggregatedFieldVersionsExpression.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/AggregatedFieldVersionsExpression.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/AggregatedFieldVersionsExpression.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -26,14 +26,14 @@
import java.util.ArrayList;
import java.util.List;
-import org.hibernate.envers.configuration.VersionsConfiguration;
+import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.envers.tools.query.Parameters;
import org.hibernate.envers.tools.query.QueryBuilder;
/**
* @author Adam Warski (adam at warski dot org)
*/
-public class AggregatedFieldVersionsExpression implements VersionsCriterion, ExtendableCriterion {
+public class AggregatedFieldVersionsExpression implements AuditCriterion, ExtendableCriterion {
public static enum AggregatedMode {
MAX,
MIN
@@ -41,20 +41,20 @@
private String propertyName;
private AggregatedMode mode;
- private List<VersionsCriterion> criterions;
+ private List<AuditCriterion> criterions;
public AggregatedFieldVersionsExpression(String propertyName, AggregatedMode mode) {
this.propertyName = propertyName;
this.mode = mode;
- criterions = new ArrayList<VersionsCriterion>();
+ criterions = new ArrayList<AuditCriterion>();
}
- public AggregatedFieldVersionsExpression add(VersionsCriterion criterion) {
+ public AggregatedFieldVersionsExpression add(AuditCriterion criterion) {
criterions.add(criterion);
return this;
}
- public void addToQuery(VersionsConfiguration verCfg, String entityName, QueryBuilder qb, Parameters parameters) {
+ public void addToQuery(AuditConfiguration verCfg, String entityName, QueryBuilder qb, Parameters parameters) {
CriteriaTools.checkPropertyNotARelation(verCfg, entityName, propertyName);
// This will be the aggregated query, containing all the specified conditions
@@ -62,7 +62,7 @@
// Adding all specified conditions both to the main query, as well as to the
// aggregated one.
- for (VersionsCriterion versionsCriteria : criterions) {
+ for (AuditCriterion versionsCriteria : criterions) {
versionsCriteria.addToQuery(verCfg, entityName, qb, parameters);
versionsCriteria.addToQuery(verCfg, entityName, subQb, subQb.getRootParameters());
}
Copied: core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/AuditConjunction.java (from rev 15455, core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/VersionsConjunction.java)
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/AuditConjunction.java (rev 0)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/AuditConjunction.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -0,0 +1,55 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.envers.query.criteria;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.hibernate.envers.configuration.AuditConfiguration;
+import org.hibernate.envers.tools.query.Parameters;
+import org.hibernate.envers.tools.query.QueryBuilder;
+
+/**
+ * @author Adam Warski (adam at warski dot org)
+ */
+public class AuditConjunction implements AuditCriterion, ExtendableCriterion {
+ private List<AuditCriterion> criterions;
+
+ public AuditConjunction() {
+ criterions = new ArrayList<AuditCriterion>();
+ }
+
+ public AuditConjunction add(AuditCriterion criterion) {
+ criterions.add(criterion);
+ return this;
+ }
+
+ public void addToQuery(AuditConfiguration verCfg, String entityName, QueryBuilder qb, Parameters parameters) {
+ Parameters andParameters = parameters.addSubParameters(Parameters.AND);
+
+ for (AuditCriterion criterion : criterions) {
+ criterion.addToQuery(verCfg, entityName, qb, andParameters);
+ }
+ }
+}
Copied: core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/AuditCriterion.java (from rev 15455, core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/VersionsCriterion.java)
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/AuditCriterion.java (rev 0)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/AuditCriterion.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -0,0 +1,35 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.envers.query.criteria;
+
+import org.hibernate.envers.configuration.AuditConfiguration;
+import org.hibernate.envers.tools.query.Parameters;
+import org.hibernate.envers.tools.query.QueryBuilder;
+
+/**
+ * @author Adam Warski (adam at warski dot org)
+ */
+public interface AuditCriterion {
+ void addToQuery(AuditConfiguration verCfg, String entityName, QueryBuilder qb, Parameters parameters);
+}
Copied: core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/AuditDisjunction.java (from rev 15455, core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/VersionsDisjunction.java)
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/AuditDisjunction.java (rev 0)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/AuditDisjunction.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -0,0 +1,55 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.envers.query.criteria;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.hibernate.envers.configuration.AuditConfiguration;
+import org.hibernate.envers.tools.query.Parameters;
+import org.hibernate.envers.tools.query.QueryBuilder;
+
+/**
+ * @author Adam Warski (adam at warski dot org)
+ */
+public class AuditDisjunction implements AuditCriterion, ExtendableCriterion {
+ private List<AuditCriterion> criterions;
+
+ public AuditDisjunction() {
+ criterions = new ArrayList<AuditCriterion>();
+ }
+
+ public AuditDisjunction add(AuditCriterion criterion) {
+ criterions.add(criterion);
+ return this;
+ }
+
+ public void addToQuery(AuditConfiguration verCfg, String entityName, QueryBuilder qb, Parameters parameters) {
+ Parameters orParameters = parameters.addSubParameters(Parameters.OR);
+
+ for (AuditCriterion criterion : criterions) {
+ criterion.addToQuery(verCfg, entityName, qb, orParameters);
+ }
+ }
+}
\ No newline at end of file
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/BetweenVersionsExpression.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/BetweenVersionsExpression.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/BetweenVersionsExpression.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -23,14 +23,14 @@
*/
package org.hibernate.envers.query.criteria;
-import org.hibernate.envers.configuration.VersionsConfiguration;
+import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.envers.tools.query.Parameters;
import org.hibernate.envers.tools.query.QueryBuilder;
/**
* @author Adam Warski (adam at warski dot org)
*/
-public class BetweenVersionsExpression implements VersionsCriterion {
+public class BetweenVersionsExpression implements AuditCriterion {
private String propertyName;
private Object lo;
private Object hi;
@@ -41,7 +41,7 @@
this.hi = hi;
}
- public void addToQuery(VersionsConfiguration verCfg, String entityName, QueryBuilder qb, Parameters parameters) {
+ public void addToQuery(AuditConfiguration verCfg, String entityName, QueryBuilder qb, Parameters parameters) {
CriteriaTools.checkPropertyNotARelation(verCfg, entityName, propertyName);
parameters.addWhereWithParam(propertyName, ">=", lo);
parameters.addWhereWithParam(propertyName, "<=", hi);
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/CriteriaTools.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/CriteriaTools.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/CriteriaTools.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -23,10 +23,10 @@
*/
package org.hibernate.envers.query.criteria;
-import org.hibernate.envers.configuration.VersionsConfiguration;
+import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.envers.entities.RelationDescription;
import org.hibernate.envers.entities.RelationType;
-import org.hibernate.envers.exception.VersionsException;
+import org.hibernate.envers.exception.AuditException;
/**
* @author Adam Warski (adam at warski dot org)
@@ -34,16 +34,16 @@
public class CriteriaTools {
private CriteriaTools() { }
- public static void checkPropertyNotARelation(VersionsConfiguration verCfg, String entityName,
- String propertyName) throws VersionsException {
+ public static void checkPropertyNotARelation(AuditConfiguration verCfg, String entityName,
+ String propertyName) throws AuditException {
if (verCfg.getEntCfg().get(entityName).isRelation(propertyName)) {
- throw new VersionsException("This criterion cannot be used on a property that is " +
+ throw new AuditException("This criterion cannot be used on a property that is " +
"a relation to another property.");
}
}
- public static RelationDescription getRelatedEntity(VersionsConfiguration verCfg, String entityName,
- String propertyName) throws VersionsException {
+ public static RelationDescription getRelatedEntity(AuditConfiguration verCfg, String entityName,
+ String propertyName) throws AuditException {
RelationDescription relationDesc = verCfg.getEntCfg().getRelationDescription(entityName, propertyName);
if (relationDesc == null) {
@@ -54,7 +54,7 @@
return relationDesc;
}
- throw new VersionsException("This type of relation (" + entityName + "." + propertyName +
+ throw new AuditException("This type of relation (" + entityName + "." + propertyName +
") isn't supported and can't be used in queries.");
}
}
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/ExtendableCriterion.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/ExtendableCriterion.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/ExtendableCriterion.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -27,5 +27,5 @@
* @author Adam Warski (adam at warski dot org)
*/
public interface ExtendableCriterion {
- public ExtendableCriterion add(VersionsCriterion criterion);
+ public ExtendableCriterion add(AuditCriterion criterion);
}
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/IdentifierEqVersionsExpression.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/IdentifierEqVersionsExpression.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/IdentifierEqVersionsExpression.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -23,21 +23,21 @@
*/
package org.hibernate.envers.query.criteria;
-import org.hibernate.envers.configuration.VersionsConfiguration;
+import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.envers.tools.query.Parameters;
import org.hibernate.envers.tools.query.QueryBuilder;
/**
* @author Adam Warski (adam at warski dot org)
*/
-public class IdentifierEqVersionsExpression implements VersionsCriterion {
+public class IdentifierEqVersionsExpression implements AuditCriterion {
private Object id;
public IdentifierEqVersionsExpression(Object id) {
this.id = id;
}
- public void addToQuery(VersionsConfiguration verCfg, String entityName, QueryBuilder qb, Parameters parameters) {
+ public void addToQuery(AuditConfiguration verCfg, String entityName, QueryBuilder qb, Parameters parameters) {
verCfg.getEntCfg().get(entityName).getIdMapper()
.addIdEqualsToQuery(parameters, id, verCfg.getVerEntCfg().getOriginalIdPropName(), true);
}
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/InVersionsExpression.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/InVersionsExpression.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/InVersionsExpression.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -23,14 +23,14 @@
*/
package org.hibernate.envers.query.criteria;
-import org.hibernate.envers.configuration.VersionsConfiguration;
+import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.envers.tools.query.Parameters;
import org.hibernate.envers.tools.query.QueryBuilder;
/**
* @author Adam Warski (adam at warski dot org)
*/
-public class InVersionsExpression implements VersionsCriterion {
+public class InVersionsExpression implements AuditCriterion {
private String propertyName;
private Object[] values;
@@ -39,7 +39,7 @@
this.values = values;
}
- public void addToQuery(VersionsConfiguration verCfg, String entityName, QueryBuilder qb, Parameters parameters) {
+ public void addToQuery(AuditConfiguration verCfg, String entityName, QueryBuilder qb, Parameters parameters) {
CriteriaTools.checkPropertyNotARelation(verCfg, entityName, propertyName);
parameters.addWhereWithParams(propertyName, "in (", values, ")");
}
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/LogicalVersionsExpression.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/LogicalVersionsExpression.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/LogicalVersionsExpression.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -23,25 +23,25 @@
*/
package org.hibernate.envers.query.criteria;
-import org.hibernate.envers.configuration.VersionsConfiguration;
+import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.envers.tools.query.Parameters;
import org.hibernate.envers.tools.query.QueryBuilder;
/**
* @author Adam Warski (adam at warski dot org)
*/
-public class LogicalVersionsExpression implements VersionsCriterion {
- private VersionsCriterion lhs;
- private VersionsCriterion rhs;
+public class LogicalVersionsExpression implements AuditCriterion {
+ private AuditCriterion lhs;
+ private AuditCriterion rhs;
private String op;
- public LogicalVersionsExpression(VersionsCriterion lhs, VersionsCriterion rhs, String op) {
+ public LogicalVersionsExpression(AuditCriterion lhs, AuditCriterion rhs, String op) {
this.lhs = lhs;
this.rhs = rhs;
this.op = op;
}
- public void addToQuery(VersionsConfiguration verCfg, String entityName, QueryBuilder qb, Parameters parameters) {
+ public void addToQuery(AuditConfiguration verCfg, String entityName, QueryBuilder qb, Parameters parameters) {
Parameters opParameters = parameters.addSubParameters(op);
lhs.addToQuery(verCfg, entityName, qb, opParameters.addSubParameters("and"));
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/NotNullVersionsExpression.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/NotNullVersionsExpression.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/NotNullVersionsExpression.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -23,7 +23,7 @@
*/
package org.hibernate.envers.query.criteria;
-import org.hibernate.envers.configuration.VersionsConfiguration;
+import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.envers.entities.RelationDescription;
import org.hibernate.envers.tools.query.Parameters;
import org.hibernate.envers.tools.query.QueryBuilder;
@@ -31,14 +31,14 @@
/**
* @author Adam Warski (adam at warski dot org)
*/
-public class NotNullVersionsExpression implements VersionsCriterion {
+public class NotNullVersionsExpression implements AuditCriterion {
private String propertyName;
public NotNullVersionsExpression(String propertyName) {
this.propertyName = propertyName;
}
- public void addToQuery(VersionsConfiguration verCfg, String entityName, QueryBuilder qb, Parameters parameters) {
+ public void addToQuery(AuditConfiguration verCfg, String entityName, QueryBuilder qb, Parameters parameters) {
RelationDescription relatedEntity = CriteriaTools.getRelatedEntity(verCfg, entityName, propertyName);
if (relatedEntity == null) {
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/NotVersionsExpression.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/NotVersionsExpression.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/NotVersionsExpression.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -23,21 +23,21 @@
*/
package org.hibernate.envers.query.criteria;
-import org.hibernate.envers.configuration.VersionsConfiguration;
+import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.envers.tools.query.Parameters;
import org.hibernate.envers.tools.query.QueryBuilder;
/**
* @author Adam Warski (adam at warski dot org)
*/
-public class NotVersionsExpression implements VersionsCriterion {
- private VersionsCriterion criterion;
+public class NotVersionsExpression implements AuditCriterion {
+ private AuditCriterion criterion;
- public NotVersionsExpression(VersionsCriterion criterion) {
+ public NotVersionsExpression(AuditCriterion criterion) {
this.criterion = criterion;
}
- public void addToQuery(VersionsConfiguration verCfg, String entityName, QueryBuilder qb, Parameters parameters) {
+ public void addToQuery(AuditConfiguration verCfg, String entityName, QueryBuilder qb, Parameters parameters) {
criterion.addToQuery(verCfg, entityName, qb, parameters.addNegatedParameters());
}
}
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/NullVersionsExpression.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/NullVersionsExpression.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/NullVersionsExpression.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -23,7 +23,7 @@
*/
package org.hibernate.envers.query.criteria;
-import org.hibernate.envers.configuration.VersionsConfiguration;
+import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.envers.entities.RelationDescription;
import org.hibernate.envers.tools.query.Parameters;
import org.hibernate.envers.tools.query.QueryBuilder;
@@ -31,14 +31,14 @@
/**
* @author Adam Warski (adam at warski dot org)
*/
-public class NullVersionsExpression implements VersionsCriterion {
+public class NullVersionsExpression implements AuditCriterion {
private String propertyName;
public NullVersionsExpression(String propertyName) {
this.propertyName = propertyName;
}
- public void addToQuery(VersionsConfiguration verCfg, String entityName, QueryBuilder qb, Parameters parameters) {
+ public void addToQuery(AuditConfiguration verCfg, String entityName, QueryBuilder qb, Parameters parameters) {
RelationDescription relatedEntity = CriteriaTools.getRelatedEntity(verCfg, entityName, propertyName);
if (relatedEntity == null) {
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/PropertyVersionsExpression.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/PropertyVersionsExpression.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/PropertyVersionsExpression.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -23,14 +23,14 @@
*/
package org.hibernate.envers.query.criteria;
-import org.hibernate.envers.configuration.VersionsConfiguration;
+import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.envers.tools.query.Parameters;
import org.hibernate.envers.tools.query.QueryBuilder;
/**
* @author Adam Warski (adam at warski dot org)
*/
-public class PropertyVersionsExpression implements VersionsCriterion {
+public class PropertyVersionsExpression implements AuditCriterion {
private String propertyName;
private String otherPropertyName;
private String op;
@@ -41,7 +41,7 @@
this.op = op;
}
- public void addToQuery(VersionsConfiguration verCfg, String entityName, QueryBuilder qb, Parameters parameters) {
+ public void addToQuery(AuditConfiguration verCfg, String entityName, QueryBuilder qb, Parameters parameters) {
CriteriaTools.checkPropertyNotARelation(verCfg, entityName, propertyName);
CriteriaTools.checkPropertyNotARelation(verCfg, entityName, otherPropertyName);
parameters.addWhere(propertyName, op, otherPropertyName);
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/RelatedVersionsExpression.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/RelatedVersionsExpression.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/RelatedVersionsExpression.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -23,16 +23,16 @@
*/
package org.hibernate.envers.query.criteria;
-import org.hibernate.envers.configuration.VersionsConfiguration;
+import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.envers.entities.RelationDescription;
-import org.hibernate.envers.exception.VersionsException;
+import org.hibernate.envers.exception.AuditException;
import org.hibernate.envers.tools.query.Parameters;
import org.hibernate.envers.tools.query.QueryBuilder;
/**
* @author Adam Warski (adam at warski dot org)
*/
-public class RelatedVersionsExpression implements VersionsCriterion {
+public class RelatedVersionsExpression implements AuditCriterion {
private String propertyName;
private Object id;
private boolean equals;
@@ -43,11 +43,11 @@
this.equals = equals;
}
- public void addToQuery(VersionsConfiguration verCfg, String entityName, QueryBuilder qb, Parameters parameters) {
+ public void addToQuery(AuditConfiguration verCfg, String entityName, QueryBuilder qb, Parameters parameters) {
RelationDescription relatedEntity = CriteriaTools.getRelatedEntity(verCfg, entityName, propertyName);
if (relatedEntity == null) {
- throw new VersionsException("This criterion can only be used on a property that is " +
+ 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);
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/RevisionVersionsExpression.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/RevisionVersionsExpression.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/RevisionVersionsExpression.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -23,14 +23,14 @@
*/
package org.hibernate.envers.query.criteria;
-import org.hibernate.envers.configuration.VersionsConfiguration;
+import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.envers.tools.query.Parameters;
import org.hibernate.envers.tools.query.QueryBuilder;
/**
* @author Adam Warski (adam at warski dot org)
*/
-public class RevisionVersionsExpression implements VersionsCriterion {
+public class RevisionVersionsExpression implements AuditCriterion {
private Object value;
private String op;
@@ -39,7 +39,7 @@
this.op = op;
}
- public void addToQuery(VersionsConfiguration verCfg, String entityName, QueryBuilder qb, Parameters parameters) {
+ public void addToQuery(AuditConfiguration verCfg, String entityName, QueryBuilder qb, Parameters parameters) {
parameters.addWhereWithParam(verCfg.getVerEntCfg().getRevisionPropPath(), op, value);
}
}
\ No newline at end of file
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/SimpleVersionsExpression.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/SimpleVersionsExpression.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/query/criteria/SimpleVersionsExpression.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -23,16 +23,16 @@
*/
package org.hibernate.envers.query.criteria;
-import org.hibernate.envers.configuration.VersionsConfiguration;
+import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.envers.entities.RelationDescription;
-import org.hibernate.envers.exception.VersionsException;
+import org.hibernate.envers.exception.AuditException;
import org.hibernate.envers.tools.query.Parameters;
import org.hibernate.envers.tools.query.QueryBuilder;
/**
* @author Adam Warski (adam at warski dot org)
*/
-public class SimpleVersionsExpression implements VersionsCriterion {
+public class SimpleVersionsExpression implements AuditCriterion {
private String propertyName;
private Object value;
private String op;
@@ -43,14 +43,14 @@
this.op = op;
}
- public void addToQuery(VersionsConfiguration verCfg, String entityName, QueryBuilder qb, Parameters parameters) {
+ public void addToQuery(AuditConfiguration verCfg, String entityName, QueryBuilder qb, Parameters parameters) {
RelationDescription relatedEntity = CriteriaTools.getRelatedEntity(verCfg, entityName, propertyName);
if (relatedEntity == null) {
parameters.addWhereWithParam(propertyName, op, value);
} else {
if (!"=".equals(op) && !"<>".equals(op)) {
- throw new VersionsException("This type of operation: " + op + " (" + entityName + "." + propertyName +
+ throw new AuditException("This type of operation: " + op + " (" + entityName + "." + propertyName +
") isn't supported and can't be used in queries.");
}
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/query/impl/AbstractVersionsQuery.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/query/impl/AbstractVersionsQuery.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/query/impl/AbstractVersionsQuery.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -30,14 +30,14 @@
import javax.persistence.NoResultException;
import javax.persistence.NonUniqueResultException;
-import org.hibernate.envers.configuration.VersionsConfiguration;
+import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.envers.entities.EntityInstantiator;
-import org.hibernate.envers.exception.VersionsException;
-import org.hibernate.envers.query.VersionsQuery;
-import org.hibernate.envers.query.criteria.VersionsCriterion;
-import org.hibernate.envers.query.order.VersionsOrder;
-import org.hibernate.envers.query.projection.VersionsProjection;
-import org.hibernate.envers.reader.VersionsReaderImplementor;
+import org.hibernate.envers.exception.AuditException;
+import org.hibernate.envers.query.AuditQuery;
+import org.hibernate.envers.query.criteria.AuditCriterion;
+import org.hibernate.envers.query.order.AuditOrder;
+import org.hibernate.envers.query.projection.AuditProjection;
+import org.hibernate.envers.reader.AuditReaderImplementor;
import org.hibernate.envers.tools.Pair;
import org.hibernate.envers.tools.Triple;
import org.hibernate.envers.tools.query.QueryBuilder;
@@ -50,9 +50,9 @@
/**
* @author Adam Warski (adam at warski dot org)
*/
-public abstract class AbstractVersionsQuery implements VersionsQuery {
+public abstract class AbstractVersionsQuery implements AuditQuery {
protected EntityInstantiator entityInstantiator;
- protected List<VersionsCriterion> criterions;
+ protected List<AuditCriterion> criterions;
protected String entityName;
protected String versionsEntityName;
@@ -61,15 +61,15 @@
protected boolean hasProjection;
protected boolean hasOrder;
- protected final VersionsConfiguration verCfg;
- private final VersionsReaderImplementor versionsReader;
+ protected final AuditConfiguration verCfg;
+ private final AuditReaderImplementor versionsReader;
- protected AbstractVersionsQuery(VersionsConfiguration verCfg, VersionsReaderImplementor versionsReader,
+ protected AbstractVersionsQuery(AuditConfiguration verCfg, AuditReaderImplementor versionsReader,
Class<?> cls) {
this.verCfg = verCfg;
this.versionsReader = versionsReader;
- criterions = new ArrayList<VersionsCriterion>();
+ criterions = new ArrayList<AuditCriterion>();
entityInstantiator = new EntityInstantiator(verCfg, versionsReader);
entityName = cls.getName();
@@ -94,13 +94,13 @@
return query.list();
}
- public abstract List list() throws VersionsException;
+ public abstract List list() throws AuditException;
- public List getResultList() throws VersionsException {
+ public List getResultList() throws AuditException {
return list();
}
- public Object getSingleResult() throws VersionsException, NonUniqueResultException, NoResultException {
+ public Object getSingleResult() throws AuditException, NonUniqueResultException, NoResultException {
List result = list();
if (result == null || result.size() == 0) {
@@ -114,33 +114,33 @@
return result.get(0);
}
- public VersionsQuery add(VersionsCriterion criterion) {
+ public AuditQuery add(AuditCriterion criterion) {
criterions.add(criterion);
return this;
}
// Projection and order
- public VersionsQuery addProjection(String function, String propertyName) {
+ public AuditQuery addProjection(String function, String propertyName) {
hasProjection = true;
qb.addProjection(function, propertyName, false);
return this;
}
- public VersionsQuery addProjection(VersionsProjection projection) {
+ public AuditQuery addProjection(AuditProjection projection) {
Triple<String, String, Boolean> projectionData = projection.getData(verCfg);
hasProjection = true;
qb.addProjection(projectionData.getFirst(), projectionData.getSecond(), projectionData.getThird());
return this;
}
- public VersionsQuery addOrder(String propertyName, boolean asc) {
+ public AuditQuery addOrder(String propertyName, boolean asc) {
hasOrder = true;
qb.addOrder(propertyName, asc);
return this;
}
- public VersionsQuery addOrder(VersionsOrder order) {
+ public AuditQuery addOrder(AuditOrder order) {
Pair<String, Boolean> orderData = order.getData(verCfg);
return addOrder(orderData.getFirst(), orderData.getSecond());
}
@@ -157,47 +157,47 @@
private Integer timeout;
private LockMode lockMode;
- public VersionsQuery setMaxResults(int maxResults) {
+ public AuditQuery setMaxResults(int maxResults) {
this.maxResults = maxResults;
return this;
}
- public VersionsQuery setFirstResult(int firstResult) {
+ public AuditQuery setFirstResult(int firstResult) {
this.firstResult = firstResult;
return this;
}
- public VersionsQuery setCacheable(boolean cacheable) {
+ public AuditQuery setCacheable(boolean cacheable) {
this.cacheable = cacheable;
return this;
}
- public VersionsQuery setCacheRegion(String cacheRegion) {
+ public AuditQuery setCacheRegion(String cacheRegion) {
this.cacheRegion = cacheRegion;
return this;
}
- public VersionsQuery setComment(String comment) {
+ public AuditQuery setComment(String comment) {
this.comment = comment;
return this;
}
- public VersionsQuery setFlushMode(FlushMode flushMode) {
+ public AuditQuery setFlushMode(FlushMode flushMode) {
this.flushMode = flushMode;
return this;
}
- public VersionsQuery setCacheMode(CacheMode cacheMode) {
+ public AuditQuery setCacheMode(CacheMode cacheMode) {
this.cacheMode = cacheMode;
return this;
}
- public VersionsQuery setTimeout(int timeout) {
+ public AuditQuery setTimeout(int timeout) {
this.timeout = timeout;
return this;
}
- public VersionsQuery setLockMode(LockMode lockMode) {
+ public AuditQuery setLockMode(LockMode lockMode) {
this.lockMode = lockMode;
return this;
}
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/query/impl/EntitiesAtRevisionQuery.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/query/impl/EntitiesAtRevisionQuery.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/query/impl/EntitiesAtRevisionQuery.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -27,10 +27,10 @@
import java.util.List;
import org.hibernate.envers.RevisionType;
-import org.hibernate.envers.configuration.VersionsConfiguration;
-import org.hibernate.envers.configuration.VersionsEntitiesConfiguration;
-import org.hibernate.envers.query.criteria.VersionsCriterion;
-import org.hibernate.envers.reader.VersionsReaderImplementor;
+import org.hibernate.envers.configuration.AuditConfiguration;
+import org.hibernate.envers.configuration.AuditEntitiesConfiguration;
+import org.hibernate.envers.query.criteria.AuditCriterion;
+import org.hibernate.envers.reader.AuditReaderImplementor;
import org.hibernate.envers.tools.query.QueryBuilder;
/**
@@ -39,8 +39,8 @@
public class EntitiesAtRevisionQuery extends AbstractVersionsQuery {
private final Number revision;
- public EntitiesAtRevisionQuery(VersionsConfiguration verCfg,
- VersionsReaderImplementor versionsReader, Class<?> cls,
+ public EntitiesAtRevisionQuery(AuditConfiguration verCfg,
+ AuditReaderImplementor versionsReader, Class<?> cls,
Number revision) {
super(verCfg, versionsReader, cls);
this.revision = revision;
@@ -59,7 +59,7 @@
QueryBuilder maxRevQb = qb.newSubQueryBuilder(versionsEntityName, "e2");
- VersionsEntitiesConfiguration verEntCfg = verCfg.getVerEntCfg();
+ AuditEntitiesConfiguration verEntCfg = verCfg.getVerEntCfg();
String revisionPropertyPath = verEntCfg.getRevisionPropPath();
String originalIdPropertyName = verEntCfg.getOriginalIdPropName();
@@ -77,7 +77,7 @@
// e.revision = (SELECT max(...) ...)
qb.getRootParameters().addWhere(revisionPropertyPath, verCfg.getGlobalCfg().getCorrelatedSubqueryOperator(), maxRevQb);
// all specified conditions
- for (VersionsCriterion criterion : criterions) {
+ for (AuditCriterion criterion : criterions) {
criterion.addToQuery(verCfg, entityName, qb, qb.getRootParameters());
}
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/query/impl/RevisionsOfEntityQuery.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/query/impl/RevisionsOfEntityQuery.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/query/impl/RevisionsOfEntityQuery.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -28,11 +28,11 @@
import java.util.Map;
import org.hibernate.envers.RevisionType;
-import org.hibernate.envers.configuration.VersionsConfiguration;
-import org.hibernate.envers.configuration.VersionsEntitiesConfiguration;
-import org.hibernate.envers.exception.VersionsException;
-import org.hibernate.envers.query.criteria.VersionsCriterion;
-import org.hibernate.envers.reader.VersionsReaderImplementor;
+import org.hibernate.envers.configuration.AuditConfiguration;
+import org.hibernate.envers.configuration.AuditEntitiesConfiguration;
+import org.hibernate.envers.exception.AuditException;
+import org.hibernate.envers.query.criteria.AuditCriterion;
+import org.hibernate.envers.reader.AuditReaderImplementor;
import org.hibernate.proxy.HibernateProxy;
@@ -43,8 +43,8 @@
private final boolean selectEntitiesOnly;
private final boolean selectDeletedEntities;
- public RevisionsOfEntityQuery(VersionsConfiguration verCfg,
- VersionsReaderImplementor versionsReader,
+ public RevisionsOfEntityQuery(AuditConfiguration verCfg,
+ AuditReaderImplementor versionsReader,
Class<?> cls, boolean selectEntitiesOnly,
boolean selectDeletedEntities) {
super(verCfg, versionsReader, cls);
@@ -54,7 +54,7 @@
}
private Number getRevisionNumber(Map versionsEntity) {
- VersionsEntitiesConfiguration verEntCfg = verCfg.getVerEntCfg();
+ AuditEntitiesConfiguration verEntCfg = verCfg.getVerEntCfg();
String originalId = verEntCfg.getOriginalIdPropName();
String revisionPropertyName = verEntCfg.getRevisionPropName();
@@ -70,8 +70,8 @@
}
@SuppressWarnings({"unchecked"})
- public List list() throws VersionsException {
- VersionsEntitiesConfiguration verEntCfg = verCfg.getVerEntCfg();
+ public List list() throws AuditException {
+ AuditEntitiesConfiguration verEntCfg = verCfg.getVerEntCfg();
/*
The query that should be executed in the versions table:
@@ -87,7 +87,7 @@
}
// all specified conditions, transformed
- for (VersionsCriterion criterion : criterions) {
+ for (AuditCriterion criterion : criterions) {
criterion.addToQuery(verCfg, entityName, qb, qb.getRootParameters());
}
Copied: core/trunk/envers/src/main/java/org/hibernate/envers/query/order/AuditOrder.java (from rev 15455, core/trunk/envers/src/main/java/org/hibernate/envers/query/order/VersionsOrder.java)
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/query/order/AuditOrder.java (rev 0)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/query/order/AuditOrder.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -0,0 +1,38 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.envers.query.order;
+
+import org.hibernate.envers.configuration.AuditConfiguration;
+import org.hibernate.envers.tools.Pair;
+
+/**
+ * @author Adam Warski (adam at warski dot org)
+ */
+public interface AuditOrder {
+ /**
+ * @param verCfg Configuration.
+ * @return A pair: (property name, ascending?).
+ */
+ Pair<String, Boolean> getData(AuditConfiguration verCfg);
+}
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/query/order/RevisionVersionsOrder.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/query/order/RevisionVersionsOrder.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/query/order/RevisionVersionsOrder.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -23,20 +23,20 @@
*/
package org.hibernate.envers.query.order;
-import org.hibernate.envers.configuration.VersionsConfiguration;
+import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.envers.tools.Pair;
/**
* @author Adam Warski (adam at warski dot org)
*/
-public class RevisionVersionsOrder implements VersionsOrder {
+public class RevisionVersionsOrder implements AuditOrder {
private final boolean asc;
public RevisionVersionsOrder(boolean asc) {
this.asc = asc;
}
- public Pair<String, Boolean> getData(VersionsConfiguration verCfg) {
+ public Pair<String, Boolean> getData(AuditConfiguration verCfg) {
String revisionPropPath = verCfg.getVerEntCfg().getRevisionPropPath();
return Pair.make(revisionPropPath, asc);
}
Copied: core/trunk/envers/src/main/java/org/hibernate/envers/query/projection/AuditProjection.java (from rev 15455, core/trunk/envers/src/main/java/org/hibernate/envers/query/projection/VersionsProjection.java)
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/query/projection/AuditProjection.java (rev 0)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/query/projection/AuditProjection.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -0,0 +1,39 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.envers.query.projection;
+
+import org.hibernate.envers.configuration.AuditConfiguration;
+import org.hibernate.envers.tools.Triple;
+
+/**
+ * @author Adam Warski (adam at warski dot org)
+ */
+public interface AuditProjection {
+ /**
+ *
+ * @param verCfg Configuration.
+ * @return A triple: (function name - possibly null, property name, add distinct?).
+ */
+ Triple<String, String, Boolean> getData(AuditConfiguration verCfg);
+}
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/query/projection/RevisionVersionsProjection.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/query/projection/RevisionVersionsProjection.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/query/projection/RevisionVersionsProjection.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -23,13 +23,13 @@
*/
package org.hibernate.envers.query.projection;
-import org.hibernate.envers.configuration.VersionsConfiguration;
+import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.envers.tools.Triple;
/**
* @author Adam Warski (adam at warski dot org)
*/
-public class RevisionVersionsProjection implements VersionsProjection {
+public class RevisionVersionsProjection implements AuditProjection {
public static enum ProjectionType {
MAX,
MIN,
@@ -44,7 +44,7 @@
this.type = type;
}
- public Triple<String, String, Boolean> getData(VersionsConfiguration verCfg) {
+ public Triple<String, String, Boolean> getData(AuditConfiguration verCfg) {
String revisionPropPath = verCfg.getVerEntCfg().getRevisionPropPath();
switch (type) {
Copied: core/trunk/envers/src/main/java/org/hibernate/envers/reader/AuditReaderImpl.java (from rev 15455, core/trunk/envers/src/main/java/org/hibernate/envers/reader/VersionsReaderImpl.java)
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/reader/AuditReaderImpl.java (rev 0)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/reader/AuditReaderImpl.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -0,0 +1,197 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.envers.reader;
+
+import java.util.Date;
+import java.util.List;
+import javax.persistence.NoResultException;
+
+import org.hibernate.envers.configuration.AuditConfiguration;
+import org.hibernate.envers.exception.NotVersionedException;
+import org.hibernate.envers.exception.RevisionDoesNotExistException;
+import org.hibernate.envers.exception.AuditException;
+import org.hibernate.envers.query.RevisionProperty;
+import org.hibernate.envers.query.AuditQueryCreator;
+import org.hibernate.envers.query.AuditRestrictions;
+import static org.hibernate.envers.tools.ArgumentsTools.checkNotNull;
+import static org.hibernate.envers.tools.ArgumentsTools.checkPositive;
+
+import org.hibernate.NonUniqueResultException;
+import org.hibernate.Query;
+import org.hibernate.Session;
+import org.hibernate.engine.SessionImplementor;
+
+/**
+ * @author Adam Warski (adam at warski dot org)
+ */
+public class AuditReaderImpl implements AuditReaderImplementor {
+ private final AuditConfiguration verCfg;
+ private final SessionImplementor sessionImplementor;
+ private final Session session;
+ private final FirstLevelCache firstLevelCache;
+
+ public AuditReaderImpl(AuditConfiguration verCfg, Session session,
+ SessionImplementor sessionImplementor) {
+ this.verCfg = verCfg;
+ this.sessionImplementor = sessionImplementor;
+ this.session = session;
+
+ firstLevelCache = new FirstLevelCache();
+ }
+
+ private void checkSession() {
+ if (!session.isOpen()) {
+ throw new IllegalStateException("The associated entity manager is closed!");
+ }
+ }
+
+ public SessionImplementor getSessionImplementor() {
+ return sessionImplementor;
+ }
+
+ public Session getSession() {
+ return session;
+ }
+
+ public FirstLevelCache getFirstLevelCache() {
+ return firstLevelCache;
+ }
+
+ @SuppressWarnings({"unchecked"})
+ public <T> T find(Class<T> cls, Object primaryKey, Number revision) throws
+ IllegalArgumentException, NotVersionedException, IllegalStateException {
+ checkNotNull(cls, "Entity class");
+ checkNotNull(primaryKey, "Primary key");
+ checkNotNull(revision, "Entity revision");
+ checkPositive(revision, "Entity revision");
+ checkSession();
+
+ String entityName = cls.getName();
+
+ if (!verCfg.getEntCfg().isVersioned(entityName)) {
+ throw new NotVersionedException(entityName, entityName + " is not versioned!");
+ }
+
+ if (firstLevelCache.contains(entityName, revision, primaryKey)) {
+ return (T) firstLevelCache.get(entityName, revision, primaryKey);
+ }
+
+ Object result;
+ try {
+ // The result is put into the cache by the entity instantiator called from the query
+ result = createQuery().forEntitiesAtRevision(cls, revision)
+ .add(AuditRestrictions.idEq(primaryKey)).getSingleResult();
+ } catch (NoResultException e) {
+ result = null;
+ } catch (NonUniqueResultException e) {
+ throw new AuditException(e);
+ }
+
+ return (T) result;
+ }
+
+ @SuppressWarnings({"unchecked"})
+ public List<Number> getRevisions(Class<?> cls, Object primaryKey)
+ throws IllegalArgumentException, NotVersionedException, IllegalStateException {
+ // todo: if a class is not versioned from the beginning, there's a missing ADD rev - what then?
+ checkNotNull(cls, "Entity class");
+ checkNotNull(primaryKey, "Primary key");
+ checkSession();
+
+ String entityName = cls.getName();
+
+ if (!verCfg.getEntCfg().isVersioned(entityName)) {
+ throw new NotVersionedException(entityName, entityName + " is not versioned!");
+ }
+
+ return createQuery().forRevisionsOfEntity(cls, false, true)
+ .addProjection(RevisionProperty.revisionNumber())
+ .add(AuditRestrictions.idEq(primaryKey))
+ .getResultList();
+ }
+
+ public Date getRevisionDate(Number revision) throws IllegalArgumentException, RevisionDoesNotExistException,
+ IllegalStateException{
+ checkNotNull(revision, "Entity revision");
+ checkPositive(revision, "Entity revision");
+ checkSession();
+
+ Query query = verCfg.getRevisionInfoQueryCreator().getRevisionDateQuery(session, revision);
+
+ try {
+ Long timestamp = (Long) query.uniqueResult();
+ if (timestamp == null) {
+ throw new RevisionDoesNotExistException(revision);
+ }
+
+ return new Date(timestamp);
+ } catch (NonUniqueResultException e) {
+ throw new AuditException(e);
+ }
+ }
+
+ public Number getRevisionNumberForDate(Date date) {
+ checkNotNull(date, "Date of revision");
+ checkSession();
+
+ Query query = verCfg.getRevisionInfoQueryCreator().getRevisionNumberForDateQuery(session, date);
+
+ try {
+ Number res = (Number) query.uniqueResult();
+ if (res == null) {
+ throw new RevisionDoesNotExistException(date);
+ }
+
+ return res;
+ } catch (NonUniqueResultException e) {
+ throw new AuditException(e);
+ }
+ }
+
+ @SuppressWarnings({"unchecked"})
+ public <T> T findRevision(Class<T> revisionEntityClass, Number revision) throws IllegalArgumentException,
+ RevisionDoesNotExistException, IllegalStateException {
+ checkNotNull(revision, "Entity revision");
+ checkPositive(revision, "Entity revision");
+ checkSession();
+
+ Query query = verCfg.getRevisionInfoQueryCreator().getRevisionQuery(session, revision);
+
+ try {
+ T revisionData = (T) query.uniqueResult();
+
+ if (revisionData == null) {
+ throw new RevisionDoesNotExistException(revision);
+ }
+
+ return revisionData;
+ } catch (NonUniqueResultException e) {
+ throw new AuditException(e);
+ }
+ }
+
+ public AuditQueryCreator createQuery() {
+ return new AuditQueryCreator(verCfg, this);
+ }
+}
Copied: core/trunk/envers/src/main/java/org/hibernate/envers/reader/AuditReaderImplementor.java (from rev 15459, core/trunk/envers/src/main/java/org/hibernate/envers/reader/VersionsReaderImplementor.java)
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/reader/AuditReaderImplementor.java (rev 0)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/reader/AuditReaderImplementor.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -0,0 +1,39 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.envers.reader;
+
+import org.hibernate.envers.AuditReader;
+
+import org.hibernate.Session;
+import org.hibernate.engine.SessionImplementor;
+
+/**
+ * An interface exposed by a VersionsReader to library-facing classes.
+ * @author Adam Warski (adam at warski dot org)
+ */
+public interface AuditReaderImplementor extends AuditReader {
+ SessionImplementor getSessionImplementor();
+ Session getSession();
+ FirstLevelCache getFirstLevelCache();
+}
Copied: core/trunk/envers/src/main/java/org/hibernate/envers/synchronization/AuditSync.java (from rev 15455, core/trunk/envers/src/main/java/org/hibernate/envers/synchronization/VersionsSync.java)
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/synchronization/AuditSync.java (rev 0)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/synchronization/AuditSync.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -0,0 +1,160 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.envers.synchronization;
+
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.Map;
+import java.util.Queue;
+import javax.transaction.Synchronization;
+
+import org.hibernate.envers.revisioninfo.RevisionInfoGenerator;
+import org.hibernate.envers.synchronization.work.AuditWorkUnit;
+import org.hibernate.envers.tools.Pair;
+
+import org.hibernate.FlushMode;
+import org.hibernate.Session;
+import org.hibernate.Transaction;
+import org.hibernate.event.EventSource;
+
+/**
+ * @author Adam Warski (adam at warski dot org)
+ */
+public class AuditSync implements Synchronization {
+ private final RevisionInfoGenerator revisionInfoGenerator;
+ private final AuditSyncManager manager;
+ private final EventSource session;
+
+ private final Transaction transaction;
+ private final LinkedList<AuditWorkUnit> workUnits;
+ private final Queue<AuditWorkUnit> undoQueue;
+ private final Map<Pair<String, Object>, AuditWorkUnit> usedIds;
+
+ private Object revisionData;
+
+ public AuditSync(AuditSyncManager manager, EventSource session, RevisionInfoGenerator revisionInfoGenerator) {
+ this.manager = manager;
+ this.session = session;
+ this.revisionInfoGenerator = revisionInfoGenerator;
+
+ transaction = session.getTransaction();
+ workUnits = new LinkedList<AuditWorkUnit>();
+ undoQueue = new LinkedList<AuditWorkUnit>();
+ usedIds = new HashMap<Pair<String, Object>, AuditWorkUnit>();
+ }
+
+ private void removeWorkUnit(AuditWorkUnit vwu) {
+ workUnits.remove(vwu);
+ if (vwu.isPerformed()) {
+ // If this work unit has already been performed, it must be deleted (undone) first.
+ undoQueue.offer(vwu);
+ }
+ }
+
+ public void addWorkUnit(AuditWorkUnit vwu) {
+ if (vwu.containsWork()) {
+ Object entityId = vwu.getEntityId();
+
+ if (entityId == null) {
+ // Just adding the work unit - it's not associated with any persistent entity.
+ workUnits.offer(vwu);
+ } else {
+ String entityName = vwu.getEntityName();
+ Pair<String, Object> usedIdsKey = Pair.make(entityName, entityId);
+
+ if (usedIds.containsKey(usedIdsKey)) {
+ AuditWorkUnit other = usedIds.get(usedIdsKey);
+
+ // The entity with entityId has two work units; checking which one should be kept.
+ switch (vwu.dispatch(other)) {
+ case FIRST:
+ // Simply not adding the second
+ break;
+
+ case SECOND:
+ removeWorkUnit(other);
+ usedIds.put(usedIdsKey, vwu);
+ workUnits.offer(vwu);
+ break;
+
+ case NONE:
+ removeWorkUnit(other);
+ break;
+ }
+ } else {
+ usedIds.put(usedIdsKey, vwu);
+ workUnits.offer(vwu);
+ }
+ }
+ }
+ }
+
+ private void executeInSession(Session session) {
+ if (revisionData == null) {
+ revisionData = revisionInfoGenerator.generate(session);
+ }
+
+ AuditWorkUnit vwu;
+
+ // First undoing any performed work units
+ while ((vwu = undoQueue.poll()) != null) {
+ vwu.undo(session);
+ }
+
+ while ((vwu = workUnits.poll()) != null) {
+ vwu.perform(session, revisionData);
+ }
+ }
+
+ public void beforeCompletion() {
+ if (workUnits.size() == 0 && undoQueue.size() == 0) {
+ return;
+ }
+
+ // see: http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4178431
+ if (FlushMode.isManualFlushMode(session.getFlushMode()) || session.isClosed()) {
+ Session temporarySession = null;
+ try {
+ temporarySession = session.getFactory().openTemporarySession();
+
+ executeInSession(temporarySession);
+
+ temporarySession.flush();
+ } finally {
+ if (temporarySession != null) {
+ temporarySession.close();
+ }
+ }
+ } else {
+ executeInSession(session);
+
+ // Explicity flushing the session, as the auto-flush may have already happened.
+ session.flush();
+ }
+ }
+
+ public void afterCompletion(int i) {
+ manager.remove(transaction);
+ }
+}
Copied: core/trunk/envers/src/main/java/org/hibernate/envers/synchronization/AuditSyncManager.java (from rev 15455, core/trunk/envers/src/main/java/org/hibernate/envers/synchronization/VersionsSyncManager.java)
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/synchronization/AuditSyncManager.java (rev 0)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/synchronization/AuditSyncManager.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -0,0 +1,66 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.envers.synchronization;
+
+import java.util.Map;
+
+import org.hibernate.envers.revisioninfo.RevisionInfoGenerator;
+import org.hibernate.envers.tools.ConcurrentReferenceHashMap;
+
+import org.hibernate.Transaction;
+import org.hibernate.event.EventSource;
+
+/**
+ * @author Adam Warski (adam at warski dot org)
+ */
+public class AuditSyncManager {
+ private final Map<Transaction, AuditSync> versionsSyncs;
+ private final RevisionInfoGenerator revisionInfoGenerator;
+
+ public AuditSyncManager(RevisionInfoGenerator revisionInfoGenerator) {
+ versionsSyncs = new ConcurrentReferenceHashMap<Transaction, AuditSync>(10,
+ ConcurrentReferenceHashMap.ReferenceType.WEAK,
+ ConcurrentReferenceHashMap.ReferenceType.STRONG);
+
+ this.revisionInfoGenerator = revisionInfoGenerator;
+ }
+
+ public AuditSync get(EventSource session) {
+ Transaction transaction = session.getTransaction();
+
+ AuditSync verSync = versionsSyncs.get(transaction);
+ if (verSync == null) {
+ verSync = new AuditSync(this, session, revisionInfoGenerator);
+ versionsSyncs.put(transaction, verSync);
+
+ transaction.registerSynchronization(verSync);
+ }
+
+ return verSync;
+ }
+
+ public void remove(Transaction transaction) {
+ versionsSyncs.remove(transaction);
+ }
+}
Copied: core/trunk/envers/src/main/java/org/hibernate/envers/synchronization/work/AbstractAuditWorkUnit.java (from rev 15455, core/trunk/envers/src/main/java/org/hibernate/envers/synchronization/work/AbstractVersionsWorkUnit.java)
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/synchronization/work/AbstractAuditWorkUnit.java (rev 0)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/synchronization/work/AbstractAuditWorkUnit.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -0,0 +1,86 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.envers.synchronization.work;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.hibernate.envers.RevisionType;
+import org.hibernate.envers.configuration.AuditConfiguration;
+import org.hibernate.envers.configuration.AuditEntitiesConfiguration;
+
+import org.hibernate.Session;
+
+/**
+ * @author Adam Warski (adam at warski dot org)
+ */
+public abstract class AbstractAuditWorkUnit implements AuditWorkUnit {
+ protected final AuditConfiguration verCfg;
+ protected final Serializable id;
+
+ private final String entityName;
+
+ private Object performedData;
+
+ protected AbstractAuditWorkUnit(String entityName, AuditConfiguration verCfg, Serializable id) {
+ this.verCfg = verCfg;
+ this.id = id;
+ this.entityName = entityName;
+ }
+
+ protected void fillDataWithId(Map<String, Object> data, Object revision, RevisionType revisionType) {
+ AuditEntitiesConfiguration entitiesCfg = verCfg.getVerEntCfg();
+
+ Map<String, Object> originalId = new HashMap<String, Object>();
+ originalId.put(entitiesCfg.getRevisionPropName(), revision);
+
+ verCfg.getEntCfg().get(getEntityName()).getIdMapper().mapToMapFromId(originalId, id);
+ data.put(entitiesCfg.getRevisionTypePropName(), revisionType);
+ data.put(entitiesCfg.getOriginalIdPropName(), originalId);
+ }
+
+ public Object getEntityId() {
+ return id;
+ }
+
+ public boolean isPerformed() {
+ return performedData != null;
+ }
+
+ public String getEntityName() {
+ return entityName;
+ }
+
+ protected void setPerformed(Object performedData) {
+ this.performedData = performedData;
+ }
+
+ public void undo(Session session) {
+ if (isPerformed()) {
+ session.delete(verCfg.getVerEntCfg().getVersionsEntityName(getEntityName()), performedData);
+ session.flush();
+ }
+ }
+}
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/synchronization/work/AddWorkUnit.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/synchronization/work/AddWorkUnit.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/synchronization/work/AddWorkUnit.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -28,7 +28,7 @@
import java.util.Map;
import org.hibernate.envers.RevisionType;
-import org.hibernate.envers.configuration.VersionsConfiguration;
+import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.Session;
import org.hibernate.persister.entity.EntityPersister;
@@ -36,11 +36,11 @@
/**
* @author Adam Warski (adam at warski dot org)
*/
-public class AddWorkUnit extends AbstractVersionsWorkUnit implements VersionsWorkUnit {
+public class AddWorkUnit extends AbstractAuditWorkUnit implements AuditWorkUnit {
private final Object[] state;
private final String[] propertyNames;
- public AddWorkUnit(String entityName, VersionsConfiguration verCfg, Serializable id,
+ public AddWorkUnit(String entityName, AuditConfiguration verCfg, Serializable id,
EntityPersister entityPersister, Object[] state) {
super(entityName, verCfg, id);
Copied: core/trunk/envers/src/main/java/org/hibernate/envers/synchronization/work/AuditWorkUnit.java (from rev 15455, core/trunk/envers/src/main/java/org/hibernate/envers/synchronization/work/VersionsWorkUnit.java)
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/synchronization/work/AuditWorkUnit.java (rev 0)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/synchronization/work/AuditWorkUnit.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -0,0 +1,41 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.envers.synchronization.work;
+
+import org.hibernate.Session;
+
+/**
+ * @author Adam Warski (adam at warski dot org)
+ */
+public interface AuditWorkUnit extends KeepCheckVisitor, KeepCheckDispatcher {
+ Object getEntityId();
+ String getEntityName();
+
+ boolean containsWork();
+
+ boolean isPerformed();
+
+ void perform(Session session, Object revisionData);
+ void undo(Session session);
+}
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/synchronization/work/CollectionChangeWorkUnit.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/synchronization/work/CollectionChangeWorkUnit.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/synchronization/work/CollectionChangeWorkUnit.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -28,17 +28,17 @@
import java.util.Map;
import org.hibernate.envers.RevisionType;
-import org.hibernate.envers.configuration.VersionsConfiguration;
+import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.Session;
/**
* @author Adam Warski (adam at warski dot org)
*/
-public class CollectionChangeWorkUnit extends AbstractVersionsWorkUnit implements VersionsWorkUnit {
+public class CollectionChangeWorkUnit extends AbstractAuditWorkUnit implements AuditWorkUnit {
private final Object entity;
- public CollectionChangeWorkUnit(String entityName, VersionsConfiguration verCfg, Serializable id, Object entity) {
+ public CollectionChangeWorkUnit(String entityName, AuditConfiguration verCfg, Serializable id, Object entity) {
super(entityName, verCfg, id);
this.entity = entity;
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/synchronization/work/DelWorkUnit.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/synchronization/work/DelWorkUnit.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/synchronization/work/DelWorkUnit.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -28,15 +28,15 @@
import java.util.Map;
import org.hibernate.envers.RevisionType;
-import org.hibernate.envers.configuration.VersionsConfiguration;
+import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.Session;
/**
* @author Adam Warski (adam at warski dot org)
*/
-public class DelWorkUnit extends AbstractVersionsWorkUnit implements VersionsWorkUnit {
- public DelWorkUnit(String entityName, VersionsConfiguration verCfg, Serializable id) {
+public class DelWorkUnit extends AbstractAuditWorkUnit implements AuditWorkUnit {
+ public DelWorkUnit(String entityName, AuditConfiguration verCfg, Serializable id) {
super(entityName, verCfg, id);
}
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/synchronization/work/ModWorkUnit.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/synchronization/work/ModWorkUnit.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/synchronization/work/ModWorkUnit.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -28,7 +28,7 @@
import java.util.Map;
import org.hibernate.envers.RevisionType;
-import org.hibernate.envers.configuration.VersionsConfiguration;
+import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.Session;
import org.hibernate.persister.entity.EntityPersister;
@@ -36,11 +36,11 @@
/**
* @author Adam Warski (adam at warski dot org)
*/
-public class ModWorkUnit extends AbstractVersionsWorkUnit implements VersionsWorkUnit {
+public class ModWorkUnit extends AbstractAuditWorkUnit implements AuditWorkUnit {
private final Map<String, Object> data;
private final boolean changes;
- public ModWorkUnit(String entityName, VersionsConfiguration verCfg, Serializable id,
+ public ModWorkUnit(String entityName, AuditConfiguration verCfg, Serializable id,
EntityPersister entityPersister, Object[] newState, Object[] oldState) {
super(entityName, verCfg, id);
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/synchronization/work/PersistentCollectionChangeWorkUnit.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/synchronization/work/PersistentCollectionChangeWorkUnit.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/synchronization/work/PersistentCollectionChangeWorkUnit.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -27,8 +27,8 @@
import java.util.List;
import java.util.Map;
-import org.hibernate.envers.configuration.VersionsConfiguration;
-import org.hibernate.envers.configuration.VersionsEntitiesConfiguration;
+import org.hibernate.envers.configuration.AuditConfiguration;
+import org.hibernate.envers.configuration.AuditEntitiesConfiguration;
import org.hibernate.envers.entities.mapper.PersistentCollectionChangeData;
import org.hibernate.Session;
@@ -37,11 +37,11 @@
/**
* @author Adam Warski (adam at warski dot org)
*/
-public class PersistentCollectionChangeWorkUnit extends AbstractVersionsWorkUnit implements VersionsWorkUnit {
+public class PersistentCollectionChangeWorkUnit extends AbstractAuditWorkUnit implements AuditWorkUnit {
private final List<PersistentCollectionChangeData> collectionChanges;
private final String referencingPropertyName;
- public PersistentCollectionChangeWorkUnit(String entityName, VersionsConfiguration verCfg,
+ public PersistentCollectionChangeWorkUnit(String entityName, AuditConfiguration verCfg,
PersistentCollection collection, String role,
Serializable snapshot, Serializable id) {
super(entityName, verCfg, null);
@@ -58,7 +58,7 @@
@SuppressWarnings({"unchecked"})
public void perform(Session session, Object revisionData) {
- VersionsEntitiesConfiguration entitiesCfg = verCfg.getVerEntCfg();
+ AuditEntitiesConfiguration entitiesCfg = verCfg.getVerEntCfg();
for (PersistentCollectionChangeData persistentCollectionChangeData : collectionChanges) {
// Setting the revision number
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/tools/log/YLog.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/tools/log/YLog.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/tools/log/YLog.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -26,7 +26,7 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
-import org.hibernate.envers.exception.VersionsException;
+import org.hibernate.envers.exception.AuditException;
/**
* A simple logger facade which delegates through reflection to a logging delegate.
@@ -44,19 +44,19 @@
try {
errorMethod = delegate.getClass().getMethod("error", argClass);
} catch (NoSuchMethodException e) {
- throw new VersionsException(e);
+ throw new AuditException(e);
}
try {
warnMethod = delegate.getClass().getMethod("warn", argClass);
} catch (NoSuchMethodException e) {
- throw new VersionsException(e);
+ throw new AuditException(e);
}
try {
infoMethod = delegate.getClass().getMethod("info", argClass);
} catch (NoSuchMethodException e) {
- throw new VersionsException(e);
+ throw new AuditException(e);
}
}
@@ -64,9 +64,9 @@
try {
errorMethod.invoke(delegate, message);
} catch (IllegalAccessException e) {
- throw new VersionsException(e);
+ throw new AuditException(e);
} catch (InvocationTargetException e) {
- throw new VersionsException(e);
+ throw new AuditException(e);
}
}
@@ -74,9 +74,9 @@
try {
warnMethod.invoke(delegate, message);
} catch (IllegalAccessException e) {
- throw new VersionsException(e);
+ throw new AuditException(e);
} catch (InvocationTargetException e) {
- throw new VersionsException(e);
+ throw new AuditException(e);
}
}
@@ -84,9 +84,9 @@
try {
infoMethod.invoke(delegate, message);
} catch (IllegalAccessException e) {
- throw new VersionsException(e);
+ throw new AuditException(e);
} catch (InvocationTargetException e) {
- throw new VersionsException(e);
+ throw new AuditException(e);
}
}
}
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/tools/log/YLogManager.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/tools/log/YLogManager.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/tools/log/YLogManager.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -26,7 +26,7 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
-import org.hibernate.envers.exception.VersionsException;
+import org.hibernate.envers.exception.AuditException;
/**
* A class for creating logging facades either to loggers obtained from
@@ -47,7 +47,7 @@
getLogMethod = logFactoryClass.getMethod("getLog", Class.class);
argClass = Object.class;
} catch (NoSuchMethodException e) {
- throw new VersionsException("No 'getLog' method in org.apache.commons.logging.LogFactory.");
+ throw new AuditException("No 'getLog' method in org.apache.commons.logging.LogFactory.");
}
} catch (ClassNotFoundException e) {
try {
@@ -56,10 +56,10 @@
getLogMethod = loggerFactoryClass.getMethod("getLogger", Class.class);
argClass = String.class;
} catch (NoSuchMethodException e1) {
- throw new VersionsException("No 'getLogger' method in org.slf4j.LoggerFactory.");
+ throw new AuditException("No 'getLogger' method in org.slf4j.LoggerFactory.");
}
} catch (ClassNotFoundException e1) {
- throw new VersionsException("No org.apache.commons.logging.LogFactory or org.slf4j.LoggerFactory found.");
+ throw new AuditException("No org.apache.commons.logging.LogFactory or org.slf4j.LoggerFactory found.");
}
}
}
@@ -68,9 +68,9 @@
try {
return new YLog(getLogMethod.invoke(null, cls), argClass);
} catch (IllegalAccessException e) {
- throw new VersionsException(e);
+ throw new AuditException(e);
} catch (InvocationTargetException e) {
- throw new VersionsException(e);
+ throw new AuditException(e);
}
}
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/tools/reflection/ReflectionTools.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/tools/reflection/ReflectionTools.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/tools/reflection/ReflectionTools.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -25,7 +25,7 @@
import java.util.Map;
-import org.hibernate.envers.exception.VersionsException;
+import org.hibernate.envers.exception.AuditException;
import org.hibernate.envers.tools.ConcurrentReferenceHashMap;
import org.hibernate.envers.tools.Pair;
import static org.hibernate.envers.tools.Pair.make;
@@ -55,7 +55,7 @@
try {
return Thread.currentThread().getContextClassLoader().loadClass(name);
} catch (ClassNotFoundException e) {
- throw new VersionsException(e);
+ throw new AuditException(e);
}
}
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/tools/reflection/YClass.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/tools/reflection/YClass.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/tools/reflection/YClass.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -28,7 +28,7 @@
import java.util.ArrayList;
import java.util.List;
-import org.hibernate.envers.exception.VersionsException;
+import org.hibernate.envers.exception.AuditException;
/**
* @author Adam Warski (adam at warski dot org)
@@ -50,9 +50,9 @@
try {
return (String) ymc.getXClass_getNameMethod().invoke(delegate);
} catch (IllegalAccessException e) {
- throw new VersionsException(e);
+ throw new AuditException(e);
} catch (InvocationTargetException e) {
- throw new VersionsException(e);
+ throw new AuditException(e);
}
}
@@ -60,9 +60,9 @@
try {
return new YClass(ymc, ymc.getXClass_getSuperclassMethod().invoke(delegate));
} catch (IllegalAccessException e) {
- throw new VersionsException(e);
+ throw new AuditException(e);
} catch (InvocationTargetException e) {
- throw new VersionsException(e);
+ throw new AuditException(e);
}
}
@@ -72,9 +72,9 @@
try {
delegates = (List) ymc.getXClass_getDeclaredPropertiesMethod().invoke(delegate, accessMode);
} catch (IllegalAccessException e) {
- throw new VersionsException(e);
+ throw new AuditException(e);
} catch (InvocationTargetException e) {
- throw new VersionsException(e);
+ throw new AuditException(e);
}
List<YProperty> ret = new ArrayList<YProperty>();
@@ -90,9 +90,9 @@
//noinspection unchecked
return (T) ymc.getXClass_getAnnotationMethod().invoke(delegate, annotation);
} catch (IllegalAccessException e) {
- throw new VersionsException(e);
+ throw new AuditException(e);
} catch (InvocationTargetException e) {
- throw new VersionsException(e);
+ throw new AuditException(e);
}
}
}
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/tools/reflection/YMethodsAndClasses.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/tools/reflection/YMethodsAndClasses.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/tools/reflection/YMethodsAndClasses.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -25,7 +25,7 @@
import java.lang.reflect.Method;
-import org.hibernate.envers.exception.VersionsException;
+import org.hibernate.envers.exception.AuditException;
/**
* @author Adam Warski (adam at warski dot org)
@@ -54,7 +54,7 @@
try {
xClassClass = cl.loadClass("org.hibernate.reflection.XClass");
} catch (ClassNotFoundException e1) {
- throw new VersionsException("No XClass found.");
+ throw new AuditException("No XClass found.");
}
}
@@ -65,7 +65,7 @@
try {
xPropertyClass = cl.loadClass("org.hibernate.reflection.XProperty");
} catch (ClassNotFoundException e1) {
- throw new VersionsException("No XProperty found.");
+ throw new AuditException("No XProperty found.");
}
}
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/tools/reflection/YProperty.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/tools/reflection/YProperty.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/tools/reflection/YProperty.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -26,7 +26,7 @@
import java.lang.annotation.Annotation;
import java.lang.reflect.InvocationTargetException;
-import org.hibernate.envers.exception.VersionsException;
+import org.hibernate.envers.exception.AuditException;
/**
* @author Adam Warski (adam at warski dot org)
@@ -44,9 +44,9 @@
try {
return (String) ymc.getXProperty_getNameMethod().invoke(delegate);
} catch (IllegalAccessException e) {
- throw new VersionsException(e);
+ throw new AuditException(e);
} catch (InvocationTargetException e) {
- throw new VersionsException(e);
+ throw new AuditException(e);
}
}
@@ -55,9 +55,9 @@
//noinspection unchecked
return (T) ymc.getXProperty_getAnnotationMethod().invoke(delegate, annotation);
} catch (IllegalAccessException e) {
- throw new VersionsException(e);
+ throw new AuditException(e);
} catch (InvocationTargetException e) {
- throw new VersionsException(e);
+ throw new AuditException(e);
}
}
@@ -65,9 +65,9 @@
try {
return new YClass(ymc, ymc.getXProperty_getTypeMethod().invoke(delegate));
} catch (IllegalAccessException e) {
- throw new VersionsException(e);
+ throw new AuditException(e);
} catch (InvocationTargetException e) {
- throw new VersionsException(e);
+ throw new AuditException(e);
}
}
}
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/tools/reflection/YReflectionManager.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/tools/reflection/YReflectionManager.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/tools/reflection/YReflectionManager.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -25,7 +25,7 @@
import java.lang.reflect.InvocationTargetException;
-import org.hibernate.envers.exception.VersionsException;
+import org.hibernate.envers.exception.AuditException;
import org.hibernate.MappingException;
import org.hibernate.cfg.Configuration;
@@ -57,9 +57,9 @@
try {
return new YClass(ymc, ymc.getReflectionManager_classForNameMethod().invoke(delegate, className, caller));
} catch (IllegalAccessException e) {
- throw new VersionsException(e);
+ throw new AuditException(e);
} catch (InvocationTargetException e) {
- throw new VersionsException(e);
+ throw new AuditException(e);
}
}
@@ -67,9 +67,9 @@
try {
return (Boolean) ymc.getReflectionManager_equalsMethod().invoke(delegate, class1.getDelegate(), class2);
} catch (IllegalAccessException e) {
- throw new VersionsException(e);
+ throw new AuditException(e);
} catch (InvocationTargetException e) {
- throw new VersionsException(e);
+ throw new AuditException(e);
}
}
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/query/CustomRevEntityQuery.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/query/CustomRevEntityQuery.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/query/CustomRevEntityQuery.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -26,7 +26,7 @@
import java.util.List;
import javax.persistence.EntityManager;
-import org.hibernate.envers.query.VersionsRestrictions;
+import org.hibernate.envers.query.AuditRestrictions;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.entities.StrIntTestEntity;
import org.hibernate.envers.test.entities.reventity.CustomRevEntity;
@@ -79,7 +79,7 @@
public void testRevisionsOfId1Query() {
List<Object[]> result = getVersionsReader().createQuery()
.forRevisionsOfEntity(StrIntTestEntity.class, false, true)
- .add(VersionsRestrictions.idEq(id1))
+ .add(AuditRestrictions.idEq(id1))
.getResultList();
assert result.get(0)[0].equals(new StrIntTestEntity("a", 10, id1));
@@ -95,7 +95,7 @@
public void testRevisionsOfId2Query() {
List<Object[]> result = getVersionsReader().createQuery()
.forRevisionsOfEntity(StrIntTestEntity.class, false, true)
- .add(VersionsRestrictions.idEq(id2))
+ .add(AuditRestrictions.idEq(id2))
.getResultList();
assert result.get(0)[0].equals(new StrIntTestEntity("b", 15, id2));
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/query/DeletedEntities.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/query/DeletedEntities.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/query/DeletedEntities.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -28,7 +28,7 @@
import org.hibernate.envers.DefaultRevisionEntity;
import org.hibernate.envers.RevisionType;
-import org.hibernate.envers.query.VersionsRestrictions;
+import org.hibernate.envers.query.AuditRestrictions;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.entities.StrIntTestEntity;
import org.testng.annotations.BeforeClass;
@@ -88,7 +88,7 @@
public void testRevisionsOfEntityWithoutDelete() {
List result = getVersionsReader().createQuery()
.forRevisionsOfEntity(StrIntTestEntity.class, false, false)
- .add(VersionsRestrictions.idEq(id2))
+ .add(AuditRestrictions.idEq(id2))
.getResultList();
assert result.size() == 1;
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/query/MaximalizePropertyQuery.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/query/MaximalizePropertyQuery.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/query/MaximalizePropertyQuery.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -28,7 +28,7 @@
import javax.persistence.EntityManager;
import org.hibernate.envers.query.RevisionProperty;
-import org.hibernate.envers.query.VersionsRestrictions;
+import org.hibernate.envers.query.AuditRestrictions;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.entities.StrIntTestEntity;
import org.testng.annotations.BeforeClass;
@@ -104,8 +104,8 @@
List revs_id1 = getVersionsReader().createQuery()
.forRevisionsOfEntity(StrIntTestEntity.class, false, true)
.addProjection(RevisionProperty.revisionNumber())
- .add(VersionsRestrictions.maximizeProperty("number")
- .add(VersionsRestrictions.idEq(id2)))
+ .add(AuditRestrictions.maximizeProperty("number")
+ .add(AuditRestrictions.idEq(id2)))
.getResultList();
assert Arrays.asList(2, 3, 4).equals(revs_id1);
@@ -116,8 +116,8 @@
List result = getVersionsReader().createQuery()
.forRevisionsOfEntity(StrIntTestEntity.class, false, true)
.addProjection(RevisionProperty.revisionNumber())
- .add(VersionsRestrictions.minimizeProperty("number")
- .add(VersionsRestrictions.eq("str1", "a")))
+ .add(AuditRestrictions.minimizeProperty("number")
+ .add(AuditRestrictions.eq("str1", "a")))
.getResultList();
assert Arrays.asList(1).equals(result);
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/query/RevisionConstraintQuery.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/query/RevisionConstraintQuery.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/query/RevisionConstraintQuery.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -28,7 +28,7 @@
import javax.persistence.EntityManager;
import org.hibernate.envers.query.RevisionProperty;
-import org.hibernate.envers.query.VersionsRestrictions;
+import org.hibernate.envers.query.AuditRestrictions;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.entities.StrIntTestEntity;
import org.testng.annotations.BeforeClass;
@@ -126,7 +126,7 @@
.forRevisionsOfEntity(StrIntTestEntity.class, false, true)
.addProjection(RevisionProperty.revisionNumber())
.add(RevisionProperty.le(3))
- .add(VersionsRestrictions.eq("str1", "a"))
+ .add(AuditRestrictions.eq("str1", "a"))
.getResultList();
assert Arrays.asList(1).equals(result);
@@ -138,7 +138,7 @@
.forRevisionsOfEntity(StrIntTestEntity.class, false, true)
.addProjection(RevisionProperty.revisionNumber())
.add(RevisionProperty.gt(1))
- .add(VersionsRestrictions.lt("number", 10))
+ .add(AuditRestrictions.lt("number", 10))
.getResultList();
assert Arrays.asList(3, 4).equals(result);
@@ -152,7 +152,7 @@
.addProjection(RevisionProperty.count())
.addProjection(RevisionProperty.countDistinct())
.addProjection(RevisionProperty.min())
- .add(VersionsRestrictions.idEq(id1))
+ .add(AuditRestrictions.idEq(id1))
.getSingleResult();
assert (Integer) result[0] == 4;
@@ -166,7 +166,7 @@
List result = getVersionsReader().createQuery()
.forRevisionsOfEntity(StrIntTestEntity.class, false, true)
.addProjection(RevisionProperty.revisionNumber())
- .add(VersionsRestrictions.idEq(id1))
+ .add(AuditRestrictions.idEq(id1))
.addOrder(RevisionProperty.desc())
.getResultList();
@@ -179,7 +179,7 @@
Object result = getVersionsReader().createQuery()
.forRevisionsOfEntity(StrIntTestEntity.class, false, true)
.addProjection(RevisionProperty.count())
- .add(VersionsRestrictions.idEq(id1))
+ .add(AuditRestrictions.idEq(id1))
.getSingleResult();
assert (Long) result == 4;
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/query/SimpleQuery.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/query/SimpleQuery.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/query/SimpleQuery.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -32,7 +32,7 @@
import org.hibernate.envers.RevisionType;
import org.hibernate.envers.query.RevisionProperty;
import org.hibernate.envers.query.RevisionTypeProperty;
-import org.hibernate.envers.query.VersionsRestrictions;
+import org.hibernate.envers.query.AuditRestrictions;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.entities.StrIntTestEntity;
import org.hibernate.envers.test.tools.TestTools;
@@ -108,7 +108,7 @@
public void testEntitiesIdQuery() {
StrIntTestEntity ver2 = (StrIntTestEntity) getVersionsReader().createQuery()
.forEntitiesAtRevision(StrIntTestEntity.class, 2)
- .add(VersionsRestrictions.idEq(id2))
+ .add(AuditRestrictions.idEq(id2))
.getSingleResult();
assert ver2.equals(new StrIntTestEntity("a", 20, id2));
@@ -118,17 +118,17 @@
public void testEntitiesPropertyEqualsQuery() {
List ver1 = getVersionsReader().createQuery()
.forEntitiesAtRevision(StrIntTestEntity.class, 1)
- .add(VersionsRestrictions.eq("str1", "a"))
+ .add(AuditRestrictions.eq("str1", "a"))
.getResultList();
List ver2 = getVersionsReader().createQuery()
.forEntitiesAtRevision(StrIntTestEntity.class, 2)
- .add(VersionsRestrictions.eq("str1", "a"))
+ .add(AuditRestrictions.eq("str1", "a"))
.getResultList();
List ver3 = getVersionsReader().createQuery()
.forEntitiesAtRevision(StrIntTestEntity.class, 3)
- .add(VersionsRestrictions.eq("str1", "a"))
+ .add(AuditRestrictions.eq("str1", "a"))
.getResultList();
assert new HashSet(ver1).equals(TestTools.makeSet(new StrIntTestEntity("a", 10, id1),
@@ -142,17 +142,17 @@
public void testEntitiesPropertyLeQuery() {
List ver1 = getVersionsReader().createQuery()
.forEntitiesAtRevision(StrIntTestEntity.class, 1)
- .add(VersionsRestrictions.le("number", 10))
+ .add(AuditRestrictions.le("number", 10))
.getResultList();
List ver2 = getVersionsReader().createQuery()
.forEntitiesAtRevision(StrIntTestEntity.class, 2)
- .add(VersionsRestrictions.le("number", 10))
+ .add(AuditRestrictions.le("number", 10))
.getResultList();
List ver3 = getVersionsReader().createQuery()
.forEntitiesAtRevision(StrIntTestEntity.class, 3)
- .add(VersionsRestrictions.le("number", 10))
+ .add(AuditRestrictions.le("number", 10))
.getResultList();
assert new HashSet(ver1).equals(TestTools.makeSet(new StrIntTestEntity("a", 10, id1),
@@ -168,22 +168,22 @@
List revs_id1 = getVersionsReader().createQuery()
.forRevisionsOfEntity(StrIntTestEntity.class, false, true)
.addProjection(RevisionProperty.revisionNumber())
- .add(VersionsRestrictions.le("str1", "a"))
- .add(VersionsRestrictions.idEq(id1))
+ .add(AuditRestrictions.le("str1", "a"))
+ .add(AuditRestrictions.idEq(id1))
.getResultList();
List revs_id2 = getVersionsReader().createQuery()
.forRevisionsOfEntity(StrIntTestEntity.class, false, true)
.addProjection(RevisionProperty.revisionNumber())
- .add(VersionsRestrictions.le("str1", "a"))
- .add(VersionsRestrictions.idEq(id2))
+ .add(AuditRestrictions.le("str1", "a"))
+ .add(AuditRestrictions.idEq(id2))
.getResultList();
List revs_id3 = getVersionsReader().createQuery()
.forRevisionsOfEntity(StrIntTestEntity.class, false, true)
.addProjection(RevisionProperty.revisionNumber())
- .add(VersionsRestrictions.le("str1", "a"))
- .add(VersionsRestrictions.idEq(id3))
+ .add(AuditRestrictions.le("str1", "a"))
+ .add(AuditRestrictions.idEq(id3))
.getResultList();
assert Arrays.asList(1).equals(revs_id1);
@@ -195,7 +195,7 @@
public void testSelectEntitiesQuery() {
List result = getVersionsReader().createQuery()
.forRevisionsOfEntity(StrIntTestEntity.class, true, false)
- .add(VersionsRestrictions.idEq(id1))
+ .add(AuditRestrictions.idEq(id1))
.getResultList();
assert result.size() == 2;
@@ -208,7 +208,7 @@
public void testSelectEntitiesAndRevisionsQuery() {
List result = getVersionsReader().createQuery()
.forRevisionsOfEntity(StrIntTestEntity.class, false, true)
- .add(VersionsRestrictions.idEq(id1))
+ .add(AuditRestrictions.idEq(id1))
.getResultList();
assert result.size() == 3;
@@ -231,7 +231,7 @@
List result = getVersionsReader().createQuery()
.forRevisionsOfEntity(StrIntTestEntity.class, false, true)
.addProjection(RevisionTypeProperty.revisionType())
- .add(VersionsRestrictions.idEq(id1))
+ .add(AuditRestrictions.idEq(id1))
.getResultList();
assert result.size() == 3;
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/query/ids/EmbIdOneToManyQuery.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/query/ids/EmbIdOneToManyQuery.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/query/ids/EmbIdOneToManyQuery.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -28,7 +28,7 @@
import java.util.Set;
import javax.persistence.EntityManager;
-import org.hibernate.envers.query.VersionsRestrictions;
+import org.hibernate.envers.query.AuditRestrictions;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.entities.ids.EmbId;
import org.hibernate.envers.test.entities.onetomany.ids.SetRefEdEmbIdEntity;
@@ -105,32 +105,32 @@
public void testEntitiesReferencedToId3() {
Set rev1_related = new HashSet(getVersionsReader().createQuery()
.forEntitiesAtRevision(SetRefIngEmbIdEntity.class, 1)
- .add(VersionsRestrictions.relatedIdEq("reference", id3))
+ .add(AuditRestrictions.relatedIdEq("reference", id3))
.getResultList());
Set rev1 = new HashSet(getVersionsReader().createQuery()
.forEntitiesAtRevision(SetRefIngEmbIdEntity.class, 1)
- .add(VersionsRestrictions.eq("reference", new SetRefEdEmbIdEntity(id3, null)))
+ .add(AuditRestrictions.eq("reference", new SetRefEdEmbIdEntity(id3, null)))
.getResultList());
Set rev2_related = new HashSet(getVersionsReader().createQuery()
.forEntitiesAtRevision(SetRefIngEmbIdEntity.class, 2)
- .add(VersionsRestrictions.relatedIdEq("reference", id3))
+ .add(AuditRestrictions.relatedIdEq("reference", id3))
.getResultList());
Set rev2 = new HashSet(getVersionsReader().createQuery()
.forEntitiesAtRevision(SetRefIngEmbIdEntity.class, 2)
- .add(VersionsRestrictions.eq("reference", new SetRefEdEmbIdEntity(id3, null)))
+ .add(AuditRestrictions.eq("reference", new SetRefEdEmbIdEntity(id3, null)))
.getResultList());
Set rev3_related = new HashSet(getVersionsReader().createQuery()
.forEntitiesAtRevision(SetRefIngEmbIdEntity.class, 3)
- .add(VersionsRestrictions.relatedIdEq("reference", id3))
+ .add(AuditRestrictions.relatedIdEq("reference", id3))
.getResultList());
Set rev3 = new HashSet(getVersionsReader().createQuery()
.forEntitiesAtRevision(SetRefIngEmbIdEntity.class, 3)
- .add(VersionsRestrictions.eq("reference", new SetRefEdEmbIdEntity(id3, null)))
+ .add(AuditRestrictions.eq("reference", new SetRefEdEmbIdEntity(id3, null)))
.getResultList());
assert rev1.equals(rev1_related);
@@ -147,17 +147,17 @@
public void testEntitiesReferencedToId4() {
Set rev1_related = new HashSet(getVersionsReader().createQuery()
.forEntitiesAtRevision(SetRefIngEmbIdEntity.class, 1)
- .add(VersionsRestrictions.relatedIdEq("reference", id4))
+ .add(AuditRestrictions.relatedIdEq("reference", id4))
.getResultList());
Set rev2_related = new HashSet(getVersionsReader().createQuery()
.forEntitiesAtRevision(SetRefIngEmbIdEntity.class, 2)
- .add(VersionsRestrictions.relatedIdEq("reference", id4))
+ .add(AuditRestrictions.relatedIdEq("reference", id4))
.getResultList());
Set rev3_related = new HashSet(getVersionsReader().createQuery()
.forEntitiesAtRevision(SetRefIngEmbIdEntity.class, 3)
- .add(VersionsRestrictions.relatedIdEq("reference", id4))
+ .add(AuditRestrictions.relatedIdEq("reference", id4))
.getResultList());
assert rev1_related.equals(TestTools.makeSet());
@@ -169,20 +169,20 @@
public void testEntitiesReferencedByIng1ToId3() {
List rev1_related = getVersionsReader().createQuery()
.forEntitiesAtRevision(SetRefIngEmbIdEntity.class, 1)
- .add(VersionsRestrictions.relatedIdEq("reference", id3))
- .add(VersionsRestrictions.idEq(id1))
+ .add(AuditRestrictions.relatedIdEq("reference", id3))
+ .add(AuditRestrictions.idEq(id1))
.getResultList();
Object rev2_related = getVersionsReader().createQuery()
.forEntitiesAtRevision(SetRefIngEmbIdEntity.class, 2)
- .add(VersionsRestrictions.relatedIdEq("reference", id3))
- .add(VersionsRestrictions.idEq(id1))
+ .add(AuditRestrictions.relatedIdEq("reference", id3))
+ .add(AuditRestrictions.idEq(id1))
.getSingleResult();
Object rev3_related = getVersionsReader().createQuery()
.forEntitiesAtRevision(SetRefIngEmbIdEntity.class, 3)
- .add(VersionsRestrictions.relatedIdEq("reference", id3))
- .add(VersionsRestrictions.idEq(id1))
+ .add(AuditRestrictions.relatedIdEq("reference", id3))
+ .add(AuditRestrictions.idEq(id1))
.getSingleResult();
assert rev1_related.size() == 0;
@@ -194,20 +194,20 @@
public void testEntitiesReferencedByIng2ToId3() {
List rev1_related = getVersionsReader().createQuery()
.forEntitiesAtRevision(SetRefIngEmbIdEntity.class, 1)
- .add(VersionsRestrictions.relatedIdEq("reference", id3))
- .add(VersionsRestrictions.idEq(id2))
+ .add(AuditRestrictions.relatedIdEq("reference", id3))
+ .add(AuditRestrictions.idEq(id2))
.getResultList();
List rev2_related = getVersionsReader().createQuery()
.forEntitiesAtRevision(SetRefIngEmbIdEntity.class, 2)
- .add(VersionsRestrictions.relatedIdEq("reference", id3))
- .add(VersionsRestrictions.idEq(id2))
+ .add(AuditRestrictions.relatedIdEq("reference", id3))
+ .add(AuditRestrictions.idEq(id2))
.getResultList();
Object rev3_related = getVersionsReader().createQuery()
.forEntitiesAtRevision(SetRefIngEmbIdEntity.class, 3)
- .add(VersionsRestrictions.relatedIdEq("reference", id3))
- .add(VersionsRestrictions.idEq(id2))
+ .add(AuditRestrictions.relatedIdEq("reference", id3))
+ .add(AuditRestrictions.idEq(id2))
.getSingleResult();
assert rev1_related.size() == 0;
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/query/ids/MulIdOneToManyQuery.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/query/ids/MulIdOneToManyQuery.java 2008-10-31 11:42:38 UTC (rev 15459)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/query/ids/MulIdOneToManyQuery.java 2008-10-31 11:53:38 UTC (rev 15460)
@@ -28,7 +28,7 @@
import java.util.Set;
import javax.persistence.EntityManager;
-import org.hibernate.envers.query.VersionsRestrictions;
+import org.hibernate.envers.query.AuditRestrictions;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.entities.ids.MulId;
import org.hibernate.envers.test.entities.onetomany.ids.SetRefEdMulIdEntity;
@@ -105,32 +105,32 @@
public void testEntitiesReferencedToId3() {
Set rev1_related = new HashSet(getVersionsReader().createQuery()
.forEntitiesAtRevision(SetRefIngMulIdEntity.class, 1)
- .add(VersionsRestrictions.relatedIdEq("reference", id3))
+ .add(AuditRestrictions.relatedIdEq("reference", id3))
.getResultList());
Set rev1 = new HashSet(getVersionsReader().createQuery()
.forEntitiesAtRevision(SetRefIngMulIdEntity.class, 1)
- .add(VersionsRestrictions.eq("reference", new SetRefEdMulIdEntity(id3, null)))
+ .add(AuditRestrictions.eq("reference", new SetRefEdMulIdEntity(id3, null)))
.getResultList());
Set rev2_related = new HashSet(getVersionsReader().createQuery()
.forEntitiesAtRevision(SetRefIngMulIdEntity.class, 2)
- .add(VersionsRestrictions.relatedIdEq("reference", id3))
+ .add(AuditRestrictions.relatedIdEq("reference", id3))
.getResultList());
Set rev2 = new HashSet(getVersionsReader().createQuery()
.forEntitiesAtRevision(SetRefIngMulIdEntity.class, 2)
- .add(VersionsRestrictions.eq("reference", new SetRefEdMulIdEntity(id3, null)))
+ .add(AuditRestrictions.eq("reference", new SetRefEdMulIdEntity(id3, null)))
.getResultList());
Set rev3_related = new HashSet(getVersionsReader().createQuery()
.forEntitiesAtRevision(SetRefIngMulIdEntity.class, 3)
- .add(VersionsRestrictions.relatedIdEq("reference", id3))
+ .add(AuditRestrictions.relatedIdEq("reference", id3))
.getResultList());
Set rev3 = new HashSet(getVersionsReader().createQuery()
.forEntitiesAtRevision(SetRefIngMulIdEntity.class, 3)
- .add(VersionsRestrictions.eq("reference", new SetRefEdMulIdEntity(id3, null)))
+ .add(AuditRestrictions.eq("reference", new SetRefEdMulIdEntity(id3, null)))
.getResultList());
assert rev1.equals(rev1_related);
@@ -147,17 +147,17 @@
public void testEntitiesReferencedToId4() {
Set rev1_related = new HashSet(getVersionsReader().createQuery()
.forEntitiesAtRevision(SetRefIngMulIdEntity.class, 1)
- .add(VersionsRestrictions.relatedIdEq("reference", id4))
+ .add(AuditRestrictions.relatedIdEq("reference", id4))
.getResultList());
Set rev2_related = new HashSet(getVersionsReader().createQuery()
.forEntitiesAtRevision(SetRefIngMulIdEntity.class, 2)
- .add(VersionsRestrictions.relatedIdEq("reference", id4))
+ .add(AuditRestrictions.relatedIdEq("reference", id4))
.getResultList());
Set rev3_related = new HashSet(getVersionsReader().createQuery()
.forEntitiesAtRevision(SetRefIngMulIdEntity.class, 3)
- .add(VersionsRestrictions.relatedIdEq("reference", id4))
+ .add(AuditRestrictions.relatedIdEq("reference", id4))
.getResultList());
assert rev1_related.equals(TestTools.makeSet());
@@ -169,20 +169,20 @@
public void testEntitiesReferencedByIng1ToId3() {
List rev1_related = getVersionsReader().createQuery()
.forEntitiesAtRevision(SetRefIngMulIdEntity.class, 1)
- .add(VersionsRestrictions.relatedIdEq("reference", id3))
- .add(VersionsRestrictions.idEq(id1))
+ .add(AuditRestrictions.relatedIdEq("reference", id3))
+ .add(AuditRestrictions.idEq(id1))
.getResultList();
Object rev2_related = getVersionsReader().createQuery()
.forEntitiesAtRevision(SetRefIngMulIdEntity.class, 2)
- .add(VersionsRestrictions.relatedIdEq("reference", id3))
- .add(VersionsRestrictions.idEq(id1))
+ .add(AuditRestrictions.relatedIdEq("reference", id3))
+ .add(AuditRestrictions.idEq(id1))
.getSingleResult();
Object rev3_related = getVersionsReader().createQuery()
.forEntitiesAtRevision(SetRefIngMulIdEntity.class, 3)
- .add(VersionsRestrictions.relatedIdEq("reference", id3))
- .add(VersionsRestrictions.idEq(id1))
+ .add(AuditRestrictions.relatedIdEq("reference", id3))
+ .add(AuditRestrictions.idEq(id1))
.getSingleResult();
assert rev1_related.size() == 0;
@@ -194,20 +194,20 @@
public void testEntitiesReferencedByIng2ToId3() {
List rev1_related = getVersionsReader().createQuery()
.forEntitiesAtRevision(SetRefIngMulIdEntity.class, 1)
- .add(VersionsRestrictions.relatedIdEq("reference", id3))
- .add(VersionsRestrictions.idEq(id2))
+ .add(AuditRestrictions.relatedIdEq("reference", id3))
+ .add(AuditRestrictions.idEq(id2))
.getResultList();
List rev2_related = getVersionsReader().createQuery()
.forEntitiesAtRevision(SetRefIngMulIdEntity.class, 2)
- .add(VersionsRestrictions.relatedIdEq("reference", id3))
- .add(VersionsRestrictions.idEq(id2))
+ .add(AuditRestrictions.relatedIdEq("reference", id3))
+ .add(AuditRestrictions.idEq(id2))
.getResultList();
Object rev3_related = getVersionsReader().createQuery()
.forEntitiesAtRevision(SetRefIngMulIdEntity.class, 3)
- .add(VersionsRestrictions.relatedIdEq("reference", id3))
- .add(VersionsRestrictions.idEq(id2))
+ .add(AuditRestrictions.relatedIdEq("reference", id3))
+ .add(AuditRestrictions.idEq(id2))
.getSingleResult();
assert rev1_related.size() == 0;
16 years, 1 month
Hibernate SVN: r15459 - in core/trunk/envers/src: main/java/org/hibernate/envers/configuration and 36 other directories.
by hibernate-commits@lists.jboss.org
Author: adamw
Date: 2008-10-31 07:42:38 -0400 (Fri, 31 Oct 2008)
New Revision: 15459
Added:
core/trunk/envers/src/main/java/org/hibernate/envers/AuditJoinTable.java
core/trunk/envers/src/main/java/org/hibernate/envers/AuditReader.java
core/trunk/envers/src/main/java/org/hibernate/envers/AuditReaderFactory.java
core/trunk/envers/src/main/java/org/hibernate/envers/AuditTable.java
core/trunk/envers/src/main/java/org/hibernate/envers/Audited.java
core/trunk/envers/src/main/java/org/hibernate/envers/NotAudited.java
core/trunk/envers/src/main/java/org/hibernate/envers/SecondaryAuditTable.java
core/trunk/envers/src/main/java/org/hibernate/envers/SecondaryAuditTables.java
Removed:
core/trunk/envers/src/main/java/org/hibernate/envers/SecondaryVersionsTable.java
core/trunk/envers/src/main/java/org/hibernate/envers/SecondaryVersionsTables.java
core/trunk/envers/src/main/java/org/hibernate/envers/Unversioned.java
core/trunk/envers/src/main/java/org/hibernate/envers/Versioned.java
core/trunk/envers/src/main/java/org/hibernate/envers/VersionsJoinTable.java
core/trunk/envers/src/main/java/org/hibernate/envers/VersionsReader.java
core/trunk/envers/src/main/java/org/hibernate/envers/VersionsReaderFactory.java
core/trunk/envers/src/main/java/org/hibernate/envers/VersionsTable.java
Modified:
core/trunk/envers/src/main/java/org/hibernate/envers/configuration/RevisionInfoConfiguration.java
core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/AnnotationsMetadataReader.java
core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/CollectionMetadataGenerator.java
core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/PersistentClassVersioningData.java
core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/VersionsMetadataGenerator.java
core/trunk/envers/src/main/java/org/hibernate/envers/reader/VersionsReaderImplementor.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/AbstractEntityTest.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/IntTestEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/StrIntTestEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/StrTestEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/UnversionedEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/collection/EnumSetEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/collection/StringListEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/collection/StringMapEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/collection/StringSetEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/components/ComponentTestEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/customtype/CompositeCustomTypeEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/customtype/ParametrizedCustomTypeEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/ids/EmbIdTestEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/ids/MulIdTestEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/manytomany/ListOwnedEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/manytomany/ListOwningEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/manytomany/MapOwnedEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/manytomany/MapOwningEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/manytomany/SetOwnedEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/manytomany/SetOwningEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/manytomany/unidirectional/ListUniEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/manytomany/unidirectional/MapUniEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/manytomany/unidirectional/SetUniEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/onetomany/CollectionRefEdEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/onetomany/CollectionRefIngEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/onetomany/ListRefEdEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/onetomany/ListRefIngEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/onetomany/SetRefEdEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/onetomany/SetRefIngEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/onetomany/detached/DoubleSetRefCollEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/onetomany/detached/ListRefCollEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/onetomany/detached/SetJoinColumnRefCollEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/onetomany/detached/SetRefCollEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/onetomany/detached/ids/SetRefCollEntityEmbId.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/onetomany/detached/ids/SetRefCollEntityMulId.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/onetomany/ids/SetRefEdEmbIdEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/onetomany/ids/SetRefEdMulIdEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/onetomany/ids/SetRefIngEmbIdEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/onetomany/ids/SetRefIngMulIdEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/basic/BasicTestEntity1.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/basic/BasicTestEntity2.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/basic/BasicTestEntity4.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/collection/mapkey/ComponentMapKeyEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/collection/mapkey/IdMapKeyEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/data/DateTestEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/data/EnumTestEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/data/LobTestEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/data/SerializableTestEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/single/ChildEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/single/ParentEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/single/childrelation/ChildIngEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/single/childrelation/ParentNotIngEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/single/childrelation/ReferencedEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/single/relation/ChildIngEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/single/relation/ParentIngEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/single/relation/ReferencedEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/manytomany/ternary/TernaryMapEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/naming/DetachedNamingTestEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/naming/JoinNamingRefEdEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/naming/JoinNamingRefIngEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/naming/NamingTestEntity1.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/naming/VersionsJoinTableTestEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/naming/ids/JoinEmbIdNamingRefEdEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/naming/ids/JoinEmbIdNamingRefIngEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/naming/ids/JoinMulIdNamingRefEdEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/naming/ids/JoinMulIdNamingRefIngEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/notinsertable/NotInsertableTestEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/onetomany/RefEdMapKeyEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/onetomany/RefIngMapKeyEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/onetoone/bidirectional/BiRefEdEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/onetoone/bidirectional/BiRefIngEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/onetoone/bidirectional/ids/BiEmbIdRefEdEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/onetoone/bidirectional/ids/BiEmbIdRefIngEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/onetoone/bidirectional/ids/BiMulIdRefEdEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/onetoone/bidirectional/ids/BiMulIdRefIngEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/onetoone/unidirectional/UniRefEdEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/onetoone/unidirectional/UniRefIngEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/properties/PropertiesTestEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/properties/UnversionedOptimisticLockingFieldEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/reventity/Custom.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/reventity/CustomBoxed.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/reventity/CustomPropertyAccess.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/reventity/Inherited.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/reventity/Listener.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/reventity/LongRevNumber.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/revfordate/RevisionForDate.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/sameids/SameIdTestEntity1.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/sameids/SameIdTestEntity2.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/secondary/SecondaryNamingTestEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/secondary/SecondaryTestEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/secondary/ids/SecondaryEmbIdTestEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/secondary/ids/SecondaryMulIdTestEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/superclass/SuperclassOfEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/various/Address.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/various/Person.java
Log:
HHH-3570: renaming versioned to audited
Copied: core/trunk/envers/src/main/java/org/hibernate/envers/AuditJoinTable.java (from rev 15455, core/trunk/envers/src/main/java/org/hibernate/envers/VersionsJoinTable.java)
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/AuditJoinTable.java (rev 0)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/AuditJoinTable.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -0,0 +1,59 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.envers;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import javax.persistence.JoinColumn;
+
+/**
+ * @author Adam Warski (adam at warski dot org)
+ */
+(a)Retention(RetentionPolicy.RUNTIME)
+(a)Target({ElementType.FIELD, ElementType.METHOD})
+public @interface AuditJoinTable {
+ /**
+ * @return Name of the join table. Defaults to a concatenation of the names of the primary table of the entity
+ * owning the association and of the primary table of the entity referenced by the association.
+ */
+ String name() default "";
+
+ /**
+ * @return The schema of the join table. Defaults to the schema of the entity owning the association.
+ */
+ String schema() default "";
+
+ /**
+ * @return The catalog of the join table. Defaults to the catalog of the entity owning the association.
+ */
+ String catalog() default "";
+
+ /**
+ * @return The foreign key columns of the join table which reference the primary table of the entity that does not
+ * own the association (i.e. the inverse side of the association).
+ */
+ JoinColumn[] inverseJoinColumns() default {};
+}
\ No newline at end of file
Copied: core/trunk/envers/src/main/java/org/hibernate/envers/AuditReader.java (from rev 15455, core/trunk/envers/src/main/java/org/hibernate/envers/VersionsReader.java)
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/AuditReader.java (rev 0)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/AuditReader.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -0,0 +1,110 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.envers;
+
+import java.util.Date;
+import java.util.List;
+
+import org.hibernate.envers.exception.NotVersionedException;
+import org.hibernate.envers.exception.RevisionDoesNotExistException;
+import org.hibernate.envers.query.VersionsQueryCreator;
+
+/**
+ * @author Adam Warski (adam at warski dot org)
+ */
+public interface AuditReader {
+ /**
+ * Find an entity by primary key at the given revision.
+ * @param cls Class of the entity.
+ * @param primaryKey Primary key of the entity.
+ * @param revision Revision in which to get the entity.
+ * @return The found entity instance at the given revision (its properties may be partially filled
+ * if not all properties are versioned) or null, if an entity with that id didn't exist at that
+ * revision.
+ * @throws IllegalArgumentException If cls or primaryKey is null or revision is less or equal to 0.
+ * @throws NotVersionedException When entities of the given class are not versioned.
+ * @throws IllegalStateException If the associated entity manager is closed.
+ */
+ <T> T find(Class<T> cls, Object primaryKey, Number revision) throws
+ IllegalArgumentException, NotVersionedException, IllegalStateException;
+
+ /**
+ * Get a list of revision numbers, at which an entity was modified.
+ * @param cls Class of the entity.
+ * @param primaryKey Primary key of the entity.
+ * @return A list of revision numbers, at which the entity was modified, sorted in ascending order (so older
+ * revisions come first).
+ * @throws NotVersionedException When entities of the given class are not versioned.
+ * @throws IllegalArgumentException If cls or primaryKey is null.
+ * @throws IllegalStateException If the associated entity manager is closed.
+ */
+ List<Number> getRevisions(Class<?> cls, Object primaryKey)
+ throws IllegalArgumentException, NotVersionedException, IllegalStateException;
+
+ /**
+ * Get the date, at which a revision was created.
+ * @param revision Number of the revision for which to get the date.
+ * @return Date of commiting the given revision.
+ * @throws IllegalArgumentException If revision is less or equal to 0.
+ * @throws RevisionDoesNotExistException If the revision does not exist.
+ * @throws IllegalStateException If the associated entity manager is closed.
+ */
+ Date getRevisionDate(Number revision) throws IllegalArgumentException, RevisionDoesNotExistException,
+ IllegalStateException;
+
+ /**
+ * Gets the revision number, that corresponds to the given date. More precisely, returns
+ * the number of the highest revision, which was created on or before the given date. So:
+ * <code>getRevisionDate(getRevisionNumberForDate(date)) <= date</code> and
+ * <code>getRevisionDate(getRevisionNumberForDate(date)+1) > date</code>.
+ * @param date Date for which to get the revision.
+ * @return Revision number corresponding to the given date.
+ * @throws IllegalStateException If the associated entity manager is closed.
+ * @throws RevisionDoesNotExistException If the given date is before the first revision.
+ * @throws IllegalArgumentException If <code>date</code> is <code>null</code>.
+ */
+ Number getRevisionNumberForDate(Date date) throws IllegalStateException, RevisionDoesNotExistException,
+ IllegalArgumentException;
+
+ /**
+ * A helper method; should be used only if a custom revision entity is used. See also {@link RevisionEntity}.
+ * @param revisionEntityClass Class of the revision entity. Should be annotated with {@link RevisionEntity}.
+ * @param revision Number of the revision for which to get the data.
+ * @return Entity containing data for the given revision.
+ * @throws IllegalArgumentException If revision is less or equal to 0 or if the class of the revision entity
+ * is invalid.
+ * @throws RevisionDoesNotExistException If the revision does not exist.
+ * @throws IllegalStateException If the associated entity manager is closed.
+ */
+ <T> T findRevision(Class<T> revisionEntityClass, Number revision) throws IllegalArgumentException,
+ RevisionDoesNotExistException, IllegalStateException;
+
+ /**
+ *
+ * @return A query creator, associated with this VersionsReader instance, with which queries can be
+ * created and later executed. Shouldn't be used after the associated Session or EntityManager
+ * is closed.
+ */
+ VersionsQueryCreator createQuery();
+}
Copied: core/trunk/envers/src/main/java/org/hibernate/envers/AuditReaderFactory.java (from rev 15455, core/trunk/envers/src/main/java/org/hibernate/envers/VersionsReaderFactory.java)
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/AuditReaderFactory.java (rev 0)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/AuditReaderFactory.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -0,0 +1,93 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.envers;
+
+import javax.persistence.EntityManager;
+
+import org.hibernate.envers.event.VersionsEventListener;
+import org.hibernate.envers.exception.VersionsException;
+import org.hibernate.envers.reader.VersionsReaderImpl;
+import static org.hibernate.envers.tools.ArraysTools.arrayIncludesInstanceOf;
+
+import org.hibernate.Session;
+import org.hibernate.engine.SessionImplementor;
+import org.hibernate.event.EventListeners;
+import org.hibernate.event.PostInsertEventListener;
+
+/**
+ * @author Adam Warski (adam at warski dot org)
+ */
+public class AuditReaderFactory {
+ private AuditReaderFactory() { }
+
+ /**
+ * Create a versions reader associated with an open session.
+ * <b>WARNING:</b> Using Envers with Hibernate (not with Hibernate Entity Manager/JPA) is experimental,
+ * if possible, use {@link AuditReaderFactory#get(javax.persistence.EntityManager)}.
+ * @param session An open session.
+ * @return A versions reader associated with the given sesison. It shouldn't be used
+ * after the session is closed.
+ * @throws VersionsException When the given required listeners aren't installed.
+ */
+ public static AuditReader get(Session session) throws VersionsException {
+ SessionImplementor sessionImpl = (SessionImplementor) session;
+
+ EventListeners listeners = sessionImpl.getListeners();
+
+ for (PostInsertEventListener listener : listeners.getPostInsertEventListeners()) {
+ if (listener instanceof VersionsEventListener) {
+ if (arrayIncludesInstanceOf(listeners.getPostUpdateEventListeners(), VersionsEventListener.class) &&
+ arrayIncludesInstanceOf(listeners.getPostDeleteEventListeners(), VersionsEventListener.class)) {
+ return new VersionsReaderImpl(((VersionsEventListener) listener).getVerCfg(), session,
+ sessionImpl);
+ }
+ }
+ }
+
+ throw new VersionsException("You need install the org.hibernate.envers.event.VersionsEventListener " +
+ "class as post insert, update and delete event listener.");
+ }
+
+ /**
+ * Create a versions reader associated with an open entity manager.
+ * @param entityManager An open entity manager.
+ * @return A versions reader associated with the given entity manager. It shouldn't be used
+ * after the entity manager is closed.
+ * @throws VersionsException When the given entity manager is not based on Hibernate, or if the required
+ * listeners aren't installed.
+ */
+ public static AuditReader get(EntityManager entityManager) throws VersionsException {
+ if (entityManager.getDelegate() instanceof Session) {
+ return get((Session) entityManager.getDelegate());
+ }
+
+ if (entityManager.getDelegate() instanceof EntityManager) {
+ if (entityManager.getDelegate() instanceof Session) {
+ return get((Session) entityManager.getDelegate());
+ }
+ }
+
+ throw new VersionsException("Hibernate EntityManager not present!");
+ }
+}
Copied: core/trunk/envers/src/main/java/org/hibernate/envers/AuditTable.java (from rev 15455, core/trunk/envers/src/main/java/org/hibernate/envers/VersionsTable.java)
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/AuditTable.java (rev 0)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/AuditTable.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -0,0 +1,48 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.envers;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * @author Adam Warski (adam at warski dot org)
+ */
+(a)Retention(RetentionPolicy.RUNTIME)
+(a)Target(ElementType.TYPE)
+public @interface AuditTable {
+ String value();
+
+ /**
+ * @return The schema of the table. Defaults to the schema of the annotated entity.
+ */
+ String schema() default "";
+
+ /**
+ * @return The catalog of the table. Defaults to the catalog of the annotated entity.
+ */
+ String catalog() default "";
+}
Copied: core/trunk/envers/src/main/java/org/hibernate/envers/Audited.java (from rev 15455, core/trunk/envers/src/main/java/org/hibernate/envers/Versioned.java)
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/Audited.java (rev 0)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/Audited.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -0,0 +1,40 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.envers;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * When applied to a class, indicates that all of its properties should be versioned.
+ * When applied to a field, indicates that this field should be versioned.
+ * @author Adam Warski (adam at warski dot org)
+ */
+(a)Retention(RetentionPolicy.RUNTIME)
+(a)Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD})
+public @interface Audited {
+ ModificationStore modStore() default ModificationStore.FULL;
+}
Copied: core/trunk/envers/src/main/java/org/hibernate/envers/NotAudited.java (from rev 15455, core/trunk/envers/src/main/java/org/hibernate/envers/Unversioned.java)
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/NotAudited.java (rev 0)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/NotAudited.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -0,0 +1,39 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.envers;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * When applied to a field, indicates that this field should not be versioned.
+ * @author Sebastian Komander
+ */
+(a)Retention(RetentionPolicy.RUNTIME)
+(a)Target({ElementType.METHOD, ElementType.FIELD})
+public @interface NotAudited {
+
+}
Copied: core/trunk/envers/src/main/java/org/hibernate/envers/SecondaryAuditTable.java (from rev 15455, core/trunk/envers/src/main/java/org/hibernate/envers/SecondaryVersionsTable.java)
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/SecondaryAuditTable.java (rev 0)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/SecondaryAuditTable.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -0,0 +1,40 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.envers;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * @author Adam Warski (adam at warski dot org)
+ */
+(a)Target(ElementType.TYPE)
+(a)Retention(RetentionPolicy.RUNTIME)
+public @interface SecondaryAuditTable {
+ String secondaryTableName();
+
+ String secondaryVersionsTableName();
+}
Copied: core/trunk/envers/src/main/java/org/hibernate/envers/SecondaryAuditTables.java (from rev 15455, core/trunk/envers/src/main/java/org/hibernate/envers/SecondaryVersionsTables.java)
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/SecondaryAuditTables.java (rev 0)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/SecondaryAuditTables.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -0,0 +1,38 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.envers;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * @author Adam Warski (adam at warski dot org)
+ */
+(a)Target(ElementType.TYPE)
+(a)Retention(RetentionPolicy.RUNTIME)
+public @interface SecondaryAuditTables {
+ SecondaryAuditTable[] value();
+}
Deleted: core/trunk/envers/src/main/java/org/hibernate/envers/SecondaryVersionsTable.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/SecondaryVersionsTable.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/SecondaryVersionsTable.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -1,40 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.envers;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * @author Adam Warski (adam at warski dot org)
- */
-(a)Target(ElementType.TYPE)
-(a)Retention(RetentionPolicy.RUNTIME)
-public @interface SecondaryVersionsTable {
- String secondaryTableName();
-
- String secondaryVersionsTableName();
-}
Deleted: core/trunk/envers/src/main/java/org/hibernate/envers/SecondaryVersionsTables.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/SecondaryVersionsTables.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/SecondaryVersionsTables.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -1,38 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.envers;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * @author Adam Warski (adam at warski dot org)
- */
-(a)Target(ElementType.TYPE)
-(a)Retention(RetentionPolicy.RUNTIME)
-public @interface SecondaryVersionsTables {
- SecondaryVersionsTable[] value();
-}
Deleted: core/trunk/envers/src/main/java/org/hibernate/envers/Unversioned.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/Unversioned.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/Unversioned.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -1,39 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.envers;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * When applied to a field, indicates that this field should not be versioned.
- * @author Sebastian Komander
- */
-(a)Retention(RetentionPolicy.RUNTIME)
-(a)Target({ElementType.METHOD, ElementType.FIELD})
-public @interface Unversioned {
-
-}
Deleted: core/trunk/envers/src/main/java/org/hibernate/envers/Versioned.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/Versioned.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/Versioned.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -1,40 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.envers;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * When applied to a class, indicates that all of its properties should be versioned.
- * When applied to a field, indicates that this field should be versioned.
- * @author Adam Warski (adam at warski dot org)
- */
-(a)Retention(RetentionPolicy.RUNTIME)
-(a)Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD})
-public @interface Versioned {
- ModificationStore modStore() default ModificationStore.FULL;
-}
Deleted: core/trunk/envers/src/main/java/org/hibernate/envers/VersionsJoinTable.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/VersionsJoinTable.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/VersionsJoinTable.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -1,59 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.envers;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-import javax.persistence.JoinColumn;
-
-/**
- * @author Adam Warski (adam at warski dot org)
- */
-(a)Retention(RetentionPolicy.RUNTIME)
-(a)Target({ElementType.FIELD, ElementType.METHOD})
-public @interface VersionsJoinTable {
- /**
- * @return Name of the join table. Defaults to a concatenation of the names of the primary table of the entity
- * owning the association and of the primary table of the entity referenced by the association.
- */
- String name() default "";
-
- /**
- * @return The schema of the join table. Defaults to the schema of the entity owning the association.
- */
- String schema() default "";
-
- /**
- * @return The catalog of the join table. Defaults to the catalog of the entity owning the association.
- */
- String catalog() default "";
-
- /**
- * @return The foreign key columns of the join table which reference the primary table of the entity that does not
- * own the association (i.e. the inverse side of the association).
- */
- JoinColumn[] inverseJoinColumns() default {};
-}
\ No newline at end of file
Deleted: core/trunk/envers/src/main/java/org/hibernate/envers/VersionsReader.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/VersionsReader.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/VersionsReader.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -1,110 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.envers;
-
-import java.util.Date;
-import java.util.List;
-
-import org.hibernate.envers.exception.NotVersionedException;
-import org.hibernate.envers.exception.RevisionDoesNotExistException;
-import org.hibernate.envers.query.VersionsQueryCreator;
-
-/**
- * @author Adam Warski (adam at warski dot org)
- */
-public interface VersionsReader {
- /**
- * Find an entity by primary key at the given revision.
- * @param cls Class of the entity.
- * @param primaryKey Primary key of the entity.
- * @param revision Revision in which to get the entity.
- * @return The found entity instance at the given revision (its properties may be partially filled
- * if not all properties are versioned) or null, if an entity with that id didn't exist at that
- * revision.
- * @throws IllegalArgumentException If cls or primaryKey is null or revision is less or equal to 0.
- * @throws NotVersionedException When entities of the given class are not versioned.
- * @throws IllegalStateException If the associated entity manager is closed.
- */
- <T> T find(Class<T> cls, Object primaryKey, Number revision) throws
- IllegalArgumentException, NotVersionedException, IllegalStateException;
-
- /**
- * Get a list of revision numbers, at which an entity was modified.
- * @param cls Class of the entity.
- * @param primaryKey Primary key of the entity.
- * @return A list of revision numbers, at which the entity was modified, sorted in ascending order (so older
- * revisions come first).
- * @throws NotVersionedException When entities of the given class are not versioned.
- * @throws IllegalArgumentException If cls or primaryKey is null.
- * @throws IllegalStateException If the associated entity manager is closed.
- */
- List<Number> getRevisions(Class<?> cls, Object primaryKey)
- throws IllegalArgumentException, NotVersionedException, IllegalStateException;
-
- /**
- * Get the date, at which a revision was created.
- * @param revision Number of the revision for which to get the date.
- * @return Date of commiting the given revision.
- * @throws IllegalArgumentException If revision is less or equal to 0.
- * @throws RevisionDoesNotExistException If the revision does not exist.
- * @throws IllegalStateException If the associated entity manager is closed.
- */
- Date getRevisionDate(Number revision) throws IllegalArgumentException, RevisionDoesNotExistException,
- IllegalStateException;
-
- /**
- * Gets the revision number, that corresponds to the given date. More precisely, returns
- * the number of the highest revision, which was created on or before the given date. So:
- * <code>getRevisionDate(getRevisionNumberForDate(date)) <= date</code> and
- * <code>getRevisionDate(getRevisionNumberForDate(date)+1) > date</code>.
- * @param date Date for which to get the revision.
- * @return Revision number corresponding to the given date.
- * @throws IllegalStateException If the associated entity manager is closed.
- * @throws RevisionDoesNotExistException If the given date is before the first revision.
- * @throws IllegalArgumentException If <code>date</code> is <code>null</code>.
- */
- Number getRevisionNumberForDate(Date date) throws IllegalStateException, RevisionDoesNotExistException,
- IllegalArgumentException;
-
- /**
- * A helper method; should be used only if a custom revision entity is used. See also {@link RevisionEntity}.
- * @param revisionEntityClass Class of the revision entity. Should be annotated with {@link RevisionEntity}.
- * @param revision Number of the revision for which to get the data.
- * @return Entity containing data for the given revision.
- * @throws IllegalArgumentException If revision is less or equal to 0 or if the class of the revision entity
- * is invalid.
- * @throws RevisionDoesNotExistException If the revision does not exist.
- * @throws IllegalStateException If the associated entity manager is closed.
- */
- <T> T findRevision(Class<T> revisionEntityClass, Number revision) throws IllegalArgumentException,
- RevisionDoesNotExistException, IllegalStateException;
-
- /**
- *
- * @return A query creator, associated with this VersionsReader instance, with which queries can be
- * created and later executed. Shouldn't be used after the associated Session or EntityManager
- * is closed.
- */
- VersionsQueryCreator createQuery();
-}
Deleted: core/trunk/envers/src/main/java/org/hibernate/envers/VersionsReaderFactory.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/VersionsReaderFactory.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/VersionsReaderFactory.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -1,93 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.envers;
-
-import javax.persistence.EntityManager;
-
-import org.hibernate.envers.event.VersionsEventListener;
-import org.hibernate.envers.exception.VersionsException;
-import org.hibernate.envers.reader.VersionsReaderImpl;
-import static org.hibernate.envers.tools.ArraysTools.arrayIncludesInstanceOf;
-
-import org.hibernate.Session;
-import org.hibernate.engine.SessionImplementor;
-import org.hibernate.event.EventListeners;
-import org.hibernate.event.PostInsertEventListener;
-
-/**
- * @author Adam Warski (adam at warski dot org)
- */
-public class VersionsReaderFactory {
- private VersionsReaderFactory() { }
-
- /**
- * Create a versions reader associated with an open session.
- * <b>WARNING:</b> Using Envers with Hibernate (not with Hibernate Entity Manager/JPA) is experimental,
- * if possible, use {@link org.hibernate.envers.VersionsReaderFactory#get(javax.persistence.EntityManager)}.
- * @param session An open session.
- * @return A versions reader associated with the given sesison. It shouldn't be used
- * after the session is closed.
- * @throws VersionsException When the given required listeners aren't installed.
- */
- public static VersionsReader get(Session session) throws VersionsException {
- SessionImplementor sessionImpl = (SessionImplementor) session;
-
- EventListeners listeners = sessionImpl.getListeners();
-
- for (PostInsertEventListener listener : listeners.getPostInsertEventListeners()) {
- if (listener instanceof VersionsEventListener) {
- if (arrayIncludesInstanceOf(listeners.getPostUpdateEventListeners(), VersionsEventListener.class) &&
- arrayIncludesInstanceOf(listeners.getPostDeleteEventListeners(), VersionsEventListener.class)) {
- return new VersionsReaderImpl(((VersionsEventListener) listener).getVerCfg(), session,
- sessionImpl);
- }
- }
- }
-
- throw new VersionsException("You need install the org.hibernate.envers.event.VersionsEventListener " +
- "class as post insert, update and delete event listener.");
- }
-
- /**
- * Create a versions reader associated with an open entity manager.
- * @param entityManager An open entity manager.
- * @return A versions reader associated with the given entity manager. It shouldn't be used
- * after the entity manager is closed.
- * @throws VersionsException When the given entity manager is not based on Hibernate, or if the required
- * listeners aren't installed.
- */
- public static VersionsReader get(EntityManager entityManager) throws VersionsException {
- if (entityManager.getDelegate() instanceof Session) {
- return get((Session) entityManager.getDelegate());
- }
-
- if (entityManager.getDelegate() instanceof EntityManager) {
- if (entityManager.getDelegate() instanceof Session) {
- return get((Session) entityManager.getDelegate());
- }
- }
-
- throw new VersionsException("Hibernate EntityManager not present!");
- }
-}
Deleted: core/trunk/envers/src/main/java/org/hibernate/envers/VersionsTable.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/VersionsTable.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/VersionsTable.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -1,48 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.envers;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * @author Adam Warski (adam at warski dot org)
- */
-(a)Retention(RetentionPolicy.RUNTIME)
-(a)Target(ElementType.TYPE)
-public @interface VersionsTable {
- String value();
-
- /**
- * @return The schema of the table. Defaults to the schema of the annotated entity.
- */
- String schema() default "";
-
- /**
- * @return The catalog of the table. Defaults to the catalog of the annotated entity.
- */
- String catalog() default "";
-}
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/configuration/RevisionInfoConfiguration.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/configuration/RevisionInfoConfiguration.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/configuration/RevisionInfoConfiguration.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -28,12 +28,8 @@
import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
-import org.hibernate.envers.DefaultRevisionEntity;
-import org.hibernate.envers.RevisionEntity;
-import org.hibernate.envers.RevisionListener;
-import org.hibernate.envers.RevisionNumber;
-import org.hibernate.envers.RevisionTimestamp;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
+import org.hibernate.envers.*;
import org.hibernate.envers.configuration.metadata.MetadataTools;
import org.hibernate.envers.revisioninfo.DefaultRevisionInfoGenerator;
import org.hibernate.envers.revisioninfo.RevisionInfoGenerator;
@@ -181,7 +177,7 @@
}
// Checking if custom revision entity isn't versioned
- if (clazz.getAnnotation(Versioned.class) != null) {
+ if (clazz.getAnnotation(Audited.class) != null) {
throw new MappingException("An entity annotated with @RevisionEntity cannot be versioned!");
}
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/AnnotationsMetadataReader.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/AnnotationsMetadataReader.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/AnnotationsMetadataReader.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -27,12 +27,8 @@
import javax.persistence.MapKey;
import javax.persistence.Version;
-import org.hibernate.envers.SecondaryVersionsTable;
-import org.hibernate.envers.SecondaryVersionsTables;
-import org.hibernate.envers.Unversioned;
-import org.hibernate.envers.Versioned;
-import org.hibernate.envers.VersionsJoinTable;
-import org.hibernate.envers.VersionsTable;
+import org.hibernate.envers.SecondaryAuditTable;
+import org.hibernate.envers.*;
import org.hibernate.envers.configuration.GlobalConfiguration;
import org.hibernate.envers.tools.reflection.YClass;
import org.hibernate.envers.tools.reflection.YProperty;
@@ -67,7 +63,7 @@
}
private void addPropertyVersioned(YProperty property) {
- Versioned ver = property.getAnnotation(Versioned.class);
+ Audited ver = property.getAnnotation(Audited.class);
if (ver != null) {
versioningData.propertyStoreInfo.propertyStores.put(property.getName(), ver.modStore());
}
@@ -83,7 +79,7 @@
private void addPropertyUnversioned(YProperty property) {
// check if a property is declared as unversioned to exclude it
// useful if a class is versioned but some properties should be excluded
- Unversioned unVer = property.getAnnotation(Unversioned.class);
+ NotAudited unVer = property.getAnnotation(NotAudited.class);
if (unVer != null) {
versioningData.unversionedProperties.add(property.getName());
} else {
@@ -99,7 +95,7 @@
}
private void addPropertyJoinTables(YProperty property) {
- VersionsJoinTable joinTable = property.getAnnotation(VersionsJoinTable.class);
+ AuditJoinTable joinTable = property.getAnnotation(AuditJoinTable.class);
if (joinTable != null) {
versioningData.versionsJoinTables.put(property.getName(), joinTable);
}
@@ -125,7 +121,7 @@
}
private void addDefaultVersioned(YClass clazz) {
- Versioned defaultVersioned = clazz.getAnnotation(Versioned.class);
+ Audited defaultVersioned = clazz.getAnnotation(Audited.class);
if (defaultVersioned != null) {
versioningData.propertyStoreInfo.defaultStore = defaultVersioned.modStore();
@@ -133,7 +129,7 @@
}
private void addVersionsTable(YClass clazz) {
- VersionsTable versionsTable = clazz.getAnnotation(VersionsTable.class);
+ AuditTable versionsTable = clazz.getAnnotation(AuditTable.class);
if (versionsTable != null) {
versioningData.versionsTable = versionsTable;
} else {
@@ -143,15 +139,15 @@
private void addVersionsSecondaryTables(YClass clazz) {
// Getting information on secondary tables
- SecondaryVersionsTable secondaryVersionsTable1 = clazz.getAnnotation(SecondaryVersionsTable.class);
+ SecondaryAuditTable secondaryVersionsTable1 = clazz.getAnnotation(SecondaryAuditTable.class);
if (secondaryVersionsTable1 != null) {
versioningData.secondaryTableDictionary.put(secondaryVersionsTable1.secondaryTableName(),
secondaryVersionsTable1.secondaryVersionsTableName());
}
- SecondaryVersionsTables secondaryVersionsTables = clazz.getAnnotation(SecondaryVersionsTables.class);
+ SecondaryAuditTables secondaryVersionsTables = clazz.getAnnotation(SecondaryAuditTables.class);
if (secondaryVersionsTables != null) {
- for (SecondaryVersionsTable secondaryVersionsTable2 : secondaryVersionsTables.value()) {
+ for (SecondaryAuditTable secondaryVersionsTable2 : secondaryVersionsTables.value()) {
versioningData.secondaryTableDictionary.put(secondaryVersionsTable2.secondaryTableName(),
secondaryVersionsTable2.secondaryVersionsTableName());
}
@@ -177,8 +173,8 @@
return versioningData;
}
- private VersionsTable getDefaultVersionsTable() {
- return new VersionsTable() {
+ private AuditTable getDefaultVersionsTable() {
+ return new AuditTable() {
public String value() { return ""; }
public String schema() { return ""; }
public String catalog() { return ""; }
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/CollectionMetadataGenerator.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/CollectionMetadataGenerator.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/CollectionMetadataGenerator.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -37,7 +37,7 @@
import org.dom4j.Element;
import org.hibernate.envers.ModificationStore;
-import org.hibernate.envers.VersionsJoinTable;
+import org.hibernate.envers.AuditJoinTable;
import org.hibernate.envers.entities.EntityConfiguration;
import org.hibernate.envers.entities.IdMappingData;
import org.hibernate.envers.entities.mapper.CompositeMapperBuilder;
@@ -91,7 +91,7 @@
private final CompositeMapperBuilder currentMapper;
private final String referencingEntityName;
private final EntityXmlMappingData xmlMappingData;
- private final VersionsJoinTable joinTable;
+ private final AuditJoinTable joinTable;
private final String mapKey;
private final EntityConfiguration referencingEntityConfiguration;
@@ -116,7 +116,7 @@
public CollectionMetadataGenerator(VersionsMetadataGenerator mainGenerator, String propertyName,
Collection propertyValue, CompositeMapperBuilder currentMapper,
String referencingEntityName, EntityXmlMappingData xmlMappingData,
- VersionsJoinTable joinTable, String mapKey) {
+ AuditJoinTable joinTable, String mapKey) {
this.mainGenerator = mainGenerator;
this.propertyName = propertyName;
this.propertyValue = propertyValue;
@@ -474,8 +474,8 @@
return middleEntityXmlId;
}
- private VersionsJoinTable getDefaultVersionsJoinTable() {
- return new VersionsJoinTable() {
+ private AuditJoinTable getDefaultVersionsJoinTable() {
+ return new AuditJoinTable() {
public String name() { return ""; }
public String schema() { return ""; }
public String catalog() { return ""; }
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/PersistentClassVersioningData.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/PersistentClassVersioningData.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/PersistentClassVersioningData.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -29,8 +29,8 @@
import java.util.Map;
import org.hibernate.envers.ModificationStore;
-import org.hibernate.envers.VersionsJoinTable;
-import org.hibernate.envers.VersionsTable;
+import org.hibernate.envers.AuditJoinTable;
+import org.hibernate.envers.AuditTable;
/**
* @author Adam Warski (adam at warski dot org)
@@ -41,18 +41,18 @@
propertyStoreInfo = new PropertyStoreInfo(new HashMap<String, ModificationStore>());
secondaryTableDictionary = new HashMap<String, String>();
unversionedProperties = new ArrayList<String>();
- versionsJoinTables = new HashMap<String, VersionsJoinTable>();
+ versionsJoinTables = new HashMap<String, AuditJoinTable>();
mapKeys = new HashMap<String, String>();
}
public PropertyStoreInfo propertyStoreInfo;
- public VersionsTable versionsTable;
+ public AuditTable versionsTable;
public Map<String, String> secondaryTableDictionary;
public List<String> unversionedProperties;
/**
* A map from property names to custom join tables definitions.
*/
- public Map<String, VersionsJoinTable> versionsJoinTables;
+ public Map<String, AuditJoinTable> versionsJoinTables;
/**
* A map from property names to the value of the related property names in a map key annotation. An empty string,
* if the property name is not specified in the mapkey annotation.
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/VersionsMetadataGenerator.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/VersionsMetadataGenerator.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/VersionsMetadataGenerator.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -30,7 +30,7 @@
import org.dom4j.Element;
import org.hibernate.envers.ModificationStore;
-import org.hibernate.envers.VersionsJoinTable;
+import org.hibernate.envers.AuditJoinTable;
import org.hibernate.envers.configuration.GlobalConfiguration;
import org.hibernate.envers.configuration.VersionsEntitiesConfiguration;
import org.hibernate.envers.entities.EntityConfiguration;
@@ -132,7 +132,7 @@
@SuppressWarnings({"unchecked"})
void addValue(Element parent, String name, Value value, CompositeMapperBuilder currentMapper,
ModificationStore store, String entityName, EntityXmlMappingData xmlMappingData,
- VersionsJoinTable joinTable, String mapKey, boolean insertable, boolean firstPass) {
+ AuditJoinTable joinTable, String mapKey, boolean insertable, boolean firstPass) {
Type type = value.getType();
// only first pass
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/reader/VersionsReaderImplementor.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/reader/VersionsReaderImplementor.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/reader/VersionsReaderImplementor.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -23,7 +23,7 @@
*/
package org.hibernate.envers.reader;
-import org.hibernate.envers.VersionsReader;
+import org.hibernate.envers.AuditReader;
import org.hibernate.Session;
import org.hibernate.engine.SessionImplementor;
@@ -32,7 +32,7 @@
* An interface exposed by a VersionsReader to library-facing classes.
* @author Adam Warski (adam at warski dot org)
*/
-public interface VersionsReaderImplementor extends VersionsReader {
+public interface VersionsReaderImplementor extends AuditReader {
SessionImplementor getSessionImplementor();
Session getSession();
FirstLevelCache getFirstLevelCache();
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/AbstractEntityTest.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/AbstractEntityTest.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/AbstractEntityTest.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -27,8 +27,8 @@
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
-import org.hibernate.envers.VersionsReader;
-import org.hibernate.envers.VersionsReaderFactory;
+import org.hibernate.envers.AuditReader;
+import org.hibernate.envers.AuditReaderFactory;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
@@ -40,7 +40,7 @@
public abstract class AbstractEntityTest {
private EntityManagerFactory emf;
private EntityManager entityManager;
- private VersionsReader versionsReader;
+ private AuditReader versionsReader;
private Ejb3Configuration cfg;
public abstract void configure(Ejb3Configuration cfg);
@@ -52,7 +52,7 @@
}
entityManager = emf.createEntityManager();
- versionsReader = VersionsReaderFactory.get(entityManager);
+ versionsReader = AuditReaderFactory.get(entityManager);
}
@BeforeClass
@@ -69,7 +69,7 @@
return entityManager;
}
- public VersionsReader getVersionsReader() {
+ public AuditReader getVersionsReader() {
return versionsReader;
}
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/IntTestEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/IntTestEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/IntTestEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -27,7 +27,7 @@
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
/**
* @author Adam Warski (adam at warski dot org)
@@ -38,7 +38,7 @@
@GeneratedValue
private Integer id;
- @Versioned
+ @Audited
private Integer number;
public IntTestEntity() {
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/StrIntTestEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/StrIntTestEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/StrIntTestEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -27,7 +27,7 @@
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
/**
* @author Adam Warski (adam at warski dot org)
@@ -38,10 +38,10 @@
@GeneratedValue
private Integer id;
- @Versioned
+ @Audited
private String str1;
- @Versioned
+ @Audited
private Integer number;
public StrIntTestEntity() {
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/StrTestEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/StrTestEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/StrTestEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -27,7 +27,7 @@
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
/**
* @author Adam Warski (adam at warski dot org)
@@ -38,7 +38,7 @@
@GeneratedValue
private Integer id;
- @Versioned
+ @Audited
private String str;
public StrTestEntity() {
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/UnversionedEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/UnversionedEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/UnversionedEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -28,14 +28,14 @@
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
-import org.hibernate.envers.Unversioned;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.NotAudited;
+import org.hibernate.envers.Audited;
/**
* @author Adam Warski (adam at warski dot org)
*/
@Entity
-@Versioned
+@Audited
public class UnversionedEntity {
@Id
@GeneratedValue
@@ -45,7 +45,7 @@
private String data1;
@Basic
- @Unversioned
+ @NotAudited
private String data2;
public UnversionedEntity() {
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/collection/EnumSetEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/collection/EnumSetEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/collection/EnumSetEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -31,7 +31,7 @@
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
import org.hibernate.annotations.CollectionOfElements;
@@ -47,12 +47,12 @@
@GeneratedValue
private Integer id;
- @Versioned
+ @Audited
@CollectionOfElements
@Enumerated(EnumType.STRING)
private Set<E1> enums1;
- @Versioned
+ @Audited
@CollectionOfElements
@Enumerated(EnumType.ORDINAL)
private Set<E2> enums2;
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/collection/StringListEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/collection/StringListEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/collection/StringListEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -29,7 +29,7 @@
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
import org.hibernate.annotations.CollectionOfElements;
import org.hibernate.annotations.IndexColumn;
@@ -43,7 +43,7 @@
@GeneratedValue
private Integer id;
- @Versioned
+ @Audited
@CollectionOfElements
@IndexColumn(name = "list_index")
private List<String> strings;
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/collection/StringMapEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/collection/StringMapEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/collection/StringMapEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -29,7 +29,7 @@
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
import org.hibernate.annotations.CollectionOfElements;
@@ -42,7 +42,7 @@
@GeneratedValue
private Integer id;
- @Versioned
+ @Audited
@CollectionOfElements
private Map<String, String> strings;
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/collection/StringSetEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/collection/StringSetEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/collection/StringSetEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -29,7 +29,7 @@
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
import org.hibernate.annotations.CollectionOfElements;
@@ -42,7 +42,7 @@
@GeneratedValue
private Integer id;
- @Versioned
+ @Audited
@CollectionOfElements
private Set<String> strings;
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/components/ComponentTestEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/components/ComponentTestEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/components/ComponentTestEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -28,7 +28,7 @@
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
/**
* @author Adam Warski (adam at warski dot org)
@@ -40,7 +40,7 @@
private Integer id;
@Embedded
- @Versioned
+ @Audited
private Component1 comp1;
@Embedded
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/customtype/CompositeCustomTypeEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/customtype/CompositeCustomTypeEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/customtype/CompositeCustomTypeEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -28,7 +28,7 @@
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
import org.hibernate.annotations.Columns;
import org.hibernate.annotations.Type;
@@ -44,7 +44,7 @@
@GeneratedValue
private Integer id;
- @Versioned
+ @Audited
@Type(type = "comp")
@Columns(columns = { @Column(name = "str"), @Column(name = "num") })
private Component component;
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/customtype/ParametrizedCustomTypeEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/customtype/ParametrizedCustomTypeEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/customtype/ParametrizedCustomTypeEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -27,7 +27,7 @@
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
import org.hibernate.annotations.Parameter;
import org.hibernate.annotations.Type;
@@ -44,7 +44,7 @@
@GeneratedValue
private Integer id;
- @Versioned
+ @Audited
@Type(type = "param")
private String str;
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/ids/EmbIdTestEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/ids/EmbIdTestEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/ids/EmbIdTestEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -26,7 +26,7 @@
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
/**
* @author Adam Warski (adam at warski dot org)
@@ -36,7 +36,7 @@
@EmbeddedId
private EmbId id;
- @Versioned
+ @Audited
private String str1;
public EmbIdTestEntity() {
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/ids/MulIdTestEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/ids/MulIdTestEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/ids/MulIdTestEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -27,7 +27,7 @@
import javax.persistence.Id;
import javax.persistence.IdClass;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
/**
* @author Adam Warski (adam at warski dot org)
@@ -41,7 +41,7 @@
@Id
private Integer id2;
- @Versioned
+ @Audited
private String str1;
public MulIdTestEntity() {
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/manytomany/ListOwnedEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/manytomany/ListOwnedEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/manytomany/ListOwnedEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -28,7 +28,7 @@
import javax.persistence.Id;
import javax.persistence.ManyToMany;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
/**
* Many-to-many not-owning entity
@@ -39,10 +39,10 @@
@Id
private Integer id;
- @Versioned
+ @Audited
private String data;
- @Versioned
+ @Audited
@ManyToMany(mappedBy="references")
private List<ListOwningEntity> referencing;
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/manytomany/ListOwningEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/manytomany/ListOwningEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/manytomany/ListOwningEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -28,7 +28,7 @@
import javax.persistence.Id;
import javax.persistence.ManyToMany;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
/**
* Entity owning the many-to-many relation
@@ -39,10 +39,10 @@
@Id
private Integer id;
- @Versioned
+ @Audited
private String data;
- @Versioned
+ @Audited
@ManyToMany
private List<ListOwnedEntity> references;
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/manytomany/MapOwnedEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/manytomany/MapOwnedEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/manytomany/MapOwnedEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -28,7 +28,7 @@
import javax.persistence.Id;
import javax.persistence.ManyToMany;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
/**
* Many-to-many not-owning entity
@@ -39,10 +39,10 @@
@Id
private Integer id;
- @Versioned
+ @Audited
private String data;
- @Versioned
+ @Audited
@ManyToMany(mappedBy="references")
private Set<MapOwningEntity> referencing;
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/manytomany/MapOwningEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/manytomany/MapOwningEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/manytomany/MapOwningEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -29,7 +29,7 @@
import javax.persistence.Id;
import javax.persistence.ManyToMany;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
/**
* Entity owning the many-to-many relation
@@ -40,10 +40,10 @@
@Id
private Integer id;
- @Versioned
+ @Audited
private String data;
- @Versioned
+ @Audited
@ManyToMany
private Map<String, MapOwnedEntity> references = new HashMap<String, MapOwnedEntity>();
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/manytomany/SetOwnedEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/manytomany/SetOwnedEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/manytomany/SetOwnedEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -28,7 +28,7 @@
import javax.persistence.Id;
import javax.persistence.ManyToMany;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
/**
* Many-to-many not-owning entity
@@ -39,10 +39,10 @@
@Id
private Integer id;
- @Versioned
+ @Audited
private String data;
- @Versioned
+ @Audited
@ManyToMany(mappedBy="references")
private Set<SetOwningEntity> referencing;
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/manytomany/SetOwningEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/manytomany/SetOwningEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/manytomany/SetOwningEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -28,7 +28,7 @@
import javax.persistence.Id;
import javax.persistence.ManyToMany;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
/**
* Entity owning the many-to-many relation
@@ -39,10 +39,10 @@
@Id
private Integer id;
- @Versioned
+ @Audited
private String data;
- @Versioned
+ @Audited
@ManyToMany
private Set<SetOwnedEntity> references;
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/manytomany/unidirectional/ListUniEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/manytomany/unidirectional/ListUniEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/manytomany/unidirectional/ListUniEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -28,7 +28,7 @@
import javax.persistence.Id;
import javax.persistence.ManyToMany;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
import org.hibernate.envers.test.entities.StrTestEntity;
/**
@@ -40,10 +40,10 @@
@Id
private Integer id;
- @Versioned
+ @Audited
private String data;
- @Versioned
+ @Audited
@ManyToMany
private List<StrTestEntity> references;
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/manytomany/unidirectional/MapUniEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/manytomany/unidirectional/MapUniEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/manytomany/unidirectional/MapUniEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -28,7 +28,7 @@
import javax.persistence.Id;
import javax.persistence.ManyToMany;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
import org.hibernate.envers.test.entities.StrTestEntity;
/**
@@ -40,10 +40,10 @@
@Id
private Integer id;
- @Versioned
+ @Audited
private String data;
- @Versioned
+ @Audited
@ManyToMany
private Map<String, StrTestEntity> map;
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/manytomany/unidirectional/SetUniEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/manytomany/unidirectional/SetUniEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/manytomany/unidirectional/SetUniEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -28,7 +28,7 @@
import javax.persistence.Id;
import javax.persistence.ManyToMany;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
import org.hibernate.envers.test.entities.StrTestEntity;
/**
@@ -40,10 +40,10 @@
@Id
private Integer id;
- @Versioned
+ @Audited
private String data;
- @Versioned
+ @Audited
@ManyToMany
private Set<StrTestEntity> references;
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/onetomany/CollectionRefEdEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/onetomany/CollectionRefEdEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/onetomany/CollectionRefEdEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -28,7 +28,7 @@
import javax.persistence.Id;
import javax.persistence.OneToMany;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
/**
* ReferencEd entity
@@ -39,10 +39,10 @@
@Id
private Integer id;
- @Versioned
+ @Audited
private String data;
- @Versioned
+ @Audited
@OneToMany(mappedBy="reference")
private Collection<CollectionRefIngEntity> reffering;
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/onetomany/CollectionRefIngEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/onetomany/CollectionRefIngEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/onetomany/CollectionRefIngEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -27,7 +27,7 @@
import javax.persistence.Id;
import javax.persistence.ManyToOne;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
/**
* ReferencIng entity
@@ -38,10 +38,10 @@
@Id
private Integer id;
- @Versioned
+ @Audited
private String data;
- @Versioned
+ @Audited
@ManyToOne
private CollectionRefEdEntity reference;
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/onetomany/ListRefEdEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/onetomany/ListRefEdEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/onetomany/ListRefEdEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -28,7 +28,7 @@
import javax.persistence.Id;
import javax.persistence.OneToMany;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
/**
* ReferencEd entity
@@ -39,10 +39,10 @@
@Id
private Integer id;
- @Versioned
+ @Audited
private String data;
- @Versioned
+ @Audited
@OneToMany(mappedBy="reference")
private List<ListRefIngEntity> reffering;
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/onetomany/ListRefIngEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/onetomany/ListRefIngEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/onetomany/ListRefIngEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -27,7 +27,7 @@
import javax.persistence.Id;
import javax.persistence.ManyToOne;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
/**
* ReferencIng entity
@@ -38,10 +38,10 @@
@Id
private Integer id;
- @Versioned
+ @Audited
private String data;
- @Versioned
+ @Audited
@ManyToOne
private ListRefEdEntity reference;
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/onetomany/SetRefEdEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/onetomany/SetRefEdEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/onetomany/SetRefEdEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -28,7 +28,7 @@
import javax.persistence.Id;
import javax.persistence.OneToMany;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
/**
* ReferencEd entity
@@ -39,10 +39,10 @@
@Id
private Integer id;
- @Versioned
+ @Audited
private String data;
- @Versioned
+ @Audited
@OneToMany(mappedBy="reference")
private Set<SetRefIngEntity> reffering;
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/onetomany/SetRefIngEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/onetomany/SetRefIngEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/onetomany/SetRefIngEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -27,7 +27,7 @@
import javax.persistence.Id;
import javax.persistence.ManyToOne;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
/**
* ReferencIng entity
@@ -38,10 +38,10 @@
@Id
private Integer id;
- @Versioned
+ @Audited
private String data;
- @Versioned
+ @Audited
@ManyToOne
private SetRefEdEntity reference;
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/onetomany/detached/DoubleSetRefCollEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/onetomany/detached/DoubleSetRefCollEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/onetomany/detached/DoubleSetRefCollEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -29,7 +29,7 @@
import javax.persistence.JoinTable;
import javax.persistence.OneToMany;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
import org.hibernate.envers.test.entities.StrTestEntity;
/**
@@ -41,15 +41,15 @@
@Id
private Integer id;
- @Versioned
+ @Audited
private String data;
- @Versioned
+ @Audited
@OneToMany
@JoinTable(name = "DOUBLE_STR_1")
private Set<StrTestEntity> collection;
- @Versioned
+ @Audited
@OneToMany
@JoinTable(name = "DOUBLE_STR_2")
private Set<StrTestEntity> collection2;
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/onetomany/detached/ListRefCollEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/onetomany/detached/ListRefCollEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/onetomany/detached/ListRefCollEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -28,7 +28,7 @@
import javax.persistence.Id;
import javax.persistence.OneToMany;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
import org.hibernate.envers.test.entities.StrTestEntity;
/**
@@ -40,10 +40,10 @@
@Id
private Integer id;
- @Versioned
+ @Audited
private String data;
- @Versioned
+ @Audited
@OneToMany
private List<StrTestEntity> collection;
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/onetomany/detached/SetJoinColumnRefCollEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/onetomany/detached/SetJoinColumnRefCollEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/onetomany/detached/SetJoinColumnRefCollEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -29,7 +29,7 @@
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
import org.hibernate.envers.test.entities.StrTestEntity;
/**
@@ -41,10 +41,10 @@
@Id
private Integer id;
- @Versioned
+ @Audited
private String data;
- @Versioned
+ @Audited
@OneToMany
@JoinColumn(name = "SJCR_ID")
private Set<StrTestEntity> collection;
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/onetomany/detached/SetRefCollEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/onetomany/detached/SetRefCollEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/onetomany/detached/SetRefCollEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -28,7 +28,7 @@
import javax.persistence.Id;
import javax.persistence.OneToMany;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
import org.hibernate.envers.test.entities.StrTestEntity;
/**
@@ -40,10 +40,10 @@
@Id
private Integer id;
- @Versioned
+ @Audited
private String data;
- @Versioned
+ @Audited
@OneToMany
private Set<StrTestEntity> collection;
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/onetomany/detached/ids/SetRefCollEntityEmbId.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/onetomany/detached/ids/SetRefCollEntityEmbId.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/onetomany/detached/ids/SetRefCollEntityEmbId.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -28,7 +28,7 @@
import javax.persistence.Entity;
import javax.persistence.OneToMany;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
import org.hibernate.envers.test.entities.ids.EmbId;
import org.hibernate.envers.test.entities.ids.EmbIdTestEntity;
@@ -41,10 +41,10 @@
@EmbeddedId
private EmbId id;
- @Versioned
+ @Audited
private String data;
- @Versioned
+ @Audited
@OneToMany
private Set<EmbIdTestEntity> collection;
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/onetomany/detached/ids/SetRefCollEntityMulId.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/onetomany/detached/ids/SetRefCollEntityMulId.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/onetomany/detached/ids/SetRefCollEntityMulId.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -29,7 +29,7 @@
import javax.persistence.IdClass;
import javax.persistence.OneToMany;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
import org.hibernate.envers.test.entities.ids.MulId;
import org.hibernate.envers.test.entities.ids.MulIdTestEntity;
@@ -46,10 +46,10 @@
@Id
private Integer id2;
- @Versioned
+ @Audited
private String data;
- @Versioned
+ @Audited
@OneToMany
private Set<MulIdTestEntity> collection;
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/onetomany/ids/SetRefEdEmbIdEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/onetomany/ids/SetRefEdEmbIdEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/onetomany/ids/SetRefEdEmbIdEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -28,7 +28,7 @@
import javax.persistence.Entity;
import javax.persistence.OneToMany;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
import org.hibernate.envers.test.entities.ids.EmbId;
/**
@@ -40,10 +40,10 @@
@EmbeddedId
private EmbId id;
- @Versioned
+ @Audited
private String data;
- @Versioned
+ @Audited
@OneToMany(mappedBy="reference")
private Set<SetRefIngEmbIdEntity> reffering;
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/onetomany/ids/SetRefEdMulIdEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/onetomany/ids/SetRefEdMulIdEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/onetomany/ids/SetRefEdMulIdEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -29,7 +29,7 @@
import javax.persistence.IdClass;
import javax.persistence.OneToMany;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
import org.hibernate.envers.test.entities.ids.MulId;
/**
@@ -45,10 +45,10 @@
@Id
private Integer id2;
- @Versioned
+ @Audited
private String data;
- @Versioned
+ @Audited
@OneToMany(mappedBy="reference")
private Set<SetRefIngMulIdEntity> reffering;
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/onetomany/ids/SetRefIngEmbIdEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/onetomany/ids/SetRefIngEmbIdEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/onetomany/ids/SetRefIngEmbIdEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -27,7 +27,7 @@
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
import org.hibernate.envers.test.entities.ids.EmbId;
/**
@@ -39,10 +39,10 @@
@EmbeddedId
private EmbId id;
- @Versioned
+ @Audited
private String data;
- @Versioned
+ @Audited
@ManyToOne
private SetRefEdEmbIdEntity reference;
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/onetomany/ids/SetRefIngMulIdEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/onetomany/ids/SetRefIngMulIdEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/onetomany/ids/SetRefIngMulIdEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -28,7 +28,7 @@
import javax.persistence.IdClass;
import javax.persistence.ManyToOne;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
import org.hibernate.envers.test.entities.ids.MulId;
/**
@@ -44,10 +44,10 @@
@Id
private Integer id2;
- @Versioned
+ @Audited
private String data;
- @Versioned
+ @Audited
@ManyToOne
private SetRefEdMulIdEntity reference;
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/basic/BasicTestEntity1.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/basic/BasicTestEntity1.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/basic/BasicTestEntity1.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -27,7 +27,7 @@
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
/**
* @author Adam Warski (adam at warski dot org)
@@ -38,10 +38,10 @@
@GeneratedValue
private Integer id;
- @Versioned
+ @Audited
private String str1;
- @Versioned
+ @Audited
private long long1;
public BasicTestEntity1() {
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/basic/BasicTestEntity2.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/basic/BasicTestEntity2.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/basic/BasicTestEntity2.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -27,7 +27,7 @@
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
/**
* @author Adam Warski (adam at warski dot org)
@@ -38,7 +38,7 @@
@GeneratedValue
private Integer id;
- @Versioned
+ @Audited
private String str1;
private String str2;
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/basic/BasicTestEntity4.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/basic/BasicTestEntity4.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/basic/BasicTestEntity4.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -27,13 +27,13 @@
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
/**
* @author Adam Warski (adam at warski dot org)
*/
@Entity
-@Versioned
+@Audited
public class BasicTestEntity4 {
@Id
@GeneratedValue
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/collection/mapkey/ComponentMapKeyEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/collection/mapkey/ComponentMapKeyEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/collection/mapkey/ComponentMapKeyEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -31,7 +31,7 @@
import javax.persistence.ManyToMany;
import javax.persistence.MapKey;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
import org.hibernate.envers.test.entities.components.Component1;
import org.hibernate.envers.test.entities.components.ComponentTestEntity;
@@ -44,7 +44,7 @@
@GeneratedValue
private Integer id;
- @Versioned
+ @Audited
@ManyToMany
@MapKey(name = "comp1")
private Map<Component1, ComponentTestEntity> idmap;
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/collection/mapkey/IdMapKeyEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/collection/mapkey/IdMapKeyEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/collection/mapkey/IdMapKeyEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -31,7 +31,7 @@
import javax.persistence.ManyToMany;
import javax.persistence.MapKey;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
import org.hibernate.envers.test.entities.StrTestEntity;
/**
@@ -43,7 +43,7 @@
@GeneratedValue
private Integer id;
- @Versioned
+ @Audited
@ManyToMany
@MapKey
private Map<Integer, StrTestEntity> idmap;
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/data/DateTestEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/data/DateTestEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/data/DateTestEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -28,7 +28,7 @@
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
/**
* @author Adam Warski (adam at warski dot org)
@@ -39,7 +39,7 @@
@GeneratedValue
private Integer id;
- @Versioned
+ @Audited
private Date date;
public DateTestEntity() {
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/data/EnumTestEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/data/EnumTestEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/data/EnumTestEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -29,13 +29,13 @@
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
/**
* @author Adam Warski (adam at warski dot org)
*/
@Entity
-@Versioned
+@Audited
public class EnumTestEntity {
@Id
@GeneratedValue
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/data/LobTestEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/data/LobTestEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/data/LobTestEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -29,7 +29,7 @@
import javax.persistence.Id;
import javax.persistence.Lob;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
/**
* @author Adam Warski (adam at warski dot org)
@@ -41,15 +41,15 @@
private Integer id;
@Lob
- @Versioned
+ @Audited
private String stringLob;
@Lob
- @Versioned
+ @Audited
private byte[] byteLob;
@Lob
- @Versioned
+ @Audited
private char[] charLob;
public LobTestEntity() {
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/data/SerializableTestEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/data/SerializableTestEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/data/SerializableTestEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -27,7 +27,7 @@
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
/**
* @author Adam Warski (adam at warski dot org)
@@ -38,7 +38,7 @@
@GeneratedValue
private Integer id;
- @Versioned
+ @Audited
private SerObject obj;
public SerializableTestEntity() {
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/single/ChildEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/single/ChildEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/single/ChildEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -27,14 +27,14 @@
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
/**
* @author Adam Warski (adam at warski dot org)
*/
@Entity
@DiscriminatorValue("2")
-@Versioned
+@Audited
public class ChildEntity extends ParentEntity {
@Basic
private Long number;
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/single/ParentEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/single/ParentEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/single/ParentEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -33,7 +33,7 @@
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
/**
* @author Adam Warski (adam at warski dot org)
@@ -42,7 +42,7 @@
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name = "discriminator", discriminatorType = DiscriminatorType.INTEGER)
@DiscriminatorValue("1")
-@Versioned
+@Audited
public class ParentEntity {
@Id
@GeneratedValue
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/single/childrelation/ChildIngEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/single/childrelation/ChildIngEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/single/childrelation/ChildIngEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -28,14 +28,14 @@
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
/**
* @author Adam Warski (adam at warski dot org)
*/
@Entity
@DiscriminatorValue("2")
-@Versioned
+@Audited
public class ChildIngEntity extends ParentNotIngEntity {
@Basic
private Long number;
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/single/childrelation/ParentNotIngEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/single/childrelation/ParentNotIngEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/single/childrelation/ParentNotIngEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -33,7 +33,7 @@
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
/**
* @author Adam Warski (adam at warski dot org)
@@ -42,7 +42,7 @@
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name = "discriminator", discriminatorType = DiscriminatorType.INTEGER)
@DiscriminatorValue("1")
-@Versioned
+@Audited
public class ParentNotIngEntity {
@Id
@GeneratedValue
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/single/childrelation/ReferencedEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/single/childrelation/ReferencedEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/single/childrelation/ReferencedEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -29,13 +29,13 @@
import javax.persistence.Id;
import javax.persistence.OneToMany;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
/**
* @author Adam Warski (adam at warski dot org)
*/
@Entity
-@Versioned
+@Audited
public class ReferencedEntity {
@Id
@GeneratedValue
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/single/relation/ChildIngEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/single/relation/ChildIngEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/single/relation/ChildIngEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -27,14 +27,14 @@
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
/**
* @author Adam Warski (adam at warski dot org)
*/
@Entity
@DiscriminatorValue("2")
-@Versioned
+@Audited
public class ChildIngEntity extends ParentIngEntity {
@Basic
private Long number;
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/single/relation/ParentIngEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/single/relation/ParentIngEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/single/relation/ParentIngEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -34,7 +34,7 @@
import javax.persistence.InheritanceType;
import javax.persistence.ManyToOne;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
/**
* @author Adam Warski (adam at warski dot org)
@@ -43,7 +43,7 @@
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name = "discriminator", discriminatorType = DiscriminatorType.INTEGER)
@DiscriminatorValue("1")
-@Versioned
+@Audited
public class ParentIngEntity {
@Id
@GeneratedValue
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/single/relation/ReferencedEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/single/relation/ReferencedEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/single/relation/ReferencedEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -29,13 +29,13 @@
import javax.persistence.Id;
import javax.persistence.OneToMany;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
/**
* @author Adam Warski (adam at warski dot org)
*/
@Entity
-@Versioned
+@Audited
public class ReferencedEntity {
@Id
@GeneratedValue
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/manytomany/ternary/TernaryMapEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/manytomany/ternary/TernaryMapEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/manytomany/ternary/TernaryMapEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -30,7 +30,7 @@
import javax.persistence.Id;
import javax.persistence.ManyToMany;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
import org.hibernate.envers.test.entities.IntTestEntity;
import org.hibernate.envers.test.entities.StrTestEntity;
@@ -45,7 +45,7 @@
@GeneratedValue
private Integer id;
- @Versioned
+ @Audited
@ManyToMany
@MapKeyManyToMany
private Map<IntTestEntity, StrTestEntity> map;
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/naming/DetachedNamingTestEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/naming/DetachedNamingTestEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/naming/DetachedNamingTestEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -30,7 +30,7 @@
import javax.persistence.JoinTable;
import javax.persistence.OneToMany;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
import org.hibernate.envers.test.entities.StrTestEntity;
/**
@@ -41,10 +41,10 @@
@Id
private Integer id;
- @Versioned
+ @Audited
private String data;
- @Versioned
+ @Audited
@OneToMany
@JoinTable(name = "UNI_NAMING_TEST",
joinColumns = @JoinColumn(name = "ID_1"),
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/naming/JoinNamingRefEdEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/naming/JoinNamingRefEdEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/naming/JoinNamingRefEdEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -30,7 +30,7 @@
import javax.persistence.Id;
import javax.persistence.OneToMany;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
/**
* ReferencEd entity
@@ -43,10 +43,10 @@
@Column(name = "jnree_id")
private Integer id;
- @Versioned
+ @Audited
private String data;
- @Versioned
+ @Audited
@OneToMany(mappedBy="reference")
private List<JoinNamingRefIngEntity> reffering;
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/naming/JoinNamingRefIngEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/naming/JoinNamingRefIngEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/naming/JoinNamingRefIngEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -30,7 +30,7 @@
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
/**
* ReferencIng entity
@@ -43,10 +43,10 @@
@Column(name = "jnrie_id")
private Integer id;
- @Versioned
+ @Audited
private String data;
- @Versioned
+ @Audited
@ManyToOne
@JoinColumn(name = "jnree_column_reference")
private JoinNamingRefEdEntity reference;
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/naming/NamingTestEntity1.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/naming/NamingTestEntity1.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/naming/NamingTestEntity1.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -29,15 +29,15 @@
import javax.persistence.Id;
import javax.persistence.Table;
-import org.hibernate.envers.Versioned;
-import org.hibernate.envers.VersionsTable;
+import org.hibernate.envers.Audited;
+import org.hibernate.envers.AuditTable;
/**
* @author Adam Warski (adam at warski dot org)
*/
@Entity
@Table(name="naming_test_entity_1")
-@VersionsTable("naming_test_entity_1_versions")
+@AuditTable("naming_test_entity_1_versions")
public class NamingTestEntity1 {
@Id
@GeneratedValue
@@ -45,7 +45,7 @@
private Integer id;
@Column(name = "nte_data")
- @Versioned
+ @Audited
private String data;
public NamingTestEntity1() {
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/naming/VersionsJoinTableTestEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/naming/VersionsJoinTableTestEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/naming/VersionsJoinTableTestEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -29,8 +29,8 @@
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
-import org.hibernate.envers.Versioned;
-import org.hibernate.envers.VersionsJoinTable;
+import org.hibernate.envers.Audited;
+import org.hibernate.envers.AuditJoinTable;
import org.hibernate.envers.test.entities.StrTestEntity;
/**
@@ -41,13 +41,13 @@
@Id
private Integer id;
- @Versioned
+ @Audited
private String data;
- @Versioned
+ @Audited
@OneToMany
@JoinColumn(name = "VJT_ID")
- @VersionsJoinTable(name = "VERSIONS_JOIN_TABLE_TEST", inverseJoinColumns = @JoinColumn(name = "STR_ID"))
+ @AuditJoinTable(name = "VERSIONS_JOIN_TABLE_TEST", inverseJoinColumns = @JoinColumn(name = "STR_ID"))
private Set<StrTestEntity> collection;
public VersionsJoinTableTestEntity() {
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/naming/ids/JoinEmbIdNamingRefEdEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/naming/ids/JoinEmbIdNamingRefEdEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/naming/ids/JoinEmbIdNamingRefEdEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -29,7 +29,7 @@
import javax.persistence.Id;
import javax.persistence.OneToMany;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
/**
* ReferencEd entity
@@ -41,10 +41,10 @@
@GeneratedValue
private EmbIdNaming id;
- @Versioned
+ @Audited
private String data;
- @Versioned
+ @Audited
@OneToMany(mappedBy="reference")
private List<JoinEmbIdNamingRefIngEntity> reffering;
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/naming/ids/JoinEmbIdNamingRefIngEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/naming/ids/JoinEmbIdNamingRefIngEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/naming/ids/JoinEmbIdNamingRefIngEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -30,7 +30,7 @@
import javax.persistence.JoinColumns;
import javax.persistence.ManyToOne;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
/**
* ReferencIng entity
@@ -42,10 +42,10 @@
@GeneratedValue
private EmbIdNaming id;
- @Versioned
+ @Audited
private String data;
- @Versioned
+ @Audited
@ManyToOne
@JoinColumns({@JoinColumn(name = "XX_reference", referencedColumnName = "XX"),
@JoinColumn(name = "YY_reference", referencedColumnName = "YY")})
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/naming/ids/JoinMulIdNamingRefEdEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/naming/ids/JoinMulIdNamingRefEdEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/naming/ids/JoinMulIdNamingRefEdEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -29,7 +29,7 @@
import javax.persistence.IdClass;
import javax.persistence.OneToMany;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
/**
* ReferencEd entity
@@ -44,10 +44,10 @@
@Id
private Integer id2;
- @Versioned
+ @Audited
private String data;
- @Versioned
+ @Audited
@OneToMany(mappedBy="reference")
private List<JoinMulIdNamingRefIngEntity> reffering;
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/naming/ids/JoinMulIdNamingRefIngEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/naming/ids/JoinMulIdNamingRefIngEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/naming/ids/JoinMulIdNamingRefIngEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -30,7 +30,7 @@
import javax.persistence.JoinColumns;
import javax.persistence.ManyToOne;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
/**
* ReferencIng entity
@@ -45,10 +45,10 @@
@Id
private Integer id2;
- @Versioned
+ @Audited
private String data;
- @Versioned
+ @Audited
@ManyToOne
@JoinColumns({@JoinColumn(name = "ID2_reference", referencedColumnName = "ID_2"),
@JoinColumn(name = "ID1_reference", referencedColumnName = "ID_1")})
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/notinsertable/NotInsertableTestEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/notinsertable/NotInsertableTestEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/notinsertable/NotInsertableTestEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -28,13 +28,13 @@
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
/**
* @author Adam Warski (adam at warski dot org)
*/
@Entity
-@Versioned
+@Audited
public class NotInsertableTestEntity {
@Id
@GeneratedValue
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/onetomany/RefEdMapKeyEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/onetomany/RefEdMapKeyEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/onetomany/RefEdMapKeyEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -31,7 +31,7 @@
import javax.persistence.MapKey;
import javax.persistence.OneToMany;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
/**
* @author Adam Warski (adam at warski dot org)
@@ -42,7 +42,7 @@
@GeneratedValue
private Integer id;
- @Versioned
+ @Audited
@OneToMany(mappedBy="reference")
@MapKey(name = "data")
private Map<String, RefIngMapKeyEntity> idmap;
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/onetomany/RefIngMapKeyEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/onetomany/RefIngMapKeyEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/onetomany/RefIngMapKeyEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -28,7 +28,7 @@
import javax.persistence.Id;
import javax.persistence.ManyToOne;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
/**
* @author Adam Warski (adam at warski dot org)
@@ -39,11 +39,11 @@
@GeneratedValue
private Integer id;
- @Versioned
+ @Audited
@ManyToOne
private RefEdMapKeyEntity reference;
- @Versioned
+ @Audited
private String data;
public Integer getId() {
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/onetoone/bidirectional/BiRefEdEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/onetoone/bidirectional/BiRefEdEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/onetoone/bidirectional/BiRefEdEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -27,7 +27,7 @@
import javax.persistence.Id;
import javax.persistence.OneToOne;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
/**
* @author Adam Warski (adam at warski dot org)
@@ -37,10 +37,10 @@
@Id
private Integer id;
- @Versioned
+ @Audited
private String data;
- @Versioned
+ @Audited
@OneToOne(mappedBy="reference")
private BiRefIngEntity referencing;
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/onetoone/bidirectional/BiRefIngEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/onetoone/bidirectional/BiRefIngEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/onetoone/bidirectional/BiRefIngEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -27,7 +27,7 @@
import javax.persistence.Id;
import javax.persistence.OneToOne;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
/**
* @author Adam Warski (adam at warski dot org)
@@ -37,10 +37,10 @@
@Id
private Integer id;
- @Versioned
+ @Audited
private String data;
- @Versioned
+ @Audited
@OneToOne
private BiRefEdEntity reference;
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/onetoone/bidirectional/ids/BiEmbIdRefEdEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/onetoone/bidirectional/ids/BiEmbIdRefEdEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/onetoone/bidirectional/ids/BiEmbIdRefEdEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -27,7 +27,7 @@
import javax.persistence.Entity;
import javax.persistence.OneToOne;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
import org.hibernate.envers.test.entities.ids.EmbId;
/**
@@ -38,10 +38,10 @@
@EmbeddedId
private EmbId id;
- @Versioned
+ @Audited
private String data;
- @Versioned
+ @Audited
@OneToOne(mappedBy="reference")
private BiEmbIdRefIngEntity referencing;
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/onetoone/bidirectional/ids/BiEmbIdRefIngEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/onetoone/bidirectional/ids/BiEmbIdRefIngEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/onetoone/bidirectional/ids/BiEmbIdRefIngEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -27,7 +27,7 @@
import javax.persistence.Entity;
import javax.persistence.OneToOne;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
import org.hibernate.envers.test.entities.ids.EmbId;
/**
@@ -38,10 +38,10 @@
@EmbeddedId
private EmbId id;
- @Versioned
+ @Audited
private String data;
- @Versioned
+ @Audited
@OneToOne
private BiEmbIdRefEdEntity reference;
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/onetoone/bidirectional/ids/BiMulIdRefEdEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/onetoone/bidirectional/ids/BiMulIdRefEdEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/onetoone/bidirectional/ids/BiMulIdRefEdEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -28,7 +28,7 @@
import javax.persistence.IdClass;
import javax.persistence.OneToOne;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
import org.hibernate.envers.test.entities.ids.MulId;
/**
@@ -43,10 +43,10 @@
@Id
private Integer id2;
- @Versioned
+ @Audited
private String data;
- @Versioned
+ @Audited
@OneToOne(mappedBy="reference")
private BiMulIdRefIngEntity referencing;
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/onetoone/bidirectional/ids/BiMulIdRefIngEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/onetoone/bidirectional/ids/BiMulIdRefIngEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/onetoone/bidirectional/ids/BiMulIdRefIngEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -28,7 +28,7 @@
import javax.persistence.IdClass;
import javax.persistence.OneToOne;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
import org.hibernate.envers.test.entities.ids.MulId;
/**
@@ -43,10 +43,10 @@
@Id
private Integer id2;
- @Versioned
+ @Audited
private String data;
- @Versioned
+ @Audited
@OneToOne
private BiMulIdRefEdEntity reference;
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/onetoone/unidirectional/UniRefEdEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/onetoone/unidirectional/UniRefEdEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/onetoone/unidirectional/UniRefEdEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -26,7 +26,7 @@
import javax.persistence.Entity;
import javax.persistence.Id;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
/**
* Unidirectional ReferencEd Entity
@@ -37,7 +37,7 @@
@Id
private Integer id;
- @Versioned
+ @Audited
private String data;
public UniRefEdEntity() {
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/onetoone/unidirectional/UniRefIngEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/onetoone/unidirectional/UniRefIngEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/onetoone/unidirectional/UniRefIngEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -27,7 +27,7 @@
import javax.persistence.Id;
import javax.persistence.OneToOne;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
/**
* Unidirectional ReferencIng Entity
@@ -38,10 +38,10 @@
@Id
private Integer id;
- @Versioned
+ @Audited
private String data;
- @Versioned
+ @Audited
@OneToOne
private UniRefEdEntity reference;
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/properties/PropertiesTestEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/properties/PropertiesTestEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/properties/PropertiesTestEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -27,7 +27,7 @@
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
/**
* @author Adam Warski (adam at warski dot org)
@@ -38,7 +38,7 @@
@GeneratedValue
private Integer id;
- @Versioned
+ @Audited
private String str;
public PropertiesTestEntity() {
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/properties/UnversionedOptimisticLockingFieldEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/properties/UnversionedOptimisticLockingFieldEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/properties/UnversionedOptimisticLockingFieldEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -28,12 +28,12 @@
import javax.persistence.Id;
import javax.persistence.Version;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
/**
* @author Nicolas Doroskevich
*/
-@Versioned
+@Audited
@Entity
public class UnversionedOptimisticLockingFieldEntity {
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/reventity/Custom.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/reventity/Custom.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/reventity/Custom.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -27,7 +27,7 @@
import java.util.Date;
import javax.persistence.EntityManager;
-import org.hibernate.envers.VersionsReader;
+import org.hibernate.envers.AuditReader;
import org.hibernate.envers.exception.RevisionDoesNotExistException;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.entities.StrTestEntity;
@@ -91,14 +91,14 @@
@Test
public void testDatesForRevisions() {
- VersionsReader vr = getVersionsReader();
+ AuditReader vr = getVersionsReader();
assert vr.getRevisionNumberForDate(vr.getRevisionDate(1)).intValue() == 1;
assert vr.getRevisionNumberForDate(vr.getRevisionDate(2)).intValue() == 2;
}
@Test
public void testRevisionsForDates() {
- VersionsReader vr = getVersionsReader();
+ AuditReader vr = getVersionsReader();
assert vr.getRevisionDate(vr.getRevisionNumberForDate(new Date(timestamp2))).getTime() <= timestamp2;
assert vr.getRevisionDate(vr.getRevisionNumberForDate(new Date(timestamp2)).intValue()+1).getTime() > timestamp2;
@@ -108,7 +108,7 @@
@Test
public void testFindRevision() {
- VersionsReader vr = getVersionsReader();
+ AuditReader vr = getVersionsReader();
long rev1Timestamp = vr.findRevision(CustomRevEntity.class, 1).getCustomTimestamp();
assert rev1Timestamp > timestamp1;
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/reventity/CustomBoxed.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/reventity/CustomBoxed.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/reventity/CustomBoxed.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -27,7 +27,7 @@
import java.util.Date;
import javax.persistence.EntityManager;
-import org.hibernate.envers.VersionsReader;
+import org.hibernate.envers.AuditReader;
import org.hibernate.envers.exception.RevisionDoesNotExistException;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.entities.StrTestEntity;
@@ -90,14 +90,14 @@
@Test
public void testDatesForRevisions() {
- VersionsReader vr = getVersionsReader();
+ AuditReader vr = getVersionsReader();
assert vr.getRevisionNumberForDate(vr.getRevisionDate(1)).intValue() == 1;
assert vr.getRevisionNumberForDate(vr.getRevisionDate(2)).intValue() == 2;
}
@Test
public void testRevisionsForDates() {
- VersionsReader vr = getVersionsReader();
+ AuditReader vr = getVersionsReader();
assert vr.getRevisionDate(vr.getRevisionNumberForDate(new Date(timestamp2))).getTime() <= timestamp2;
assert vr.getRevisionDate(vr.getRevisionNumberForDate(new Date(timestamp2)).intValue()+1).getTime() > timestamp2;
@@ -107,7 +107,7 @@
@Test
public void testFindRevision() {
- VersionsReader vr = getVersionsReader();
+ AuditReader vr = getVersionsReader();
long rev1Timestamp = vr.findRevision(CustomBoxedRevEntity.class, 1).getCustomTimestamp();
assert rev1Timestamp > timestamp1;
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/reventity/CustomPropertyAccess.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/reventity/CustomPropertyAccess.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/reventity/CustomPropertyAccess.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -27,7 +27,7 @@
import java.util.Date;
import javax.persistence.EntityManager;
-import org.hibernate.envers.VersionsReader;
+import org.hibernate.envers.AuditReader;
import org.hibernate.envers.exception.RevisionDoesNotExistException;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.entities.StrTestEntity;
@@ -91,14 +91,14 @@
@Test
public void testDatesForRevisions() {
- VersionsReader vr = getVersionsReader();
+ AuditReader vr = getVersionsReader();
assert vr.getRevisionNumberForDate(vr.getRevisionDate(1)).intValue() == 1;
assert vr.getRevisionNumberForDate(vr.getRevisionDate(2)).intValue() == 2;
}
@Test
public void testRevisionsForDates() {
- VersionsReader vr = getVersionsReader();
+ AuditReader vr = getVersionsReader();
assert vr.getRevisionDate(vr.getRevisionNumberForDate(new Date(timestamp2))).getTime() <= timestamp2;
assert vr.getRevisionDate(vr.getRevisionNumberForDate(new Date(timestamp2)).intValue()+1).getTime() > timestamp2;
@@ -108,7 +108,7 @@
@Test
public void testFindRevision() {
- VersionsReader vr = getVersionsReader();
+ AuditReader vr = getVersionsReader();
long rev1Timestamp = vr.findRevision(CustomPropertyAccessRevEntity.class, 1).getCustomTimestamp();
assert rev1Timestamp > timestamp1;
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/reventity/Inherited.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/reventity/Inherited.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/reventity/Inherited.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -27,7 +27,7 @@
import java.util.Date;
import javax.persistence.EntityManager;
-import org.hibernate.envers.VersionsReader;
+import org.hibernate.envers.AuditReader;
import org.hibernate.envers.exception.RevisionDoesNotExistException;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.entities.StrTestEntity;
@@ -90,14 +90,14 @@
@Test
public void testDatesForRevisions() {
- VersionsReader vr = getVersionsReader();
+ AuditReader vr = getVersionsReader();
assert vr.getRevisionNumberForDate(vr.getRevisionDate(1)).intValue() == 1;
assert vr.getRevisionNumberForDate(vr.getRevisionDate(2)).intValue() == 2;
}
@Test
public void testRevisionsForDates() {
- VersionsReader vr = getVersionsReader();
+ AuditReader vr = getVersionsReader();
assert vr.getRevisionDate(vr.getRevisionNumberForDate(new Date(timestamp2))).getTime() <= timestamp2;
assert vr.getRevisionDate(vr.getRevisionNumberForDate(new Date(timestamp2)).intValue()+1).getTime() > timestamp2;
@@ -107,7 +107,7 @@
@Test
public void testFindRevision() {
- VersionsReader vr = getVersionsReader();
+ AuditReader vr = getVersionsReader();
long rev1Timestamp = vr.findRevision(InheritedRevEntity.class, 1).getTimestamp();
assert rev1Timestamp > timestamp1;
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/reventity/Listener.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/reventity/Listener.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/reventity/Listener.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -27,7 +27,7 @@
import java.util.Date;
import javax.persistence.EntityManager;
-import org.hibernate.envers.VersionsReader;
+import org.hibernate.envers.AuditReader;
import org.hibernate.envers.exception.RevisionDoesNotExistException;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.entities.StrTestEntity;
@@ -96,14 +96,14 @@
@Test
public void testDatesForRevisions() {
- VersionsReader vr = getVersionsReader();
+ AuditReader vr = getVersionsReader();
assert vr.getRevisionNumberForDate(vr.getRevisionDate(1)).intValue() == 1;
assert vr.getRevisionNumberForDate(vr.getRevisionDate(2)).intValue() == 2;
}
@Test
public void testRevisionsForDates() {
- VersionsReader vr = getVersionsReader();
+ AuditReader vr = getVersionsReader();
assert vr.getRevisionDate(vr.getRevisionNumberForDate(new Date(timestamp2))).getTime() <= timestamp2;
assert vr.getRevisionDate(vr.getRevisionNumberForDate(new Date(timestamp2)).intValue()+1).getTime() > timestamp2;
@@ -113,7 +113,7 @@
@Test
public void testFindRevision() {
- VersionsReader vr = getVersionsReader();
+ AuditReader vr = getVersionsReader();
ListenerRevEntity rev1Data = vr.findRevision(ListenerRevEntity.class, 1);
ListenerRevEntity rev2Data = vr.findRevision(ListenerRevEntity.class, 2);
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/reventity/LongRevNumber.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/reventity/LongRevNumber.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/reventity/LongRevNumber.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -26,7 +26,7 @@
import java.util.Arrays;
import javax.persistence.EntityManager;
-import org.hibernate.envers.VersionsReader;
+import org.hibernate.envers.AuditReader;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.entities.StrTestEntity;
import org.testng.annotations.BeforeClass;
@@ -64,7 +64,7 @@
@Test
public void testFindRevision() {
- VersionsReader vr = getVersionsReader();
+ AuditReader vr = getVersionsReader();
assert vr.findRevision(LongRevNumberRevEntity.class, 1l).getCustomId() == 1l;
assert vr.findRevision(LongRevNumberRevEntity.class, 2l).getCustomId() == 2l;
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/revfordate/RevisionForDate.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/revfordate/RevisionForDate.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/revfordate/RevisionForDate.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -26,7 +26,7 @@
import java.util.Date;
import javax.persistence.EntityManager;
-import org.hibernate.envers.VersionsReader;
+import org.hibernate.envers.AuditReader;
import org.hibernate.envers.exception.RevisionDoesNotExistException;
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.entities.StrTestEntity;
@@ -99,7 +99,7 @@
@Test
public void testDatesForRevisions() {
- VersionsReader vr = getVersionsReader();
+ AuditReader vr = getVersionsReader();
assert vr.getRevisionNumberForDate(vr.getRevisionDate(1)).intValue() == 1;
assert vr.getRevisionNumberForDate(vr.getRevisionDate(2)).intValue() == 2;
assert vr.getRevisionNumberForDate(vr.getRevisionDate(3)).intValue() == 3;
@@ -107,7 +107,7 @@
@Test
public void testRevisionsForDates() {
- VersionsReader vr = getVersionsReader();
+ AuditReader vr = getVersionsReader();
assert vr.getRevisionDate(vr.getRevisionNumberForDate(new Date(timestamp2))).getTime() <= timestamp2;
assert vr.getRevisionDate(vr.getRevisionNumberForDate(new Date(timestamp2)).intValue()+1).getTime() > timestamp2;
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/sameids/SameIdTestEntity1.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/sameids/SameIdTestEntity1.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/sameids/SameIdTestEntity1.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -26,7 +26,7 @@
import javax.persistence.Entity;
import javax.persistence.Id;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
/**
* @author Adam Warski (adam at warski dot org)
@@ -36,7 +36,7 @@
@Id
private Integer id;
- @Versioned
+ @Audited
private String str1;
public SameIdTestEntity1() {
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/sameids/SameIdTestEntity2.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/sameids/SameIdTestEntity2.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/sameids/SameIdTestEntity2.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -26,7 +26,7 @@
import javax.persistence.Entity;
import javax.persistence.Id;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
/**
* @author Adam Warski (adam at warski dot org)
@@ -36,7 +36,7 @@
@Id
private Integer id;
- @Versioned
+ @Audited
private String str1;
public SameIdTestEntity2() {
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/secondary/SecondaryNamingTestEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/secondary/SecondaryNamingTestEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/secondary/SecondaryNamingTestEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -29,16 +29,16 @@
import javax.persistence.Id;
import javax.persistence.SecondaryTable;
-import org.hibernate.envers.SecondaryVersionsTable;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.SecondaryAuditTable;
+import org.hibernate.envers.Audited;
/**
* @author Adam Warski (adam at warski dot org)
*/
@Entity
@SecondaryTable(name = "secondary")
-@SecondaryVersionsTable(secondaryTableName = "secondary", secondaryVersionsTableName = "sec_versions")
-@Versioned
+@SecondaryAuditTable(secondaryTableName = "secondary", secondaryVersionsTableName = "sec_versions")
+@Audited
public class SecondaryNamingTestEntity {
@Id
@GeneratedValue
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/secondary/SecondaryTestEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/secondary/SecondaryTestEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/secondary/SecondaryTestEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -29,14 +29,14 @@
import javax.persistence.Id;
import javax.persistence.SecondaryTable;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
/**
* @author Adam Warski (adam at warski dot org)
*/
@Entity
@SecondaryTable(name = "secondary")
-@Versioned
+@Audited
public class SecondaryTestEntity {
@Id
@GeneratedValue
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/secondary/ids/SecondaryEmbIdTestEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/secondary/ids/SecondaryEmbIdTestEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/secondary/ids/SecondaryEmbIdTestEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -28,8 +28,8 @@
import javax.persistence.Id;
import javax.persistence.SecondaryTable;
-import org.hibernate.envers.SecondaryVersionsTable;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.SecondaryAuditTable;
+import org.hibernate.envers.Audited;
import org.hibernate.envers.test.entities.ids.EmbId;
/**
@@ -37,8 +37,8 @@
*/
@Entity
@SecondaryTable(name = "secondary")
-@SecondaryVersionsTable(secondaryTableName = "secondary", secondaryVersionsTableName = "sec_embid_versions")
-@Versioned
+@SecondaryAuditTable(secondaryTableName = "secondary", secondaryVersionsTableName = "sec_embid_versions")
+@Audited
public class SecondaryEmbIdTestEntity {
@Id
private EmbId id;
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/secondary/ids/SecondaryMulIdTestEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/secondary/ids/SecondaryMulIdTestEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/secondary/ids/SecondaryMulIdTestEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -29,8 +29,8 @@
import javax.persistence.IdClass;
import javax.persistence.SecondaryTable;
-import org.hibernate.envers.SecondaryVersionsTable;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.SecondaryAuditTable;
+import org.hibernate.envers.Audited;
import org.hibernate.envers.test.entities.ids.MulId;
/**
@@ -38,8 +38,8 @@
*/
@Entity
@SecondaryTable(name = "secondary")
-@SecondaryVersionsTable(secondaryTableName = "secondary", secondaryVersionsTableName = "sec_mulid_versions")
-@Versioned
+@SecondaryAuditTable(secondaryTableName = "secondary", secondaryVersionsTableName = "sec_mulid_versions")
+@Audited
@IdClass(MulId.class)
public class SecondaryMulIdTestEntity {
@Id
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/superclass/SuperclassOfEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/superclass/SuperclassOfEntity.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/superclass/SuperclassOfEntity.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -25,14 +25,14 @@
import javax.persistence.MappedSuperclass;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
/**
* @author Adam Warski (adam at warski dot org)
*/
@MappedSuperclass
public class SuperclassOfEntity {
- @Versioned
+ @Audited
private String str;
public SuperclassOfEntity() {
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/various/Address.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/various/Address.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/various/Address.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -29,7 +29,7 @@
import javax.persistence.Id;
import javax.persistence.OneToMany;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
/**
* @author Adam Warski (adam at warski dot org)
@@ -40,16 +40,16 @@
@GeneratedValue
private int id;
- @Versioned
+ @Audited
private String streetName;
- @Versioned
+ @Audited
private Integer houseNumber;
- @Versioned
+ @Audited
private Integer flatNumber;
- @Versioned
+ @Audited
@OneToMany(mappedBy = "address")
private Set<Person> persons;
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/various/Person.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/various/Person.java 2008-10-31 10:59:37 UTC (rev 15458)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/various/Person.java 2008-10-31 11:42:38 UTC (rev 15459)
@@ -28,7 +28,7 @@
import javax.persistence.Id;
import javax.persistence.ManyToOne;
-import org.hibernate.envers.Versioned;
+import org.hibernate.envers.Audited;
/**
* @author Adam Warski (adam at warski dot org)
@@ -39,13 +39,13 @@
@GeneratedValue
private int id;
- @Versioned
+ @Audited
private String name;
- @Versioned
+ @Audited
private String surname;
- @Versioned
+ @Audited
@ManyToOne
private Address address;
16 years, 1 month
Hibernate SVN: r15458 - core/trunk/annotations.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2008-10-31 06:59:37 -0400 (Fri, 31 Oct 2008)
New Revision: 15458
Removed:
core/trunk/annotations/doc/
Log:
removed the obsolete ant stuff
16 years, 1 month