protected ExecutionEntity getExecutionFromContext() { if(Context.getCommandContext() != null) { BpmnExecutionContext executionContext = Context.getBpmnExecutionContext(); if(executionContext != null) { return executionContext.getExecution(); } } return null; }
protected boolean isCurrentContextExecution(BaseDelegateExecution execution) { CoreExecutionContext<?> coreExecutionContext = Context.getCoreExecutionContext(); return coreExecutionContext != null && coreExecutionContext.getExecution() == execution; }
protected DeploymentEntity getDeployment() { return Context.getBpmnExecutionContext().getDeployment(); }
/** * Returns the current delegation execution or null if the * execution is not available. * * @return the current delegation execution or null if not available */ public static DelegateExecution getCurrentDelegationExecution() { BpmnExecutionContext bpmnExecutionContext = Context.getBpmnExecutionContext(); ExecutionEntity executionEntity = null; if (bpmnExecutionContext != null) { executionEntity = bpmnExecutionContext.getExecution(); } return executionEntity; } }
protected CommandContext getCommandContext() { return Context.getCommandContext(); }
protected boolean shouldPerformPaContextSwitch(DelegateExecution execution) { if(execution == null) { return false; } else { ProcessApplicationReference targetPa = ProcessApplicationContextUtil.getTargetProcessApplication((ExecutionEntity) execution); return targetPa != null && !targetPa.equals(Context.getCurrentProcessApplication()); } }
protected <T> T performContextSwitch(final Callable<T> callable) { ProcessApplicationReference targetProcessApplication = ProcessApplicationContextUtil.getTargetProcessApplication(deploymentId); if(targetProcessApplication != null) { return Context.executeWithinProcessApplication(new Callable<T>() { public T call() throws Exception { return doCall(callable); } }, targetProcessApplication); } else { return doCall(callable); } }
/** * Use {@link #executeWithinProcessApplication(Callable, ProcessApplicationReference, InvocationContext)} * instead if an {@link InvocationContext} is available. */ public static <T> T executeWithinProcessApplication(Callable<T> callback, ProcessApplicationReference processApplicationReference) { return executeWithinProcessApplication(callback, processApplicationReference, null); }
public static ProcessApplicationReference getTargetProcessApplication(CoreExecution execution) { if (execution instanceof ExecutionEntity) { return getTargetProcessApplication((ExecutionEntity) execution); } else { return getTargetProcessApplication((CaseExecutionEntity) execution); } }
@Override public ProcessApplicationReference execute(CommandContext commandContext) { return Context.getCurrentProcessApplication(); } });
public static BpmnExecutionContext getBpmnExecutionContext() { return (BpmnExecutionContext) getCoreExecutionContext(); }
/** * Returns the current delegation execution or null if the * execution is not available. * * @return the current delegation execution or null if not available */ public static DelegateExecution getCurrentDelegationExecution() { BpmnExecutionContext bpmnExecutionContext = Context.getBpmnExecutionContext(); ExecutionEntity executionEntity = null; if (bpmnExecutionContext != null) { executionEntity = bpmnExecutionContext.getExecution(); } return executionEntity; } }
protected DeploymentEntity getDeployment() { return Context.getBpmnExecutionContext().getDeployment(); }
protected boolean shouldPerformPaContextSwitch(DelegateExecution execution) { if(execution == null) { return false; } else { ProcessApplicationReference targetPa = ProcessApplicationContextUtil.getTargetProcessApplication((ExecutionEntity) execution); return targetPa != null && !targetPa.equals(Context.getCurrentProcessApplication()); } }
protected <T> T performContextSwitch(final Callable<T> callable) { ProcessApplicationReference targetProcessApplication = ProcessApplicationContextUtil.getTargetProcessApplication(deploymentId); if(targetProcessApplication != null) { return Context.executeWithinProcessApplication(new Callable<T>() { public T call() throws Exception { return doCall(callable); } }, targetProcessApplication); } else { return doCall(callable); } }
protected boolean isCurrentContextExecution(BaseDelegateExecution execution) { CoreExecutionContext<?> coreExecutionContext = Context.getCoreExecutionContext(); return coreExecutionContext != null && coreExecutionContext.getExecution() == execution; }
/** * Use {@link #executeWithinProcessApplication(Callable, ProcessApplicationReference, InvocationContext)} * instead if an {@link InvocationContext} is available. */ public static <T> T executeWithinProcessApplication(Callable<T> callback, ProcessApplicationReference processApplicationReference) { return executeWithinProcessApplication(callback, processApplicationReference, null); }
public static ProcessApplicationReference getTargetProcessApplication(CoreExecution execution) { if (execution instanceof ExecutionEntity) { return getTargetProcessApplication((ExecutionEntity) execution); } else { return getTargetProcessApplication((CaseExecutionEntity) execution); } }
protected boolean isSymptomOfContextSwitchFailure(Throwable t, ExecutionEntity contextExecution) { // a context switch failure can occur, if the current engine has no PA registration for the deployment // subclasses may assert the actual throwable to narrow down the diagnose return ProcessApplicationContextUtil.getTargetProcessApplication(contextExecution) == null; }
protected boolean isSymptomOfContextSwitchFailure(Throwable t, ExecutionEntity contextExecution) { // a context switch failure can occur, if the current engine has no PA registration for the deployment // subclasses may assert the actual throwable to narrow down the diagnose return ProcessApplicationContextUtil.getTargetProcessApplication(contextExecution) == null; }