Commit Graph

1085 Commits

Author SHA1 Message Date
Mark Paluch
ae4f0361af DATACMNS-800 - Polishing.
Update RxJava 2/3 repositories with deleteAllById(…). Reorder methods.

Original pull request: #476.
2020-11-25 09:37:48 +01:00
Jens Schauder
bc76fcb7fc DATACMNS-800 - Adds deleteAllById to ReactiveCrudRepository and CrudRepository.
CrudRepository and ReactiveCrudRepository now expose a deleteAllById(Iterable<ID>) method to delete multiple entities by their Id.

Original pull request: #476.
2020-11-25 09:32:11 +01:00
Mark Paluch
cd482bf9e3 DATACMNS-1827 - Polishing.
Consider Qualifier meta-annotated Sort and Pageable method parameters. Add author tag.

Original pull request: #473.
2020-11-11 09:30:06 +01:00
Vedran Pavic
e758dd3a84 DATACMNS-1827 - Pageable and Sort arguments with empty qualifier value shouldn't be prefixed with delimiter.
Original pull request: #473.
2020-11-11 09:30:01 +01:00
Mark Paluch
1d146da048 DATACMNS-1828 - Revert custom collection component type lookup.
We now report the first generic parameter for collection-like types to use the behavior that was previously in place. We will address the issues resulting of the intent to report the correct component type of Iterable in a later change.
2020-11-06 16:08:06 +01:00
Oliver Drotbohm
9fddd402f7 DATACMNS-1828 - Fix Map component type lookup for custom Map implementations.
Instead of using the first generic type parameter of a parameterized type as Map component type, we now explicitly lookup the super type's Map-specific generics configuration and use its first generic type parameter. The same for collection like types falling back to the parameter type bound to Iterable.
2020-11-05 15:21:55 +01:00
Jens Schauder
6572880412 DATACMNS-1820 - Moves PageabeExecutionUtils to o.s.data.support.
This avoids module cycles when it is used from a template.
The old version is still there, deprecated and delegates to the new version.

Original pull request: #472.
2020-10-28 09:54:54 +01:00
Mark Paluch
0902fe8f8b DATACMNS-1819 - Use awaitSingleOrNull to bridge Publisher to Coroutines Repositories.
We're now awaiting completion of the underlying Publisher to ensure all completion tasks have finished before continuing with the execution. This is to avoid completion running in parallel to the actual coroutine as not awaiting completion can result in race conditions.
2020-10-27 16:43:29 +01:00
John Blum
2fbf709459 DATACMNS-1804 - Correct grammar in Exception messages thrown by Repository classes.
Original pull request: #467.
2020-10-23 17:03:36 +02:00
Oliver Drotbohm
e3e23828ef DATACMNS-1806 - Polishing.
Styilistic tweaks (we only qualify writing field access with this).

Original pull request: #468.
2020-09-25 16:42:41 +02:00
Henning Rohlfs
a442b90021 DATACMNS-1806 - Prevent returning null from Lazy due to concurrency problem.
When accessed concurrently from multiple threads, Lazy.getNullable() could return null unexpectedly.

Original pull request: #468.
2020-09-25 16:42:41 +02:00
Mark Paluch
d10560f238 DATACMNS-1762 - Reintroduce calls to ReactiveWrapperConverters.supports(…) after decoupling from QueryExecutionConverters.
We now consider reactive wrapper types in all areas that previously relied on QueryExecutionConverters to handle reactive type information correctly. Specifically, we call supports(…) and perform type unwrapping to ensure to detect the correct return type.
2020-09-25 16:25:43 +02:00
Oliver Drotbohm
af9dd6110d DATACMNS-1726 - Polishing of nullability after Lombok removal.
Reviewed visibility modifiers manually introduced constructors previously provided by Lombok. Also some nullability constraints have been accidentally changed by that.
2020-09-25 15:29:08 +02:00
Mark Paluch
5876bd2e5a DATACMNS-1762 - Consider reactive types as wrappers during method introspection.
We now perform type unwrapping and introspection for reactive types for method return types and method arguments after decoupling QueryExecutionConverters.supports(…) from ReactiveWrapperConverters.
2020-09-25 14:41:54 +02:00
Christoph Strobl
f261220372 DATACMNS-1762 - Polishing.
Update JavaDoc, remove unused imports and reduce method visibility.

Original Pull Request: #459
2020-09-25 08:00:29 +02:00
Wim Deblauwe
97df0fa899 DATACMNS-1762 - Add tests for projections returning Optional.
Original Pull Request: #459
2020-09-25 08:00:08 +02:00
Mark Paluch
bd3992dfc5 DATACMNS-1762 - Support Optional wrapping for projection getters.
We now support nullable wrappers for projection interfaces. Getters are inspected whether their return type is a supported nullable wrapper. If so, then the value can be wrapped into that type. Null values default in that case to their corresponding empty wrapper representation.

Original Pull Request: #459
2020-09-25 07:59:02 +02:00
Mark Paluch
04f59f1307 DATACMNS-1762 - Extract NullableWrapperConverters from QueryExecutionConverters.
Nullable wrappers such as Java 8 Optional, Guava Optional, Scala Option and Vavr Option are now handled in NullableWrapperConverters and are no longer coupled to QueryExecutionConverters so that this functionality can be reused.

Original Pull Request: #459
2020-09-25 07:58:52 +02:00
Mark Paluch
9ced611ea5 DATACMNS-1762 - Remove ReactiveWrappers support from from QueryExecutionConverters.
ReactiveWrappers doesn't belong in there in the first place so we're removing ReactiveWrappers support from QueryExecutionConverters so ReactiveWrappers is used from parts that need to be reactive-aware.

Original Pull Request: #459
2020-09-25 07:54:21 +02:00
Mark Paluch
eadbe80f03 DATACMNS-1802 - Extract Flux.from(…) into own method.
For some reason, calling Flux.from(…) in its own, static method, heals NoClassDefFoundError even though the method is not used during runtime nor Publisher is defined in a method signature.
2020-09-22 16:07:52 +02:00
Mark Paluch
b3d0fea061 DATACMNS-1637 - Add default stream() method to CloseableIterator.
CloseableIterator now allows construction of a Stream that is associated with a close hook to release resources after its use.

CloseableIterator<Person> iterator = …;

try (Stream<Person> stream = iterator.stream()) {
	assertThat(stream.count()).isEqualTo(3);
}
2020-09-22 15:47:48 +02:00
Mark Paluch
82cb36f727 DATACMNS-1802 - Add support for suspend repository query methods returning List<T>.
We now support returning List<T> from a suspended repository query method to simplify consumption of collection queries.
2020-09-22 14:44:46 +02:00
Oliver Drotbohm
96097c290d DATACMNS-1736 - Polishing.
Avoid reuse of Lazy instances for (Sort|Pageable)HandlerMethodArgumentResolver and consistently use those to avoid breaking API changes in configuration classes.
2020-09-15 17:01:20 +02:00
Greg L. Turnquist
9d12ac7324 DATACMNS-1736 - Switch away from overrideable methods. 2020-09-15 17:01:19 +02:00
Mark Paluch
c10072c96f DATACMNS-1736 - Use BeanFactory lookup in configuration classes instead of intercepted local bean methods.
We now use @Configuration(proxyBeanMethods = false) and use BeanFactory bean lookups to avoid CGlib proxy creation.

Using Spring's BeanProvider.getIfUnique(…) instead of catching NoSuchBeanDefinitionException.
2020-09-15 17:01:19 +02:00
Mark Paluch
c85b524508 DATACMNS-1795 - Align checks in ReactiveWrappers with checks in ReactiveAdapterRegistry.
Checks in ReactiveWrappers align now with checks in ReactiveAdapterRegistry for a consistent configuration experience.
2020-09-10 10:35:13 +02:00
Mark Paluch
fb9dbb0cc2 DATACMNS-1764 - Fix CoroutineAdapterInformation when Kotlin reflection is absent.
We now correctly determine the parameter count instead of returning a stating no-op object to correctly compare whether the target method uses the same count of arguments.

Original Pull Request: #455.
2020-08-11 15:38:04 +02:00
Mark Paluch
01e394b913 DATACMNS-1764 - Polishing.
Move Publisher decoration into its own type to avoid a static reference to Publisher. Fix imperative repository MethodLookups.

Original Pull Request: #455.
2020-08-11 15:03:24 +02:00
Christoph Strobl
b667dfa779 DATACMNS-1764 - Capture reactive invocation on per subscription basis.
Original Pull Request: #455
2020-08-11 13:53:30 +02:00
Mark Paluch
35a3d3cde9 DATACMNS-1764 - Allow registration of RepositoryFactory customizers.
Original Pull Request: #455
2020-08-11 13:41:38 +02:00
Mark Paluch
e77947f0a5 DATACMNS-1763 - Allow registration of QueryMethod invocation listeners.
We now allow for registering RepositoryMethodInvocationListeners to notify listeners upon repository method invocations (query methods and repository fragments). Listeners are notified upon method completion reporting the repository interface, the invoked methods, duration, outcome and arguments.

Original Pull Request: #455
2020-08-11 13:40:57 +02:00
Mark Paluch
d840057b0c DATACMNS-1783 - Simplify null check in PersistentEntityIsNewStrategy.
Switch from Number.class.isInstance(…) method call to instanceof check.
2020-08-11 10:16:28 +02:00
Mark Paluch
e72470993d DATACMNS-1754 - Polishing.
Revert bean name change so all nested repository interface components (repository bean, fragment bean, legacy custom implementation bean) remain prefixed with their enclosing type name.

Adopt tests. Add test for RepositoryBeanDefinitionRegistrar. Extend documentation.

Original pull request: #460.
2020-08-10 16:33:21 +02:00
Kyrylo Merzlikin
2a44d2394c DATACMNS-1754 - Support implementation lookup for nested repositories and fragments.
Problem: while repository and fragment interfaces are discovered
correctly (provided that considerNestedRepositories=true), their
implementations are not found/registered despite proper class naming.

Cause: DefaultImplementationLookupConfiguration works in such way that
for nested interface (i.e. one whose class name includes name of the
enclosing class) expected implementation class name is built including
that enclosing class name. In the same time actual implementation class
names are always "localized" (i.e. stripped from enclosing class name,
if any) before matching. This makes matching implementation classes
against nested interface impossible.

Solution: when building expected implementation class name, use "local"
interface class name, so that it can match any implementation class that
follows naming convention "SimpleInterfaceName" + "ImplemenetationPostfix".

Original pull request: #460.
2020-08-10 16:29:38 +02:00
Oliver Drotbohm
c99f2c9459 DATACMNS-1296 - PersistentPropertyPathAccessor now properly handles intermediate nulls when setting values.
We now use a dedicated GetOptions instance for the lookup of the parent path in case SetOptions is defined to skip nulls so that the lookup does not fail if the parent path contains a null value.
2020-08-06 08:50:20 +02:00
Mark Paluch
cdd8359103 DATACMNS-1781 - Reinstantate PersistentPropertyPathAccessor.setProperty(…).
Reintroduce method that was earlier removed as part of deprecation cleanup.
2020-08-05 08:58:35 +02:00
Mark Paluch
7b26fd199f DATACMNS-1780 - Polishing.
Consistently use MappingException when a required PersistentEntity cannot be obtained.
2020-08-04 15:25:34 +02:00
Mark Paluch
2aae23763b DATACMNS-1780 - Polishing.
Refine Javaoc. Eagerly react to availability of a single MappingContext.

Original pull request: #462.
2020-08-04 14:39:17 +02:00
Christoph Strobl
fd15c099e9 DATACMNS-1780 - PersistentEntities allows in flight metadata creation if the associated mapping context can be identified.
Use a more lenient approach, that allows metadata creation, when looking up persistent entities. This allows eg. a configured AuditingHandler to kick in without having to register an initial entity set in first place.

Original pull request: #462.
2020-08-04 14:39:05 +02:00
Mark Paluch
a600d8160c DATACMNS-1781 - Move off deprecated Spring Framework API.
Use KotlinDetector instead of ReflectionUtils.isKotlinClass(…). Use replacement MethodParameter(…).withContainingClass(…) instead of GenericTypeResolver.resolveParameterType(…). Use MergedAnnotations.from(…).isPresent(…) instead of AnnotationUtils.isAnnotationMetaPresent(…).
2020-08-04 12:16:55 +02:00
Mark Paluch
bb4d621a32 DATACMNS-1779 - Consider kotlin.Unit a simple type.
kotlin.Unit is now considered a simple type to avoid PersistentEntity creation.

ReflectionUtils.isVoid(…) now encapsulates the check so that calling code doesn't need to check if Kotlin is on the class path.
2020-07-31 10:57:56 +02:00
Mark Paluch
45874430d6 DATACMNS-1777 - Polishing.
Use non-null construction of Optional for non-nullable method arguments.
2020-07-28 15:29:36 +02:00
Christoph Strobl
fb15a9647d DATACMNS-1108 - Polishing.
Move loop to Set lookup, update Javadoc and remove unused imports.

Original Pull Request: #454
2020-07-22 13:47:00 +02:00
Mark Paluch
e9901e7df8 DATACMNS-1108 - Polishing.
Original Pull Request: #454
2020-07-22 13:46:08 +02:00
Mark Paluch
0671862ed8 DATACMNS-1108 - Add repository configuration infrastructure.
Add config infrastructure for ReactiveQueryMethodEvaluationContextProvider.

Original Pull Request: #454
2020-07-22 13:45:25 +02:00
Mark Paluch
edcf1a0562 DATACMNS-1108 - Prefer regular methods in ReflectionUtils.findRequiredMethod(…).
findRequiredMethod(…) now prefers regular methods over synthetic/bridge methods. This refinement is required for newer Java versions that create synthetic bridge methods using the interface's return type. For SpEL extension introspection we're looking for the most specific return type that may be declared in the extension.

Original Pull Request: #454
2020-07-22 13:44:19 +02:00
Mark Paluch
1c354f6d4e DATACMNS-1108 - Add support for Reactive SpEL Context retrieval.
We now support reactive EvaluationContext retrieval in conjunction with ReactiveEvaluationContextExtensions. Reactive SpEL Context extensions may access Reactor's Context and provide contextual details during SpEL evaluation.

Original Pull Request: #454
2020-07-22 13:43:28 +02:00
Mark Paluch
13c03e9d17 DATACMNS-1772 - Remove SpringDataAnnotationBeanNameGenerator and use BeanNameGenerator directly.
We now invoke BeanNameGenerator directly without additional indirections. Previously, SpringDataAnnotationBeanNameGenerator was calling BeanNameGenerator using null for BeanDefinitionRegistry which caused downstream null dereference.
2020-07-21 14:51:23 +02:00
Christoph Strobl
d4e94109df DATACMNS-1231 - Introduce dedicated Auditor value object.
Original Pull Request: #458
2020-07-17 11:16:43 +02:00
Mark Paluch
d3af4a79e4 DATACMNS-1231 - Add reactive auditing infrastructure.
We now provide a reactive variant for auditing with ReactiveAuditingHandler and ReactiveIsNewAwareAuditingHandler.

Extracted common auditing functionality into AuditingHandlerSupport which serves as base class for AuditingHandler and ReactiveAuditingHandler.

Original Pull Request: #458
2020-07-17 10:14:10 +02:00