public class TreeTableOrphanPromoter extends Object implements com.fishlib.base.Function.Unary<Table,Table>
Identify orphan rows in a table destined for conversion into a tree table, and mask their parent column value to null; so that they show up at the top level of the hierarchy.
This is useful if your data contains values which you can not identify as top-level rows; or if you would like to filter your tree table source; excluding parents which do not meet your filter criteria; but do not want to orphan the matches.
This class should be used by calling TreeTableOrphanPromoter.promoteOrphans(Table, String, String)
method.
Modifier and Type | Method and Description |
---|---|
Table |
call(Table table) |
static Table |
promoteOrphans(Table table,
String idColumn,
String parentColumn)
Convert a table with orphans to one without.
|
public static Table promoteOrphans(Table table, String idColumn, String parentColumn)
table
- the input table to operate onidColumn
- the column containing each row's unique IDparentColumn
- the column containing the parent for this row, null for top-level rows