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

cn.schoolwow.workflow.service.deploy.WorkFlowDeployImpl Maven / Gradle / Ivy

There is a newer version: 1.0.6
Show newest version
package cn.schoolwow.workflow.service.deploy;

import cn.schoolwow.quickflow.domain.FlowContext;
import cn.schoolwow.workflow.composite.definition.DeployWorkFlowCompositeBusiness;
import cn.schoolwow.workflow.domain.QuickWorkFlowConfig;
import cn.schoolwow.workflow.entity.WorkFlowDefinition;
import cn.schoolwow.workflow.flow.definition.query.GetWorkFlowDefinitionListFlow;
import cn.schoolwow.workflow.flow.definition.query.HasDeployWorkFlowFlow;

import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;

public class WorkFlowDeployImpl implements WorkFlowDeploy{
    private QuickWorkFlowConfig quickWorkFlowConfig;

    public WorkFlowDeployImpl(QuickWorkFlowConfig quickWorkFlowConfig) {
        this.quickWorkFlowConfig = quickWorkFlowConfig;
    }

    @Override
    public List getWorkFlowDefinitionList(){
        FlowContext flowContext = quickWorkFlowConfig.workflow.startFlow(new GetWorkFlowDefinitionListFlow())
                .execute();
        List workFlowDefinitionList = (List) flowContext.getData("workFlowDefinitionList", new ArrayList<>());
        return workFlowDefinitionList;
    }

    @Override
    public boolean hasDeploy(String name) {
        FlowContext flowContext = quickWorkFlowConfig.workflow.startFlow(new HasDeployWorkFlowFlow())
                .putCurrentCompositeFlowData("name", name)
                .execute();
        boolean exist = (boolean) flowContext.checkData("exist");
        return exist;
    }

    @Override
    public void deployWorkFlow(String name, InputStream inputStream) {
        quickWorkFlowConfig.workflow.startFlow(new DeployWorkFlowCompositeBusiness())
                .putCurrentCompositeFlowData("name", name)
                .putCurrentCompositeFlowData("inputStream", inputStream)
                .execute();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy