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

PropertyReturnsDescription
rowSanityCheckTableActionHandlersList<TableActionHandler>The built-in row-level sanity check action handlers offered to every table uploader.
tableActionHandlersList<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.
tableUploadersList<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.
uploadSanityCheckTableActionHandlersList<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.

ParameterDescription
taskNamethe 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.

ParameterDescription
paththe 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.

ParameterDescription
pathStrfolder 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.

ParameterDescription
dirfolder path string to search within
searchoptional 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.

ParameterDescription
tablePathpath string of the saved spreadsheet

findDir(String dirPath)

Returns: TableDir

Look up a saved spreadsheet folder by its path.

ParameterDescription
dirPathpath string of the folder, or null or blank for the root spreadsheets folder

deleteTable(String pathStr)

Returns: void

Delete a saved spreadsheet.

ParameterDescription
pathStrpath string of the spreadsheet to delete

renameTable(String pathStr, String newName)

Returns: void

Rename a saved spreadsheet, keeping it in the same folder.

ParameterDescription
pathStrpath string of the spreadsheet to rename
newNamenew 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).

ParameterDescription
pathStrpath 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.

ParameterDescription
pathStrpath string of the saved spreadsheet
rowIndexzero-based row index
colIndexzero-based column index
valuenew cell value

getAnalyticsConfigJson(String pathStr)

Returns: String

Return the configured analytics for a saved spreadsheet.

ParameterDescription
pathStrpath string of the saved spreadsheet

saveAnalyticsConfigJson(String pathStr, String configJson)

Returns: void

Save the analytics configuration for a saved spreadsheet, replacing any existing configuration.

ParameterDescription
pathStrpath string of the saved spreadsheet
configJsonthe 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.

ParameterDescription
pathStrpath string of the saved spreadsheet
hasHeaderRowwhether 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.

ParameterDescription
pathStrpath 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.

ParameterDescription
pathStrpath string of the spreadsheet whose analytics configuration should be saved as a template
templateNamethe 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.

ParameterDescription
pathStrpath string of the spreadsheet to apply the template to
templateNamethe template's name

deleteAnalyticsTemplate(String templateName)

Returns: void

Delete a saved analytics template.

ParameterDescription
templateNamethe template's name

getSpreadsheetRowCount(String pathStr)

Returns: int

Return the total number of rows in a saved spreadsheet.

ParameterDescription
pathStrpath 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.

ParameterDescription
pathStrpath string of the saved spreadsheet
startzero-based first row index
countnumber 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.

ParameterDescription
pathStrpath 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.

ParameterDescription
inthe 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.

ParameterDescription
dirthe folder to save the spreadsheet under
namethe spreadsheet's name
inthe 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.

ParameterDescription
rowsthe 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.

ParameterDescription
dirthe folder to save the spreadsheet under
namethe spreadsheet's name
rowsthe rows to save

load(String hash)

Returns: UploadedTable

Look up a previously saved spreadsheet by its content hash.

ParameterDescription
hashthe 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).

ParameterDescription
tableUploaderthe table uploader to resolve destination fields for
parametersthe import parameters to build a transient import context with

tableUploader(String tableUploader)

Returns: TableUploader

Look up a registered table uploader by its name.

ParameterDescription
tableUploaderthe 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.

ParameterDescription
pthe 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.

ParameterDescription
pthe profile to check
tuthe 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.

ParameterDescription
tableUploaderNamethe table uploader's name
savedNamethe saved mapping's name

savedMappings(String tableUploaderName)

Returns: List<FieldMapping>

Returns a list of saved import mappings for the given uploader

ParameterDescription
tableUploaderNamethe 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.

ParameterDescription
tableUploaderthe table uploader to run the import with
fieldMappingsthe saved field mapping to use
currentUserthe profile initiating the import
inthe 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.

ParameterDescription
tableUploaderNamethe name of the table uploader to run the import with
currentUserthe profile initiating the import
startRowthe zero-based row to start importing from, skipping any rows before it
taskSizethe number of rows to process per batch
inthe spreadsheet content to import
destFieldsMapthe column mappings, keyed by destination field name
parametersthe 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.

ParameterDescription
destFieldsthe candidate destination fields, keyed by field name with the display title as the value
tablethe 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).

ParameterDescription
tablePathpath of the saved spreadsheet
To get full access to the Kademi Hub existing customers can login here, or new customers can register here.