Commit Graph

41 Commits

Author SHA1 Message Date
Oliver Gierke
8372e34adf DATACMNS-867 - Cleanups in Pageable API.
Dropped Pageable.NONE in favor of ….unpaged() for consistency with Sort.unsorted(). Extracted the implementation for the value backing it into an Unpaged enum instance. Introduced defaulted isPaged() / isUnpaged() to avoid having to compare instances.

JavaDoc in Sort and a couple of API polishes.
2017-03-24 08:00:44 +01:00
Christoph Strobl
be347eaaab DATACMNS-867 - Additional Java 8 language feature cleanup.
Make use of lambdas and method references though out the codebase. Remove no longer required generic type parameters.
Additionally remove unused imports and replace single element list initialization with dedicated singletonList.
Use Assertion overloads taking Supplier for dynamic assertion error messages.
2017-03-24 08:00:43 +01:00
Oliver Gierke
d4811e29d9 DATACMNS-867 - Second draft. 2017-03-24 08:00:23 +01:00
Oliver Gierke
cc63e5b7a4 DATACMNS-867 - First draft. 2017-03-24 08:00:23 +01:00
Christoph Strobl
3e048a6dca DATACMNS-985 - Remove references to single-argument assertion methods. 2017-01-31 18:10:40 +01:00
Oliver Gierke
a696484f8d DATACMNS-953 - Fixed application of GenericPropertyMatchers.exact().
We now really use exact matching for a match setup requesting exact matching. Previously, we erroneously set up the matching with a startsWith().
2016-12-06 10:58:52 +01:00
Oliver Gierke
c52c45741a DATACMNS-928 - Polishing.
Additional JavaDoc and @since tags. Minor additions to AbstractAggregateRoot.
2016-11-30 18:30:51 +01:00
Oliver Gierke
802eb7deef DATACMNS-928 - Support for publishing events from aggregate roots.
Introduced @DomainEvents usable on a method of an aggregate root. The method will be invoked when the aggregate is passed to a repository to save and its returned value or values will be exposed via an ApplicationEventListener.

Also, the aggregate can expose a method annotated with @AfterDomainEventPublication which will be invoked once all events have been published.
2016-11-30 18:30:51 +01:00
Oliver Gierke
b4518f0583 DATACMNS-920 - Added accessors for Range.lowerInclusive / ….upperInclusive.
Generally improved Range to be a value type by using Lombok's @Value.
2016-11-04 18:37:22 +01:00
Oliver Gierke
e294fb5ef4 DATACMNS-908 - Introduced Order.withProperty(…).
The introduced method allows creating new Order instances for a different property ensuring all other aspects (ignore case, null handling) are retained.
2016-09-05 14:46:51 +02:00
Oliver Gierke
acf12423e0 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.
2016-09-01 19:48:23 +02:00
Mark Paluch
ac51b1671d DATACMNS-900 - Added equals(…) and hashCode() methods for ExampleMatcher utility classes.
We now provide equals(…) and hashCode() methods for GenericPropertyMatcher, PropertySpecifier and PropertySpecifiers so that they can be compared and used in sets.

Original pull request: #175.
2016-09-01 17:24:32 +02:00
Oliver Gierke
d41a9cb5c5 DATACMNS-879 - ExampleMatcher now allows to define whether all or any match should be used.
Introduced dedicated factory methods for ExampleMatcher so that it exposes whether the predicates built from Example instances have to be fulfilled all or if it's sufficient that any of them matches.
2016-07-14 08:54:56 +02:00
Oliver Gierke
26f725be0d DATACMNS-810 - Polishing.
Renamed ExampleSpecification to ExampleMatcher and introduced a matching() factory method, dropping the dedicated override mechanism for types for now. Updated documentation accordingly.

Used Lombok for constructor creation, field defaults, toString() as well as equals(…) and hashCode() implementations.

Tweaked imports in unit tests. Renamed methods to express expected behavior.

Original pull request: #153.
2016-03-17 16:22:55 +01:00
Mark Paluch
b0ce7009e8 DATACMNS-810 - Refactor Query by Example API.
Split Example and ExampleSpec to create reusable components. Refactor builder pattern to a fluent API that creates immutable instances. Split user and framework API, Example and ExampleSpec are user API, created ExampleSpecAccessor for modules to access example spec configuration. Create static methods in GenericPropertyMatchers to ease creation of matchers in a readable style. Convert PropertySpecifier to inner class  and move PropertySpecifiers to ExampleSpec.

Related tickets: DATAJPA-218, DATAMONGO-1245.
Original pull request: #153.
2016-03-17 16:17:39 +01:00
Christoph Strobl
4092f0716f DATACMNS-810 - Add core types for Query by Example support.
Added required types for Query by Example which should be used by the individual store implementations. 

Generally the Example type captures a sample object and allow various settings concerning the mapping into an actual query. So there’s configuration options for handling null values, string matching, property paths to ignore,

Related tickets: DATAJPA-218, DATAMONGO-1245.
Original pull request: #153.
2016-03-17 16:17:39 +01:00
Oliver Gierke
ae96301ab0 DATACMNS-812 - Polishing.
Formatting and extension of copyright years.

Original pull request: #154.
2016-03-07 11:33:57 +01:00
Timothy Cheng
bc421f53c0 DATACMNS-812 - Fixed PageImpl.toString() to improve readability.
Add one to the getNumber() in PageImpl.toString() since it uses 0-based index.

Original pull request: #154.
2016-03-07 11:31:42 +01:00
Pepe García
64eafa4341 DATACMNS-789 - Fixed typo in JavaDoc of Page.
Original pull request: #146.
2015-11-23 17:13:15 +01:00
Oliver Gierke
3a2dc3d1d4 DATACMNS-713 - Disabled total adaption in PageImpl for empty pages.
The newly introduced adaption of the total in PageImpl must only be applied if the page accessed is not empty.
2015-06-19 15:26:40 +02:00
Oliver Gierke
de4f1ffb7b DATACMNS-713 - PageImpl now adapts total if necessary.
On a last page the total handed into a PageImpl constructor might not necessarily fit the content as there's the change of an insertion or deletion between the calculated count and the retrieval of the content. We now leniently mitigate those differences if the page created is the last page of the result.

Related tickets: DATAJPA-728, DATACMNS-615.
2015-06-15 14:24:03 +02:00
Oliver Gierke
2d75cf2c43 DATACMNS-651 - Introduced a Range value type.
Primarily intended to be used with Distance instances, we introduce a Range value type. Distance now has factory methods to create Range instances between two distances. To support this, Distance now implements comparable based on the normalized value of it.

Tiny refactoring in TypeDiscoverer to avoid code duplication between the lookup of parameter type information for constructors and methods.
2015-03-04 17:34:32 +01:00
Oliver Gierke
5cc4811c52 DATACMNS-635 - Slice and Page can now be mapped using a Converter.
Introduced a map(Converter converter) method on Slice and Page to be able to easily transform the elements and create a new Slice or Page of the transformation result.

On Java 8 this allows code like this:

Page<String> strings = …;
Page<Integer> ints = strings.map(String::length);
2015-01-22 19:01:16 +01:00
Oliver Gierke
55d988e7b7 DATACMNS-615 - PageImpl now rejects a total less than the amount of items given.
PageImpl now makes sure that the total given to the constructor is never less than then number of items given to make sure we do not mask broken count calculation by creating an actually invalid instance.

Related ticket: DATAMONGO-1120.
2014-12-16 12:40:48 +01:00
Oliver Gierke
e1b38faee9 DATACMNS-601 - Fixes for most of the SonarQube warnings. 2014-11-26 09:25:14 +01:00
Oliver Gierke
3660676338 DATACMNS-558 - Some code cleanups according to the Sonar report. 2014-08-10 12:51:28 +02:00
Oliver Gierke
ed0f7c51f8 DATACMNS-469 - Removed deprecations. 2014-07-16 11:53:20 +02:00
Oliver Gierke
63e595b0af DATACMNS-491 - Polishing of null handling API in Sort.Order.
Fixed @since-tags, added author tags where appropriate, fixed copyright header in SortUnitTests. Removed unnecessary formatting line comments. Renamed nullHandlingHint to nullHandling inside Order. Changed builder method signatures to be consistent with with(…) methods defining the direction.

Fixed copy & paste test in SortUnitTests.

Original pull request: #79.
2014-04-28 11:34:34 +02:00
Thomas Darimont
f689b5d5f3 DATACMNS-491 - Add support for configuring null handling hints in Sort.Order.
Null handling hints can now be configured on Order as being either NATIVE (we let the data store decide how to order nulls), NULLS_FIRST or NULLS_LAST.

This is the foundation for custom null-handling in other data store support modules like SD JPA and SD MongoDB.

Original pull request: #79.
2014-04-28 11:34:26 +02:00
Oliver Gierke
1805aad718 DATACMNS-387 - Introduce Slice abstraction.
Introduced a Slice interface which is effectively a Page without the total page information. This will allow store modules to implement slice-by-slice access without having to calculate a total number of elements.

Extracted content and Pageable related functionality into a common Chunk class which serves as base class for the two concrete implementations SliceImpl and PageImpl. Deprecated hasNextPage() etc. on Page in favor of the generic hasNext() methods.

QueryMethod now exposes an isSliceQuery() to indicate a query method will need sliced execution.
2014-03-04 14:25:08 +01:00
Oliver Gierke
1e3640e0ee DATACMNS-436 - Order.equals(…) / hashCode() / toString() now consider ignore case flag.
Extended equals(…), hashCode() and toString() methods t consider the ignore case flag held in an Order instance.
2014-02-06 18:13:54 +01:00
Oliver Gierke
8f0979e963 DATACMNS-431 - Code cleanups. 2014-01-28 13:14:35 +01:00
Oliver Gierke
f1d49c6f37 DATACMNS-429 - Improved JavaDoc for PageRequest and Sort.
Added a few missing parameter documentations in terms of semantics and nullability.
2014-01-23 12:23:13 +01:00
Oliver Gierke
62e14d2b12 DATACMNS-402 - Slight refinements in QSort implementation.
Re-enable concatenation with plain Sort via ….and(…) method. Some general polishing and JavaDoc cleanups.

Original pull request: #59.
2013-12-04 13:30:19 +01:00
Thomas Darimont
f2ff84fb63 DATACMNS-402 - Add support for sorting by a QueryDSL OrderSpecifier.
Previously we did only support ordering by a string or property path through Sort. In order to be able to express more type safe ordering expressions we introduce QSort as a subclass of Sort that is able to wrap QueryDSL OrderSpecifiers. To be able to separate the concerns of sorting via QueryDSL expressions better we introduce the AbstractPageRequest base class and QPageRequest as a special implementation that accepts a QSort or OrderSpecifiers for ordering.

Original pull request: #59.
2013-12-04 13:09:25 +01:00
Oliver Gierke
93b2d39cf1 DATACMNS-377 - Prevent page sizes less than one.
PageRequest now actively prevents page sizes less than one. PageableHandlerMethodArgumentResolver falls back to default page size if it detects a page size less than one. It also rejects invalid default configuration using @PageableDefault.
2013-10-07 10:47:25 +02:00
Oliver Gierke
70ce9a0908 DATACMNS-323 - PageImpl returns correct number of pages for use with content only.
So far, the PageImpl class returned 0 as total number of pages if set up from a plain List. This returns 1 now (as it should be). We've also adapted the hasNextPage() implementation to correctly calculate whether a next page is available.
2013-05-14 16:45:13 +02:00
Kevin Raymond
a588f43857 DATACMNS-281 - Added support to Order for case insensitive sorts.
Modified the Order class to allow an ignore case flag to be set so that case insensitive sorts could be supported.
2013-02-27 15:17:21 +01:00
Oliver Gierke
9fae10750e DATACMNS-286 - Extended Page/Pageable APIs.
Pageable and Page interfaces now expose API to easily access Pageables pointing to the previous and next Page instance if available.
2013-02-19 12:45:11 +01:00
Oliver Gierke
3a72d56ee8 DATACMNS-266 - Fixed JavaDoc of Page and PageImpl.
Includes pull request #16.
2013-01-18 09:42:12 +01:00
Oliver Gierke
ac256f9921 DATACMNS-266 - Use new common Maven build infrastructure.
Simplified project setup to be a single module build again. Using Spring Data Build parent POM to simplify project setup. See https://github.com/SpringSource/spring-data-build#spring-data-build-infrastructure
2013-01-16 15:15:24 +01:00