FormWorkflow
class FormWorkflow[Owner, Schema, Domain, Failure]Pure baseline, revision, reset, and one-in-flight-save state.
Create with workflow. Legal transitions are represented by the result enums; callers should store the returned workflow. Completion tokens reject stale callbacks, while a successful save always advances baseline to the acknowledged snapshot.
Parameters
currentThe form being edited.
baselineThe last saved values: the values the workflow was created with, or those acknowledged by the latest successful save.
revisionThe revision of the editable values. It advances each time the current values change.
saveThe save state: idle, saving, or failed.
Defined by scalive.FormWorkflow. View source (scalive/api/src/scalive/forms/FormWorkflow.scala:165-343)
Types1
Submission
type Submission = FormSubmission[Owner, Schema, Domain]The type of the submissions this workflow starts.
Defined by scalive.FormWorkflow.Submission. View source (scalive/api/src/scalive/forms/FormWorkflow.scala:175-175)
Methods10
beginSave
def beginSave: FormSaveStart[FormWorkflow[Owner, Schema, Domain, Failure], Submission]Starts persistence only for a valid current form and only when no save is active.
An invalid form is returned with all errors visible; a started submission snapshots the exact values and domain value to persist.
Defined by scalive.FormWorkflow.beginSave. View source (scalive/api/src/scalive/forms/FormWorkflow.scala:234-254)
dismissFailure
def dismissFailure: FormWorkflow[Owner, Schema, Domain, Failure]Clears the stored failure back to idle without changing the form, baseline, or revision.
Idle and saving workflows are unchanged; dismissal does not cancel persistence.
Defined by scalive.FormWorkflow.dismissFailure. View source (scalive/api/src/scalive/forms/FormWorkflow.scala:199-201)
failureForCurrentRevision
def failureForCurrentRevision: Option[Failure]Failure feedback for the current revision.
Feedback-only and identical-value changes retain relevance. Revision-changing edits hide, but do not clear, the stored failure.
Defined by scalive.FormWorkflow.failureForCurrentRevision. View source (scalive/api/src/scalive/forms/FormWorkflow.scala:190-193)
isDirty
def isDirty: BooleanWhether current editable values differ from the last acknowledged baseline.
Defined by scalive.FormWorkflow.isDirty. View source (scalive/api/src/scalive/forms/FormWorkflow.scala:178-178)
isSaving
def isSaving: BooleanWhether a save is currently in flight.
Defined by scalive.FormWorkflow.isSaving. View source (scalive/api/src/scalive/forms/FormWorkflow.scala:181-183)
reset
def reset: FormWorkflowReset[FormWorkflow[Owner, Schema, Domain, Failure], Submission]Restores the baseline as a pristine form, unless a save is currently in flight.
Defined by scalive.FormWorkflow.reset. View source (scalive/api/src/scalive/forms/FormWorkflow.scala:212-227)
saveCancelled
def saveCancelled(token: FormSubmissionToken): FormWorkflowTransition[FormWorkflow[Owner, Schema, Domain, Failure]]Cancels the current token back to idle; stale cancellations are ignored explicitly.
Defined by scalive.FormWorkflow.saveCancelled. View source (scalive/api/src/scalive/forms/FormWorkflow.scala:298-303)
saveFailed
def saveFailed(token: FormSubmissionToken, failure: Failure): FormWorkflowTransition[FormWorkflow[Owner, Schema, Domain, Failure]]Records a failure for the current token; stale completions leave the workflow unchanged.
Defined by scalive.FormWorkflow.saveFailed. View source (scalive/api/src/scalive/forms/FormWorkflow.scala:287-295)
saveSucceeded
def saveSucceeded(token: FormSubmissionToken): FormWorkflowTransition[FormWorkflow[Owner, Schema, Domain, Failure]]Applies a successful save when token belongs to the save in flight.
This form makes the submitted values the new baseline. If the values were not edited since the save started, the current form becomes a pristine form of them; otherwise the newer edits stay current. Any other token returns Stale.
Defined by scalive.FormWorkflow.saveSucceeded. View source (scalive/api/src/scalive/forms/FormWorkflow.scala:262-268)
def saveSucceeded(token: FormSubmissionToken, canonical: ValidFormSnapshot[Owner, Schema, Domain]): FormWorkflowTransition[FormWorkflow[Owner, Schema, Domain, Failure]]Applies a successful save when token belongs to the save in flight.
This form makes canonical, a snapshot supplied by persistence, the new baseline. If the
values were not edited since the save started, the current form becomes a pristine form of
canonical; otherwise the newer edits stay current. Any other token returns
Stale.
Defined by scalive.FormWorkflow.saveSucceeded. View source (scalive/api/src/scalive/forms/FormWorkflow.scala:277-284)
updated
def updated(next: Form[Owner, Schema, Domain]): FormWorkflow[Owner, Schema, Domain, Failure]Installs a same-definition form and advances revision only when editable values changed.
Defined by scalive.FormWorkflow.updated. View source (scalive/api/src/scalive/forms/FormWorkflow.scala:204-209)
Values4
baseline
val baseline: FormValues[Owner, Schema]The last saved values: the values the workflow was created with, or those acknowledged by the latest successful save.
Defined by scalive.FormWorkflow.baseline. View source (scalive/api/src/scalive/forms/FormWorkflow.scala:169-169)
current
val current: Form[Owner, Schema, Domain]The form being edited.
Defined by scalive.FormWorkflow.current. View source (scalive/api/src/scalive/forms/FormWorkflow.scala:168-168)
revision
val revision: FormRevisionThe revision of the editable values. It advances each time the current values change.
Defined by scalive.FormWorkflow.revision. View source (scalive/api/src/scalive/forms/FormWorkflow.scala:170-170)
save
val save: FormSaveState[FormSubmission[Owner, Schema, Domain], Failure]The save state: idle, saving, or failed.
Defined by scalive.FormWorkflow.save. View source (scalive/api/src/scalive/forms/FormWorkflow.scala:171-171)