Uploaded image for project: 'ModeShape'
  1. ModeShape
  2. MODE-302

Improve the Graph API's methods for returning blocks of children

    XMLWordPrintable

Details

    • Feature Request
    • Resolution: Done
    • Minor
    • 0.4
    • 0.3
    • API, Graph (2.x)
    • None
    • Low

    Description

      The Graph API has several methods for getting a subset (or "block") of children by specifying the parent, starting index, and child. This is useful when a graph client is paging through the children. However, the Graph API methods to do this are less than ideal and don't make for readable code. Plus, there is a use case when the client doesn't want to specify the index, but rather they want to specify the last child that they read. This may be more appealing to some clients for cases when the children are being modified, and the indexes change in between calls to read blocks.

      The Graph API should be changed to make getting children more closely aligned with the method to get all children, so that developers can decide after they add the "getChildren()." call, letting the IDE show the different options. Also, the API should supporting getting n children after a previously-retrieved sibling.

      Here are some examples of what the new API should look like. This line:

      graph.getChildren().of(parent);

      gets all children of the 'parent' node (where 'parent' can be a string path, Path, Location, UUID, or identification Property objects). This line:

      graph.getChildren().inBlockOf(10).startingAt(50).under(parent);

      gets up to 10 children under a parent node, starting at the 51st child (remember, indexes are 0-based). And this line:

      graph.getChildren().inBlockOf(10).startingAfter(sibling);

      gets up to 10 children that immediately follow the 'sibling' node. Here, 'sibling' can be a string path, Path, Location, UUID, or identification Property objects, but will often be the actual Location returned from a previous call.

      Attachments

        Activity

          People

            rhauch Randall Hauch (Inactive)
            rhauch Randall Hauch (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: