diff options
Diffstat (limited to 'src/main/java/com/encora/ToDosRepository.java')
-rw-r--r-- | src/main/java/com/encora/ToDosRepository.java | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/main/java/com/encora/ToDosRepository.java b/src/main/java/com/encora/ToDosRepository.java index 8d09d7e..a4c9a10 100644 --- a/src/main/java/com/encora/ToDosRepository.java +++ b/src/main/java/com/encora/ToDosRepository.java @@ -184,6 +184,19 @@ public class ToDosRepository implements JpaRepository<ToDos, Integer> { return comparator; } + + // Filter and then sort all of our to dos. + public void refreshFilteredToDos(Sort sort, String name, String priority, String done) throws Exception { + this.filteredToDos = this.findAllWithFilter(name, priority, done); + + try { + Comparator<ToDos> comparator = this.getToDoComparator(sort); + Collections.sort(this.filteredToDos, comparator); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + /* * N O T Y E T D E F I N E D . */ |