@@ -25,26 +25,14 @@ import org.springframework.data.repository.history.support.RevisionEntityInforma
|
||||
*/
|
||||
class DefaultRevisionEntityInformation implements RevisionEntityInformation {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.repository.history.support.RevisionEntityInformation#getRevisionNumberType()
|
||||
*/
|
||||
public Class<?> getRevisionNumberType() {
|
||||
return Integer.class;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.repository.history.support.RevisionEntityInformation#isDefaultRevisionEntity()
|
||||
*/
|
||||
public boolean isDefaultRevisionEntity() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.repository.history.support.RevisionEntityInformation#getRevisionEntityClass()
|
||||
*/
|
||||
public Class<?> getRevisionEntityClass() {
|
||||
return DefaultRevisionEntity.class;
|
||||
}
|
||||
|
||||
@@ -50,54 +50,30 @@ public final class DefaultRevisionMetadata implements RevisionMetadata<Integer>
|
||||
this.revisionType = revisionType;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.history.RevisionMetadata#getRevisionNumber()
|
||||
*/
|
||||
public Optional<Integer> getRevisionNumber() {
|
||||
return Optional.of(entity.getId());
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.history.RevisionMetadata#getRevisionDate()
|
||||
*/
|
||||
@Deprecated
|
||||
public Optional<LocalDateTime> getRevisionDate() {
|
||||
return getRevisionInstant().map(instant -> LocalDateTime.ofInstant(instant, ZoneOffset.systemDefault()));
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.history.RevisionMetadata#getRevisionInstant()
|
||||
*/
|
||||
@Override
|
||||
public Optional<Instant> getRevisionInstant() {
|
||||
return Optional.of(Instant.ofEpochMilli(entity.getTimestamp()));
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.history.RevisionMetadata#getDelegate()
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> T getDelegate() {
|
||||
return (T) entity;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.history.RevisionMetadata#getRevisionType()
|
||||
*/
|
||||
@Override
|
||||
public RevisionType getRevisionType() {
|
||||
return revisionType;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see java.lang.Object#equals(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
|
||||
@@ -112,10 +88,6 @@ public final class DefaultRevisionMetadata implements RevisionMetadata<Integer>
|
||||
&& getRevisionInstant().equals(that.getRevisionInstant()) && revisionType.equals(that.getRevisionType());
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see java.lang.Object#toString()
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DefaultRevisionMetadata{" + "entity=" + entity + ", revisionType=" + revisionType + '}';
|
||||
|
||||
@@ -58,10 +58,6 @@ public class EnversRevisionRepositoryFactoryBean<T extends RevisionRepository<S,
|
||||
this.revisionEntityClass = revisionEntityClass;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean#createRepositoryFactory(jakarta.persistence.EntityManager)
|
||||
*/
|
||||
@Override
|
||||
protected RepositoryFactorySupport createRepositoryFactory(EntityManager entityManager) {
|
||||
return new RevisionRepositoryFactory<T, ID, N>(entityManager, revisionEntityClass);
|
||||
|
||||
@@ -83,10 +83,6 @@ public class EnversRevisionRepositoryImpl<T, ID, N extends Number & Comparable<N
|
||||
this.entityManager = entityManager;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.repository.history.RevisionRepository#findLastChangeRevision(java.io.Serializable)
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public Optional<Revision<N, T>> findLastChangeRevision(ID id) {
|
||||
|
||||
@@ -104,10 +100,6 @@ public class EnversRevisionRepositoryImpl<T, ID, N extends Number & Comparable<N
|
||||
return Optional.of(createRevision(new QueryResult<>(singleResult.get(0))));
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.envers.repository.support.EnversRevisionRepository#findRevision(java.io.Serializable, java.lang.Number)
|
||||
*/
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public Optional<Revision<N, T>> findRevision(ID id, N revisionNumber) {
|
||||
|
||||
@@ -50,10 +50,6 @@ public class ReflectionRevisionEntityInformation implements RevisionEntityInform
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.repository.history.support.RevisionEntityInformation#isDefaultRevisionEntity()
|
||||
*/
|
||||
public boolean isDefaultRevisionEntity() {
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user