Java Code Examples for org.activiti.engine.delegate.DelegateExecution#getCurrentActivityId()

The following examples show how to use org.activiti.engine.delegate.DelegateExecution#getCurrentActivityId() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RecorderExecutionListener.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
public void notify(DelegateExecution execution) {
  ExecutionEntity executionCasted = ((ExecutionEntity) execution);
  
  org.activiti.bpmn.model.Process process = ProcessDefinitionUtil.getProcess(execution.getProcessDefinitionId());
  String activityId = execution.getCurrentActivityId();
  FlowElement currentFlowElement = process.getFlowElement(activityId, true);
  
  recordedEvents.add(new RecordedEvent(
      executionCasted.getActivityId(),
      (currentFlowElement != null) ? currentFlowElement.getName() : null,
      execution.getEventName(), 
      (String) parameter.getValue(execution)));
}
 
Example 2
Source File: ExecuteJdbc.java    From herd with Apache License 2.0 5 votes vote down vote up
/**
 * Executes the task synchronously. overrideActivitiId is provided to customize the name of the variable to set during the execution of the task. This is
 * important when the task is running asynchronously because execution.getCurrentActivitiId() will report the ID the task that the workflow is currently in,
 * and not the ID of the task that was originally executed.
 *
 * @param execution The execution.
 * @param overrideActivitiId Optionally overrides the task id which to use to generate variable names.
 * @param jdbcExecutionRequest The request.
 *
 * @throws Exception When any exception occurs during the execution of the task.
 */
private void executeSync(DelegateExecution execution, String overrideActivitiId, JdbcExecutionRequest jdbcExecutionRequest) throws Exception
{
    String executionId = execution.getId();
    String activitiId = execution.getCurrentActivityId();
    if (overrideActivitiId != null)
    {
        activitiId = overrideActivitiId;
    }

    // Execute the request. May throw exception here in case of validation or system errors.
    // Thrown exceptions should be caught by parent implementation.
    JdbcExecutionResponse jdbcExecutionResponse = jdbcService.executeJdbc(jdbcExecutionRequest);

    // Set the response
    setJsonResponseAsWorkflowVariable(jdbcExecutionResponse, executionId, activitiId);

    /*
     * Special handling of error condition.
     * Any one of the requested SQL statements could've failed without throwing an exception.
     * If any of the statements are in ERROR, throw an exception.
     * This ensures that the workflow response variable is still available to the users.
     */
    for (JdbcStatement jdbcStatement : jdbcExecutionResponse.getStatements())
    {
        if (JdbcStatementStatus.ERROR.equals(jdbcStatement.getStatus()))
        {
            throw new IllegalArgumentException("There are failed executions. See JSON response for details.");
        }
    }
}
 
Example 3
Source File: HandleErrorInfoForPaymentListener.java    From activiti-in-action-codes with Apache License 2.0 5 votes vote down vote up
@Override
public void notify(DelegateExecution execution) throws Exception {
    String currentActivityId = execution.getCurrentActivityId();
    if ("exclusivegateway-treasurerAudit".equals(currentActivityId)) {
        execution.setVariable("message", "财务审批未通过");
    } else if ("exclusivegateway-generalManagerAudit".equals(currentActivityId)) {
        execution.setVariable("message", "总经理审批未通过");
    }
}
 
Example 4
Source File: HandleErrorInfoForPaymentListener.java    From activiti-in-action-codes with Apache License 2.0 5 votes vote down vote up
@Override
public void notify(DelegateExecution execution) throws Exception {
    String currentActivityId = execution.getCurrentActivityId();
    if ("exclusivegateway-treasurerAudit".equals(currentActivityId)) {
        execution.setVariable("message", "财务审批未通过");
    } else if ("exclusivegateway-generalManagerAudit".equals(currentActivityId)) {
        execution.setVariable("message", "总经理审批未通过");
    }
}
 
Example 5
Source File: HandleErrorInfoForPaymentListener.java    From activiti-in-action-codes with Apache License 2.0 5 votes vote down vote up
@Override
public void notify(DelegateExecution execution) throws Exception {
    String currentActivityId = execution.getCurrentActivityId();
    if ("exclusivegateway-treasurerAudit".equals(currentActivityId)) {
        execution.setVariable("message", "财务审批未通过");
    } else if ("exclusivegateway-generalManagerAudit".equals(currentActivityId)) {
        execution.setVariable("message", "总经理审批未通过");
    }
}
 
Example 6
Source File: HandleErrorInfoForPaymentListener.java    From activiti-in-action-codes with Apache License 2.0 5 votes vote down vote up
@Override
public void notify(DelegateExecution execution) throws Exception {
    String currentActivityId = execution.getCurrentActivityId();
    if ("exclusivegateway-treasurerAudit".equals(currentActivityId)) {
        execution.setVariable("message", "财务审批未通过");
    } else if ("exclusivegateway-generalManagerAudit".equals(currentActivityId)) {
        execution.setVariable("message", "总经理审批未通过");
    }
}
 
Example 7
Source File: HandleErrorInfoForPaymentListener.java    From activiti-in-action-codes with Apache License 2.0 5 votes vote down vote up
@Override
public void notify(DelegateExecution execution) throws Exception {
    String currentActivityId = execution.getCurrentActivityId();
    if ("exclusivegateway-treasurerAudit".equals(currentActivityId)) {
        execution.setVariable("message", "财务审批未通过");
    } else if ("exclusivegateway-generalManagerAudit".equals(currentActivityId)) {
        execution.setVariable("message", "总经理审批未通过");
    }
}
 
Example 8
Source File: HandleErrorInfoForPaymentListener.java    From activiti-in-action-codes with Apache License 2.0 5 votes vote down vote up
@Override
public void notify(DelegateExecution execution) throws Exception {
    String currentActivityId = execution.getCurrentActivityId();
    if ("exclusivegateway-treasurerAudit".equals(currentActivityId)) {
        execution.setVariable("message", "财务审批未通过");
    } else if ("exclusivegateway-generalManagerAudit".equals(currentActivityId)) {
        execution.setVariable("message", "总经理审批未通过");
    }
}
 
Example 9
Source File: HandleErrorInfoForPaymentListener.java    From activiti-in-action-codes with Apache License 2.0 5 votes vote down vote up
@Override
public void notify(DelegateExecution execution) throws Exception {
    String currentActivityId = execution.getCurrentActivityId();
    if ("exclusivegateway-treasurerAudit".equals(currentActivityId)) {
        execution.setVariable("message", "财务审批未通过");
    } else if ("exclusivegateway-generalManagerAudit".equals(currentActivityId)) {
        execution.setVariable("message", "总经理审批未通过");
    }
}
 
Example 10
Source File: CamelBehavior.java    From activiti6-boot2 with Apache License 2.0 4 votes vote down vote up
protected ActivitiEndpoint createEndpoint(DelegateExecution execution) {
  String uri = "activiti://" + getProcessDefinitionKey(execution) + ":" + execution.getCurrentActivityId();
  return getEndpoint(uri);
}
 
Example 11
Source File: CurrentActivityExecutionListener.java    From activiti6-boot2 with Apache License 2.0 4 votes vote down vote up
public void notify(DelegateExecution execution) {
  org.activiti.bpmn.model.Process process = ProcessDefinitionUtil.getProcess(execution.getProcessDefinitionId());
  String activityId = execution.getCurrentActivityId();
  FlowElement currentFlowElement = process.getFlowElement(activityId, true);
  currentActivities.add(new CurrentActivity(execution.getCurrentActivityId(), currentFlowElement.getName()));
}