Java Code Examples for org.flowable.engine.delegate.DelegateExecution#getId()
The following examples show how to use
org.flowable.engine.delegate.DelegateExecution#getId() .
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: TestService.java From flowable-engine with Apache License 2.0 | 5 votes |
@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 File: ListenerNotificationHelper.java From flowable-engine with Apache License 2.0 | 5 votes |
protected void planTransactionDependentExecutionListener(ListenerFactory listenerFactory, DelegateExecution execution, TransactionDependentExecutionListener executionListener, FlowableListener listener) { Map<String, Object> executionVariablesToUse = execution.getVariables(); CustomPropertiesResolver customPropertiesResolver = createCustomPropertiesResolver(listener); Map<String, Object> customPropertiesMapToUse = invokeCustomPropertiesResolver(execution, customPropertiesResolver); TransactionDependentExecutionListenerExecutionScope scope = new TransactionDependentExecutionListenerExecutionScope( execution.getProcessInstanceId(), execution.getId(), execution.getCurrentFlowElement(), executionVariablesToUse, customPropertiesMapToUse); addTransactionListener(listener, new ExecuteExecutionListenerTransactionListener(executionListener, scope, CommandContextUtil.getProcessEngineConfiguration().getCommandExecutor())); }
Example 3
Source File: ListenerNotificationHelper.java From flowable-engine with Apache License 2.0 | 5 votes |
protected void planTransactionDependentTaskListener(DelegateExecution execution, TransactionDependentTaskListener taskListener, FlowableListener listener) { Map<String, Object> executionVariablesToUse = execution.getVariables(); CustomPropertiesResolver customPropertiesResolver = createCustomPropertiesResolver(listener); Map<String, Object> customPropertiesMapToUse = invokeCustomPropertiesResolver(execution, customPropertiesResolver); TransactionDependentTaskListenerExecutionScope scope = new TransactionDependentTaskListenerExecutionScope( execution.getProcessInstanceId(), execution.getId(), (Task) execution.getCurrentFlowElement(), executionVariablesToUse, customPropertiesMapToUse); addTransactionListener(listener, new ExecuteTaskListenerTransactionListener(taskListener, scope, CommandContextUtil.getProcessEngineConfiguration().getCommandExecutor())); }
Example 4
Source File: TestService.java From flowable-engine with Apache License 2.0 | 5 votes |
@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 5
Source File: HttpActivityBehaviorImpl.java From flowable-engine with Apache License 2.0 | 4 votes |
@Override public void execute(DelegateExecution execution) { String skipExpressionText = httpServiceTask.getSkipExpression(); CommandContext commandContext = CommandContextUtil.getCommandContext(); boolean isSkipExpressionEnabled = SkipExpressionUtil.isSkipExpressionEnabled(skipExpressionText, execution.getCurrentActivityId(), execution, commandContext); if (!isSkipExpressionEnabled || !SkipExpressionUtil.shouldSkipFlowElement(skipExpressionText, execution.getCurrentActivityId(), execution, commandContext)) { HttpRequest request = new HttpRequest(); try { request.setMethod(getStringFromField(requestMethod, execution)); request.setUrl(getStringFromField(requestUrl, execution)); request.setHeaders(getStringFromField(requestHeaders, execution)); request.setBody(getStringFromField(requestBody, execution)); request.setBodyEncoding(getStringFromField(requestBodyEncoding, execution)); request.setTimeout(getIntFromField(requestTimeout, execution)); request.setNoRedirects(getBooleanFromField(disallowRedirects, execution)); request.setIgnoreErrors(getBooleanFromField(ignoreException, execution)); request.setSaveRequest(getBooleanFromField(saveRequestVariables, execution)); request.setSaveResponse(getBooleanFromField(saveResponseParameters, execution)); request.setSaveResponseTransient(getBooleanFromField(saveResponseParametersTransient, execution)); request.setSaveResponseAsJson(getBooleanFromField(saveResponseVariableAsJson, execution)); request.setPrefix(getStringFromField(resultVariablePrefix, execution)); String failCodes = getStringFromField(failStatusCodes, execution); String handleCodes = getStringFromField(handleStatusCodes, execution); if (failCodes != null) { request.setFailCodes(getStringSetFromField(failCodes)); } if (handleCodes != null) { request.setHandleCodes(getStringSetFromField(handleCodes)); } if (request.getPrefix() == null) { request.setPrefix(execution.getCurrentFlowElement().getId()); } // Save request fields if (request.isSaveRequest()) { execution.setVariable(request.getPrefix() + "RequestMethod", request.getMethod()); execution.setVariable(request.getPrefix() + "RequestUrl", request.getUrl()); execution.setVariable(request.getPrefix() + "RequestHeaders", request.getHeaders()); execution.setVariable(request.getPrefix() + "RequestBody", request.getBody()); execution.setVariable(request.getPrefix() + "RequestBodyEncoding", request.getBodyEncoding()); execution.setVariable(request.getPrefix() + "RequestTimeout", request.getTimeout()); execution.setVariable(request.getPrefix() + "DisallowRedirects", request.isNoRedirects()); execution.setVariable(request.getPrefix() + "FailStatusCodes", failCodes); execution.setVariable(request.getPrefix() + "HandleStatusCodes", handleCodes); execution.setVariable(request.getPrefix() + "IgnoreException", request.isIgnoreErrors()); execution.setVariable(request.getPrefix() + "SaveRequestVariables", request.isSaveRequest()); execution.setVariable(request.getPrefix() + "SaveResponseParameters", request.isSaveResponse()); } } catch (Exception e) { if (e instanceof FlowableException) { throw (FlowableException) e; } else { throw new FlowableException(HTTP_TASK_REQUEST_FIELD_INVALID + " in execution " + execution.getId(), e); } } httpActivityExecutor.validate(request); ProcessEngineConfigurationImpl processEngineConfiguration = CommandContextUtil.getProcessEngineConfiguration(); HttpClientConfig httpClientConfig = CommandContextUtil.getProcessEngineConfiguration().getHttpClientConfig(); httpActivityExecutor.execute( request, execution, execution.getId(), createHttpRequestHandler(httpServiceTask.getHttpRequestHandler(), processEngineConfiguration), createHttpResponseHandler(httpServiceTask.getHttpResponseHandler(), processEngineConfiguration), getStringFromField(responseVariableName, execution), mapExceptions, httpClientConfig.getSocketTimeout(), httpClientConfig.getConnectTimeout(), httpClientConfig.getConnectionRequestTimeout()); } leave(execution); }
Example 6
Source File: BoundaryCompensateEventActivityBehavior.java From flowable-engine with Apache License 2.0 | 4 votes |
@Override public void execute(DelegateExecution execution) { ExecutionEntity executionEntity = (ExecutionEntity) execution; BoundaryEvent boundaryEvent = (BoundaryEvent) execution.getCurrentFlowElement(); Process process = ProcessDefinitionUtil.getProcess(execution.getProcessDefinitionId()); if (process == null) { throw new FlowableException("Process model (id = " + execution.getId() + ") could not be found"); } Activity sourceActivity = null; Activity compensationActivity = null; List<Association> associations = process.findAssociationsWithSourceRefRecursive(boundaryEvent.getId()); for (Association association : associations) { sourceActivity = boundaryEvent.getAttachedToRef(); FlowElement targetElement = process.getFlowElement(association.getTargetRef(), true); if (targetElement instanceof Activity) { Activity activity = (Activity) targetElement; if (activity.isForCompensation()) { compensationActivity = activity; break; } } } if (sourceActivity == null) { throw new FlowableException("Parent activity for boundary compensation event could not be found"); } if (compensationActivity == null) { throw new FlowableException("Compensation activity could not be found (or it is missing 'isForCompensation=\"true\"'"); } // find SubProcess or Process instance execution ExecutionEntity scopeExecution = null; ExecutionEntity parentExecution = executionEntity.getParent(); while (scopeExecution == null && parentExecution != null) { if (parentExecution.getCurrentFlowElement() instanceof SubProcess) { scopeExecution = parentExecution; } else if (parentExecution.isProcessInstanceType()) { scopeExecution = parentExecution; } else { parentExecution = parentExecution.getParent(); } } if (scopeExecution == null) { throw new FlowableException("Could not find a scope execution for compensation boundary event " + boundaryEvent.getId()); } EventSubscriptionEntity eventSubscription = (EventSubscriptionEntity) CommandContextUtil.getEventSubscriptionService().createEventSubscriptionBuilder() .eventType(CompensateEventSubscriptionEntity.EVENT_TYPE) .executionId(scopeExecution.getId()) .processInstanceId(scopeExecution.getProcessInstanceId()) .activityId(sourceActivity.getId()) .tenantId(scopeExecution.getTenantId()) .create(); CountingEntityUtil.handleInsertEventSubscriptionEntityCount(eventSubscription); }
Example 7
Source File: CdiExecutionListener.java From flowable-engine with Apache License 2.0 | 4 votes |
protected BusinessProcessEvent createEvent(DelegateExecution execution) { ProcessDefinition processDefinition = ProcessDefinitionUtil.getProcessDefinition(execution.getProcessDefinitionId()); ProcessEngineConfiguration engineConfiguration = org.flowable.engine.impl.context.Context.getProcessEngineConfiguration(); Date now = engineConfiguration.getClock().getCurrentTime(); return new CdiBusinessProcessEvent(activityId, transitionName, processDefinition, execution, type, execution.getProcessInstanceId(), execution.getId(), now); }