osworkflow api 之 spi

来源:互联网 发布:传智播客c语言百度云 编辑:程序博客网 时间:2024/05/16 23:48

 

com.opensymphony.workflow.soap

*这部分先跳过,soap的应用如果以后涉及到,在具体细看。

com.opensymphony.workflow.spi

**这个包也算是一个osworkflow中一个比较核心的包了。Spiserver provider identification的缩写。主要就是对外提供workflow的服务。

接口:

 

 

Step

包含一大堆get方法:getActionId() getCaller() getDueDate()、getEntryId() getFinishDate() getId() getOwner() getPreviousStepIds()、getStartDate() getStatus() getStepId()

 

 

WorkflowEntry

一个工作流的入口:

工作流实例变量的状态在这里通过常量方式给出:

    public static final int CREATED = 0;

    public static final int ACTIVATED = 1;

    public static final int SUSPENDED = 2;

    public static final int KILLED = 3;

    public static final int COMPLETED = 4;

public static final int UNKNOWN = -1;

另外方法:getId()返回工作流入口IDgetState()getWorkflowName()isInitialized()如果被初始化了则返回true

 

 

WorkflowStore

具体这些类实现此接口:

EJBWorkflowStore, HibernateWorkflowStore, JDBCWorkflowStore, MemoryWorkflowStore, OfbizWorkflowStore, OJBWorkflowStore, PrevaylerWorkflowStore, SpringHibernateWorkflowStore, WorkflowSystem

由这些类可以看得出,这个接口主要是为具体的持久存储提供统一标准接口。

具体方法:

1、  setEntryState设置入口状态

2、  getPropertySet获取propertySet

3、  createCurrentStep创建当前step

4、  createEntry创建entry

5、  findCurrentSteps

6、  findEntry

7、  findHistorySteps

8、  init(Map props)

9、  markFinished标记结束

10、              moveToHistory将结束的step移动到历史记录

11、              query(在将query包的时候讲过,有两个query方法,分别接受不推荐使用和正常使用两种的查询构造结果。)

 

类:

SimpleStep

先看看它的壮观的构造函数:

public SimpleStep(long id, long entryId, int stepId, int actionId, String owner, Date startDate, Date dueDate, Date finishDate, String status, long[] previousStepIds, String caller) {

        this.id = id;

        this.entryId = entryId;

        this.stepId = stepId;

        this.actionId = actionId;

        this.owner = owner;

        this.startDate = startDate;

        this.finishDate = finishDate;

        this.dueDate = dueDate;

        this.status = status;

        this.previousStepIds = previousStepIds;

        this.caller = caller;

}

接下来就没什么说的了,就是set get啦。

SimpleWorkflowEntry

构造函数:

    public SimpleWorkflowEntry(long id, String workflowName, int state) {

        this.id = id;

        this.workflowName = workflowName;

        this.state = state;

}

其他也是get set啦。另外它多出了一个 protected boolean initialized(有个此方法相当于get