Interface TreeTable

All Superinterfaces:
AttributeMap<TreeTable>, GridAttributes<TreeTable>, HierarchicalTable<TreeTable>, LivenessReferent
All Known Implementing Classes:
TreeTableImpl

public interface TreeTable extends HierarchicalTable<TreeTable>
Interface for the result of Table.tree(String, String) tree} operations.
  • Method Details

    • getIdentifierColumn

      ColumnName getIdentifierColumn()
      Get the identifier column from the tree operation.
      Returns:
      The identifier column
    • getParentIdentifierColumn

      ColumnName getParentIdentifierColumn()
      Get the parent identifier column from the {tree operation.
      Returns:
      The parent identifier column
    • getNodeDefinition

      TableDefinition getNodeDefinition()
      Get the TableDefinition that should be exposed to node table consumers, e.g. UI-driven snapshots. This excludes "internal" columns used to organize the tree or support operations, as well as the row-depth column and row-expanded column, but includes formatting columns.
      Returns:
      The externally-visible node TableDefinition
    • withNodeFilterColumns

      TreeTable withNodeFilterColumns(@NotNull @NotNull Collection<? extends ColumnName> columns)
      Get a new TreeTable with columns designated for node-level filtering, in addition to any columns already so-designated on this TreeTable.

      Filters specified via withFilter(Filter), typically from the UI, that only use the designated node-level filtering columns will be applied to the nodes during snapshots. If no node-filter columns are designated, no filters will be handled at node level.

      Filters that include other columns are handled by filtering the source table in a ancestor-preserving manner and re-applying the tree operation to the result to produce a new TreeTable. Users of orphan promotion or other strategies to govern the structure of the tree should carefully consider the structure of their data before specifying node-filter columns.

      Specifying node-filter columns represents a trade-off between performance (which is expected to be much better for node-level filtering) and tree structural integrity (which may be lost since node-level filters are not ancestor-preserving).

      Parameters:
      columns - The columns to designate
      Returns:
      The new TreeTable
    • withFilter

      TreeTable withFilter(@NotNull @NotNull Filter filter)
      Apply a filter to the columns of this TreeTable in order to produce a new TreeTable.
      Parameters:
      filter - The filter to apply
      Returns:
      The new TreeTable
    • makeNodeOperationsRecorder

      TreeTable.NodeOperationsRecorder makeNodeOperationsRecorder()
      Get a recorder for per-node operations to apply during snapshots.
      Returns:
      The new recorder
    • withNodeOperations

      TreeTable withNodeOperations(@NotNull @NotNull TreeTable.NodeOperationsRecorder nodeOperations)
      Get a new TreeTable that will apply the recorded operations to nodes when gathering snapshots.
      Parameters:
      nodeOperations - The node-level operations to apply. Must have been initially supplied by makeNodeOperationsRecorder() from this TreeTable.
      Returns:
      The new TreeTable
    • promoteOrphans

      static Table promoteOrphans(@NotNull @NotNull Table source, @NotNull @NotNull String idColumn, @NotNull @NotNull String parentColumn)
      Adapt a source Table to be used for a tree to ensure that the result will have no orphaned nodes. Nodes whose parents do not exist will become children of the root node in the resulting tree. The expected usage pattern is:
       TreeTable result = promoteOrphans(source, idColumn, parentColumn).tree(idColumn, parentColumn)
       
      Parameters:
      source - The source Table
      idColumn - The name of a column containing a unique identifier for a particular row in the table
      parentColumn - The name of a column containing the parent's identifier, null for rows that are part of the root table
      Returns:
      A Table derived from source that has null as the parent for any nodes that would have been orphaned by a call to source.tree(idColumn, parentColumn)