Package com.founder.fix.fixflow.core

Examples of com.founder.fix.fixflow.core.ProcessEngine


  }

  @Override
  public void leaveClearData(ExecutionContext executionContext){

    ProcessEngine processEngine=ProcessEngineManagement.getDefaultProcessEngine();
    TaskInstanceEntity taskInstance=(TaskInstanceEntity)processEngine.getTaskService().createTaskQuery().tokenId(executionContext.getToken().getId()).addTaskType(TaskInstanceType.INTERMEDIATECATCHEVENT).taskNotEnd().singleResult();
    //当发现老任务,并没有创建等待接收任务的时候,不需要清理
    if(taskInstance==null){
      return;
    }
   
View Full Code Here


public class FlowExplorerServiceImpl implements FlowExplorerService {

  public String getProcessVersionInfo(String fileName, String userId)throws Exception {
    String processKey = fileName.substring(0, fileName.lastIndexOf("."));
      List<Map<String, Object>> resultMaps = new ArrayList<Map<String,Object>>();
      ProcessEngine processEngine = getProcessEngine(userId);
      if(processEngine != null){
        ModelService modelService = processEngine.getModelService();
        ProcessDefinitionQuery processDefinitionQuery = modelService.createProcessDefinitionQuery();
        processDefinitionQuery.processDefinitionKey(processKey);
        processDefinitionQuery.orderByProcessDefinitionVersion().desc();
        List<ProcessDefinitionBehavior> processDefinitionBehaviors = processDefinitionQuery.list();
        for(ProcessDefinitionBehavior processDefinitionBehavior :processDefinitionBehaviors){
View Full Code Here

      String result = objectMapper.writeValueAsString(resultMaps);
      return result; 
  }

  public void deploy(Map<String, InputStream> fileInputStream,String deploymentId, String userId) throws Exception {
    ProcessEngine processEngine = null;
    try {
      processEngine = getProcessEngine(userId);
      if (processEngine != null) {
        ModelService modelService = processEngine.getModelService();
        if (deploymentId != null && !"".equals(deploymentId)) {
          modelService.updateDeploymentByStream(fileInputStream,deploymentId);
        } else {
          modelService.deploymentByStream(fileInputStream);
        }
      }
    }finally {
      if (processEngine != null) {
        processEngine.contextClose(true, true);
      }
    }
  }
View Full Code Here

    }
  }

  private ProcessEngine getProcessEngine(String userId) throws Exception{
      Connection connection = null;
      ProcessEngine processEngine=ProcessEngineManagement.getDefaultProcessEngine();
    //获取流程当前配置的数据库信息
    DataBase dataBase=processEngine.getProcessEngineConfiguration().getSelectedDatabase();
    String driver = dataBase.getDriverClassName();
    String url = dataBase.getUrl();
    String user = dataBase.getUsername();
    String password = dataBase.getPassword();
    //创建Connection
    Class.forName(driver);
    connection = DriverManager.getConnection(url, user, password);
    connection.setAutoCommit(false);
    ExternalContent externalContent =new ExternalContent();
    externalContent.setAuthenticatedUserId(userId);
    externalContent.setConnection(connection);
    processEngine.setExternalContent(externalContent);
     
      return processEngine;
    }
View Full Code Here

    Connection connection=null;
   
    try {
     
     
      ProcessEngine processEngine=ProcessEngineManagement.getDefaultProcessEngine();
     
      connection=processEngine.getProcessEngineConfiguration().createConnection();
      connection.setAutoCommit(false);
      ExternalContent externalContent=new ExternalContent();
      externalContent.setConnection(connection);
      externalContent.setAuthenticatedUserId("1200119390");
      processEngine.setExternalContent(externalContent);
     
     
      ObjectMessage objMessage = (ObjectMessage)message;
     
      flowMessage = (FlowMessage)objMessage.getObject();
     
     
     
      String messageId=flowMessage.getId();
     
     
      String processDefinitionId=flowMessage.getTargetProcess();
     
     
      EventSubscriptionType eventSubscriptionType=flowMessage.getMessageType();
      String nodeId=flowMessage.getTargetNode();
      String tokenId=flowMessage.getTokenId();
      Map<String,Object> dataVariableMap=flowMessage.getDataVariableMap();
     
      RuntimeService runtimeService=processEngine.getRuntimeService();
     
      if(eventSubscriptionType==EventSubscriptionType.MessageStartEvent){
        MessageStartProcessInstanceCommand messageStartProcessInstanceCommand=new MessageStartProcessInstanceCommand();
        messageStartProcessInstanceCommand.setProcessDefinitionId(processDefinitionId);
        messageStartProcessInstanceCommand.setNodeId(nodeId);
View Full Code Here

public class ExpressionUtil {
 
  public Object performGroovyExpression(String expression){

    ProcessEngine processEngine=ProcessEngineManagement.getDefaultProcessEngine();
    //processEngine.setExternalContent(externalContent);
    RuntimeService runtimeService=processEngine.getRuntimeService();
   
    return runtimeService.executeRuleScript(expression);

   
   
View Full Code Here

      throw new FixFlowException("获取下一步链接的时候数据库链接不能为空");

    }

    ProcessEngine processEngine = ProcessEngineManagement.getDefaultProcessEngine();

    TaskService taskService = processEngine.getTaskService();

    TaskQuery taskQuery = taskService.createTaskQuery();

    TaskInstance taskInstance=taskQuery.taskId(taskId).singleResult();
   
View Full Code Here

      if(processDefinitionKey==null||processDefinitionKey.equals("")){
        throw new FixFlowException("processDefinitionKey 不能为空!");
      }
     
     
      ProcessEngine processEngine =ProcessEngineManagement.getDefaultProcessEngine();
      RuntimeService runtimeService = processEngine.getRuntimeService();
      // runtimeService.getCommandExecutor().setConnection(dbgr.getConnection());

      StartProcessInstanceCommand startProcessInstanceCommand = new StartProcessInstanceCommand();
      startProcessInstanceCommand.setProcessDefinitionKey(processDefinitionKey);
      startProcessInstanceCommand.setBusinessKey(businessKey);
      startProcessInstanceCommand.setStartAuthor(Authentication.getAuthenticatedUserId());
      startProcessInstanceCommand.setInitiator(Authentication.getAuthenticatedUserId());
      startProcessInstanceCommand.setTransientVariables(transientVariables);
      // startProcessInstanceCommand.setVariables(Variables);
      ProcessInstance processInstanceQueryTo = runtimeService
          .noneStartProcessInstance(startProcessInstanceCommand);
     
     
     

      // 任务第一步提交完还需找到一个待办事宜再执行掉才算真正完成
      String processInstanceId = processInstanceQueryTo.getId();

      TaskService taskService = processEngine.getTaskService();
      TaskQuery taskQuery = taskService.createTaskQuery()
          .processInstanceId(processInstanceId);

      //先去找独占任务没有的话就去找共享任务并完成他
      List<TaskInstance> taskQueryList = taskQuery.taskAssignee(Authentication.getAuthenticatedUserId()).taskNotEnd()
View Full Code Here

 
  private void rollBackSubProcess(String rollBackNodeId,String subProcessInstanceId,String parentProcessTokenId,ProcessInstanceEntity parentProcessInstance,CommandContext commandContext){
   
 
   
    ProcessEngine processEngine=ProcessEngineManagement.getDefaultProcessEngine();
   
    TokenEntity parentToken=parentProcessInstance.getTokenMap().get(parentProcessTokenId);
   
    ExecutionContext parentExecutionContext=ProcessObjectFactory.FACTORYINSTANCE.createExecutionContext(parentToken);
   
   
    TaskInstanceEntity taskInstanceCallAct = (TaskInstanceEntity) processEngine.getTaskService().createTaskQuery()
        .callActivityInstanceId(subProcessInstanceId).taskNotEnd().singleResult();
   
    // 获取正在操作的任务命令对象实例
    TaskCommandInst taskCommand = getTaskCommandInst();
    taskInstanceCallAct.customEnd(taskCommand, this.taskComment);
View Full Code Here

  public ProcessInstance execute(CommandContext commandContext) {
   
   

   
    ProcessEngine processEngine =ProcessEngineManagement.getDefaultProcessEngine();
    RuntimeService runtimeService = processEngine.getRuntimeService();
    // runtimeService.getCommandExecutor().setConnection(dbgr.getConnection());
    TaskService taskService = processEngine.getTaskService();
    if(this.taskId!=null&&!this.taskId.equals("")){
      //TaskInstance taskInstance=commandContext.getTaskManager().findTaskById(this.taskId);
      ExpandTaskCommand expandTaskCommand=new ExpandTaskCommand();
      expandTaskCommand.setCommandType("submit");
      expandTaskCommand.setTaskComment(this.taskComment);
View Full Code Here

TOP

Related Classes of com.founder.fix.fixflow.core.ProcessEngine

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.