org.activiti.engine.runtime.Execution类的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(12.1k)|赞(0)|评价(0)|浏览(159)

本文整理了Java中org.activiti.engine.runtime.Execution类的一些代码示例,展示了Execution类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Execution类的具体详情如下:
包路径:org.activiti.engine.runtime.Execution
类名称:Execution

Execution介绍

[英]Represent a 'path of execution' in a process instance. Note that a ProcessInstance also is an execution.
[中]表示流程实例中的“执行路径”。请注意,ProcessInstance也是一个执行。

代码示例

代码示例来源:origin: hs-web/hsweb-framework

if (!executionList.isEmpty()) {
  for (Execution execution : executionList) {
    processInstanceArray.add(subProcessInstanceMap.get(execution.getId()));

代码示例来源:origin: hs-web/hsweb-framework

@Override
public Map<String, Object> getVariablesByProcInstId(String procInstId) {
  List<Execution> executions = runtimeService.createExecutionQuery().processInstanceId(procInstId).list();
  String executionId = "";
  for (Execution execution : executions) {
    if (StringUtils.isNullOrEmpty(execution.getParentId())) {
      executionId = execution.getId();
    }
  }
  return runtimeService.getVariables(executionId);
}

代码示例来源:origin: org.activiti/activiti-rest

public ExecutionResponse createExecutionResponse(Execution execution, RestUrlBuilder urlBuilder) {
 ExecutionResponse result = new ExecutionResponse();
 result.setActivityId(execution.getActivityId());
 result.setId(execution.getId());
 result.setUrl(urlBuilder.buildUrl(RestUrls.URL_EXECUTION, execution.getId()));
 result.setSuspended(execution.isSuspended());
 result.setTenantId(execution.getTenantId());
 result.setParentId(execution.getParentId());
 if (execution.getParentId() != null) {
  result.setParentUrl(urlBuilder.buildUrl(RestUrls.URL_EXECUTION, execution.getParentId()));
 }
 
 result.setSuperExecutionId(execution.getSuperExecutionId());
 if (execution.getSuperExecutionId() != null) {
  result.setSuperExecutionUrl(urlBuilder.buildUrl(RestUrls.URL_EXECUTION, execution.getSuperExecutionId()));
 }
 result.setProcessInstanceId(execution.getProcessInstanceId());
 if (execution.getProcessInstanceId() != null) {
  result.setProcessInstanceUrl(urlBuilder.buildUrl(RestUrls.URL_PROCESS_INSTANCE, execution.getProcessInstanceId()));
 }
 return result;
}

代码示例来源:origin: com.camunda.fox.platform/fox-platform-client

/**
 * Returns the {@link ProcessInstance} currently associated or 'null'
 * 
 * @throws ActivitiCdiException
 *           if no {@link Execution} is associated. Use
 *           {@link #isAssociated()} to check whether an association exists.
 */
public ProcessInstance getProcessInstance() {
 Execution execution = getExecution();    
 if(execution != null && !(execution.getProcessInstanceId().equals(execution.getId()))){
  return processEngine
     .getRuntimeService()
     .createProcessInstanceQuery()
     .processInstanceId(execution.getProcessInstanceId())
     .singleResult();
 }
 return (ProcessInstance) execution;    
}

代码示例来源:origin: FINRAOS/herd

builder.append("    execution.getId():").append(execution.getId()).append('\n');
builder.append("    execution.getActivityId():").append(execution.getActivityId()).append('\n');
builder.append("    execution.getParentId():").append(execution.getParentId()).append('\n');
builder.append("    execution.getProcessInstanceId():").append(execution.getProcessInstanceId()).append('\n');
builder.append("    execution.isEnded():").append(execution.isEnded()).append('\n');
builder.append("    execution.isSuspended():").append(execution.isSuspended()).append('\n');
Map<String, Object> executionVariables = activitiRuntimeService.getVariables(execution.getId());
for (Map.Entry<String, Object> variable : executionVariables.entrySet())

代码示例来源:origin: org.apache.provisionr/activiti-karaf-commands

private void signal(RuntimeService rt, Execution exec) {
  try {
    if (!exec.isEnded()) {
      rt.signal(exec.getId());
    } else {
      out().printf("Execution %s already ended \n" + exec.getId());
    }
  } catch (Exception ex) {
    out().printf("Exception:%s in signaling the execution %s \n", ex.getMessage(), exec.getId());
  }
}

代码示例来源:origin: com.camunda.fox.platform/fox-platform-client

/**
 * Returns the id of the currently associated process instance or 'null'
 */
public String getProcessInstanceId() {
 Execution execution = associationManager.getExecution();
 return execution != null ? execution.getProcessInstanceId() : null; 
}

代码示例来源:origin: Evolveum/midpoint

private void dumpExecutionVariables(String executionId, DelegateExecution delegateExecution, Execution execution, Set<String> variablesSeen, RuntimeService runtimeService) {
  Map<String, Object> variablesLocal = runtimeService.getVariablesLocal(executionId);
  LOGGER.trace("Execution id={} ({} variables); class={}/{}", executionId, variablesLocal.size(),
      delegateExecution != null ? delegateExecution.getClass().getName() : null,
      execution != null ? execution.getClass().getName() : null);
  TreeSet<String> names = new TreeSet<>(variablesLocal.keySet());
  names.forEach(n -> LOGGER.trace(" - {} = {} {}", n, variablesLocal.get(n), variablesSeen.contains(n) ? "(dup)":""));
  variablesSeen.addAll(variablesLocal.keySet());
  if (delegateExecution instanceof ExecutionEntity) {
    ExecutionEntity executionEntity = (ExecutionEntity) delegateExecution;
    if (executionEntity.getParent() != null) {
      dumpExecutionVariables(executionEntity.getParentId(), executionEntity.getParent(), null, variablesSeen,
          runtimeService);
    }
  } else if (delegateExecution instanceof ExecutionImpl) {
    ExecutionImpl executionImpl = (ExecutionImpl) delegateExecution;
    if (executionImpl.getParent() != null) {
      dumpExecutionVariables(executionImpl.getParentId(), executionImpl.getParent(), null, variablesSeen,
          runtimeService);
    }
  } else {
    Execution execution1 = runtimeService.createExecutionQuery().executionId(executionId).singleResult();
    if (execution1 == null) {
      LOGGER.trace("Execution with id {} was not found.", executionId);
    } else if (execution1.getParentId() != null) {
      Execution execution2 = runtimeService.createExecutionQuery().executionId(execution1.getParentId()).singleResult();
      dumpExecutionVariables(execution.getParentId(), null, execution2, variablesSeen, runtimeService);
    }
  }
}

代码示例来源:origin: com.sap.cloud.lm.sl/com.sap.cloud.lm.sl.slp

private HistoricActivityInstance findHistoricActivityInProcessExecution(List<HistoricActivityInstance> historicActivities,
  Execution processExecution) {
  for (ListIterator<HistoricActivityInstance> iterator = historicActivities.listIterator(
    historicActivities.size()); iterator.hasPrevious();) {
    HistoricActivityInstance historicActivityInstance = (HistoricActivityInstance) iterator.previous();
    if (historicActivityInstance.getActivityId().equals(processExecution.getActivityId())) {
      return historicActivityInstance;
    }
  }
  return null;
}

代码示例来源:origin: com.camunda.fox.engine/fox-engine-cdi

/**
 * Returns the {@link ProcessInstance} currently associated or 'null'
 * 
 * @throws ActivitiCdiException
 *           if no {@link Execution} is associated. Use
 *           {@link #isAssociated()} to check whether an association exists.
 */
public ProcessInstance getProcessInstance() {
 Execution execution = getExecution();    
 if(execution != null && !(execution.getProcessInstanceId().equals(execution.getId()))){
  return processEngine
     .getRuntimeService()
     .createProcessInstanceQuery()
     .processInstanceId(execution.getProcessInstanceId())
     .singleResult();
 }
 return (ProcessInstance) execution;    
}

代码示例来源:origin: axemblr/axemblr-provisionr

private void signal(RuntimeService rt, Execution exec) {
  try {
    if (!exec.isEnded()) {
      rt.signal(exec.getId());
    } else {
      out().printf("Execution %s already ended \n" + exec.getId());
    }
  } catch (Exception ex) {
    out().printf("Exception:%s in signaling the execution %s \n", ex.getMessage(), exec.getId());
  }
}

代码示例来源:origin: com.camunda.fox.engine/fox-engine-cdi

/**
 * Returns the id of the currently associated process instance or 'null'
 */
public String getProcessInstanceId() {
 Execution execution = associationManager.getExecution();
 return execution != null ? execution.getProcessInstanceId() : null; 
}

代码示例来源:origin: com.sap.cloud.lm.sl/com.sap.cloud.lm.sl.slp

private String findProcessInReceiveTask(List<String> activeProcessIds) {
  for (String processId : activeProcessIds) {
    Execution processExecution = activitiFacade.getProcessExecution(processId);
    String activitiType = getActivitiType(processId, processExecution.getActivityId());
    if (activitiType.equals("receiveTask")) {
      return processId;
    }
  }
  return null;
}

代码示例来源:origin: org.activiti/activiti-rest

public void deleteAllLocalVariables(Execution execution, HttpServletResponse response) {
 Collection<String> currentVariables = runtimeService.getVariablesLocal(execution.getId()).keySet();
 runtimeService.removeVariablesLocal(execution.getId(), currentVariables);
 response.setStatus(HttpStatus.NO_CONTENT.value());
}

代码示例来源:origin: org.activiti/activiti-rest

protected boolean hasVariableOnScope(Execution execution, String variableName, RestVariableScope scope) {
 boolean variableFound = false;
 if (scope == RestVariableScope.GLOBAL) {
  if (execution.getParentId() != null && runtimeService.hasVariable(execution.getParentId(), variableName)) {
   variableFound = true;
  }
 } else if (scope == RestVariableScope.LOCAL) {
  if (runtimeService.hasVariableLocal(execution.getId(), variableName)) {
   variableFound = true;
  }
 }
 return variableFound;
}

代码示例来源:origin: FINRAOS/herd

@Override
public Job signalJob(JobSignalRequest request) throws Exception
{
  // Perform the validation.
  validateJobSignalRequest(request);
  Execution execution = activitiService.getExecutionByProcessInstanceIdAndActivitiId(request.getId(), request.getReceiveTaskId());
  if (execution == null)
  {
    throw new ObjectNotFoundException(
      String.format("No job found for matching job id: \"%s\" and receive task id: \"%s\".", request.getId(), request.getReceiveTaskId()));
  }
  String processDefinitionKey = activitiService.getProcessInstanceById(execution.getProcessInstanceId()).getProcessDefinitionKey();
  checkPermissions(processDefinitionKey, new NamespacePermissionEnum[] {NamespacePermissionEnum.EXECUTE});
  // Retrieve the job before signaling.
  Job job = getJob(request.getId(), false, false);
  // Build the parameters map
  Map<String, Object> signalParameters = getParameters(request);
  // Signal the workflow.
  activitiService.signal(execution.getId(), signalParameters);
  // Build the parameters map merged with job and signal parameters.
  Map<String, Object> mergedParameters = new HashMap<>();
  for (Parameter jobParam : job.getParameters())
  {
    mergedParameters.put(jobParam.getName(), jobParam.getValue());
  }
  mergedParameters.putAll(signalParameters);
  // Update the parameters in job
  populateWorkflowParameters(job, mergedParameters);
  return job;
}

代码示例来源:origin: org.alfresco/alfresco-repository

public WorkflowPath convert(Execution execution, ProcessInstance instance)
{
  if(execution == null)
    return null;
  
  boolean isActive = !execution.isEnded();
  
  // Convert workflow and collect variables
  Map<String, Object> workflowInstanceVariables = new HashMap<String, Object>();
  WorkflowInstance wfInstance = convertAndSetVariables(instance, workflowInstanceVariables);
  
  WorkflowNode node = null;
  // Get active node on execution
  List<String> nodeIds = runtimeService.getActiveActivityIds(execution.getId());
  if (nodeIds != null && nodeIds.size() >= 1)
  {
    ReadOnlyProcessDefinition procDef = activitiUtil.getDeployedProcessDefinition(instance.getProcessDefinitionId());
    PvmActivity activity = procDef.findActivity(nodeIds.get(0));
    node = convert(activity);
  }
  return factory.createPath(execution.getId(), wfInstance, node, isActive);
}

代码示例来源:origin: org.alfresco/alfresco-repository

public WorkflowPath convert(Execution execution)
{
  String instanceId = execution.getProcessInstanceId();
  ProcessInstance instance = activitiUtil.getProcessInstance(instanceId);
  return convert(execution, instance);
}

代码示例来源:origin: com.camunda.fox.platform/fox-platform-client

/**
 * @see #associateExecutionById(String)
 */
public void setExecution(Execution execution) {
 associateExecutionById(execution.getId());
}

代码示例来源:origin: org.activiti/activiti-rest

protected void setVariable(Execution execution, String name, Object value, RestVariableScope scope, boolean isNew) {
 // Create can only be done on new variables. Existing variables should
 // be updated using PUT
 boolean hasVariable = hasVariableOnScope(execution, name, scope);
 if (isNew && hasVariable) {
  throw new ActivitiException("Variable '" + name + "' is already present on execution '" + execution.getId() + "'.");
 }
 if (!isNew && !hasVariable) {
  throw new ActivitiObjectNotFoundException("Execution '" + execution.getId() + "' doesn't have a variable with name: '" + name + "'.", null);
 }
 if (scope == RestVariableScope.LOCAL) {
  runtimeService.setVariableLocal(execution.getId(), name, value);
 } else {
  if (execution.getParentId() != null) {
   runtimeService.setVariable(execution.getParentId(), name, value);
  } else {
   runtimeService.setVariable(execution.getId(), name, value);
  }
 }
}

相关文章