All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cn.schoolwow.workflow.composite.instance.query.GetInstanceContextDataFlow Maven / Gradle / Ivy

There is a newer version: 1.0.6
Show newest version
package cn.schoolwow.workflow.composite.instance.query;

import cn.schoolwow.quickdao.dao.DAO;
import cn.schoolwow.quickflow.domain.FlowContext;
import cn.schoolwow.quickflow.flow.BusinessFlow;
import cn.schoolwow.workflow.domain.request.ContextDataRequest;
import cn.schoolwow.workflow.entity.WorkFlowInstance;
import cn.schoolwow.workflow.entity.WorkFlowTask;
import com.alibaba.fastjson.JSONObject;

public class GetInstanceContextDataFlow implements BusinessFlow {
    @Override
    public void executeBusinessFlow(FlowContext flowContext) throws Exception {
        DAO dao = (DAO) flowContext.checkData("dao");
        ContextDataRequest contextDataRequest = (ContextDataRequest) flowContext.checkData("contextDataRequest");

        Long workFlowInstanceId = contextDataRequest.workFlowInstanceId;
        if(null==workFlowInstanceId){
            workFlowInstanceId = dao.query(WorkFlowTask.class)
                    .addQuery("id", contextDataRequest.workFlowTaskId)
                    .addColumn("instanceId")
                    .execute()
                    .getSingleColumn(Long.class);
        }

        JSONObject contextData = dao.query(WorkFlowInstance.class)
                .addColumn("contextData")
                .addQuery("id", workFlowInstanceId)
                .execute()
                .getSingleColumn(JSONObject.class);
        flowContext.putTemporaryData("contextData", contextData);
    }

    @Override
    public String name() {
        return "获取工作流实例上下文数据";
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy