use of org.neo4j.server.rest.paging.PagedTraverser in project neo4j by neo4j.
the class DatabaseActions method createPagedTraverser.
public String createPagedTraverser(long nodeId, Map<String, Object> description, int pageSize, int leaseTime) {
Node node = graphDb.getNodeById(nodeId);
TraversalDescription traversalDescription = traversalDescriptionBuilder.from(description);
PagedTraverser traverser = new PagedTraverser(traversalDescription.traverse(node), pageSize);
return leases.createLease(leaseTime, traverser).getId();
}
use of org.neo4j.server.rest.paging.PagedTraverser in project neo4j by neo4j.
the class DatabaseActions method pagedTraverse.
public ListRepresentation pagedTraverse(String traverserId, TraverserReturnType returnType) {
Lease lease = leases.getLeaseById(traverserId);
if (lease == null) {
throw new NotFoundException(String.format("The traverser with id [%s] was not found", traverserId));
}
PagedTraverser traverser = lease.getLeasedItemAndRenewLease();
List<Path> paths = traverser.next();
if (paths != null) {
return toListPathRepresentation(paths, returnType);
} else {
leases.remove(traverserId);
// Yuck.
throw new NotFoundException(String.format("The results for paged traverser with id [%s] have been fully enumerated", traverserId));
}
}
Aggregations