Package org.activiti.engine.runtime

Examples of org.activiti.engine.runtime.ProcessInstance


    protected ProcessInstance startProcess(String processKey) throws Exception {
        return startProcess(processKey, new HashMap<String, Object>());
    }

    protected ProcessInstance startProcess(String processKey, Map<String, Object> variables) throws Exception {
        ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(processKey, variables);
        String processInstanceId = processInstance.getId();

        LOG.info("Started process instance id " + processInstanceId);
        runtimeService.createProcessInstanceQuery().count();

        HistoricProcessInstance historicProcessInstance = processEngine
View Full Code Here


        assertThat(outputStream.toString()).isEmpty();
    }

    private ProcessInstance newProcessInstanceMock(String id, String businessKey) {
        ProcessInstance instance = mock(ProcessInstance.class);

        when(instance.getId()).thenReturn(id);
        when(instance.getBusinessKey()).thenReturn(businessKey);

        return instance;
    }
View Full Code Here

        return engine;
    }

    private ProcessInstance newProcessInstanceMock(String id, String businessKey, boolean isSuspended) {
        ProcessInstance instance = mock(ProcessInstance.class);

        when(instance.getId()).thenReturn(id);
        when(instance.getBusinessKey()).thenReturn(businessKey);
        when(instance.isSuspended()).thenReturn(isSuspended);

        return instance;
    }
View Full Code Here

        final Map<String, Object> variables = new HashMap<String, Object>();
        variables.put(USER_TO, userTO);
        variables.put(ENABLED, enabled);

        final ProcessInstance processInstance;
        try {
            processInstance = runtimeService.startProcessInstanceByKey("userWorkflow", variables);
        } catch (ActivitiException e) {
            throw new WorkflowException(e);
        }

        SyncopeUser user = (SyncopeUser) runtimeService.getVariable(processInstance.getProcessInstanceId(),
                SYNCOPE_USER);

        // this will make SyncopeUserValidator not to consider
        // password policies at all
        if (disablePwdPolicyCheck) {
            user.removeClearPassword();
        }

        updateStatus(user);
        user = userDAO.save(user);

        Boolean propagateEnable = (Boolean) runtimeService.getVariable(processInstance.getProcessInstanceId(),
                PROPAGATE_ENABLE);

        if (propagateEnable == null) {
            propagateEnable = enabled;
        }

        // save resources to be propagated and password for later -
        // after form submission - propagation
        PropagationByResource propByRes = new PropagationByResource();
        propByRes.set(PropagationOperation.CREATE, user.getResourceNames());

        if (waitingForForm(user)) {
            runtimeService.setVariable(processInstance.getProcessInstanceId(), PROP_BY_RESOURCE, propByRes);
            propByRes = null;

            if (StringUtils.isNotBlank(userTO.getPassword())) {
                runtimeService.setVariable(processInstance.getProcessInstanceId(), ENCRYPTED_PWD, encrypt(userTO
                        .getPassword()));
            }
        }

        return new WorkflowResult<Map.Entry<Long, Boolean>>(new DefaultMapEntry(user.getId(), propagateEnable),
View Full Code Here

    repositoryService.createDeployment().addInputStream("TimeBoundaryIntermediateEvent.bpmn20.xml",
        new FileInputStream(filename)).deploy();
    RuntimeService runtimeService = activitiRule.getRuntimeService();
    Map<String, Object> variableMap = new HashMap<String, Object>();
    variableMap.put("name", "Activiti");
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("TimeBoundaryIntermediateEvent", variableMap);
    assertNotNull(processInstance.getId());
    System.out.println("id " + processInstance.getId() + " "
        + processInstance.getProcessDefinitionId());
   
    TaskService taskService = activitiRule.getTaskService();
    Task task = taskService.createTaskQuery().singleResult();
    assertNotNull(task);
   
View Full Code Here

    repositoryService.createDeployment().addInputStream("TimeBoundaryIntermediateEvent.bpmn20.xml",
        new FileInputStream(filename)).deploy();
    RuntimeService runtimeService = processEngine.getRuntimeService();
    Map<String, Object> variableMap = new HashMap<String, Object>();
    variableMap.put("name", "Activiti");
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("TimeBoundaryIntermediateEvent", variableMap);
    assertNotNull(processInstance.getId());
    System.out.println("id " + processInstance.getId() + " "
        + processInstance.getProcessDefinitionId());
   
    TaskService taskService = processEngine.getTaskService();
    Task task = taskService.createTaskQuery().singleResult();
    assertNotNull(task);
   
View Full Code Here

    users.add("user3");
    variableMap.put("users", users);

    // 启动时用123456作为业务ID
    String businessKey = "123456";
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("master", businessKey, variableMap);
    assertNotNull(processInstance.getId());
    System.out.println("id " + processInstance.getId() + " " + processInstance.getProcessDefinitionId());
    assertNotNull(runtimeService.createProcessInstanceQuery().processInstanceBusinessKey(businessKey).singleResult());

    // 根据主流程的流程实例ID查询子流程(调用活动的多个实例,每一个都是一个独立的流程)
    List<ProcessInstance> subProcessInstances = runtimeService.createProcessInstanceQuery()
        .superProcessInstanceId(processInstance.getProcessInstanceId()).list();
    assertEquals(3, subProcessInstances.size());
    for (ProcessInstance subProcessInstance : subProcessInstances) {
      assertNull(subProcessInstance.getBusinessKey());
    }
View Full Code Here

    repositoryService.createDeployment().addInputStream("multiSubProcess1.bpmn20.xml",
        new FileInputStream(filename)).deploy();
    RuntimeService runtimeService = activitiRule.getRuntimeService();
    Map<String, Object> variableMap = new HashMap<String, Object>();
    variableMap.put("name", "Activiti");
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("multiSubProcess1", variableMap);
    assertNotNull(processInstance.getId());
    System.out.println("id " + processInstance.getId() + " "
        + processInstance.getProcessDefinitionId());
  }
View Full Code Here

        .addInputStream("EventGateway.bpmn20.xml",
            new FileInputStream(filename)).deploy();
    RuntimeService runtimeService = activitiRule.getRuntimeService();
    Map<String, Object> variableMap = new HashMap<String, Object>();
    variableMap.put("name", "Activiti");
    ProcessInstance processInstance = runtimeService
        .startProcessInstanceByKey("EventGateway", variableMap);
    assertNotNull(processInstance.getId());
    System.out.println("id " + processInstance.getId() + " "
        + processInstance.getProcessDefinitionId());
    Thread.currentThread().wait(2000);
  }
View Full Code Here

    repositoryService.createDeployment().addInputStream("ErrorBoundaryEventAttachToTask.bpmn20.xml",
        new FileInputStream(filename)).deploy();
    RuntimeService runtimeService = activitiRule.getRuntimeService();
    Map<String, Object> variableMap = new HashMap<String, Object>();
    variableMap.put("name", "Activiti");
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("ErrorBoundaryEventAttachToTask", variableMap);
    assertNotNull(processInstance.getId());
    System.out.println("id " + processInstance.getId() + " "
        + processInstance.getProcessDefinitionId());
    Object variable = runtimeService.getVariable(processInstance.getId(), "setOnError");
    assertEquals("1", variable.toString());
  }
View Full Code Here

TOP

Related Classes of org.activiti.engine.runtime.ProcessInstance

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.