Class FormState

java.lang.Object
com.axelor.meta.headless.FormState

public final class FormState extends Object
Everything a FormSession holds between two requests: which form, the record tree and its open lines, the steps and where the run is in them, and the open question with what to do with each answer.

Kept as JSON: toMap() gives it as maps, lists, strings, numbers, booleans and nulls, which any JSON mapper writes, and fromMap(java.util.Map<java.lang.String, ?>) takes that back as the mapper reads it. Where it is kept is the caller's business; HeadlessForms.restore(com.axelor.meta.headless.FormState) turns it back into a session. It holds no entity and no view definition: the spec is built again on restore.

  • Method Details

    • question

      public ActionAlert question()
      The open question, when the session is suspended; null otherwise.
    • toMap

      public Map<String,Object> toMap()
      The state as JSON values, for any JSON mapper to write.
    • fromMap

      public static FormState fromMap(Map<String,?> map)
      A state from what toMap() gave, as a JSON mapper reads it back.
      Throws:
      IllegalArgumentException - when the map is not a form state