DataTable (record)
Represents a collection of domain objects (typically entity instances).
API
record DataTable {
DataTable(ObjectSpecification elementType) (1)
DataTable(ObjectSpecification elementType, Predicate<ObjectAssociation> columnFilter) (2)
DataTable(ObjectSpecification elementType, Can<? extends ObjectAssociation> dataColumns) (3)
DataTable(ObjectSpecification elementType, String tableFriendlyName, Can<? extends ObjectAssociation> dataColumns, Can<ManagedObject> dataElements)
DataTable forDomainType(Class<?> domainType) (4)
DataTable forDomainType(Class<?> domainType, Predicate<ObjectAssociation> columnFilter) (5)
String getLogicalName() (6)
int getElementCount() (7)
Stream<ManagedObject> streamDataElements()
DataTable withDataElementsFrom(DataTable otherTable) (8)
DataTable withDataElements(Iterable<ManagedObject> dataElements) (9)
DataTable withDataElementPojos(Iterable<?> dataElementPojos) (10)
DataTable withEntities() (11)
DataTable withEntities(Query<?> query) (12)
DataTable visit(CellVisitor visitor)
DataTable visit(CellVisitor visitor, Predicate<DataColumn> columnFilter)
TabularSheet toTabularSheet(AccessMode accessMode)
Blob exportToBlob(TabularExporter exporter, AccessMode accessMode) (13)
Predicate<ObjectAssociation> columnFilterIncluding(Where whereToInclude)
Predicate<ObjectAssociation> columnFilterExcludingMixins()
Predicate<ObjectAssociation> columnFilterIncludingEnabledForSnapshot()
}
1 | DataTable(ObjectSpecification)
Returns an empty DataTable for given domain object type, with all properties as columns, excluding mixed-in ones. (For more control on which columns to include, consider a different constructor.) |
2 | DataTable(ObjectSpecification, Predicate)
Returns an empty DataTable for given domain object type, with all (including mixed-in) associations as columns, that pass given columnFilter . If the filter is null it acts as a pass-through. |
3 | DataTable(ObjectSpecification, Can)
Returns an empty DataTable for given domain object type. |
4 | forDomainType(Class)
Returns an empty DataTable for given domain object type, with all properties as columns, excluding mixed-in ones. (For more control on which columns to include, consider #forDomainType(Class, Predicate) or a constructor that fits.) |
5 | forDomainType(Class, Predicate)
Returns an empty DataTable for given domain object type, with all (including mixed-in) associations as columns, that pass given columnFilter . If the filter is null it acts as a pass-through. |
6 | getLogicalName()
Unique within application scope, can act as an id. |
7 | getElementCount()
Count data rows. |
8 | withDataElementsFrom(DataTable)
Returns a new table, populated from this and the other table. |
9 | withDataElements(Iterable)
Returns a new table instance with the data-elements, which make up the rows of the new table. |
10 | withDataElementPojos(Iterable)
Returns a new table instance with data-elements from given pojos, that are adapted to ManagedObject (s).. |
11 | withEntities()
Returns a new table, populated from the underlying (default) persistence layer. |
12 | withEntities(Query)
Returns a new table, populated from the underlying (default) persistence layer, using given Query to refine the result. |
13 | exportToBlob(TabularExporter, AccessMode)
Typical use-case: |
Members
DataTable(ObjectSpecification)
Returns an empty DataTable for given domain object type, with all properties as columns, excluding mixed-in ones. (For more control on which columns to include, consider a different constructor.)
The table can be populated later on using DataTable#withDataElements(Iterable) or #withDataElementPojos(Iterable) .
DataTable(ObjectSpecification, Predicate)
Returns an empty DataTable for given domain object type, with all (including mixed-in) associations as columns, that pass given columnFilter . If the filter is null it acts as a pass-through.
The table can be populated later on using DataTable#withDataElements(Iterable) or #withDataElementPojos(Iterable) .
DataTable(ObjectSpecification, Can)
Returns an empty DataTable for given domain object type.
The table can be populated later on using DataTable#withDataElements(Iterable) or #withDataElementPojos(Iterable) .
forDomainType(Class)
Returns an empty DataTable for given domain object type, with all properties as columns, excluding mixed-in ones. (For more control on which columns to include, consider #forDomainType(Class, Predicate) or a constructor that fits.)
The table can be populated later on using DataTable#withDataElements(Iterable) or #withDataElementPojos(Iterable) .
forDomainType(Class, Predicate)
Returns an empty DataTable for given domain object type, with all (including mixed-in) associations as columns, that pass given columnFilter . If the filter is null it acts as a pass-through.
The table can be populated later on using DataTable#withDataElements(Iterable) or #withDataElementPojos(Iterable) .
withDataElements(Iterable)
Returns a new table instance with the data-elements, which make up the rows of the new table.
withDataElementPojos(Iterable)
Returns a new table instance with data-elements from given pojos, that are adapted to ManagedObject (s)..
withEntities(Query)
Returns a new table, populated from the underlying (default) persistence layer, using given Query to refine the result.
exportToBlob(TabularExporter, AccessMode)
Typical use-case:
@Inject TabularExcelExporter excelExporter; Blob exportToBlob(List<MyDomainObject> myDomainObjects) { var dataTable = DataTable.forDomainType(MyDomainObject.class); dataTable.setDataElementPojos(myDomainObjects); return dataTable.exportToBlob(excelExporter, AccessMode.USER); }