Package org.activiti.engine.runtime

Examples of org.activiti.engine.runtime.ProcessInstance


 
 
  public List<DiagramNode> getActiveActivityBoundsOfLatestProcessInstance() {
    ArrayList<DiagramNode> list = new ArrayList<DiagramNode>();
    ProcessInstance processInstance = getCurrentProcessInstance();
    if (processInstance != null) {
      DiagramLayout processDiagramLayout = repositoryService.getProcessDiagramLayout(processInstance.getProcessDefinitionId());
      List<String> activeActivityIds = runtimeService.getActiveActivityIds(processInstance.getId());
      for (String activeActivityId : activeActivityIds) {
        list.add(processDiagramLayout.getNode(activeActivityId));
      }
    }
    return list;
View Full Code Here


    }
    return list;
  }
 
  public List<Comment> getCommentsOfLastHistoricTask() {
    ProcessInstance processInstance = getCurrentProcessInstance();
    List<HistoricTaskInstance> hlist = historyService.createHistoricTaskInstanceQuery().processInstanceId(processInstance.getId()).orderByHistoricTaskInstanceEndTime().desc().list();
  if (hlist.get(0).getEndTime() != null) {
      return getTaskComments(hlist.get(0).getId());   
  } else {
    return null;
  }
View Full Code Here

   
    // TODO: this should be done by a
    // transformer/processor in the flow
    businessKey = businessKey.split("-")[1].substring(0, 4);
   
    ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceBusinessKey(businessKey, PROCESS_KEY).singleResult();
    runtimeService.signal(processInstance.getId());
  }
View Full Code Here

            } else if (formType != null) {
                processParameters.put(key, value);
            }
        }

        ProcessInstance processInstance = processEngine.getRuntimeService()
                .startProcessInstanceById(processDefinitionId, businessKey,
                        processParameters);
        record = new RecordBuilder().build(record, STATUS_RUNNING,
                processInstance.getId());
        keyValue.save(record);

        return null;
    }
View Full Code Here

    assertNull(startFormData.getFormKey());
   
    Map<String, String> formProperties = new HashMap<String, String>();
    formProperties.put("name", "HenryYan");
   
    ProcessInstance processInstance = formService.submitStartFormData(processDefinition.getId(), formProperties);
    assertNotNull(processInstance);
   
    // 运行时变量
    RuntimeService runtimeService = activitiRule.getRuntimeService();
    Map<String, Object> variables = runtimeService.getVariables(processInstance.getId());
    assertEquals(variables.size(), 1);
    Set<Entry<String, Object>> entrySet = variables.entrySet();
    for (Entry<String, Object> entry : entrySet) {
      System.out.println(entry.getKey() + "=" + entry.getValue());
    }
View Full Code Here

        return runtimeService;
    }

    protected ProcessInstance mockProcessInstance(boolean ended) {
        ProcessInstance processInstance = mock(ProcessInstance.class);
        when(processInstance.isEnded()).thenReturn(ended);
        return processInstance;
    }
View Full Code Here

     * @see CoreSignals
     */
    protected void triggerSignalEvent(ProcessEngine processEngine, String businessKey, String signalName) {
        RuntimeService runtimeService = processEngine.getRuntimeService();

        ProcessInstance processInstance = runtimeService.createProcessInstanceQuery()
            .processInstanceBusinessKey(businessKey).singleResult();

        List<Execution> executions = runtimeService.createExecutionQuery()
            .processInstanceId(processInstance.getProcessInstanceId())
            .signalEventSubscriptionName(signalName).list();

        if (executions.isEmpty()) {
            throw new NoSuchElementException(String.format("No executions found waiting " +
                "for signal '%s' on process %s", signalName, businessKey));
View Full Code Here

        List<String> processIds = (List<String>) execution.getVariable(variableWithProcessIds);

        List<String> ended = Lists.newArrayList(Iterables.filter(processIds, new Predicate<String>() {
            @Override
            public boolean apply(String processInstanceId) {
                ProcessInstance instance = runtimeService.createProcessInstanceQuery()
                    .processInstanceId(processInstanceId).singleResult();

                return instance == null || instance.isEnded();
            }
        }));

        boolean done = (processIds.size() == ended.size());
        execution.setVariable(resultVariable, done);
View Full Code Here

        List<String> processIds = Lists.newArrayList();
        for (Machine machine : machines) {
            final String perMachineProcessBusinessKey = String.format("%s-%s-%s",
                execution.getProcessBusinessKey(), type, machine.getExternalId());

            ProcessInstance perMachineProcess = processEngine.getRuntimeService().startProcessInstanceByKey(
                processKey, perMachineProcessBusinessKey,
                ImmutableMap.<String, Object>of(CoreProcessVariables.POOL, pool,
                    CoreProcessVariables.POOL_BUSINESS_KEY, poolBusinessKey,
                    CoreProcessVariables.IS_CACHED_IMAGE, pool.getSoftware().isCachedImage(),
                    MACHINE, machine));

            LOG.info("Started background '" + type + "' process {} ({}) for machine {}",
                new Object[]{perMachineProcessBusinessKey, perMachineProcess.getId(), machine.getExternalId()});
            processIds.add(perMachineProcess.getId());
        }

        LOG.info("Saving process IDs {} as {}", processIds, resultVariable);
        execution.setVariable(resultVariable, processIds);
    }
View Full Code Here

    @Override
    protected Object doExecute() throws Exception {
        checkNotNull(businessKey, "pool business key is mandatory");

        ProcessInstance instance = processEngine.getRuntimeService().createProcessInstanceQuery()
            .processInstanceBusinessKey(businessKey).singleResult();
        checkNotNull(instance, "no pool found with key " + businessKey);

        String providerId = (String) processEngine.getRuntimeService()
            .getVariable(instance.getId(), CoreProcessVariables.PROVIDER);
        checkNotNull(providerId, "the process instance has no provider ID");

        Optional<Provisionr> service = Iterables.tryFind(services, ProvisionrPredicates.withId(providerId));

        if (service.isPresent()) {
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.