Search in sources :

Example 1 with ListEntityRepresentation

use of org.neo4j.server.rest.repr.ListEntityRepresentation in project neo4j by neo4j.

the class RestfulGraphDatabase method createPagedTraverser.

@POST
@Path(PATH_TO_CREATE_PAGED_TRAVERSERS)
public Response createPagedTraverser(@PathParam("nodeId") long startNode, @PathParam("returnType") TraverserReturnType returnType, @QueryParam("pageSize") @DefaultValue(FIFTY_ENTRIES) int pageSize, @QueryParam("leaseTime") @DefaultValue(SIXTY_SECONDS) int leaseTimeInSeconds, String body) {
    try {
        validatePageSize(pageSize);
        validateLeaseTime(leaseTimeInSeconds);
        String traverserId = actions.createPagedTraverser(startNode, input.readMap(body), pageSize, leaseTimeInSeconds);
        URI uri = new URI("node/" + startNode + "/paged/traverse/" + returnType + "/" + traverserId);
        return output.created(new ListEntityRepresentation(actions.pagedTraverse(traverserId, returnType), uri.normalize()));
    } catch (EvaluationException e) {
        return output.badRequest(e);
    } catch (BadInputException e) {
        return output.badRequest(e);
    } catch (NotFoundException e) {
        return output.notFound(e);
    } catch (URISyntaxException e) {
        return output.serverError(e);
    }
}
Also used : BadInputException(org.neo4j.server.rest.repr.BadInputException) StartNodeNotFoundException(org.neo4j.server.rest.domain.StartNodeNotFoundException) NotFoundException(org.neo4j.graphdb.NotFoundException) EndNodeNotFoundException(org.neo4j.server.rest.domain.EndNodeNotFoundException) EvaluationException(org.neo4j.server.rest.domain.EvaluationException) URISyntaxException(java.net.URISyntaxException) URI(java.net.URI) ListEntityRepresentation(org.neo4j.server.rest.repr.ListEntityRepresentation) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST)

Aggregations

URI (java.net.URI)1 URISyntaxException (java.net.URISyntaxException)1 POST (javax.ws.rs.POST)1 Path (javax.ws.rs.Path)1 NotFoundException (org.neo4j.graphdb.NotFoundException)1 EndNodeNotFoundException (org.neo4j.server.rest.domain.EndNodeNotFoundException)1 EvaluationException (org.neo4j.server.rest.domain.EvaluationException)1 StartNodeNotFoundException (org.neo4j.server.rest.domain.StartNodeNotFoundException)1 BadInputException (org.neo4j.server.rest.repr.BadInputException)1 ListEntityRepresentation (org.neo4j.server.rest.repr.ListEntityRepresentation)1