From acf12423e0a6dc197a64ecfdb8a46be81c895434 Mon Sep 17 00:00:00 2001 From: Oliver Gierke Date: Tue, 26 Jul 2016 14:36:00 +0200 Subject: [PATCH] DATACMNS-888 - Added dedicated Sort type to be able to express directions for revisions. Introduced dedicated RevisionSort property that allows to define the sort order independent of the revision property to be used. Introduced methods to find out whether a Sort is descending or ascending to avoid having to refer to the enum. --- .../org/springframework/data/domain/Sort.java | 34 +++++++- .../data/history/RevisionSort.java | 81 +++++++++++++++++++ .../history/RevisionRepository.java | 7 +- 3 files changed, 118 insertions(+), 4 deletions(-) create mode 100644 src/main/java/org/springframework/data/history/RevisionSort.java diff --git a/src/main/java/org/springframework/data/domain/Sort.java b/src/main/java/org/springframework/data/domain/Sort.java index 70d8eba88..dcb6cbb45 100644 --- a/src/main/java/org/springframework/data/domain/Sort.java +++ b/src/main/java/org/springframework/data/domain/Sort.java @@ -1,5 +1,5 @@ /* - * Copyright 2008-2014 the original author or authors. + * Copyright 2008-2016 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -196,6 +196,26 @@ public class Sort implements Iterable findRevisions(ID id); /** - * Returns a {@link Page} of revisions for the entity with the given id. + * Returns a {@link Page} of revisions for the entity with the given id. Note, that it's not guaranteed that + * implementations have to support sorting by all properties. * * @param id must not be {@literal null}. * @param pageable + * @see RevisionSort * @return */ Page> findRevisions(ID id, Pageable pageable);