Commit Graph

941 Commits

Author SHA1 Message Date
Oliver Drotbohm
8bb87a1749 DATACMNS-1596 - Modules not exposing identifying annotations do not claim repository interfaces anymore.
Previously, a module not exposing any entity identifying annotations would have claimed a repository definition and potentially overrode the bean definition of another store that was the proper claim in the first place. We have now changed this to abstain from a claim of the interface.

We' also tweaked the log output in the following cases:

1. If the module neither returns an identifying type nor entity identifying annotations, we now log a warning that a module does not support a multi-module setup and answer all assignment requests with false.

2. The info level warning indicating an interface has been dropped now reports which annotations or interface base types to use.

Original pull request: #411.
Related tickets: spring-projects/spring-boot#18721
2019-10-24 14:39:48 +02:00
Mark Paluch
373eccda8a DATACMNS-1591 - Polishing.
Add since tags. Reorder methods. Use method references where possible.

Original pull request: #410.
2019-10-16 12:07:13 +02:00
Oliver Drotbohm
529d7a9d47 DATACMNS-1591 - Polishing.
Whitespace.

Original pull request: #410.
2019-10-16 12:05:07 +02:00
Oliver Drotbohm
efccf6d480 DATACMNS-1591 - @Primary is now considered on repository interfaces.
We now elevate the primary annotation from the scanned repository bean definition to the one created for the repository factory. This previously got lost as the former is hidden behind the RepositoryConfiguration interface that previously didn't expose the primary nature of the underlying bean definition.

Original pull request: #410.
2019-10-16 12:04:59 +02:00
Mark Paluch
dbc6810fc3 DATACMNS-1211 - Add ReactivePageableHandlerMethodArgumentResolver.
Add ReactivePageableHandlerMethodArgumentResolver and extract shared code from imperative PageableHandlerMethodArgumentResolver into PageableHandlerMethodArgumentResolverSupport.

Original pull request: #264.
2019-09-26 16:43:58 +02:00
Mark Paluch
48daa4c4b1 DATACMNS-1211 - Add ReactiveSortHandlerMethodArgumentResolver.
Add ReactiveSortHandlerMethodArgumentResolver and extract shared code from imperative SortHandlerMethodArgumentResolver into SortHandlerMethodArgumentResolverSupport.

Original pull request: #264.
2019-09-26 16:43:50 +02:00
Oliver Drotbohm
d1d5fa085d DATACMNS-1583 - Introduced QPageRequest.of(…) factory methods.
These methods are introduced for consistency with PageRequest. Constructors have been deprecated fro removal in 2.2.
2019-09-25 13:58:39 +02:00
Oliver Drotbohm
725d88811c DATACMNS-1581 - Polishing.
Javadoc on (Q)PageRequest.
2019-09-25 13:45:20 +02:00
Oliver Drotbohm
221ad9353e DATACMNS-1581 - Tighten nullability constraints for Sort parameters in PageRequest factory methods.
We now explicitly rejects null values for the Sort parameters in the constructor of PageRequest to avoid the creation of invalid instances if the IDE validation of nullability constraints is not in use.
2019-09-25 13:45:14 +02:00
Roland Weisleder
2467cd7d42 DATACMNS-1580 - Fix typo in Javadoc.
Original pull request: #316.
2019-09-18 15:43:24 +02:00
Matthias Merdes
9647e72c27 DATACMNS-1580 - Fix typo in Javadoc.
Original pull request: #329.
2019-09-18 15:41:35 +02:00
Mark Paluch
78dcab59c7 DATACMNS-1486 - Polishing.
Consistently annotate all nullable method arguments with Nullable.

Original pull request: #341.
2019-09-18 15:34:47 +02:00
Henning Hoefer
6699e9692f DATACMNS-1486 - Add missing Nullable annotation in HateoasSortHandlerMethodArgumentResolver.
Original pull request: #341.
2019-09-18 15:33:39 +02:00
Jef LeCompte
598c9cf443 DATACMNS-1580 - Add semicolon in documentation for clarity.
Original pull request: #401.
2019-09-18 15:28:58 +02:00
Oliver Drotbohm
ac3fc2bddd DATACMNS-1578 - Polishing. 2019-09-05 17:35:15 +02:00
Colin Gao
30dbac1bce DATACMNS-1578 - Proper handling of null values in QuerydslDefaultBinding.
We now properly use an ….isNull() binding if the value to be compared to is null.
2019-09-05 17:34:51 +02:00
Michael Simons
2024c1941b DATACMNS-1576 - Fix JavaDoc on CustomConversions.
Original pull request: #405.
2019-09-02 14:26:24 +02:00
Oliver Drotbohm
c42f5efe01 DATACMNS-1547 - Properly remove partially populated PersistentEntity instances from cache.
We now remove partially populated PersistentEntity instances from the cache held in AbstractMappingContext as the creation could fail for other RuntimeExceptions other than a MappingException and we wouldn't want to keep the instances around in any case.

Slight refactorings in the unit tests so that we can easily create MappingContext instances that reject certain types with certain exceptions.
2019-08-30 12:11:55 +02:00
Oliver Drotbohm
3e41d932dd DATACMNS-1571 - Polishing. 2019-08-28 10:06:46 +02:00
Oliver Drotbohm
85e257fc82 DATACMNS-1571 - Fixed specialization in ParameterizedTypeInformation.
DATACMNS-783 introduced code to specialize a raw type containing generics with the type information from it's context so that it can be established if only the raw type has been e.g. stored as type hint in a store (SomeType<T> stored as SomeType and T needing to be reestablished from the context). That application of the context unfortunately did not consider that the raw type might carry generics information itself, like `SomeType extends Foo<String, Integer>`.

We've now changed the specialization algorithm so that the the target type is being looked at in the context of the type used for the assignment (e.g. `Foo<T, ID> foo`). If that assignment fully resolves the declared type, we just outright use the given type as it by definition carries all generics information plus better type information in the first place.

If the type to specialize on is only partially expanding the generics we now create a synthetic type to merge the generics information. I.e. a `SomeType<T> extends Foo<T, Integer>` stored as SomeType would still resolve ID to Integer but capture T from the context including all potentially declared bounds.

Related tickets: DATACMNS-783, DATACMNS-1138.
2019-08-28 10:06:46 +02:00
Jens Schauder
65b85da8f1 DATACMNS-1570 - Made the behaviour consistent between Subject part and Order By part.
The subject part wasn't decapitalizing properties starting with multiple characters properly.

Original pull request: #402.
2019-08-27 09:39:04 +02:00
Oliver Drotbohm
dcb08cfaed DATACMNS-1569 - Updated Javadoc in Querydsl APIs for nullability rules on paging and sorting. 2019-08-22 12:47:36 +02:00
Stas
34c683bc57 DATACMNS-1567 - Fixed copyright year in Repository.java.
Original pull request: #392.
2019-08-16 08:49:14 +02:00
Sangwoo Lee
ff02d34474 DATACMNS-1557 - Fix typo in Sort Javadoc.
From `ASC` to `DESC`.

Original pull request: #400.
2019-07-29 11:07:00 +02:00
Mark Paluch
88b0b3c924 DATACMNS-1556 - Store values as array in ParametersParameterAccessor.
Prevents changes in store modules that expose values as array.
2019-07-25 14:12:11 +02:00
Mark Paluch
b8c0a2fa8f DATACMNS-1556 - Deeply inspect query results deeply for the need of query post-processing.
We now inspect returned Collections whether we need to convert these at all. If not, we skip conversion.

Also, allocate GenericConversionService only once for memory-efficiency.
2019-07-25 14:12:11 +02:00
Mark Paluch
94c4713e0f DATACMNS-1556 - Conditionally copy and unwrap query method arguments.
ParametersParameterAccessor now inspects invocation arguments whether we need to unwrap these at all. If not, we skip copying the list of values.
2019-07-25 14:12:11 +02:00
Mark Paluch
f1bc778098 DATACMNS-1556 - Remove capturing lambdas from hot code paths.
Replaced orElseThrow with if blocks. Introduce nullable RepositoryComposition.getMethod(Method) to avoid Optional handling in hot code paths.
2019-07-25 14:12:11 +02:00
Mark Paluch
972449ef2d DATACMNS-1556 - Limit default method invocation only to interfaces that actually declare default methods. 2019-07-25 14:12:11 +02:00
Mark Paluch
293bbd9a63 DATACMNS-1556 - General performance improvements in repository execution.
We now avoid the allocation of an Optional instance in the lookup of a dynamic projection in ParameterAccessor. Also, Lazy now exposes a ….getNullable() to be favored over ….getOptional() for hot code paths.

Replaced Stream and Optional usage with for-loops and nullable return values. Reuse parameter names to avoid repeated annotation lookups. Reuse result from Parameters.getBindable(). Introduce ParametersParameterAccessor.getValues() to consistently reuse a single accessor instance allowing access to the unwrapped values. Introduce type cache to QueryExecutionConverters to quickly reject types that do not require wrapping. Avoid recalculation of QueryMethod.isCollectionQuery().
2019-07-25 14:12:11 +02:00
Oliver Drotbohm
e0f2d65d73 DATACMNS-1555 - Support for extracting properties during a PersistentPropertyPath traversal.
PersistentPropertyAccessor now has an overloaded method to pass in a TraversalContext that can be prepared to property handlers for PersistentProperties. During the traversal, the handler is called with the value for the property so that it can e.g. extract list elements, map values etc.
2019-07-22 10:56:07 +02:00
Oliver Drotbohm
fa9e5b799a DATACMNS-1552 - Test case to verify Option values are returned as is.
Make sure that the fix for DATACMNS-1524 fixes this ticket as well. A bit of whitespace in QueryExecutionResultHandler.
2019-07-04 12:23:14 +02:00
Oliver Drotbohm
d29fefca5b DATACMNS-1524 - Fix performance regression in QueryExecutionResultHandler.
A side effect of the fix for DATACMNS-1482 trigged source objects that already perfectly match the desired return type would still be subject to detailed inspection of potential conversions, which – by definition – will not kick in.

The code has now been changed to only trigger detailed inspection for collection values.

Related tickets: DATACMNS-1482.
2019-07-02 14:25:08 +02:00
Oliver Drotbohm
736d147446 DATACMNS-1550 - Polishing.
Javadoc wording and formatting.
2019-07-01 15:34:19 +02:00
Jens Schauder
f29756e5f8 DATACMNS-1550 - Added RevisionType to RevisionMetadata. 2019-07-01 15:34:19 +02:00
Oliver Drotbohm
ed0d30b4d6 DATACMNS-1551 - Polishing.
Method order in SortHandlerMethodArgumentResolver.
2019-07-01 14:30:48 +02:00
Oliver Drotbohm
4c1aed27d6 DATACMNS-1551 - SortHandlerMethodArgumentResolver now drops dot-only property segments.
If plain dots were submitted as elements in a Sort expression to be parsed by SortHandlerMethodArgumentResolver, those dots would be considered a property of the sort expression, which is of course wrong. We now drop property candidates solely consisting of dots and whitespace.
2019-07-01 14:16:09 +02:00
Michael Simons
38b08f4e27 DATACMNS-1548 - Fix JavaDoc on AuditingHandler#setModifyOnCreation.
Original pull request: #397.
2019-06-24 10:54:39 +02:00
Mark Paluch
687222d1fa DATACMNS-1467 - Polishing.
Tweak docs.

Original Pull Request: #332
2019-06-07 14:30:00 +02:00
Christoph Strobl
dde9a651ba DATACMNS-1467 - Decouple sync and reactive bits.
Add dedicated interfaces for sync and reactive usage.
Hide default implementation and use reflective callback method lookup.
Update documentation and add initial reference documentation snippet for store specific modules.

Original Pull Request: #332
2019-06-07 14:29:00 +02:00
Mark Paluch
52724cd5dd DATACMNS-1467 - Entity Callback API draft.
This is a draft for a possible Entity Callback API heavily inspired by Spring Framework's Application Event listeners. Entity callbacks are callbacks for entities that allow for entity modification at certain check points such as before saving an entity or after loading it.

Entity callbacks consist of a marker-interface for all entity callback types and the EntityCallbacks API to dispatch callbacks.

Entity callbacks are picked up from the ApplicationContext and invoked sequentially according to their ordering.

Usage example:

AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(MyConfig.class);

SimpleEntityCallbacks callbacks = new SimpleEntityCallbacks(ctx);

PersonDocument personDocument = new PersonDocument(null, "Walter", null);
PersonDocument afterCallback = callbacks.callback(personDocument, BeforeSaveCallback.class,
		BeforeSaveCallback::onBeforeSave);

Mono<PersonDocument> afterCallback = callbacks.callbackLater(personDocument, ReactiveBeforeSaveCallback.class,
		ReactiveBeforeSaveCallback::onBeforeSave);

@Configuration
static class MyConfig {

	@Bean
	BeforeSaveCallback<Person> personCallback() {
		return object -> {
			object.setSsn(object.getFirstName().length());
			return object;
		};
	}

	@Bean
	MyReactiveBeforeSaveCallback callback() {
		return new MyReactiveBeforeSaveCallback();
	}

}

class MyReactiveBeforeSaveCallback implements ReactiveBeforeSaveCallback<Person> {

	@Override
	public Mono<Person> onBeforeSave(Person object) {

		PersonDocument result = new PersonDocument(object.getFirstName().length(), object.getFirstName(),
				object.getLastName());

		return Mono.just(result);
	}
}

Original Pull Request: #332
2019-06-07 14:26:38 +02:00
Mark Paluch
83611de861 DATACMNS-1500 - URL Cleanup. 2019-06-05 11:16:03 +02:00
arielcarrera
098842765d DATACMNS-1538 - Repository proxy post processors in CDI.
Add support for custom repository proxy post processors in CDI.

Original pull request: #396.
2019-06-05 10:54:57 +02:00
Mark Paluch
efa529a7a6 DATACMNS-1540 - Use thread-safe path cache in QuerydslPredicateBuilder.
We now use ConcurrentHashMap instead of HashMap to cache Path instances by PathInformation.
2019-05-27 08:41:51 +02:00
Christoph Strobl
d6bb21d24f DATACMNS-1534 - Cache BeanFactory lookup for EvaluationContextExtension.
We now cache the BeanFactory lookup for EvaluationContextExtension within the ExtensionAwareEvalutationContextProvider to avoid (expensive) repeated context scans when creating the actual EvaluationContext.

Original pull request: #395.
2019-05-14 12:25:01 +02:00
Oliver Drotbohm
a45a0ded9c DATACMNS-1518 - Fixed detection of varargs overloads for SpEL expressions.
Before this commit we haven't properly resolved methods on a root object provided by an EvaluationContextExtension that was using varargs. With a vararg method, the number of parameters handed into the method is not necessary equal to the number of parameters. We previously simply skipped methods with a different number of arguments. We now try direct matches first but calculate valid varargs alternatives in case that initial lookup fails and try to match those alternatives.

This lookup is implemented in ….util.ParameterTypes now and used by ….spel.spi.Function. The latter now also handles the actual invocation of those methods properly by collecting the trailing arguments into an array.
2019-05-09 13:05:11 +02:00
Oliver Drotbohm
e31c7aed51 DATACMNS-1526 - Adapt to API changes in Spring HATEOAS. 2019-05-08 19:10:04 +02:00
David Schneider
a8e90b1932 DATACMNS-1510 - Fix phrasing in Javadoc of @Param.
Original pull request: #389.
2019-04-23 17:14:31 +02:00
Jerzy Kwiatkowski
2b6682d3b1 DATACMNS-1520 - Fix typo in Javadoc.
Original pull request: #393.
2019-04-23 17:11:18 +02:00
Oliver Drotbohm
a5681f637c DATACMNS-1497 - Polishing.
RepositoryBeanDefinitionRegistrarSupport now also overrides registerBeanDefinitions(AnnotationMetadata, BeanDefinitionRegistry) so that unit test in downstream modules still work.

Added defaulting of BeanNameGenerator in XmlRepositoryConfigurationSource so that we use an AnnotationBeanNameGenerator if a DefaultBeanNameGenerator is handed in.

Related tickets: spring-projects/spring-framework#22591
2019-04-03 11:53:58 +02:00