Workflow engine design and implementation·Model abstraction

Preface

The above has given some basic introduction to workflow. With the basic content, I believe we can easily abstract some entity models: process model, start node model, end node model, task node model, decision node model, branch Node model, merged node model, edge model.

base model

We further abstract the model and get the basic model. The basic model only contains two attributes, unique encoding and display name.

public class BaseModel {
    private String name; // 唯一编码
    private String displayName; // 显示名称
}

model behavior

If we look at it from an object-oriented perspective, in addition to attributes, the process model itself should also have methods and behaviors, that is, things that nodes and edges can do, which are defined here using the Action interface.

public interface Action {
    public void execute(Execution execution);
}

Because the execution conditions of each process model may be different, the Execution class is used to define them here. The necessary attributes are simply defined below, and they can be added later as needed.

Guess you like

Origin blog.csdn.net/qq_27246521/article/details/132876186