Support to receive aggregate references as request parameters.

We now support using AggregateReference as type to bind request parameters taking URIs pointing to related aggregates. The default resolution will try to resolve the entire URI via UriToEntityConverter but one can also provide a function that can extract any part of the URI to be then resolved into either an identifier, aggregate instance or jMolecules Association against the ConversionService.

Fixes #2239.
This commit is contained in:
Oliver Drotbohm
2023-03-11 23:50:05 +01:00
parent 6d0034f15f
commit e4bca534bf
21 changed files with 1025 additions and 129 deletions

View File

@@ -116,16 +116,18 @@ class RepositoryTestsConfig {
@Bean
public Module persistentEntityModule() {
var conversionService = new DefaultConversionService();
RepositoryResourceMappings mappings = new RepositoryResourceMappings(repositories(), persistentEntities(),
config());
EntityLinks entityLinks = new RepositoryEntityLinks(repositories(), mappings, config(),
mock(PagingAndSortingTemplateVariables.class), PluginRegistry.of(DefaultIdConverter.INSTANCE));
SelfLinkProvider selfLinkProvider = new DefaultSelfLinkProvider(persistentEntities(), entityLinks,
Collections.emptyList(), new DefaultConversionService());
Collections.emptyList(), conversionService);
DefaultRepositoryInvokerFactory invokerFactory = new DefaultRepositoryInvokerFactory(repositories());
UriToEntityConverter uriToEntityConverter = new UriToEntityConverter(persistentEntities(), invokerFactory,
repositories());
() -> conversionService);
Associations associations = new Associations(mappings, config());
LinkCollector collector = new DefaultLinkCollector(persistentEntities(), selfLinkProvider, associations);