Uploaded image for project: 'camunda BPM'
  1. camunda BPM
  2. CAM-2903

I can work with typed variables in Java API

    XMLWordPrintable

    Details

    • Type: Feature Request
    • Status: Closed
    • Priority: L3 - Default
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 7.2.0, 7.2.0-alpha6
    • Component/s: engine
    • Labels:
      None

      Description

      AT:

      • When setting a value for a variable, I can specify the type of the value, even if the value is null
      • When getting a value for a variable, I can get the type of the value, even if the value is null
      • Also works if the value is a deserialized Java Object
      • Also works if the value is a serialized Java Object

      Motivation:
      =========
      Currently the process engine provides an "untyped" API for working with variables.This leads to some subtle limitations:

      Null values:
      ---------------
      1) It is impossible to initialize a variable with "null" and declare a type for it:
      execution.setVariable("myVar", null);
      => type of variable cannot be detected by process engine and will be "null"

      2) It is impossible to get the type of a variable which has variable null. I cannot
      Object object = execution.getVariable("myVar");
      object.getClass() // < will throw NPE if object is null

      All of this is OK as long as I am "only" writing Java Applications in which I know the types of my variables everywhere. However, it causes problems when

      • developing a clean REST API
      • developing "Generic" applications such as Cockpit or Tasklist
      • crossing the language barrier and use Java Script (for instance when developing task forms)

      Additional Metadata:
      --------------------------
      1) It is impossible to attach and retrieve additional metadata to values. For instance, when working with XML data, you cannot specify additional metadata in the variable value such as Namespace / Schema information.
      While this can be to a certain extend embedded in the value itself when working with XML this is not trivially possible when working with other dataformats such as JSON or CSV...

      2) Additional Metadata is also relevant when working with serialized Java Objects. There the requirement is to be able to get and set the type of the java object even if the object itself is
      a) null
      b) not deserialized (this is required in situations where we cannot deserialize the java objects due to classloader restrictions)
      c) specify the value in a different format such as JSON or XML

      3) Formulating restrictions (read-only, type-change allowed ...)

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              thorben.lindhauer Thorben Lindhauer
              Reporter:
              meyer Daniel Meyer
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: