Package com.axelor.workflow.expression
Class WorkflowValues
java.lang.Object
com.axelor.workflow.expression.WorkflowValues
The engine's one value codec: guest values from a script (
fromValue(org.graalvm.polyglot.Value)), and host values to
and from JSON (encode(java.lang.Object, java.lang.String, com.axelor.workflow.expression.WorkflowValues.HostPolicy) / decode(java.lang.Object, com.axelor.workflow.expression.WorkflowValues.TagPolicy)). Run variables, captured snapshots and message
payloads share it, so a date, decimal or long reads back as what it was.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceWhat to do with a host objectencode(java.lang.Object, java.lang.String, com.axelor.workflow.expression.WorkflowValues.HostPolicy)cannot turn into JSON: a message refuses one, a variable stores a reference.static interfaceWhat a caller makes of a tag this codec does not recognise. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe key a tagged value carries its type under;@cannot begin a JSON field name.static final ObjectReturned by aWorkflowValues.TagPolicyfor a tag that is not its own; distinct from null, which a deleted record's reference reads back as.static final StringThe key a tagged value carries its payload under. -
Method Summary
Modifier and TypeMethodDescriptionstatic StringblankToNull(String value) A blank attribute is an absent one: the schema writes "" where the author wrote nothing.static Objectdecode(Object stored, WorkflowValues.TagPolicy onTag) static Objectencode(Object value, String path, WorkflowValues.HostPolicy onHost) The value as something Jackson can be trusted with, or whatonHostmakes of the parts that are not, such as a live entity.static ObjectfromValue(org.graalvm.polyglot.Value v) Deep-converts a GraalVM guestValueto plain Java objects that outlive the script's context.static booleanWhethervalueis a tag oftype, which a host policy's own reader asks.A tagged value, as the two keysdecode(java.lang.Object, com.axelor.workflow.expression.WorkflowValues.TagPolicy)reads it back by.
-
Field Details
-
TYPE
The key a tagged value carries its type under;@cannot begin a JSON field name.- See Also:
-
VALUE
The key a tagged value carries its payload under.- See Also:
-
UNHANDLED
Returned by aWorkflowValues.TagPolicyfor a tag that is not its own; distinct from null, which a deleted record's reference reads back as.
-
-
Method Details
-
blankToNull
A blank attribute is an absent one: the schema writes "" where the author wrote nothing. -
fromValue
Deep-converts a GraalVM guestValueto plain Java objects that outlive the script's context. Host objects pass through; arrays becomeArrayList, objectsLinkedHashMap, numbersLongwhen they fit andDoubleotherwise. -
encode
The value as something Jackson can be trusted with, or whatonHostmakes of the parts that are not, such as a live entity.Values JSON cannot represent faithfully are tagged as
{"@type": ..., "value": ...}sodecode(java.lang.Object, com.axelor.workflow.expression.WorkflowValues.TagPolicy)restores them: temporals, decimals, longs, durations and zones. Strings, booleans, ints and nulls go plain. Enums go as their name, not tagged.pathlocates the current part, so a refusal can name it. -
tagged
A tagged value, as the two keysdecode(java.lang.Object, com.axelor.workflow.expression.WorkflowValues.TagPolicy)reads it back by. -
isTagged
Whethervalueis a tag oftype, which a host policy's own reader asks. -
decode
The inverse ofencode(java.lang.Object, java.lang.String, com.axelor.workflow.expression.WorkflowValues.HostPolicy).onTagis asked about unknown tags, such as a variable's record reference, and answersUNHANDLEDfor one that is not its. A tag nobody knows is returned as its map.
-