Package com.pullreports.model
Class Table
- Object
-
- com.pullreports.model.Table
-
public class Table extends Object
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Optional<Column>
findColumn(ColumnId id)
Optional<Table>
getChild(TableId tableId)
Returns an Optional whose value is the Table which is an immediate child of the current table with the given TableId.Optional<Table>
getChild(TablePath path)
Returns an Optional whose value is the Table found at the given path or the empty Optional.Optional<Relationship>
getChildRelationship(TablePath path)
Returns an Optional whose value is the Relationship found at the given path or the empty Optional.List<Column>
getColumns()
Returns the immutable List of Table columns.Optional<String>
getDescription()
Returns an Optional whose value is this Table's human description or the empty Optional.String
getDisplayName()
boolean
getHasCompletePrimaryKeyColumns()
TableId
getId()
Returns the id of the table.Optional<String>
getName()
Returns an Optional whose value is the name of the database object to use within the SQL from clause.Optional<Relationship>
getParentRelationship()
Returns the parentRelationship
of this table or the empty Optional if this is theReport
's base table.TablePath
getPath()
List<Filter>
getPreFilters()
Returns the List of Filter objects which should always apply to the Table if included in the export results or an empty List.Set<ColumnId>
getPrimaryKeyColumnIds()
Returns a Set of ColumnId's which represent the table's primary key columns or an empty Set.List<Relationship>
getRelationships()
Optional<SubqueryProvider>
getSubqueryProvider()
int
indexOf(Column column)
Returns the index of the given Column in this Table's List of Columns or an int less than 0.boolean
isBaseTable()
Returns true if this table is the base table of theReport
.Column
requireColumn(ColumnId id)
Returns the Column for the given id.String
toString()
-
-
-
Method Detail
-
getHasCompletePrimaryKeyColumns
public boolean getHasCompletePrimaryKeyColumns()
- Returns:
- true if this table and all descendant,
getRelationships()
tables define a non-emptygetPrimaryKeyColumnIds()
Set if any descendant relationship is ofCardinality.MANY
.Used to determine if a
Report
's base table supports jsontree and htmltree exports. For tree exports formats, it is required that allTable
s which have at least one descendantRelationship
ofCardinality.MANY
define a non-emptygetPrimaryKeyColumnIds()
in order to correctly export relationship data.
-
getName
public Optional<String> getName()
Returns an Optional whose value is the name of the database object to use within the SQL from clause. The value is typically the table name. May be the empty Optional ifgetSubqueryProvider()
is non-null.- Returns:
- an Optional with the table name as value or the empty Optional.
-
getPath
public TablePath getPath()
-
getColumns
public List<Column> getColumns()
Returns the immutable List of Table columns.- Returns:
- an immutable List of Columns.
-
getPrimaryKeyColumnIds
public Set<ColumnId> getPrimaryKeyColumnIds()
Returns a Set of ColumnId's which represent the table's primary key columns or an empty Set. Required for jsontree and htmltree export formats.- Returns:
- the table's primary key ColumnIds or the empty Set.
-
getDisplayName
public String getDisplayName()
-
getDescription
public Optional<String> getDescription()
Returns an Optional whose value is this Table's human description or the empty Optional.- Returns:
- An Optional with the Table's description or the empty Optional.
-
getId
public TableId getId()
Returns the id of the table. This id must be unique in all relational child Tables of the same parent Table.- Returns:
- this Table's unique id.
-
getPreFilters
public List<Filter> getPreFilters()
Returns the List of Filter objects which should always apply to the Table if included in the export results or an empty List.- Returns:
- the list of pre-Filters or an empty List.
-
getRelationships
public List<Relationship> getRelationships()
-
getSubqueryProvider
public Optional<SubqueryProvider> getSubqueryProvider()
-
getParentRelationship
public Optional<Relationship> getParentRelationship()
Returns the parentRelationship
of this table or the empty Optional if this is theReport
's base table.- Returns:
- the parent Relationship or the empty Optional if this is the report's base table.
-
indexOf
public int indexOf(Column column)
Returns the index of the given Column in this Table's List of Columns or an int less than 0.- Parameters:
column
- The search column- Returns:
- the index of the column in the Table's List of Columns or an int less than 0.
-
requireColumn
public Column requireColumn(ColumnId id)
Returns the Column for the given id.- Parameters:
id
- The id of the column to require- Returns:
- returns the Column for the given id from the Table's list of columns.
- Throws:
NoSuchElementException
- if a Column with the given id is not found.
-
getChild
public Optional<Table> getChild(TableId tableId)
Returns an Optional whose value is the Table which is an immediate child of the current table with the given TableId.- Parameters:
tableId
- TableId which is the id of an immediate relationship child of this table.- Returns:
- an Optional with the Table at the given TableId or the empty Optional.
-
getChild
public Optional<Table> getChild(TablePath path)
Returns an Optional whose value is the Table found at the given path or the empty Optional.- Parameters:
path
- TablePath relative to the path of this Table.- Returns:
- an Optional with the Table at the given path or the empty Optional.
-
getChildRelationship
public Optional<Relationship> getChildRelationship(TablePath path)
Returns an Optional whose value is the Relationship found at the given path or the empty Optional.- Parameters:
path
- TablePath relative to the path of this Table.- Returns:
- an Optional with the Relationship at the given path or the empty Optional.
-
isBaseTable
public boolean isBaseTable()
Returns true if this table is the base table of theReport
.- Returns:
- true if this table is the base table.
-
toString
public String toString()
- Overrides:
toString
in classObject
-
-