Fluent builder for a JsTableActionHandler, exposed to app and library JS code as controllerMappings.newTableActionHandlerBuilder(). Set an id, title, description and any configuration fields, name the JS functions that implement the lifecycle hooks you need, then call build() to construct the handler and register it as one of the table uploader actions available in the app.
Group: Builders
Extends: AbstractFieldsBuilder
Properties
| Property | Returns | Description |
|---|---|---|
| afterFileFn | String | Name of the JS function currently set to implement afterFile. |
| afterRowFn | String | Name of the JS function currently set to implement afterRow. |
| description | String | Description currently set on this builder. |
| fields | List<ExtraField> | Configuration fields currently set on this builder. |
| id | String | Identifier currently set on this builder. |
| processRowFn | String | Name of the JS function currently set to implement processRow. |
| title | String | Display title currently set on this builder. |
| transformFileFn | String | Name of the JS function currently set to implement transformFile. |
| validateRowFn | String | Name of the JS function currently set to implement validateRow. |
Methods
build() · id(String id) · title(String title) · description(String description) · transformFileFn(String transformFileFn) · transformRowFn(String transformRowFn) · validateRowFn(String validateRowFn) · processRowFn(String processRowFn) · afterRowFn(String afterRowFn) · afterFileFn(String afterFileFn) · getId() · setId(String id) · getTitle() · setTitle(String title) · getFields() · setFields(List<ExtraField> fields) · getDescription() · setDescription(String description) · getTransformFileFn() · getValidateRowFn() · getProcessRowFn() · getAfterFileFn() · getAfterRowFn()
build()
Returns: JsTableActionHandler
Constructs a JsTableActionHandler from the id, title, fields and JS hook function names set on this builder. If the controller mapping engine has not yet finished initialising, the new handler is also added to its list of table action handlers, making it available for use in table uploaders.
id(String id)
Returns: JsTableActionHandlerBuilder
Sets the unique identifier for the handler being built.
| Parameter | Description |
|---|---|
id | the handler's identifier |
title(String title)
Returns: JsTableActionHandlerBuilder
Sets the display title shown to an admin when choosing this action for a table uploader.
| Parameter | Description |
|---|---|
title | the handler's display title |
description(String description)
Returns: JsTableActionHandlerBuilder
Sets the description shown for this action.
| Parameter | Description |
|---|---|
description | the handler's description |
transformFileFn(String transformFileFn)
Returns: JsTableActionHandlerBuilder
Names the JS function called to implement transformFile, which runs before validation and can rewrite the whole set of imported rows without making any database changes.
| Parameter | Description |
|---|---|
transformFileFn | the name of the JS function to invoke |
transformRowFn(String transformRowFn)
Returns: JsTableActionHandlerBuilder
Names the JS function called to implement transformRow, which runs before validation and can rewrite a single imported row without making any database changes.
| Parameter | Description |
|---|---|
transformRowFn | the name of the JS function to invoke |
validateRowFn(String validateRowFn)
Returns: JsTableActionHandlerBuilder
Names the JS function called to implement validateRow during the validation phase. The function must not change the database, and should return null if the row is valid or an error message describing the problem.
| Parameter | Description |
|---|---|
validateRowFn | the name of the JS function to invoke |
processRowFn(String processRowFn)
Returns: JsTableActionHandlerBuilder
Names the JS function called to implement processRow during the processing phase (not during validation), where the function is expected to make its database changes for the row.
| Parameter | Description |
|---|---|
processRowFn | the name of the JS function to invoke |
afterRowFn(String afterRowFn)
Returns: JsTableActionHandlerBuilder
Names the JS function called to implement afterRow, invoked once processing of a row has finished.
| Parameter | Description |
|---|---|
afterRowFn | the name of the JS function to invoke |
afterFileFn(String afterFileFn)
Returns: JsTableActionHandlerBuilder
Names the JS function called to implement afterFile, invoked once the whole file has finished processing, with the accumulated import statistics available to it.
| Parameter | Description |
|---|---|
afterFileFn | the name of the JS function to invoke |
getId()
Returns: String
Identifier currently set on this builder.
setId(String id)
Returns: void
Sets the unique identifier for the handler being built.
| Parameter | Description |
|---|---|
id | the handler's identifier |
getTitle()
Returns: String
Display title currently set on this builder.
setTitle(String title)
Returns: void
Sets the display title shown to an admin when choosing this action for a table uploader.
| Parameter | Description |
|---|---|
title | the handler's display title |
getFields()
Returns: List<ExtraField>
Configuration fields currently set on this builder.
setFields(List<ExtraField> fields)
Returns: void
Replaces the configuration fields set on this builder.
| Parameter | Description |
|---|---|
fields | the configuration fields for the handler being built |
getDescription()
Returns: String
Description currently set on this builder.
setDescription(String description)
Returns: void
Sets the description shown for this action.
| Parameter | Description |
|---|---|
description | the handler's description |
getTransformFileFn()
Returns: String
Name of the JS function currently set to implement transformFile.
getValidateRowFn()
Returns: String
Name of the JS function currently set to implement validateRow.
getProcessRowFn()
Returns: String
Name of the JS function currently set to implement processRow.
getAfterFileFn()
Returns: String
Name of the JS function currently set to implement afterFile.
getAfterRowFn()
Returns: String
Name of the JS function currently set to implement afterRow.