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

I can work with typed variables in Java API



    • Feature Request
    • Resolution: Fixed
    • L3 - Default
    • 7.2.0, 7.2.0-alpha6
    • None
    • engine
    • None



      • 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

      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 ...)


        This is the controller panel for Smart Panels app


          Issue Links



                thorben.lindhauer Thorben Lindhauer
                meyer Daniel Meyer
                0 Vote for this issue
                2 Start watching this issue