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

The following examples show how to use org.activiti.engine.delegate.DelegateExecution#getProcessDefinitionId() . 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 Project: activiti6-boot2   File: TestService.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void execute(DelegateExecution execution) {
  TestService.processDefinitionId = execution.getProcessDefinitionId();
  TestService.processInstanceId = execution.getProcessInstanceId();
  TestService.executionId = execution.getId();
  TestService.businessKey = execution.getProcessInstanceBusinessKey();

  throw new RuntimeException("test");

}
 
Example 2
Source Project: activiti6-boot2   File: TestService.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void execute(DelegateExecution execution) {
	TestService.processDefinitionId = execution.getProcessDefinitionId();
	TestService.processInstanceId =  execution.getProcessInstanceId();
	TestService.executionId = execution.getId();
	TestService.businessKey = execution.getProcessInstanceBusinessKey();
	
	throw new RuntimeException("test");
}
 
Example 3
Source Project: herd   File: BaseJavaDelegate.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Retrieves application user per last updater of the current process instance's job definition.
 *
 * @param execution the delegate execution
 *
 * @return the application user
 */
protected ApplicationUser getApplicationUser(DelegateExecution execution)
{
    String processDefinitionId = execution.getProcessDefinitionId();

    // Get process definition by process definition ID from Activiti.
    ProcessDefinition processDefinition = activitiService.getProcessDefinitionById(processDefinitionId);

    // Validate that we retrieved the process definition from Activiti.
    if (processDefinition == null)
    {
        throw new ObjectNotFoundException(String.format("Failed to find Activiti process definition for processDefinitionId=\"%s\".", processDefinitionId));
    }

    // Retrieve the process definition key.
    String processDefinitionKey = processDefinition.getKey();

    // Get the job definition key.
    JobDefinitionAlternateKeyDto jobDefinitionKey = jobDefinitionHelper.getJobDefinitionKey(processDefinitionKey);

    // Get the job definition from the Herd repository and validate that it exists.
    JobDefinitionEntity jobDefinitionEntity = jobDefinitionDaoHelper.getJobDefinitionEntity(jobDefinitionKey.getNamespace(), jobDefinitionKey.getJobName());

    // Set the security context per last updater of the job definition.
    String updatedByUserId = jobDefinitionEntity.getUpdatedBy();
    ApplicationUser applicationUser = new ApplicationUser(getClass());
    applicationUser.setUserId(updatedByUserId);

    return applicationUser;
}