org.activiti.engine.runtime.Execution.getParentId()方法的使用及代码示例

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

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

Execution.getParentId介绍

[英]Gets the id of the parent of this execution. If null, the execution represents a process-instance.
[中]获取此执行的父级的id。如果为null,则执行表示一个流程实例。

代码示例

代码示例来源: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

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: org.activiti/activiti-rest

@ApiOperation(value = "Delete a variable", tags = {"Process Instances"}, nickname = "deleteProcessInstanceVariable")
@ApiResponses(value = {
  @ApiResponse(code = 204, message = "Indicates the variable was found and has been deleted. Response-body is intentionally empty."),
  @ApiResponse(code = 404, message = "Indicates the requested variable was not found.")
})
@RequestMapping(value = "/runtime/process-instances/{processInstanceId}/variables/{variableName}", method = RequestMethod.DELETE)
public void deleteVariable(@ApiParam(name = "processInstanceId") @PathVariable("processInstanceId") String processInstanceId,@ApiParam(name = "variableName") @PathVariable("variableName") String variableName,
  @RequestParam(value = "scope", required = false) String scope, HttpServletResponse response) {
 Execution execution = getProcessInstanceFromRequest(processInstanceId);
 // Determine scope
 RestVariableScope variableScope = RestVariableScope.LOCAL;
 if (scope != null) {
  variableScope = RestVariable.getScopeFromString(scope);
 }
 if (!hasVariableOnScope(execution, variableName, variableScope)) {
  throw new ActivitiObjectNotFoundException("Execution '" + execution.getId() + "' doesn't have a variable '" + variableName + "' in scope " + variableScope.name().toLowerCase(),
    VariableInstanceEntity.class);
 }
 if (variableScope == RestVariableScope.LOCAL) {
  runtimeService.removeVariableLocal(execution.getId(), variableName);
 } else {
  // Safe to use parentId, as the hasVariableOnScope would have
  // stopped a global-var update on a root-execution
  runtimeService.removeVariable(execution.getParentId(), variableName);
 }
 response.setStatus(HttpStatus.NO_CONTENT.value());
}

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

runtimeService.removeVariable(execution.getParentId(), variableName);

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

private String getExecutionId(String processId, String activityId, long timeoutInMillis) {
  long deadline = System.currentTimeMillis() + timeoutInMillis;
  while (true) {
    Execution execution = engine.getRuntimeService().createExecutionQuery().processInstanceId(processId).activityId(
      activityId).singleResult();
    if (execution != null && execution.getParentId() != null) {
      return execution.getId();
    }
    if (isPastDeadline(deadline)) {
      IllegalStateException timeoutException = new IllegalStateException(
        format(Messages.PROCESS_STEP_NOT_REACHED_BEFORE_TIMEOUT, activityId, processId));
      LOGGER.error(timeoutException.toString(), timeoutException);
      throw timeoutException;
    }
    try {
      Thread.sleep(GET_EXECUTION_RETRY_INTERVAL_MS);
    } catch (InterruptedException e) {
      throw new IllegalStateException(e);
    }
  }
}

代码示例来源: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: org.hswebframework.web/hsweb-system-workflow-local

@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

variableFound = true;
} else {
 if (execution.getParentId() != null) {
  value = runtimeService.getVariable(execution.getParentId(), variableName);
  variableScope = RestVariableScope.GLOBAL;
  variableFound = true;
if (execution.getParentId() != null) {
 value = runtimeService.getVariable(execution.getParentId(), variableName);
 variableScope = RestVariableScope.GLOBAL;
 variableFound = true;

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

runtimeService.setVariablesLocal(execution.getId(), variablesToSet);
} else {
 if (execution.getParentId() != null) {
  runtimeService.setVariables(execution.getParentId(), variablesToSet);
 } else {

代码示例来源: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);
  }
 }
}

代码示例来源: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');

代码示例来源: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;
}

相关文章