Commit Graph

661 Commits

Author SHA1 Message Date
Mark Paluch
e768e8eb5e DATACMNS-947 - Adopt ReactiveTypeDescriptor and ReactiveAdapterRegistry changes.
Remove our own ReactiveWrappers.Descriptor type in favor of ReactiveTypeDescriptor. Adopt changes in ReactiveAdapterRegistry.
2016-12-04 13:12:43 +01:00
Oliver Gierke
cb6d2f7cc3 DATACMNS-928 - Reference documentation for event publication support. 2016-12-01 09:43:31 +01:00
Oliver Gierke
f6db714206 DATACMNS-928 - Refinements for aggregate root domain event publication.
We now publish events for all methods named "save" on the repository. Fundamentally, that's in place to capture calls to CrudRepository.save(Iterable entities), too.

Some minor refactorings to the internal setup of EventPublishingMethodInterceptor. More JavaDoc.
2016-12-01 09:43:28 +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
a8b2eb1589 DATACMNS-918 - Polishing.
Minor JavaDoc stuff.
2016-11-29 14:15:19 +01:00
Mark Paluch
08d9a61ea3 DATACMNS-918 - Provide interfaces for Pageable and Sort method argument resolvers.
We now provide HandlerMethodArgumentResolver interfaces to resolve Sort and Pageable method arguments with typed return values.
2016-11-29 14:15:19 +01:00
Oliver Gierke
fbd560ee4f DATACMNS-943 - We prefer direct matches on repository query method overloads.
We now try to look up a target class method based on concrete name and parameter type before falling back on the more expensive type matches. This also eliminates the possibility of invalid method matches as described in the ticket.
2016-11-24 17:23:57 +01:00
Oliver Gierke
232ab0e800 DATACMNS-933 - Prepare 2.0 M1 (Kay). 2016-11-23 10:35:08 +01:00
Oliver Gierke
aaf8d49238 DATACMNS-933 - Updated changelog. 2016-11-23 10:34:54 +01:00
Oliver Gierke
bc2af4ceb1 DATACMNS-937 - Fixed spelling of Javaslang related code.
Using a lower case "s" now.
2016-11-21 12:35:07 +01:00
Mark Paluch
9316ce471b DATACMNS-939 - Tests. 2016-11-21 10:43:40 +01:00
Mark Paluch
ed11c9dbd7 DATACMNS-939 - Do not create queries for static interface methods.
We now no longer attempt query creation for static methods declared on a repository interface. This allows static method usage inside of repository interfaces.

interface PersonRepository extends CrudRepository<Person, String> {

    static String createId() {
        // …
    }

    default Person findPerson() {
        return findOne(createId());
    }
}
2016-11-21 10:32:52 +01:00
Oliver Gierke
8d7752a96b DATACMNS-937 - Document JavaSlang's Option type as query method return type.
Mentioned the support for Scala's Option type, too.
2016-11-19 15:38:51 +01:00
Oliver Gierke
e009471aaa DATACMNS-937 - Polishing.
Removed Spring 4.2 guard from QueryExecutionConverter and its unit tests.
2016-11-19 12:59:08 +01:00
Oliver Gierke
71fc87ad42 DATACMNS-937 - Support for JavaSlang's Option type as nullable wrapper.
Repository methods can now return JavaSlang's Option as alternative to JDK 8's Optional or Guavas Optional.
2016-11-19 12:56:19 +01:00
Oliver Gierke
f3433a4fd4 DATACMNS-935 - Removed dependency to Spring's Descriptor.
The Descriptor class is nested in the ReactiveAdapter interface which in turn has a strong dependency to Project Reactor as it exposes some if its types as method return types. That means we can't refer to Spring's Descriptor without Project Reactor on the classpath.

Introduced a custom Descriptor that exposes the setup needs we have using a fluent API.

We now also only conditionally actually the ReactiveAdapterRegistry as eagerly instantiating it in RectiveWrapperConverter causes a strong dependency on Reactor.

Related tickets: DATACMNS-836, SPR-14902.
2016-11-14 20:18:49 +01:00
Mark Paluch
8a2ce30e70 DATACMNS-836 - Encapsulate reactive type conversion in ReactiveWrapperConverters.
Reactive type conversion now happens fully inside of ReactiveWrapperConverters and does not require an external ConversionService. This change allows changes to reactive type conversion without changing the API since all details are encapsulated by ReactiveWrapperConverters.
2016-11-14 15:41:59 +01:00
Oliver Gierke
325f7bb1d2 DATACMNS-836 - Introduced base class for reactive repository factories.
Introduced ReactiveRepositoryFactorySupport so that validation for the presence of all required converters (e.g. RxJava 1) does not have to be repeated in individual stores.
2016-11-14 15:41:54 +01:00
Oliver Gierke
9bca55a8c4 DATACMNS-836 - Improve reactive repository configuration.
RepositoryConfigurationExtensionSupport now exposes a ….useRepositoryConfiguration(RepositoryMetadata) so that extensions can opt in or out of an interface taking part in configuration more easily. Turned loadRepositoryInterface(…) private again as extensions should be able to just inspect the RepositoryMetadata now.

Some parameter rename in ReactiveWrapperConverters to avoid confusion.
2016-11-14 15:41:54 +01:00
Oliver Gierke
5d591db848 DATACMNS-836 - Polishing.
RepositoryMetadata now exposes an ….isReactiveRepository() that's implemented by inspecting the backing repository interface for any reactive wrapper type appearing in method signatures. That allows us to move down the use of a ConversionService down to ReactiveRepositoryInformation.WrapperConversionMatch.

Made a couple of methods static that could be. Simplified some logic using streams. A bit better wording in assertions. Some formatting when using streams.
2016-11-14 15:41:54 +01:00
Christoph Strobl
5bf19d1c2a DATACMNS-836 - Favor usage of Function over Converter. 2016-11-14 15:41:53 +01:00
Mark Paluch
c049fd8368 DATACMNS-836 - Enhance JavaDoc. 2016-11-14 15:41:53 +01:00
Mark Paluch
d0836773ba DATACMNS-836 - Apply deferred reactive type conversion as RxJava's PublisherAdapter keep state between multiple subscribers. 2016-11-14 15:41:53 +01:00
Mark Paluch
a6bc800138 DATACMNS-836 - Move reactive wrapper converters to ReactiveWrapperConverters.
Move reactive wrapper conversion to ReactiveWrapperConverters to minimize touching points with reactive APIs. ReactiveWrapperConverters is used only from reactive repository components and does not initialize with blocking API use. This removes the need of having Project Reactor on the class path for non-reactive use.
2016-11-14 15:41:53 +01:00
Mark Paluch
dd2fe0a34d DATACMNS-836 - Cleanups.
- Rename RxJava...Repository to RxJava1...Repository
- Use Completable and Observable instead of Single for results without values/optional values
- Remove reactive paging for now as it does not really fit reactive data streaming
- Expose ReactiveWrappers.isAvailable(ReactiveLibrary) method to query library availability
2016-11-14 15:41:53 +01:00
Mark Paluch
474c9981da DATACMNS-836 - Provide wrapper conversion, ReactiveWrappers and RxJava 2 type conversion. 2016-11-14 15:41:53 +01:00
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
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
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
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