Skip to content

Commit a8ef74f

Browse files
arefbehboudischauder
authored andcommitted
Cleaned up EnversRevisionRepositoryImpl the code to enhance readability and maintainability.
Original pull request #3576
1 parent 558c26b commit a8ef74f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

spring-data-envers/src/main/java/org/springframework/data/envers/repository/support/EnversRevisionRepositoryImpl.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,10 @@ public class EnversRevisionRepositoryImpl<T, ID, N extends Number & Comparable<N
8181
* @param entityManager must not be {@literal null}.
8282
*/
8383
public EnversRevisionRepositoryImpl(JpaEntityInformation<T, ?> entityInformation,
84-
RevisionEntityInformation revisionEntityInformation, EntityManager entityManager) {
84+
RevisionEntityInformation revisionEntityInformation, EntityManager entityManager) {
8585

86+
Assert.notNull(entityInformation, "JpaEntityInformation must not be null!");
87+
Assert.notNull(entityManager, "EntityManager must not be null!");
8688
Assert.notNull(revisionEntityInformation, "RevisionEntityInformation must not be null!");
8789

8890
this.entityInformation = entityInformation;
@@ -171,7 +173,7 @@ public Page<Revision<N, T>> findRevisions(ID id, Pageable pageable) {
171173

172174
AuditQuery baseQuery = createBaseQuery(id);
173175

174-
List<AuditOrder> orderMapped = (pageable.getSort()instanceof RevisionSort revisionSort)
176+
List<AuditOrder> orderMapped = (pageable.getSort() instanceof RevisionSort revisionSort)
175177
? List.of(mapRevisionSort(revisionSort))
176178
: mapPropertySort(pageable.getSort());
177179

@@ -190,7 +192,6 @@ public Page<Revision<N, T>> findRevisions(ID id, Pageable pageable) {
190192
for (Object[] singleResult : resultList) {
191193
revisions.add(createRevision(new QueryResult<>(singleResult)));
192194
}
193-
194195
return new PageImpl<>(revisions, pageable, count);
195196
}
196197

0 commit comments

Comments
 (0)