Skip to content

Commit 1e06692

Browse files
committed
Added changed fields methods.
1 parent f67cb87 commit 1e06692

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

src/main/java/org/springframework/data/repository/history/RevisionRepository.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
package org.springframework.data.repository.history;
1717

1818
import java.util.Optional;
19+
import java.util.Set;
1920

2021
import org.springframework.data.domain.Page;
2122
import org.springframework.data.domain.Pageable;
@@ -30,6 +31,7 @@
3031
*
3132
* @author Oliver Gierke
3233
* @author Philipp Huegelmeyer
34+
* @author Miguel Ángel Ruiz
3335
*/
3436
@NoRepositoryBean
3537
public interface RevisionRepository<T, ID, N extends Number & Comparable<N>> extends Repository<T, ID> {
@@ -50,6 +52,15 @@ public interface RevisionRepository<T, ID, N extends Number & Comparable<N>> ext
5052
*/
5153
Revisions<N, T> findRevisions(ID id);
5254

55+
/**
56+
* Returns all {@link Revisions} of an entity with the given id and filtered by the changed field of the entity.
57+
*
58+
* @param id must not be {@literal null}.
59+
* @param changedFields must not be {@literal null}.
60+
* @return
61+
*/
62+
Revisions<N, T> findRevisions(ID id, Set<String> changedFields);
63+
5364
/**
5465
* Returns a {@link Page} of revisions for the entity with the given id. Note, that it's not guaranteed that
5566
* implementations have to support sorting by all properties.
@@ -62,6 +73,19 @@ public interface RevisionRepository<T, ID, N extends Number & Comparable<N>> ext
6273
*/
6374
Page<Revision<N, T>> findRevisions(ID id, Pageable pageable);
6475

76+
/**
77+
* Returns a {@link Page} of revisions for the entity with the given id and filtered by the changed field of
78+
* the entity. Note, that it's not guaranteed that implementations have to support sorting by all properties.
79+
*
80+
* @param id must not be {@literal null}.
81+
* @param changedFields must not be {@literal null}.
82+
* @param pageable the pageable to request a paged result, can be {@link Pageable#unpaged()}, must not be
83+
* {@literal null}.
84+
* @see RevisionSort
85+
* @return
86+
*/
87+
Page<Revision<N, T>> findRevisions(ID id, Set<String> changedFields, Pageable pageable);
88+
6589
/**
6690
* Returns the entity with the given ID in the given revision number.
6791
*

0 commit comments

Comments
 (0)