Commit Graph

1175 Commits

Author SHA1 Message Date
Mark Paluch
2e4d63fddd DATACMNS-836 - Add reactive repository support.
We now expose reactive interfaces to facilitate reactive repository support in store-specific modules. Spring Data modules are free to implement their reactive support using either RxJava 1 or Project Reactor (Reactive Streams). We expose a set of base interfaces:

* `ReactiveCrudRepository`
* `ReactiveSortingRepository`
* `RxJava1CrudRepository`
* `RxJava1SortingRepository`

Reactive repositories provide a similar feature coverage to blocking repositories. Reactive paging support is limited to a `Mono<Page>`/`Single<Page>`. Data is fetched in a deferred way to provide a paging experience similar to blocking paging.

A store module can choose either Project Reactor or RxJava 1 to implement reactive repository support. Project Reactor and RxJava types are converted in both directions allowing repositories to be composed of Project Reactor and RxJava 1 query methods. Reactive wrapper type conversion handles wrapper type conversion at repository level. Query/implementation method selection uses multi-pass candidate selection to invoke the most appropriate method (exact arguments, convertible wrappers, assignable arguments).

We also provide ReactiveWrappers to expose metadata about reactive types and their value multiplicity.
2016-11-14 15:41:52 +01:00
Mark Paluch
25be6b7254 DATACMNS-836 - Add reactor-core dependency. 2016-11-14 15:41:52 +01:00
Oliver Gierke
3f3ab494a8 DATACMNS-919 - Removed deprecated DomainClassPropertyEditor and -Registrar. 2016-11-14 15:39:48 +01:00
Oliver Gierke
5d1ce6daa5 DATACMNS-864 - Fix Java 8 compiler ambiguities.
Added explicit generics invocations in places that caused an ambiguous invocation on Java 8.
2016-11-14 15:39:48 +01:00
Oliver Gierke
8bb6418251 DATACMNS-864 - Prepare 2.0 development.
Upgraded to Spring Data Build parent 2.0 snapshots. Removed obsolete distribution key property. Removed obsolete template.mf.
2016-11-14 15:39:48 +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
0005412383 DATACMNS-924 - Updated changelog. 2016-11-03 18:56:37 +01:00
Oliver Gierke
2e4e6ee61f DATACMNS-929 - Fixed NullPointerException in PageableHandlerMethodArgumentResolver.
PageableHandlerMethodArgumentResolver.isFallbackPageable() now correctly guards against the fallback Pageable being null, a situation that's explicitly deemed valid in setFallbackPageable(…).
2016-11-01 18:04:54 +01:00
Oliver Gierke
0f76ffd491 DATACMNS-925 - Polishing.
Moved an assignment back to its original place to create instance state as early as possible.

Original pull request: #180.
2016-10-16 17:22:54 +01:00
Christoph Dreis
62617bef05 DATACMNS-925 - Improve memory consumption of Parameter and Parameters.
This commit changes some ArrayList initializations to use an initial capacity and avoids the unnecessary fetch of the return type of a method in Parameter.isDynamicProjectionParameter().

Original pull request: #180.
2016-10-16 17:20:43 +01:00
Oliver Gierke
5bb60b6f0b DATACMNS-914 - Updated changelog. 2016-09-29 14:42:00 +02:00
Oliver Gierke
00776d6fe9 DATACMNS-922 - Updated changelog. 2016-09-29 11:42:02 +02:00
Oliver Gierke
7422ba4093 DATACMNS-923 - Removed obsolete code in DefaultRepositoryInformation.
The special case of an Iterable parameter doesn't have to be handled explicitly anymore so that we can simplify the type match check in DefaultRepositoryInformation.

Related ticket: DATACMNS-912.
2016-09-28 17:25:51 +02:00
Oliver Gierke
024f1ae8bd DATACMNS-921 - ResultProcessor now gracefully falls back to approximate collections if necessary.
When handling collection results, we now create an approximate collection in case the creation of the exact same collection fails.
2016-09-28 15:01:19 +02:00
Oliver Gierke
7d901d2005 DATACMNS-916 - Polishing.
Minor formatting changes.

Original pull request: #178.
2016-09-23 14:53:26 +02:00
Mark Paluch
0e29af3a15 DATACMNS-916 - Fix setter lookup in ClassGeneratingPropertyAccessorFactory.
Previously, ClassGeneratingPropertyAccessorFactory uses boxed types for primitive type setters. This threw NoSuchMethodExceptions and caused ExceptionInInitializerError as the generated class could not be initialized. We now use the appropriate argument type to look up setters.

Also, we now only generate accessor usage if the property is configured to use property access in the first place.

Original pull request: #178.
2016-09-23 14:53:26 +02:00
Oliver Gierke
3811ce5873 DATACMNS-917 - Query method execution for Maps now defaults null to an empty Map.
QueryExecutionResultHandler now explicitly handles null values for query methods returning Maps by returning an empty Map. This can be the case if a query is supposed to produce a Map (a single result) but doesn't actually yield any results at all.
2016-09-23 14:46:59 +02:00
Oliver Gierke
8e35c4e41d DATACMNS-913 - Updated changelog. 2016-09-21 08:03:03 +02:00
Oliver Gierke
f09e0d1f71 DATACMNS-873 - Updated changelog. 2016-09-21 08:03:02 +02:00
Oliver Gierke
f44c238784 DATACMNS-912 - Fixed generic method detection for overrides using generic methods.
We now correctly check the bounds of generic methods if we deal with a type variable found as method parameter. Introduced different code paths for type and method level generics so that the latter is explicitly checking all bounds available.
2016-09-20 00:43:27 +02:00
Oliver Gierke
db62390de9 DATACMNS-864 - Tweaks in tests after activation for Spring 5 builds.
After the Spring 5 build profile has been activated properly in Spring Data build [0], the test cases for RepositoryPopulators failed as there was only an explicit detection of Spring 4 to point the test to the right resource file. Removed the guard now as all supported versions can now use the same file.

Adapt to the stricter contract in Spring 5's MethodParameter in unit test for QuerydsPredicateArgumentResolver.

[0] 31df5de907
2016-09-09 23:40:21 +02:00
Oliver Gierke
e884a6678c DATACMNS-910 - Updated Travis configuration.
Disabled Spring 4.2 build profile and enabled the ones for Spring 5 instead.
2016-09-09 22:18:46 +02:00
Oliver Gierke
8ed2bca557 DATACMNS-909 - Mask getDecoratedClass() of Spring 4.3's DecoratingProxy.
The proxies created for projections now defensively mask getDecoratedClass(), a method declared on DecoratingProxy, an interface that JDK proxies on Spring 4.3 will implement.
2016-09-09 21:59:55 +02: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
8bc022ebd7 DATACMNS-875 - Add support for exists projection in repository query derivation.
We now support exists projections in derived queries by parsing the exists keyword and expose it via PartTree.isExistsProjection().

Original pull request: #171.
2016-09-01 17:36:57 +02:00
Mark Paluch
2b14d1ea54 DATACMNS-899 - Fix recursion in ParameterizedTypeInformation.getMapValueType().
Previously, calls to ParameterizedTypeInformation.getMapValueType() caused an infinite recursion when invoked on a type information that was not a map type. This lead to a StackOverflowError.

We now call the super method doGetMapValueType() instead of calling the entry super method getMapValueType() and return by that null in case the map value type is not resolvable.

Original pull request: #176.
2016-09-01 17:28:10 +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
Jasper Blues
b7f4709b7c DATACMNS-903 - Fix typo in reference documentation.
Original pull request: #170.
2016-08-29 16:31:41 +02:00
Oleksandr Mandryk
1d5273c048 DATACMNS-902 - Fix attribute name in example showing how to define a custom repository base class.
Original pull request: #173.
2016-08-29 16:21:16 +02:00
Kirill Gavrilov
eb2029310f DATACMNS-903 - Fix typo in reference documentation.
Original pull request: #174.
2016-08-29 16:16:31 +02:00
Oliver Gierke
4fa84fc983 DATACMNS-896 - Improved detection of type variable mappings in recursively nested generics.
If the same generic type was used on recursively nested generics declarations, like this:

class GenericType<T> {}

class Nested extends GenericType<String> {}

class Concrete extends GenericType<Nested> {}

our traversal of the generics discovered T bound to String in Nested and as that is extending GenericType as well, the T detected here is the same instance as the T within the map discovered for Concrete. As we previously added the nested types after we added the original entry, the nested discovery overwrote the more local one.

We now make sure the detected nested type variable mappings don't overwrite already existing ones.
2016-08-19 19:49:24 +02:00
Oliver Gierke
f75320f33c DATACMNS-891 - Repository bean definition registration now exposes repository type in metadata.
We now set an explicit attribute on the BeanDefinition created for every repository factory to allow BeanFactoryPostProcessors to inspect those.
2016-08-09 17:01:54 +02:00
Oliver Gierke
c6624be8a7 DATACMNS-838 - After release cleanups. 2016-07-27 14:32:37 +02:00
Oliver Gierke
eac6d7e9f2 DATACMNS-838 - Prepare next development iteration. 2016-07-27 14:32:33 +02:00
Oliver Gierke
856724f3aa DATACMNS-838 - Release version 1.13 M1 (Ingalls). 2016-07-27 13:52:12 +02:00
Oliver Gierke
c6391dc7f1 DATACMNS-838 - Prepare 1.13 M1 (Ingalls). 2016-07-27 13:51:37 +02:00
Oliver Gierke
f4b16298da DATACMNS-838 - Updated changelog. 2016-07-27 13:51:26 +02:00
Oliver Gierke
c23c7b9cc7 DATACMNS-885 - Fixed implementation of canRead(…) for projecting HttpMessageConverters.
Changed the implementation of both the JSON Path and XPath based projecting HttpMessageConverters to make sure the cached decisions don't depend on the media type. Reuse the evaluation of the media type in AbstractHttpMessageConverter.
2016-07-26 18:35:29 +02:00
Oliver Gierke
f53795d48e DATACMNS-880 - TransactionalRepositoryFactoryBeanSupport.setBeanFactory(…) now delegates to parent implementation.
Previously TransactionalRepositoryFactoryBeanSupport.setBeanFactory(…) didn't invoke the method of the super class preventing the BeanFactory to be propagated to the repository factory resulting in the ProjectionFactory implementation created being unaware of the BeanFactory and thus no bean references being available in projection interfaces.
2016-07-26 09:46:15 +02:00
Oliver Gierke
14eb1b946a DATACMNS-887 - Updated Sonargraph architecture description. 2016-07-25 19:40:56 +02:00
Oliver Gierke
37c895c04a DATACMNS-886 - Fix version ranges for Spring Framework in template.mf. 2016-07-25 19:28:54 +02:00
Oliver Gierke
e79c19d277 DATACMNS-885 - Added XML support for incoming projections based on XMLBeam.
Added an XML flavor of the support added in previous commits based on XML Beam [0].

[0] http://www.xmlbeam.org.
2016-07-25 18:23:53 +02:00
Oliver Gierke
762a12b4a2 DATACMNS-885 - Workaround for bug in Jayway's JSONPath array access.
When a recursive decent operator is used in a JSON Path expression there's no way to get out of the array mode again to indicate one is interested in a particular element (e.g. "the first one no matter where in the document") [0]. We now work around this by always letting the parser return lists, so that the mapping library finally kicking in can be equipped with the correct target type to create.

Unfortunately this causes arrays to be double-wrapped for definite paths so that we basically have to adapt the type handed to Jackson in another round to the unwrap the mapping result in turn [1].

[0] https://github.com/jayway/JsonPath/issues/248
[1] https://github.com/jayway/JsonPath/issues/249
2016-07-25 17:26:37 +02:00
Oliver Gierke
eec2b43fd0 DATACMNS-885 - Support for binding JSON payloads to projection interfaces.
Projection types annotated with @ProjectedPayload can now be used as parameters for @RequestBody annotated Spring MVC controller method parameters.

Accessor methods will be translated into JSON path property expressions which can be customized by using the @JsonPath annotation. The methods are allowed to return simple types, nested projection interfaces or complex classes which will will be mapped using a Jackson ObjectMapper.
2016-07-25 17:26:32 +02:00
Oliver Gierke
86c1086976 DATACMNS-884 - Polishing.
Renamed PageableExecutionSupport to …Utils as …Support classes are usually empty adapter classes for interfaces and meant to be extended.
2016-07-19 15:08:24 +02:00
Mark Paluch
29c86d74b3 DATACMNS-884 - Move PageableExecutionSupport from JPA to Spring Data Commons.
PageableExecutionSupport assumes that data queries are cheaper than count queries so we can apply some optimizations. We determine the total from the pageable and the results in which we don't hit the page size bounds (i.e. results are less than a full page without offset or results are greater 0 and less than a full page with offset). In all other cases we issue an additional count query.
2016-07-19 15:08:24 +02:00
Oliver Gierke
f2a6d63dbb DATACMNS-883 - Improved collection path binding for Querydsl-backed web requests.
Improved the dot-path translation of existing Querydsl Path instances by not relying on the toString() representation of the metadata but manually traversing the elements up to the root. Extracted the translation method into QueryDslUtils.

Furthermore, we now automatically insert an CollectionPathBase.any() step for Path instances of that type when reifying the paths from request attributes.
2016-07-15 11:39:43 +02:00
Oliver Gierke
8599ecf019 DATACMNS-879 - Polishing.
Some cleanups in ExampleMatcherAccessor.
2016-07-14 21:03:10 +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