Commit Graph

1059 Commits

Author SHA1 Message Date
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
Mark Paluch
0c37484b19 DATACMNS-1768 - Polishing.
Reduce test visibility. Remove forEach detour through stream().
2020-07-14 09:50:40 +02:00
Mark Paluch
ebcea509b8 DATACMNS-1768 - Reuse bean state in InstantiationAwarePropertyAccessor when setting multiple properties.
We now reuse the new bean in InstantiationAwarePropertyAccessor when setting properties. Previously, we used the initial bean state as the bean was held by a delegate PersistentPropertyAccessor which caused only the last set property to be visible.
2020-07-14 09:50:40 +02:00
Oliver Drotbohm
f6630a5dd5 DATACMNS-1663 - Polishing.
A few refactorings for more readable code in the publishing method interceptor. Tweaks to the reference documentation to include the CrudRepository methods that now also publish the events.

Original pull request: #436.
2020-07-13 18:05:01 +02:00
Réda Housni Alaoui
889ae01c7c DATACMNS-1663 - Support domain events for deletions.
Domain events are now also published on calls to CrudRepository.delete(…) and ….deleteAll(…).

Original pull request: #436.
2020-07-13 18:05:01 +02:00
Mark Paluch
00d77d03cd DATACMNS-1767 - Polishing.
Reformat code. Use reflection for property access when running within a native image.

Original pull request: #456.
2020-07-13 14:25:59 +02:00
Christoph Strobl
ff0a8f77e8 DATACMNS-1767 - Disable ClassGeneratingEntityInstantiator when running native-image.
Always fall back to reflection when the system property for org.graalvm.nativeimage.imagecode is set.
This is required because on the fly code generation is not supported in this case.

Original pull request: #456.
2020-07-13 14:25:48 +02:00
Mark Paluch
e19bdb8fc4 DATACMNS-1758 - Revert optimizations from DATACMNS-1698.
We ensure that each EntityCallback retrieval operates on its own List to not share the retrieved callback list with other threads.
2020-07-09 14:15:30 +02:00
Mark Paluch
80299838b3 DATACMNS-1763 - Expose ReactiveWrapperConverters.doOnSuccess and doOnError callback hooks.
We now provide callback hook operators that allow attaching of a Runnable and Consumer<Throwable> to a reactive wrapper type for participating in terminal signals.
2020-07-06 11:32:45 +02:00
Phillip Webb
d72ccdacf6 DATACMNS-1755 - Fix malformed copyright headers.
Fix a few copyright headers that had formatting or date issues.

Original pull request: #448.
2020-06-25 11:20:41 +02:00
Phillip Webb
86bda64daa DATACMNS-1755 - Declare each variable in its own statement.
Update classes so that each member is declared on its own line. This
help to make them slightly easier to see when not using an IDE.

Original pull request: #448.
2020-06-25 11:20:28 +02:00
Phillip Webb
67442077b7 DATACMNS-1755 - Consistently use commons-logging.
Replace the few occurrences where SLF4J was being used directly so that
all logging now happens via commons-logging. The log patterns used in
SLF4J messages have been replaced with `LogMessage` which was introduced
in Spring Framework 5.2.

Original pull request: #448.
2020-06-25 11:20:24 +02:00
Phillip Webb
32826eec05 DATACMNS-1755 - Replace anonymous class with static initializer.
Replace the use of an anonymous class with a static initializer block.
This update also changes the constant to an unmodifiable variant.

Original pull request: #448.
2020-06-25 11:20:03 +02:00
Phillip Webb
161250855a DATACMNS-1755 - Import 'Function' and use short-form in code.
Import `java.util.Function` to allow more concise code.

Original pull request: #448.
2020-06-25 11:19:55 +02:00
Phillip Webb
b42cdb6568 DATACMNS-1755 - Use method references in favor of lambdas.
Simplify several lambda expressions in the codebase by using
method references.

Original pull request: #448.
2020-06-25 11:19:52 +02:00
Phillip Webb
cb8443e299 DATACMNS-1755 - Rename uppercase 'CACHE' static finals.
Rename static final `CACHE` members to use the lowercase form. Although
the caches are static final, they are not constant values.

Original pull request: #448.
2020-06-25 11:19:44 +02:00
Phillip Webb
df5f42ce29 DATACMNS-1755 - Drop Java 8 check.
Remove explicit Java 8 check since it is now the minimum supported
version.

Original pull request: #448.
2020-06-25 11:19:36 +02:00
Phillip Webb
ea263b233b Rename uppercase 'LOGGER' static finals
Rename static final `LOGGER` members to use the lowercase form.
Although the loggers are static final, they are not constant values.
2020-06-25 11:09:16 +02:00
Mark Paluch
c9a5a19738 DATACMNS-1753 - Polishing.
Check for deferred types in ReactiveWrappers so that ReactiveWrapperConverters remains untouched as wrapper conversion from a reactive type into CompletableFuture is still possible from a ReactiveWrapperConverters perspective.

Original pull request: #450.
2020-06-25 10:46:44 +02:00
Gerrit Meier
558272e57b DATACMNS-1753 - Don't consider CompletableFuture as reactive type.
CompletableFuture use is permitted in imperative repositories so we should not use CompletableFuture as indicator to switch a repository implementation to a reactive one.

Original pull request: #450.
2020-06-25 10:45:53 +02:00
Mark Paluch
4bc474d8f4 DATACMNS-1750 - Refrain from inspecting Page contents if first item is null. 2020-06-22 15:27:10 +02:00
Mark Paluch
9ff82472ac DATACMNS-1653 - Polishing.
Remove superfluous static keyword from enum declarations.

Original pull request: #444.
2020-06-21 20:06:26 +02:00
Mark Paluch
d3260d3caa DATACMNS-1653 - Add support for RxJava 3.
We now include adapters and registry information for RxJava 3 types.

Original pull request: #444.
2020-06-21 20:05:53 +02:00
Oliver Drotbohm
52154f6986 DATACMNS-1743 - Polishing.
We now avoid identifier conversion in ReflectionrepositoryConverter if not necessary. Reestablish a couple of unit tests for DomainClassConverter that were disabled by accident.
2020-06-16 16:11:26 +02:00
Oliver Drotbohm
aa1c1d4f15 DATACMNS-1743 - Fixed handling of failed aggregate lookup in DomainClassConverter.
We now fall back to null in case the repository lookup for the aggregate results in an absent value rather than returning the source unconverted.
2020-06-16 15:22:06 +02:00
Oliver Drotbohm
f65451d777 DATACMNS-1745 - Polishing.
Made the reference to RepositoryInformation non-nullable from the RepositoryAnnotationTransactionAttributeSource (previously RepositoryInformationPreferring…). Adapted test cases accordingly.
2020-06-16 14:31:15 +02:00
Mark Paluch
a76ed28fe7 DATACMNS-1745 - Refactor CustomAnnotationTransactionAttributeSource to use computeTransactionAttribute template method.
We now no longer duplicate Spring Framework code as AbstractFallbackTransactionAttributeSource exposes computeTransactionAttribute which we can use to override to determine TransactionAttribute from the repository interface.

Renamed CustomAnnotationTransactionAttributeSource to RepositoryInformationPreferringAnnotationTransactionAttributeSource to reflect the nature of our customization.
2020-06-16 14:31:15 +02:00