TheOpenCloudEngine / uEngine5-base

uEngine5 BPMS that totally re-written in Microservices architecture. uEngine5 can act as not only a conventional Workflow or BPMS but also as a REST api orchestrator or a BPaaS (Business process as a service) of members of OCE's MSA components.
MIT License
10 stars 13 forks source link

Change to Visitor pattern for executing BPMN #4

Open jinyoung opened 7 years ago

jinyoung commented 7 years ago

Currently we converts JAXB-generated BPMN model to BPMN-like-and-uEngine-like model and run the later one. It's kind of good approach having some Pros. and Cons. as described below:

  1. Pros. It's kind of good approach, since the JAXB-generated BPMN is quite data model-driven, it is not suitable for execution. (e.g. for storing the model, class hierarchy must be A extends B. but, for executing it the behaviors are more inherited from A not from B, then B extends A is better choice for execution.) And the JAXB-generated BPMN will be overwritten automatically by the generator, we can't have any modification to the model classes such as inserting any execution method like 'executeActivity(ProcessInstance)' - will be ignored when the model has been upgraded.
  2. Cons. but it requires unnecessary conversion between object models - it will brought some inconsistency in the model finally. Also for educational perspective, the developers must understand two models together in the spite of we will match the property name as possible.

So, we need someday reconciling two perspectives with 'Visitor pattern' for dividing model and executor. With the approach we've utilized before in designer support, BlockFinder, and the adapter itself:

    ActivityFor(){
       visit(TFlowNode flowNode){
            Executor executor = UEngineUtil.getComponentByEscalation(flowNode, "executor");
            executor.run(flowNode, processInstance);
       }
   }