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);
}
}
Aggregations