AnsweredAssumed Answered

Mapping process data to objects

Question asked by k5 on Jul 28, 2014
i really like strong typing, so using a Map<String,Object> for the object data felt errorprone. I sketched around with an orm similar approach to bind the Map<String,Object> to domain specific Task instances (each <userTask /> gets a dedicated class), classes for the ProcessInstance and the variables used in JavaDelegates.

To provide a proper example i created a simple pet project. The code of the example can be found here: A live version can be found here: Its a little stratego like game where the "who is allowed to do what" is implemented using bpmn. The actual game logic is implemented in java behind JavaDelegates.

Some interessting file:
Screenshot of the process

The initial class that registers/binds the relevant classes for the process.
- Binder inferface defines the allowed variables in the process variables
- Activities registers with @Task classes that are bound to specific taskdefinitionkeys.
  @Start @Data @Aspect do the same for startevent or processinstances
- Servants are used together with a JavaDelegate that forwards serviceTasks to beans that implement the interface.
- An example for a @Task, @In fields are read from the processvariables when the instance is retrieved. @Out fields that are written back when the task is completed.
- An example for a complete ProcessInstance with multiple possible active tasks.

Any thoughts about this approach? Anybody thinks this approach might be useful? Is there a better way of doing certain things? Is it done in a similar way in another workflow engine?