Cleaned up EnversRevisionRepositoryImpl the code to enhance readability and maintainability.

Original pull request #3576
This commit is contained in:
arefbehboudi
2024-08-12 18:18:28 +03:30
committed by Jens Schauder
parent 558c26b355
commit a8ef74fe32

View File

@@ -81,8 +81,10 @@ public class EnversRevisionRepositoryImpl<T, ID, N extends Number & Comparable<N
* @param entityManager must not be {@literal null}.
*/
public EnversRevisionRepositoryImpl(JpaEntityInformation<T, ?> entityInformation,
RevisionEntityInformation revisionEntityInformation, EntityManager entityManager) {
RevisionEntityInformation revisionEntityInformation, EntityManager entityManager) {
Assert.notNull(entityInformation, "JpaEntityInformation must not be null!");
Assert.notNull(entityManager, "EntityManager must not be null!");
Assert.notNull(revisionEntityInformation, "RevisionEntityInformation must not be null!");
this.entityInformation = entityInformation;
@@ -171,7 +173,7 @@ public class EnversRevisionRepositoryImpl<T, ID, N extends Number & Comparable<N
AuditQuery baseQuery = createBaseQuery(id);
List<AuditOrder> orderMapped = (pageable.getSort()instanceof RevisionSort revisionSort)
List<AuditOrder> orderMapped = (pageable.getSort() instanceof RevisionSort revisionSort)
? List.of(mapRevisionSort(revisionSort))
: mapPropertySort(pageable.getSort());
@@ -190,7 +192,6 @@ public class EnversRevisionRepositoryImpl<T, ID, N extends Number & Comparable<N
for (Object[] singleResult : resultList) {
revisions.add(createRevision(new QueryResult<>(singleResult)));
}
return new PageImpl<>(revisions, pageable, count);
}