public List<VariableInstanceEntity> getQueryVariables() { if (queryVariables == null && Context.getCommandContext() != null) { queryVariables = new VariableInitializingList(); } return queryVariables; }
private static ClassLoader getCustomClassLoader() { ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration(); if (processEngineConfiguration != null) { final ClassLoader classLoader = processEngineConfiguration.getClassLoader(); if (classLoader != null) { return classLoader; } } return null; }
public <T> T execute(CommandConfig config, Command<T> command) { CommandContext context = Context.getCommandContext(); Context.setCommandContext(context); Context.setProcessEngineConfiguration(processEngineConfiguration); return next.execute(config, command); Context.removeCommandContext(); Context.removeProcessEngineConfiguration(); Context.removeBpmnOverrideContext();
protected static ObjectNode getProcessDefinitionInfoNode(String processDefinitionId) { Map<String, ObjectNode> bpmnOverrideMap = getBpmnOverrideContext(); if (!bpmnOverrideMap.containsKey(processDefinitionId)) { ProcessDefinitionInfoCacheObject cacheObject = getProcessEngineConfiguration().getDeploymentManager() .getProcessDefinitionInfoCache() .get(processDefinitionId); addBpmnOverrideElement(processDefinitionId, cacheObject.getInfoNode()); } return getBpmnOverrideContext().get(processDefinitionId); }
CommandContext context = Context.getCommandContext(); boolean isContextSuspended = false; if (context != null && context.getException() == null) Context.setCommandContext(null); isContextSuspended = true; Context.removeCommandContext();
public <T> T execute(CommandConfig config, Command<T> command) { CommandContext context = Context.getCommandContext(); Context.setCommandContext(context); Context.setProcessEngineConfiguration(processEngineConfiguration); if (processEngineConfiguration.getActiviti5CompatibilityHandler() != null) { Context.setActiviti5CompatibilityHandler(processEngineConfiguration.getActiviti5CompatibilityHandler()); Context.removeCommandContext(); Context.removeProcessEngineConfiguration(); Context.removeBpmnOverrideContext(); Context.removeActiviti5CompatibilityHandler();
protected ExecutionEntity getExecutionFromContext() { if(Context.getCommandContext() != null) { ExecutionContext executionContext = Context.getExecutionContext(); if(executionContext != null) { return executionContext.getExecution(); } } return null; }
@Override public void onEvent(FlowableEvent event) { if (isValidEvent(event) && event instanceof FlowableEngineEvent) { FlowableEngineEvent engineEvent = (FlowableEngineEvent) event; ExecutionEntity execution = null; if (Context.isExecutionContextActive()) { execution = Context.getExecutionContext().getExecution(); } else if (engineEvent.getExecutionId() != null) { // Get the execution based on the event's execution ID instead execution = Context.getCommandContext().getExecutionEntityManager().findExecutionById(engineEvent.getExecutionId()); } if (execution == null) { throw new ActivitiException("No execution context active and event is not related to an execution. No compensation event can be thrown."); } try { ErrorPropagation.propagateError(errorCode, execution); } catch (Exception e) { throw new ActivitiException("Error while propagating error-event", e); } } }
public static void setTransactionContext(TransactionContext transactionContext) { getStack(transactionContextThreadLocal).push(transactionContext); }
protected ExecutionContext getExecutionContext() { try { return Context.getExecutionContext(); } catch (EmptyStackException e) { // hack for bug in activiti return null; } }
public void exception(Throwable exception) { if (this.exception == null) { this.exception = exception; } else { if (Context.isExecutionContextActive()) { LogMDC.putMDCExecution(Context.getExecutionContext().getExecution()); } LOGGER.error("masked exception in command context. for root cause, see below as it will be rethrown later.", exception); LogMDC.clear(); } }
CommandContext context = Context.getCommandContext(); boolean isContextSuspended = false; if (context != null && context.getException() == null) Context.setCommandContext(null); isContextSuspended = true; Context.removeCommandContext();
protected ExecutionEntity getExecutionFromContext() { if(Context.getCommandContext() != null) { ExecutionContext executionContext = Context.getExecutionContext(); if(executionContext != null) { return executionContext.getExecution(); } } return null; }
public static void setCommandContext(CommandContext commandContext) { getStack(commandContextThreadLocal).push(commandContext); }
public Object invoke(MethodInvocation methodInvocation) throws Throwable { String methodName = methodInvocation.getMethod().getName() ; logger.info("method invocation for " + methodName+ "."); if(methodName.equals("toString")) return "SharedProcessInstance"; ProcessInstance processInstance = Context.getExecutionContext().getProcessInstance(); Method method = methodInvocation.getMethod(); Object[] args = methodInvocation.getArguments(); Object result = method.invoke(processInstance, args); return result; } });
protected static void populateEventWithCurrentContext(ActivitiEventImpl event) { boolean extractedFromContext = false; if (Context.isExecutionContextActive()) { ExecutionContext executionContext = Context.getExecutionContext(); if (executionContext != null) { extractedFromContext = true;
@SuppressWarnings("unchecked") public U singleResult() { this.resultType = ResultType.SINGLE_RESULT; if (commandExecutor != null) { return (U) commandExecutor.execute(this); } return executeSingleResult(Context.getCommandContext()); }
public <T> T execute(Command<T> command) { CommandContext context = Context.getCommandContext(); Context.setCommandContext(context); Context.setProcessEngineConfiguration(processEngineConfiguration); Context.removeCommandContext(); Context.removeProcessEngineConfiguration();
private static Class loadClass(ClassLoader classLoader, String className) throws ClassNotFoundException { ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration(); boolean useClassForName = processEngineConfiguration == null || processEngineConfiguration.isUseClassForNameClassLoading(); return useClassForName ? Class.forName(className, true, classLoader) : classLoader.loadClass(className); }
public static void setProcessEngineConfiguration(ProcessEngineConfigurationImpl processEngineConfiguration) { getStack(processEngineConfigurationStackThreadLocal).push(processEngineConfiguration); }