Пример #1
0
  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();
  }
Пример #2
0
  public ListRepresentation traverse(
      long startNode, Map<String, Object> description, TraverserReturnType returnType) {
    Node node = graphDb.getNodeById(startNode);

    List<Representation> result = new ArrayList<Representation>();

    TraversalDescription traversalDescription = TraversalDescriptionBuilder.from(description);
    for (Path position : traversalDescription.traverse(node)) {
      MappingRepresentation representation = returnType.toRepresentation(position);
      if (representation != null) {
        result.add(representation);
      }
    }

    return new ListRepresentation(returnType.repType, result);
  }