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 boolean shouldPerformPaContextSwitch(DelegateExecution execution) { if(execution == null) { return false; } else { ProcessApplicationReference targetPa = ProcessApplicationContextUtil.getTargetProcessApplication((ExecutionEntity) execution); return targetPa != null && !targetPa.equals(Context.getCurrentProcessApplication()); } }
@Override public ProcessApplicationReference execute(CommandContext commandContext) { return Context.getCurrentProcessApplication(); } });
protected static VariableSerializers getCurrentPaSerializers() { if (Context.getCurrentProcessApplication() != null) { ProcessApplicationReference processApplicationReference = Context.getCurrentProcessApplication(); try { ProcessApplicationInterface processApplicationInterface = processApplicationReference.getProcessApplication(); ProcessApplicationInterface rawPa = processApplicationInterface.getRawObject(); if (rawPa instanceof AbstractProcessApplication) { return ((AbstractProcessApplication) rawPa).getVariableSerializers(); } else { return null; } } catch (ProcessApplicationUnavailableException e) { throw LOG.cannotDeterminePaDataformats(e); } } else { return null; } }
protected Map<String, List<ExecutableScript>> getEnv(String language) { ProcessEngineConfigurationImpl config = Context.getProcessEngineConfiguration(); ProcessApplicationReference processApplication = Context.getCurrentProcessApplication(); Map<String, List<ExecutableScript>> result = null; if (config.isEnableFetchScriptEngineFromProcessApplication()) { if(processApplication != null) { result = getPaEnvScripts(processApplication); } } return result != null ? result : env; }
protected Map<String, List<ExecutableScript>> getEnv(String language) { ProcessEngineConfigurationImpl config = Context.getProcessEngineConfiguration(); ProcessApplicationReference processApplication = Context.getCurrentProcessApplication(); Map<String, List<ExecutableScript>> result = null; if (config.isEnableFetchScriptEngineFromProcessApplication()) { if(processApplication != null) { result = getPaEnvScripts(processApplication); } } return result != null ? result : env; }
protected ELResolver getElResolverDelegate() { ProcessApplicationReference processApplicationReference = Context.getCurrentProcessApplication(); if(processApplicationReference != null) { try { ProcessApplicationInterface processApplication = processApplicationReference.getProcessApplication(); return processApplication.getElResolver(); } catch (ProcessApplicationUnavailableException e) { throw new ProcessEngineException("Cannot access process application '"+processApplicationReference.getName()+"'", e); } } else { return null; } } }
protected ELResolver getElResolverDelegate() { ProcessApplicationReference processApplicationReference = Context.getCurrentProcessApplication(); if(processApplicationReference != null) { try { ProcessApplicationInterface processApplication = processApplicationReference.getProcessApplication(); return processApplication.getElResolver(); } catch (ProcessApplicationUnavailableException e) { throw new ProcessEngineException("Cannot access process application '"+processApplicationReference.getName()+"'", e); } } else { return null; } } }
protected ELResolver getElResolverDelegate() { ProcessApplicationReference processApplicationReference = Context.getCurrentProcessApplication(); if(processApplicationReference != null) { try { ProcessApplicationInterface processApplication = processApplicationReference.getProcessApplication(); return processApplication.getBeanElResolver(); } catch (ProcessApplicationUnavailableException e) { throw new ProcessEngineException("Cannot access process application '"+processApplicationReference.getName()+"'", e); } } else { return new BeanELResolver(); } } }
protected ELResolver getElResolverDelegate() { ProcessApplicationReference processApplicationReference = Context.getCurrentProcessApplication(); if(processApplicationReference != null) { try { ProcessApplicationInterface processApplication = processApplicationReference.getProcessApplication(); return processApplication.getBeanElResolver(); } catch (ProcessApplicationUnavailableException e) { throw new ProcessEngineException("Cannot access process application '"+processApplicationReference.getName()+"'", e); } } else { return new BeanELResolver(); } } }
public void testExecutionInPAContextbyRawPA() throws Exception { Assert.assertNull(Context.getCurrentProcessApplication()); ProcessApplicationReference contextPA = ProcessApplicationContext.withProcessApplicationContext( new Callable<ProcessApplicationReference>() { @Override public ProcessApplicationReference call() throws Exception { return getCurrentContextApplication(); } }, pa); Assert.assertEquals(contextPA.getProcessApplication(), pa); Assert.assertNull(Context.getCurrentProcessApplication()); }
public void testExecutionInPAContextByName() throws Exception { Assert.assertNull(Context.getCurrentProcessApplication()); ProcessApplicationReference contextPA = ProcessApplicationContext.withProcessApplicationContext( new Callable<ProcessApplicationReference>() { @Override public ProcessApplicationReference call() throws Exception { return getCurrentContextApplication(); } }, pa.getName()); Assert.assertEquals(contextPA.getProcessApplication(), pa); Assert.assertNull(Context.getCurrentProcessApplication()); }
public void testExecutionInPAContextByReference() throws Exception { Assert.assertNull(Context.getCurrentProcessApplication()); ProcessApplicationReference contextPA = ProcessApplicationContext.withProcessApplicationContext( new Callable<ProcessApplicationReference>() { @Override public ProcessApplicationReference call() throws Exception { return getCurrentContextApplication(); } }, pa.getReference()); Assert.assertEquals(contextPA.getProcessApplication(), pa); Assert.assertNull(Context.getCurrentProcessApplication()); }
protected void notifyExecutionListener(DelegateExecution execution) throws Exception { ProcessApplicationReference processApp = Context.getCurrentProcessApplication(); try { ProcessApplicationInterface processApplication = processApp.getProcessApplication(); ExecutionListener executionListener = processApplication.getExecutionListener(); if(executionListener != null) { executionListener.notify(execution); } else { LOG.paDoesNotProvideExecutionListener(processApp.getName()); } } catch (ProcessApplicationUnavailableException e) { // Process Application unavailable => ignore silently LOG.cannotInvokeListenerPaUnavailable(processApp.getName(), e); } }
protected void notifyExecutionListener(DelegateExecution execution) throws Exception { ProcessApplicationReference processApp = Context.getCurrentProcessApplication(); try { ProcessApplicationInterface processApplication = processApp.getProcessApplication(); ExecutionListener executionListener = processApplication.getExecutionListener(); if(executionListener != null) { executionListener.notify(execution); } else { LOG.paDoesNotProvideExecutionListener(processApp.getName()); } } catch (ProcessApplicationUnavailableException e) { // Process Application unavailable => ignore silently LOG.cannotInvokeListenerPaUnavailable(processApp.getName(), e); } }
protected void notifyTaskListener(DelegateTask task) throws Exception { ProcessApplicationReference processApp = Context.getCurrentProcessApplication(); try { ProcessApplicationInterface processApplication = processApp.getProcessApplication(); TaskListener taskListener = processApplication.getTaskListener(); if(taskListener != null) { taskListener.notify(task); } else { LOG.paDoesNotProvideTaskListener(processApp.getName()); } } catch (ProcessApplicationUnavailableException e) { // Process Application unavailable => ignore silently LOG.cannotInvokeListenerPaUnavailable(processApp.getName(), e); } }
protected void notifyTaskListener(DelegateTask task) throws Exception { ProcessApplicationReference processApp = Context.getCurrentProcessApplication(); try { ProcessApplicationInterface processApplication = processApp.getProcessApplication(); TaskListener taskListener = processApplication.getTaskListener(); if(taskListener != null) { taskListener.notify(task); } else { LOG.paDoesNotProvideTaskListener(processApp.getName()); } } catch (ProcessApplicationUnavailableException e) { // Process Application unavailable => ignore silently LOG.cannotInvokeListenerPaUnavailable(processApp.getName(), e); } }
public void testSetPAContextByRawPA() throws ProcessApplicationUnavailableException { Assert.assertNull(Context.getCurrentProcessApplication()); try { ProcessApplicationContext.setCurrentProcessApplication(pa); Assert.assertEquals(pa, getCurrentContextApplication().getProcessApplication()); } finally { ProcessApplicationContext.clear(); } Assert.assertNull(Context.getCurrentProcessApplication()); }
public void testSetPAContextByName() throws ProcessApplicationUnavailableException { Assert.assertNull(Context.getCurrentProcessApplication()); try { ProcessApplicationContext.setCurrentProcessApplication(pa.getName()); Assert.assertEquals(getCurrentContextApplication().getProcessApplication(), pa); } finally { ProcessApplicationContext.clear(); } Assert.assertNull(Context.getCurrentProcessApplication()); }
public void testSetPAContextByReference() throws ProcessApplicationUnavailableException { Assert.assertNull(Context.getCurrentProcessApplication()); try { ProcessApplicationContext.setCurrentProcessApplication(pa.getReference()); Assert.assertEquals(getCurrentContextApplication().getProcessApplication(), pa); } finally { ProcessApplicationContext.clear(); } Assert.assertNull(Context.getCurrentProcessApplication()); }