FormDataManager

abstract class FormDataManager : KoinComponent

Abstract class managing the data flow of a form.

FormDataManager is responsible for:

  • Loading data from the database for edited entities

  • Providing default values for new records

  • Defining relations between tables

  • Turning form data into database operations

Every form implements its own DataManager, fitted to its domain and database structure.

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard
protected val db: OctaviusClient
Link copied to clipboard

Functions

Link copied to clipboard

Defines the logic of form actions that operate on data (Save, Delete, etc.). The map key matches actionKey in FormActionTrigger.triggerAction. The value is a lambda that receives the current form data and returns true if the operation succeeded.

Link copied to clipboard
open fun getKoin(): Koin
Link copied to clipboard
abstract fun initData(payload: Map<String, Any?>): Map<String, Any?>?

Provides the initial values for the form's controls.

Link copied to clipboard
fun loadData(id: Any?, block: DataLoaderBuilder.() -> Unit): Map<String, Any?>?

Loads the record with id according to the mapping in block (the DSL from FormLoader.kt).

Link copied to clipboard
internal fun setupFormReferences(errorManager: ErrorManager)