Owns the table upload and spreadsheet import feature: saved spreadsheets, their analytics configuration, saved field mappings, and the registered before/after and sanity check action handlers used by every TableUploader. Reached from Java code via its registered context instance (see RequestContext.C). It is the entry point for listing and searching saved spreadsheets, reading and editing their cell data, computing and templating their analytics, and starting an asynchronous import job for a given TableUploader.
Group: Managers
Properties
| Property | Returns | Description |
|---|---|---|
| rowSanityCheckTableActionHandlers | List<TableActionHandler> | The built-in row-level sanity check action handlers offered to every table uploader. |
| tableActionHandlers | List<TableActionHandler> | The before/after action handlers offered to every table uploader: the built-in handlers plus any contributed by the active TableUploadApplication apps for the current tenant. |
| tableUploaders | List<TableUploader> | All table uploaders registered by the active TableUploadApplication apps for the current tenant, regardless of the current user's access. Cached per root folder for the duration of the request. |
| uploadSanityCheckTableActionHandlers | List<TableActionHandler> | The built-in upload-level sanity check action handlers offered to every table uploader. |
Methods
findUploadJobs(String taskName) · findDirs() · findDirs(Path path) · findTables() · findTables(String pathStr) · searchTables(String dir, String search) · findTable(String tablePath) · findDir(String dirPath) · deleteTable(String pathStr) · renameTable(String pathStr, String newName) · loadAuditLog(String pathStr) · updateCell(String pathStr, int rowIndex, int colIndex, String value) · getAnalyticsConfigJson(String pathStr) · saveAnalyticsConfigJson(String pathStr, String configJson) · setSpreadsheetHasHeaderRow(String pathStr, boolean hasHeaderRow) · calcAnalyticsResultsJson(String pathStr) · listAnalyticsTemplateNamesJson() · saveAnalyticsTemplate(String pathStr, String templateName) · applyAnalyticsTemplate(String pathStr, String templateName) · deleteAnalyticsTemplate(String templateName) · getSpreadsheetRowCount(String pathStr) · loadSpreadsheetRowsJson(String pathStr, int start, int count) · openTableInputStream(String pathStr) · getTableActionHandlers() · getRowSanityCheckTableActionHandlers() · getUploadSanityCheckTableActionHandlers() · persistAsTable(InputStream in) · persistAsTable(String dir, String name, InputStream in) · persistAsTable(List<List> rows) · persistAsTable(String dir, String name, List<List> rows) · load(String hash) · fieldMappings(TableUploader tableUploader, Map<String,String> parameters) · tableUploader(String tableUploader) · tableUploadersForProfile(Profile p) · canAccessUploader(Profile p, TableUploader tu) · getTableUploaders() · savedMapping(String tableUploaderName, String savedName) · savedMappings(String tableUploaderName) · initiateSavedImport(TableUploader tableUploader, FieldMapping fieldMappings, Profile currentUser, InputStream in) · initiateImport(String tableUploaderName, Profile currentUser, int startRow, Integer taskSize, InputStream in, Map<String,List<Integer>> destFieldsMap, Map<String,String> parameters) · findAutoMappings(Map<String,String> destFields, UploadedTable table) · loadAuditLog(Path tablePath)
findUploadJobs(String taskName)
Returns: List<UploadJobInfo>
Find the async jobs recorded for a given import task name, most recent progress and result info included.
| Parameter | Description |
|---|---|
taskName | the task name a table import job was enqueued under (see initiateImport) |
findDirs()
Returns: List<String>
List the names of the top-level saved spreadsheet folders for the current tenant.
findDirs(Path path)
Returns: List<String>
List the names of the saved spreadsheet folders directly under the given path.
| Parameter | Description |
|---|---|
path | the parent folder path, or null for the root spreadsheets folder |
findTables()
Returns: List<UploadedTable>
List every saved spreadsheet's metadata for the current tenant.
findTables(String pathStr)
Returns: List<UploadedTable>
List every saved spreadsheet's metadata within a given folder.
| Parameter | Description |
|---|---|
pathStr | folder path string; null or blank means the root spreadsheets folder |
searchTables(String dir, String search)
Returns: List<UploadedTable>
Search the saved spreadsheets within a given folder by name.
| Parameter | Description |
|---|---|
dir | folder path string to search within |
search | optional case-insensitive contains filter; pass null or blank for all |
findTable(String tablePath)
Returns: UploadedTable
Look up a saved spreadsheet's metadata by its path.
| Parameter | Description |
|---|---|
tablePath | path string of the saved spreadsheet |
findDir(String dirPath)
Returns: TableDir
Look up a saved spreadsheet folder by its path.
| Parameter | Description |
|---|---|
dirPath | path string of the folder, or null or blank for the root spreadsheets folder |
deleteTable(String pathStr)
Returns: void
Delete a saved spreadsheet.
| Parameter | Description |
|---|---|
pathStr | path string of the spreadsheet to delete |
renameTable(String pathStr, String newName)
Returns: void
Rename a saved spreadsheet, keeping it in the same folder.
| Parameter | Description |
|---|---|
pathStr | path string of the spreadsheet to rename |
newName | new name (not a path - just the leaf name within the same folder) |
loadAuditLog(String pathStr)
Returns: List<Map<String,Object>>
Return the audit log entries for a saved spreadsheet. Each entry is a map with keys: date (ISO8601 string), userId (Long), action (String).
| Parameter | Description |
|---|---|
pathStr | path string of the saved spreadsheet |
updateCell(String pathStr, int rowIndex, int colIndex, String value)
Returns: void
Update a single cell in a saved spreadsheet by zero-based row and column ordinals.
| Parameter | Description |
|---|---|
pathStr | path string of the saved spreadsheet |
rowIndex | zero-based row index |
colIndex | zero-based column index |
value | new cell value |
getAnalyticsConfigJson(String pathStr)
Returns: String
Return the configured analytics for a saved spreadsheet.
| Parameter | Description |
|---|---|
pathStr | path string of the saved spreadsheet |
saveAnalyticsConfigJson(String pathStr, String configJson)
Returns: void
Save the analytics configuration for a saved spreadsheet, replacing any existing configuration.
| Parameter | Description |
|---|---|
pathStr | path string of the saved spreadsheet |
configJson | the new configuration, as JSON |
setSpreadsheetHasHeaderRow(String pathStr, boolean hasHeaderRow)
Returns: void
Sets whether a saved spreadsheet's first row is column headings, leaving the rest of its analytics configuration unchanged.
| Parameter | Description |
|---|---|
pathStr | path string of the saved spreadsheet |
hasHeaderRow | whether the first row holds column headings rather than data |
calcAnalyticsResultsJson(String pathStr)
Returns: String
Compute the current value of every configured analytics metric for a saved spreadsheet.
| Parameter | Description |
|---|---|
pathStr | path string of the saved spreadsheet |
listAnalyticsTemplateNamesJson()
Returns: String
Return the names of all analytics templates saved for the current tenant.
saveAnalyticsTemplate(String pathStr, String templateName)
Returns: void
Save a saved spreadsheet's current metrics, terms aggregations and pivots as a named, reusable template.
| Parameter | Description |
|---|---|
pathStr | path string of the spreadsheet whose analytics configuration should be saved as a template |
templateName | the template's name |
applyAnalyticsTemplate(String pathStr, String templateName)
Returns: void
Apply a saved template's metrics, terms aggregations and pivots to a spreadsheet, replacing its existing ones.
| Parameter | Description |
|---|---|
pathStr | path string of the spreadsheet to apply the template to |
templateName | the template's name |
deleteAnalyticsTemplate(String templateName)
Returns: void
Delete a saved analytics template.
| Parameter | Description |
|---|---|
templateName | the template's name |
getSpreadsheetRowCount(String pathStr)
Returns: int
Return the total number of rows in a saved spreadsheet.
| Parameter | Description |
|---|---|
pathStr | path string of the saved spreadsheet |
loadSpreadsheetRowsJson(String pathStr, int start, int count)
Returns: String
Load a range of rows from a saved spreadsheet and return them as a JSON object with a "rows" array of arrays. Cells are coerced to strings. Only the partition files that overlap the requested range are read.
| Parameter | Description |
|---|---|
pathStr | path string of the saved spreadsheet |
start | zero-based first row index |
count | number of rows to return |
openTableInputStream(String pathStr)
Returns: InputStream
Open a streaming InputStream for the CSV content of a saved table. Partitions are concatenated lazily.
| Parameter | Description |
|---|---|
pathStr | path string of the saved table (e.g. "reports/123") |
getTableActionHandlers()
Returns: List<TableActionHandler>
The before/after action handlers offered to every table uploader: the built-in handlers plus any contributed by the active TableUploadApplication apps for the current tenant.
getRowSanityCheckTableActionHandlers()
Returns: List<TableActionHandler>
The built-in row-level sanity check action handlers offered to every table uploader.
getUploadSanityCheckTableActionHandlers()
Returns: List<TableActionHandler>
The built-in upload-level sanity check action handlers offered to every table uploader.
persistAsTable(InputStream in)
Returns: UploadedTable
Save the content read from the given stream as a new spreadsheet under the "uploads" folder, with a generated random name.
| Parameter | Description |
|---|---|
in | the spreadsheet content to save |
persistAsTable(String dir, String name, InputStream in)
Returns: UploadedTable
Save the content read from the given stream as a new spreadsheet with the given folder and name.
| Parameter | Description |
|---|---|
dir | the folder to save the spreadsheet under |
name | the spreadsheet's name |
in | the spreadsheet content to save |
persistAsTable(List<List> rows)
Returns: UploadedTable
Save the given rows as a new spreadsheet under the "uploads" folder, with a generated random name.
| Parameter | Description |
|---|---|
rows | the rows to save |
persistAsTable(String dir, String name, List<List> rows)
Returns: UploadedTable
Save the given rows as a new spreadsheet with the given folder and name.
| Parameter | Description |
|---|---|
dir | the folder to save the spreadsheet under |
name | the spreadsheet's name |
rows | the rows to save |
load(String hash)
Returns: UploadedTable
Look up a previously saved spreadsheet by its content hash.
| Parameter | Description |
|---|---|
hash | the spreadsheet's content hash |
fieldMappings(TableUploader tableUploader, Map<String,String> parameters)
Returns: List<DestFieldV2>
Resolve the destination fields a source row can be mapped to for the given table uploader, taking the given parameters into account (some uploaders vary their destination fields based on options).
| Parameter | Description |
|---|---|
tableUploader | the table uploader to resolve destination fields for |
parameters | the import parameters to build a transient import context with |
tableUploader(String tableUploader)
Returns: TableUploader
Look up a registered table uploader by its name.
| Parameter | Description |
|---|---|
tableUploader | the table uploader's name |
tableUploadersForProfile(Profile p)
Returns: List<TableUploader>
Find the table uploaders available to the given user, ie those with no role restriction or for which the profile holds at least one of the required roles. An admin (holding the AdminApp admin role) is given every registered table uploader.
| Parameter | Description |
|---|---|
p | the profile to find available table uploaders for |
canAccessUploader(Profile p, TableUploader tu)
Returns: boolean
Checks whether the given profile is permitted to use the given table uploader: an admin can access any uploader, an uploader with no role restriction is open to everyone, otherwise the profile must hold at least one of the uploader's required roles.
| Parameter | Description |
|---|---|
p | the profile to check |
tu | the table uploader to check access to |
getTableUploaders()
Returns: List<TableUploader>
All table uploaders registered by the active TableUploadApplication apps for the current tenant, regardless of the current user's access. Cached per root folder for the duration of the request.
savedMapping(String tableUploaderName, String savedName)
Returns: FieldMapping
Look up a single saved field mapping for a table uploader by its saved name.
| Parameter | Description |
|---|---|
tableUploaderName | the table uploader's name |
savedName | the saved mapping's name |
savedMappings(String tableUploaderName)
Returns: List<FieldMapping>
Returns a list of saved import mappings for the given uploader
| Parameter | Description |
|---|---|
tableUploaderName | the table uploader's name |
initiateSavedImport(TableUploader tableUploader, FieldMapping fieldMappings, Profile currentUser, InputStream in)
Returns: AsyncJob
Start an asynchronous import using a previously saved field mapping, translating its mappings and options (including its configured action handlers) into the parameters initiateImport expects.
| Parameter | Description |
|---|---|
tableUploader | the table uploader to run the import with |
fieldMappings | the saved field mapping to use |
currentUser | the profile initiating the import |
in | the spreadsheet content to import |
initiateImport(String tableUploaderName, Profile currentUser, int startRow, Integer taskSize, InputStream in, Map<String,List<Integer>> destFieldsMap, Map<String,String> parameters)
Returns: AsyncJob
Save the uploaded content as a table and enqueue an asynchronous job to import it in batches using the named table uploader.
| Parameter | Description |
|---|---|
tableUploaderName | the name of the table uploader to run the import with |
currentUser | the profile initiating the import |
startRow | the zero-based row to start importing from, skipping any rows before it |
taskSize | the number of rows to process per batch |
in | the spreadsheet content to import |
destFieldsMap | the column mappings, keyed by destination field name |
parameters | the import parameters, including any action handler configuration |
findAutoMappings(Map<String,String> destFields, UploadedTable table)
Returns: Map<String,Integer>
Suggest column mappings for an uploaded table by asking an LLM to match the table's header row against the given destination fields. Returns an empty map if the tenant has not consented to LLM usage, no model is available, or the table has no rows; returns whatever mappings could be resolved if the LLM's response could not be fully interpreted.
| Parameter | Description |
|---|---|
destFields | the candidate destination fields, keyed by field name with the display title as the value |
table | the uploaded table whose first few rows are sampled for the LLM prompt |
loadAuditLog(Path tablePath)
Returns: List<Map<String,Object>>
Return the audit log entries for a saved spreadsheet. Each entry is a map with keys: date (ISO8601 string), userId (Long), action (String).
| Parameter | Description |
|---|---|
tablePath | path of the saved spreadsheet |