#105 - Prepare 1.1.10 (Ingalls SR10).
This commit is contained in:
10
pom.xml
10
pom.xml
@@ -9,7 +9,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.data.build</groupId>
|
||||
<artifactId>spring-data-parent</artifactId>
|
||||
<version>1.9.10.BUILD-SNAPSHOT</version>
|
||||
<version>1.9.10.RELEASE</version>
|
||||
<relativePath/>
|
||||
</parent>
|
||||
|
||||
@@ -42,8 +42,8 @@
|
||||
</scm>
|
||||
|
||||
<properties>
|
||||
<springdata.commons>1.13.10.BUILD-SNAPSHOT</springdata.commons>
|
||||
<springdata.jpa>1.11.10.BUILD-SNAPSHOT</springdata.jpa>
|
||||
<springdata.commons>1.13.10.RELEASE</springdata.commons>
|
||||
<springdata.jpa>1.11.10.RELEASE</springdata.jpa>
|
||||
<hibernate.envers>4.3.11</hibernate.envers>
|
||||
</properties>
|
||||
|
||||
@@ -114,8 +114,8 @@
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>spring-libs-snapshot</id>
|
||||
<url>https://repo.spring.io/libs-snapshot</url>
|
||||
<id>spring-libs-release</id>
|
||||
<url>https://repo.spring.io/libs-release</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
|
||||
@@ -1,68 +1,68 @@
|
||||
/*
|
||||
* Copyright 2012 the original author or authors.
|
||||
*
|
||||
* 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.springframework.data.envers.repository.support;
|
||||
|
||||
import org.hibernate.envers.DefaultRevisionEntity;
|
||||
import org.joda.time.DateTime;
|
||||
import org.springframework.data.history.RevisionMetadata;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* {@link RevisionMetadata} working with a {@link DefaultRevisionEntity}.
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
* @author Philip Huegelmeyer
|
||||
*/
|
||||
public class DefaultRevisionMetadata implements RevisionMetadata<Integer> {
|
||||
|
||||
private final DefaultRevisionEntity entity;
|
||||
|
||||
/**
|
||||
* Creates a new {@link DefaultRevisionMetadata}.
|
||||
*
|
||||
* @param entity must not be {@literal null}.
|
||||
*/
|
||||
public DefaultRevisionMetadata(DefaultRevisionEntity entity) {
|
||||
|
||||
Assert.notNull(entity);
|
||||
this.entity = entity;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.history.RevisionMetadata#getRevisionNumber()
|
||||
*/
|
||||
public Integer getRevisionNumber() {
|
||||
return entity.getId();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.history.RevisionMetadata#getRevisionDate()
|
||||
*/
|
||||
public DateTime getRevisionDate() {
|
||||
return new DateTime(entity.getTimestamp());
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.history.RevisionMetadata#getDelegate()
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> T getDelegate() {
|
||||
return (T) entity;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright 2012 the original author or authors.
|
||||
*
|
||||
* 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.springframework.data.envers.repository.support;
|
||||
|
||||
import org.hibernate.envers.DefaultRevisionEntity;
|
||||
import org.joda.time.DateTime;
|
||||
import org.springframework.data.history.RevisionMetadata;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* {@link RevisionMetadata} working with a {@link DefaultRevisionEntity}.
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
* @author Philip Huegelmeyer
|
||||
*/
|
||||
public class DefaultRevisionMetadata implements RevisionMetadata<Integer> {
|
||||
|
||||
private final DefaultRevisionEntity entity;
|
||||
|
||||
/**
|
||||
* Creates a new {@link DefaultRevisionMetadata}.
|
||||
*
|
||||
* @param entity must not be {@literal null}.
|
||||
*/
|
||||
public DefaultRevisionMetadata(DefaultRevisionEntity entity) {
|
||||
|
||||
Assert.notNull(entity);
|
||||
this.entity = entity;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.history.RevisionMetadata#getRevisionNumber()
|
||||
*/
|
||||
public Integer getRevisionNumber() {
|
||||
return entity.getId();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.history.RevisionMetadata#getRevisionDate()
|
||||
*/
|
||||
public DateTime getRevisionDate() {
|
||||
return new DateTime(entity.getTimestamp());
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.history.RevisionMetadata#getDelegate()
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> T getDelegate() {
|
||||
return (T) entity;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,76 +1,76 @@
|
||||
/*
|
||||
* Copyright 2012-2014 the original author or authors.
|
||||
*
|
||||
* 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.springframework.data.envers;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.hibernate.envers.strategy.ValidityAuditStrategy;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.envers.repository.support.EnversRevisionRepositoryFactoryBean;
|
||||
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
|
||||
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder;
|
||||
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType;
|
||||
import org.springframework.orm.jpa.AbstractEntityManagerFactoryBean;
|
||||
import org.springframework.orm.jpa.JpaTransactionManager;
|
||||
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
|
||||
import org.springframework.orm.jpa.vendor.Database;
|
||||
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
|
||||
/**
|
||||
* Spring JavaConfig configuration for general infrastructure.
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
@Configuration
|
||||
@EnableJpaRepositories(repositoryFactoryBeanClass = EnversRevisionRepositoryFactoryBean.class)
|
||||
public class Config {
|
||||
|
||||
@Bean
|
||||
public DataSource dataSource() throws SQLException {
|
||||
return new EmbeddedDatabaseBuilder().setType(EmbeddedDatabaseType.H2).build();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public PlatformTransactionManager transactionManager() throws SQLException {
|
||||
return new JpaTransactionManager();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public AbstractEntityManagerFactoryBean entityManagerFactory() throws SQLException {
|
||||
|
||||
HibernateJpaVendorAdapter jpaVendorAdapter = new HibernateJpaVendorAdapter();
|
||||
jpaVendorAdapter.setDatabase(Database.H2);
|
||||
jpaVendorAdapter.setGenerateDdl(true);
|
||||
|
||||
LocalContainerEntityManagerFactoryBean bean = new LocalContainerEntityManagerFactoryBean();
|
||||
bean.setJpaVendorAdapter(jpaVendorAdapter);
|
||||
bean.setPackagesToScan(Config.class.getPackage().getName());
|
||||
bean.setDataSource(dataSource());
|
||||
bean.setJpaPropertyMap(jpaProperties());
|
||||
|
||||
return bean;
|
||||
}
|
||||
|
||||
private Map<String, String> jpaProperties() {
|
||||
return Collections.singletonMap("org.hibernate.envers.audit_strategy", ValidityAuditStrategy.class.getName());
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright 2012-2014 the original author or authors.
|
||||
*
|
||||
* 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.springframework.data.envers;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.hibernate.envers.strategy.ValidityAuditStrategy;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.envers.repository.support.EnversRevisionRepositoryFactoryBean;
|
||||
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
|
||||
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder;
|
||||
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType;
|
||||
import org.springframework.orm.jpa.AbstractEntityManagerFactoryBean;
|
||||
import org.springframework.orm.jpa.JpaTransactionManager;
|
||||
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
|
||||
import org.springframework.orm.jpa.vendor.Database;
|
||||
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
|
||||
/**
|
||||
* Spring JavaConfig configuration for general infrastructure.
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
@Configuration
|
||||
@EnableJpaRepositories(repositoryFactoryBeanClass = EnversRevisionRepositoryFactoryBean.class)
|
||||
public class Config {
|
||||
|
||||
@Bean
|
||||
public DataSource dataSource() throws SQLException {
|
||||
return new EmbeddedDatabaseBuilder().setType(EmbeddedDatabaseType.H2).build();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public PlatformTransactionManager transactionManager() throws SQLException {
|
||||
return new JpaTransactionManager();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public AbstractEntityManagerFactoryBean entityManagerFactory() throws SQLException {
|
||||
|
||||
HibernateJpaVendorAdapter jpaVendorAdapter = new HibernateJpaVendorAdapter();
|
||||
jpaVendorAdapter.setDatabase(Database.H2);
|
||||
jpaVendorAdapter.setGenerateDdl(true);
|
||||
|
||||
LocalContainerEntityManagerFactoryBean bean = new LocalContainerEntityManagerFactoryBean();
|
||||
bean.setJpaVendorAdapter(jpaVendorAdapter);
|
||||
bean.setPackagesToScan(Config.class.getPackage().getName());
|
||||
bean.setDataSource(dataSource());
|
||||
bean.setJpaPropertyMap(jpaProperties());
|
||||
|
||||
return bean;
|
||||
}
|
||||
|
||||
private Map<String, String> jpaProperties() {
|
||||
return Collections.singletonMap("org.hibernate.envers.audit_strategy", ValidityAuditStrategy.class.getName());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,33 +1,33 @@
|
||||
/*
|
||||
* Copyright 2012 the original author or authors.
|
||||
*
|
||||
* 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.springframework.data.envers.sample;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
|
||||
import org.hibernate.envers.Audited;
|
||||
|
||||
/**
|
||||
* Sample domain class.
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
@Audited
|
||||
@Entity
|
||||
public class Country extends AbstractEntity {
|
||||
|
||||
public String code;
|
||||
public String name;
|
||||
}
|
||||
/*
|
||||
* Copyright 2012 the original author or authors.
|
||||
*
|
||||
* 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.springframework.data.envers.sample;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
|
||||
import org.hibernate.envers.Audited;
|
||||
|
||||
/**
|
||||
* Sample domain class.
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
@Audited
|
||||
@Entity
|
||||
public class Country extends AbstractEntity {
|
||||
|
||||
public String code;
|
||||
public String name;
|
||||
}
|
||||
|
||||
@@ -1,41 +1,41 @@
|
||||
/*
|
||||
* Copyright 2012 the original author or authors.
|
||||
*
|
||||
* 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.springframework.data.envers.sample;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.ManyToMany;
|
||||
import javax.persistence.Version;
|
||||
|
||||
import org.hibernate.envers.Audited;
|
||||
|
||||
/**
|
||||
* Sample domain class.
|
||||
*
|
||||
* @author Philip Huegelmeyer
|
||||
*/
|
||||
@Audited
|
||||
@Entity
|
||||
public class License extends AbstractEntity {
|
||||
|
||||
@Version
|
||||
public Integer version;
|
||||
|
||||
public String name;
|
||||
@ManyToMany
|
||||
public Set<Country> laender;
|
||||
}
|
||||
/*
|
||||
* Copyright 2012 the original author or authors.
|
||||
*
|
||||
* 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.springframework.data.envers.sample;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.ManyToMany;
|
||||
import javax.persistence.Version;
|
||||
|
||||
import org.hibernate.envers.Audited;
|
||||
|
||||
/**
|
||||
* Sample domain class.
|
||||
*
|
||||
* @author Philip Huegelmeyer
|
||||
*/
|
||||
@Audited
|
||||
@Entity
|
||||
public class License extends AbstractEntity {
|
||||
|
||||
@Version
|
||||
public Integer version;
|
||||
|
||||
public String name;
|
||||
@ManyToMany
|
||||
public Set<Country> laender;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user