Search in sources :

Example 1 with RepositoryInformationProviderContext

use of io.crnk.core.engine.information.repository.RepositoryInformationProviderContext in project crnk-framework by crnk-project.

the class DefaultRegistryEntryBuilder method fromImplementation.

@Override
public void fromImplementation(Object repository) {
    RepositoryInformationProvider repositoryInformationBuilder = moduleRegistry.getRepositoryInformationBuilder();
    RepositoryInformationProviderContext builderContext = new DefaultRepositoryInformationProviderContext(moduleRegistry);
    ResourceRepositoryInformation repositoryInformation = (ResourceRepositoryInformation) repositoryInformationBuilder.build(repository, builderContext);
    ResourceInformation resourceInformation = repositoryInformation.getResourceInformation().get();
    resource().from(resourceInformation);
    resourceRepository().information().from(repositoryInformation);
    resourceRepository().instance(repository);
}
Also used : ResourceInformation(io.crnk.core.engine.information.resource.ResourceInformation) ResourceRepositoryInformation(io.crnk.core.engine.information.repository.ResourceRepositoryInformation) DefaultRepositoryInformationProviderContext(io.crnk.core.module.internal.DefaultRepositoryInformationProviderContext) DefaultRepositoryInformationProviderContext(io.crnk.core.module.internal.DefaultRepositoryInformationProviderContext) RepositoryInformationProviderContext(io.crnk.core.engine.information.repository.RepositoryInformationProviderContext) RepositoryInformationProvider(io.crnk.core.engine.information.repository.RepositoryInformationProvider)

Example 2 with RepositoryInformationProviderContext

use of io.crnk.core.engine.information.repository.RepositoryInformationProviderContext in project crnk-framework by crnk-project.

the class ModuleRegistryTest method buildWithInvalidRepositoryClass.

@Test(expected = UnsupportedOperationException.class)
public void buildWithInvalidRepositoryClass() {
    RepositoryInformationProviderContext context = Mockito.mock(RepositoryInformationProviderContext.class);
    moduleRegistry.getRepositoryInformationBuilder().build(String.class, context);
}
Also used : RepositoryInformationProviderContext(io.crnk.core.engine.information.repository.RepositoryInformationProviderContext) Test(org.junit.Test)

Example 3 with RepositoryInformationProviderContext

use of io.crnk.core.engine.information.repository.RepositoryInformationProviderContext in project crnk-framework by crnk-project.

the class JaxrsModuleTest method setup.

@Before
public void setup() {
    final ModuleRegistry moduleRegistry = new ModuleRegistry();
    builder = new JaxrsModule.JaxrsResourceRepositoryInformationProvider();
    final ResourceInformationProvider resourceInformationProvider = new DefaultResourceInformationProvider(moduleRegistry.getPropertiesProvider(), ImmutableList.<PagingBehavior>of(new OffsetLimitPagingBehavior()), new DefaultResourceFieldInformationProvider(), new JacksonResourceFieldInformationProvider());
    resourceInformationProvider.init(new DefaultResourceInformationProviderContext(resourceInformationProvider, new DefaultInformationBuilder(moduleRegistry.getTypeParser()), moduleRegistry.getTypeParser(), new ObjectMapper()));
    context = new RepositoryInformationProviderContext() {

        @Override
        public ResourceInformationProvider getResourceInformationBuilder() {
            return resourceInformationProvider;
        }

        @Override
        public TypeParser getTypeParser() {
            return moduleRegistry.getTypeParser();
        }

        @Override
        public InformationBuilder builder() {
            return new DefaultInformationBuilder(moduleRegistry.getTypeParser());
        }
    };
}
Also used : OffsetLimitPagingBehavior(io.crnk.core.queryspec.pagingspec.OffsetLimitPagingBehavior) TypeParser(io.crnk.core.engine.parser.TypeParser) ModuleRegistry(io.crnk.core.module.ModuleRegistry) JaxrsModule(io.crnk.rs.internal.JaxrsModule) DefaultResourceInformationProviderContext(io.crnk.legacy.registry.DefaultResourceInformationProviderContext) RepositoryInformationProviderContext(io.crnk.core.engine.information.repository.RepositoryInformationProviderContext) DefaultResourceInformationProvider(io.crnk.core.engine.internal.information.resource.DefaultResourceInformationProvider) JacksonResourceFieldInformationProvider(io.crnk.core.engine.internal.jackson.JacksonResourceFieldInformationProvider) InformationBuilder(io.crnk.core.engine.information.InformationBuilder) DefaultInformationBuilder(io.crnk.core.engine.internal.information.DefaultInformationBuilder) DefaultInformationBuilder(io.crnk.core.engine.internal.information.DefaultInformationBuilder) ResourceInformationProvider(io.crnk.core.engine.information.resource.ResourceInformationProvider) DefaultResourceInformationProvider(io.crnk.core.engine.internal.information.resource.DefaultResourceInformationProvider) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) DefaultResourceFieldInformationProvider(io.crnk.core.engine.internal.information.resource.DefaultResourceFieldInformationProvider) Before(org.junit.Before)

Aggregations

RepositoryInformationProviderContext (io.crnk.core.engine.information.repository.RepositoryInformationProviderContext)3 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 InformationBuilder (io.crnk.core.engine.information.InformationBuilder)1 RepositoryInformationProvider (io.crnk.core.engine.information.repository.RepositoryInformationProvider)1 ResourceRepositoryInformation (io.crnk.core.engine.information.repository.ResourceRepositoryInformation)1 ResourceInformation (io.crnk.core.engine.information.resource.ResourceInformation)1 ResourceInformationProvider (io.crnk.core.engine.information.resource.ResourceInformationProvider)1 DefaultInformationBuilder (io.crnk.core.engine.internal.information.DefaultInformationBuilder)1 DefaultResourceFieldInformationProvider (io.crnk.core.engine.internal.information.resource.DefaultResourceFieldInformationProvider)1 DefaultResourceInformationProvider (io.crnk.core.engine.internal.information.resource.DefaultResourceInformationProvider)1 JacksonResourceFieldInformationProvider (io.crnk.core.engine.internal.jackson.JacksonResourceFieldInformationProvider)1 TypeParser (io.crnk.core.engine.parser.TypeParser)1 ModuleRegistry (io.crnk.core.module.ModuleRegistry)1 DefaultRepositoryInformationProviderContext (io.crnk.core.module.internal.DefaultRepositoryInformationProviderContext)1 OffsetLimitPagingBehavior (io.crnk.core.queryspec.pagingspec.OffsetLimitPagingBehavior)1 DefaultResourceInformationProviderContext (io.crnk.legacy.registry.DefaultResourceInformationProviderContext)1 JaxrsModule (io.crnk.rs.internal.JaxrsModule)1 Before (org.junit.Before)1 Test (org.junit.Test)1