Example usage for org.springframework.data.rest.core UriToEntityConverter UriToEntityConverter

List of usage examples for org.springframework.data.rest.core UriToEntityConverter UriToEntityConverter

Introduction

In this page you can find the example usage for org.springframework.data.rest.core UriToEntityConverter UriToEntityConverter.

Prototype

public UriToEntityConverter(PersistentEntities entities, RepositoryInvokerFactory invokerFactory,
        Repositories repositories) 

Source Link

Document

Creates a new UriToEntityConverter using the given PersistentEntities , RepositoryInvokerFactory and Repositories .

Usage

From source file:org.springframework.data.rest.tests.RepositoryTestsConfig.java

@Bean
public Module persistentEntityModule() {

    RepositoryResourceMappings mappings = new RepositoryResourceMappings(repositories(), persistentEntities(),
            config().getRepositoryDetectionStrategy());
    EntityLinks entityLinks = new RepositoryEntityLinks(repositories(), mappings, config(),
            mock(PagingAndSortingTemplateVariables.class), OrderAwarePluginRegistry
                    .<Class<?>, BackendIdConverter>create(Arrays.asList(DefaultIdConverter.INSTANCE)));
    SelfLinkProvider selfLinkProvider = new DefaultSelfLinkProvider(persistentEntities(), entityLinks,
            Collections.<EntityLookup<?>>emptyList());

    DefaultRepositoryInvokerFactory invokerFactory = new DefaultRepositoryInvokerFactory(repositories());
    UriToEntityConverter uriToEntityConverter = new UriToEntityConverter(persistentEntities(), invokerFactory,
            repositories());//from  w  w  w  . ja  v a2s  .co  m

    Associations associations = new Associations(mappings, config());
    LinkCollector collector = new LinkCollector(persistentEntities(), selfLinkProvider, associations);

    NestedEntitySerializer nestedEntitySerializer = new NestedEntitySerializer(persistentEntities(),
            new EmbeddedResourcesAssembler(persistentEntities(), associations, mock(ExcerptProjector.class)),
            new ResourceProcessorInvoker(Collections.<ResourceProcessor<?>>emptyList()));

    return new PersistentEntityJackson2Module(associations, persistentEntities(), uriToEntityConverter,
            collector, invokerFactory, nestedEntitySerializer, mock(LookupObjectSerializer.class));
}

From source file:org.springframework.data.rest.webmvc.config.RepositoryRestMvcConfiguration.java

protected UriToEntityConverter uriToEntityConverter(ConversionService conversionService) {
    return new UriToEntityConverter(persistentEntities(), repositoryInvokerFactory(conversionService),
            repositories());// w w  w .java2 s  .c  o m
}