Search in sources :

Example 1 with Page

use of jakarta.nosql.mapping.Page in project jnosql-diana by eclipse.

the class AbstractGraphRepositoryProxy method converter.

private Object converter(Method method, Class<?> typeClass, Supplier<Stream<?>> querySupplier, Object[] args) {
    Supplier<Optional<?>> singleSupplier = DynamicReturn.toSingleResult(method).apply(querySupplier);
    Function<Pagination, Page<?>> pageFunction = p -> {
        throw new DynamicQueryException("Graph database repository does not support Page as return Type");
    };
    DynamicReturn<?> dynamicReturn = DynamicReturn.builder().withClassSource(typeClass).withMethodSource(method).withResult(querySupplier).withSingleResult(singleSupplier).withPagination(DynamicReturn.findPagination(args)).withStreamPagination(p -> querySupplier.get()).withSingleResultPagination(p -> singleSupplier.get()).withPage(pageFunction).build();
    return dynamicReturn.execute();
}
Also used : RepositoryType(org.eclipse.jnosql.mapping.query.RepositoryType) GraphConverter(org.eclipse.jnosql.mapping.graph.GraphConverter) ClassMapping(org.eclipse.jnosql.mapping.reflection.ClassMapping) DynamicReturn(org.eclipse.jnosql.mapping.repository.DynamicReturn) Graph(org.apache.tinkerpop.gremlin.structure.Graph) Converters(jakarta.nosql.mapping.Converters) Vertex(org.apache.tinkerpop.gremlin.structure.Vertex) GraphTraversal(org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal) Function(java.util.function.Function) Supplier(java.util.function.Supplier) Repository(jakarta.nosql.mapping.Repository) List(java.util.List) Stream(java.util.stream.Stream) GraphTemplate(org.eclipse.jnosql.mapping.graph.GraphTemplate) Optional(java.util.Optional) DynamicQueryException(jakarta.nosql.mapping.DynamicQueryException) DynamicQueryMethodReturn(org.eclipse.jnosql.mapping.repository.DynamicQueryMethodReturn) InvocationHandler(java.lang.reflect.InvocationHandler) Pagination(jakarta.nosql.mapping.Pagination) Method(java.lang.reflect.Method) Page(jakarta.nosql.mapping.Page) Pagination(jakarta.nosql.mapping.Pagination) Optional(java.util.Optional) DynamicQueryException(jakarta.nosql.mapping.DynamicQueryException) Page(jakarta.nosql.mapping.Page)

Aggregations

Converters (jakarta.nosql.mapping.Converters)1 DynamicQueryException (jakarta.nosql.mapping.DynamicQueryException)1 Page (jakarta.nosql.mapping.Page)1 Pagination (jakarta.nosql.mapping.Pagination)1 Repository (jakarta.nosql.mapping.Repository)1 InvocationHandler (java.lang.reflect.InvocationHandler)1 Method (java.lang.reflect.Method)1 List (java.util.List)1 Optional (java.util.Optional)1 Function (java.util.function.Function)1 Supplier (java.util.function.Supplier)1 Stream (java.util.stream.Stream)1 GraphTraversal (org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal)1 Graph (org.apache.tinkerpop.gremlin.structure.Graph)1 Vertex (org.apache.tinkerpop.gremlin.structure.Vertex)1 GraphConverter (org.eclipse.jnosql.mapping.graph.GraphConverter)1 GraphTemplate (org.eclipse.jnosql.mapping.graph.GraphTemplate)1 RepositoryType (org.eclipse.jnosql.mapping.query.RepositoryType)1 ClassMapping (org.eclipse.jnosql.mapping.reflection.ClassMapping)1 DynamicQueryMethodReturn (org.eclipse.jnosql.mapping.repository.DynamicQueryMethodReturn)1