public static void applyFieldDeclaration(List<FieldDeclaration> fieldDeclarations, Object target) { if(fieldDeclarations != null) { for(FieldDeclaration declaration : fieldDeclarations) { applyFieldDeclaration(declaration, target); } } }
public static void applyFieldDeclaration(List<FieldDeclaration> fieldDeclarations, Object target) { if(fieldDeclarations != null) { for(FieldDeclaration declaration : fieldDeclarations) { applyFieldDeclaration(declaration, target); } } }
public static Object instantiateDelegate(String className, List<FieldDeclaration> fieldDeclarations) { ArtifactFactory artifactFactory = Context.getProcessEngineConfiguration().getArtifactFactory(); try { Class<?> clazz = ReflectUtil.loadClass(className); Object object = artifactFactory.getArtifact(clazz); applyFieldDeclaration(fieldDeclarations, object); return object; } catch (Exception e) { throw LOG.exceptionWhileInstantiatingClass(className, e); } }
public static Object instantiateDelegate(String className, List<FieldDeclaration> fieldDeclarations) { ArtifactFactory artifactFactory = Context.getProcessEngineConfiguration().getArtifactFactory(); try { Class<?> clazz = ReflectUtil.loadClass(className); Object object = artifactFactory.getArtifact(clazz); applyFieldDeclaration(fieldDeclarations, object); return object; } catch (Exception e) { throw LOG.exceptionWhileInstantiatingClass(className, e); } }
public void doSignal(final ActivityExecution execution, final String signalName, final Object signalData) throws Exception { Object delegate = expression.getValue(execution); applyFieldDeclaration(fieldDeclarations, delegate); final ActivityBehavior activityBehaviorInstance = getActivityBehaviorInstance(execution, delegate); if (activityBehaviorInstance instanceof CustomActivityBehavior) { CustomActivityBehavior behavior = (CustomActivityBehavior) activityBehaviorInstance; ActivityBehavior delegateActivityBehavior = behavior.getDelegateActivityBehavior(); if (!(delegateActivityBehavior instanceof SignallableActivityBehavior)) { // legacy behavior: do nothing when it is not a signallable activity behavior return; } } executeWithErrorPropagation(execution, new Callable<Void>() { @Override public Void call() throws Exception { ((SignallableActivityBehavior) activityBehaviorInstance).signal(execution, signalName, signalData); return null; } }); }
public void doSignal(final ActivityExecution execution, final String signalName, final Object signalData) throws Exception { Object delegate = expression.getValue(execution); applyFieldDeclaration(fieldDeclarations, delegate); final ActivityBehavior activityBehaviorInstance = getActivityBehaviorInstance(execution, delegate); if (activityBehaviorInstance instanceof CustomActivityBehavior) { CustomActivityBehavior behavior = (CustomActivityBehavior) activityBehaviorInstance; ActivityBehavior delegateActivityBehavior = behavior.getDelegateActivityBehavior(); if (!(delegateActivityBehavior instanceof SignallableActivityBehavior)) { // legacy behavior: do nothing when it is not a signallable activity behavior return; } } executeWithErrorPropagation(execution, new Callable<Void>() { @Override public Void call() throws Exception { ((SignallableActivityBehavior) activityBehaviorInstance).signal(execution, signalName, signalData); return null; } }); }
public void notify(DelegateCaseExecution caseExecution) throws Exception { // Note: we can't cache the result of the expression, because the // caseExecution can change: eg. delegateExpression='${mySpringBeanFactory.randomSpringBean()}' Object delegate = expression.getValue(caseExecution); applyFieldDeclaration(fieldDeclarations, delegate); if (delegate instanceof CaseExecutionListener) { CaseExecutionListener listenerInstance = (CaseExecutionListener) delegate; Context .getProcessEngineConfiguration() .getDelegateInterceptor() .handleInvocation(new CaseExecutionListenerInvocation(listenerInstance, caseExecution)); } else { throw new ProcessEngineException("Delegate expression " + expression + " did not resolve to an implementation of " + CaseExecutionListener.class); } }
public void notify(DelegateCaseExecution caseExecution) throws Exception { // Note: we can't cache the result of the expression, because the // caseExecution can change: eg. delegateExpression='${mySpringBeanFactory.randomSpringBean()}' Object delegate = expression.getValue(caseExecution); applyFieldDeclaration(fieldDeclarations, delegate); if (delegate instanceof CaseExecutionListener) { CaseExecutionListener listenerInstance = (CaseExecutionListener) delegate; Context .getProcessEngineConfiguration() .getDelegateInterceptor() .handleInvocation(new CaseExecutionListenerInvocation(listenerInstance, caseExecution)); } else { throw new ProcessEngineException("Delegate expression " + expression + " did not resolve to an implementation of " + CaseExecutionListener.class); } }
public void notify(DelegateCaseVariableInstance variableInstance) throws Exception { Object delegate = expression.getValue(variableInstance.getSourceExecution()); applyFieldDeclaration(fieldDeclarations, delegate); if (delegate instanceof CaseVariableListener) { CaseVariableListener listenerInstance = (CaseVariableListener) delegate; Context .getProcessEngineConfiguration() .getDelegateInterceptor() .handleInvocation(new CaseVariableListenerInvocation(listenerInstance, variableInstance)); } else { throw new ProcessEngineException("Delegate expression " + expression + " did not resolve to an implementation of " + CaseVariableListener.class); } }
public void notify(DelegateCaseVariableInstance variableInstance) throws Exception { Object delegate = expression.getValue(variableInstance.getSourceExecution()); applyFieldDeclaration(fieldDeclarations, delegate); if (delegate instanceof CaseVariableListener) { CaseVariableListener listenerInstance = (CaseVariableListener) delegate; Context .getProcessEngineConfiguration() .getDelegateInterceptor() .handleInvocation(new CaseVariableListenerInvocation(listenerInstance, variableInstance)); } else { throw new ProcessEngineException("Delegate expression " + expression + " did not resolve to an implementation of " + CaseVariableListener.class); } }
public void notify(DelegateTask delegateTask) { // Note: we can't cache the result of the expression, because the // execution can change: eg. delegateExpression='${mySpringBeanFactory.randomSpringBean()}' VariableScope variableScope = delegateTask.getExecution(); if (variableScope == null) { variableScope = delegateTask.getCaseExecution(); } Object delegate = expression.getValue(variableScope); applyFieldDeclaration(fieldDeclarations, delegate); if (delegate instanceof TaskListener) { try { Context.getProcessEngineConfiguration() .getDelegateInterceptor() .handleInvocation(new TaskListenerInvocation((TaskListener)delegate, delegateTask)); }catch (Exception e) { throw new ProcessEngineException("Exception while invoking TaskListener: "+e.getMessage(), e); } } else { throw new ProcessEngineException("Delegate expression " + expression + " did not resolve to an implementation of " + TaskListener.class ); } }
public void notify(DelegateTask delegateTask) { // Note: we can't cache the result of the expression, because the // execution can change: eg. delegateExpression='${mySpringBeanFactory.randomSpringBean()}' VariableScope variableScope = delegateTask.getExecution(); if (variableScope == null) { variableScope = delegateTask.getCaseExecution(); } Object delegate = expression.getValue(variableScope); applyFieldDeclaration(fieldDeclarations, delegate); if (delegate instanceof TaskListener) { try { Context.getProcessEngineConfiguration() .getDelegateInterceptor() .handleInvocation(new TaskListenerInvocation((TaskListener)delegate, delegateTask)); }catch (Exception e) { throw new ProcessEngineException("Exception while invoking TaskListener: "+e.getMessage(), e); } } else { throw new ProcessEngineException("Delegate expression " + expression + " did not resolve to an implementation of " + TaskListener.class ); } }
public static void applyFieldDeclaration(List<FieldDeclaration> fieldDeclarations, Object target) { if(fieldDeclarations != null) { for(FieldDeclaration declaration : fieldDeclarations) { applyFieldDeclaration(declaration, target); } } }
public void notify(DelegateExecution execution) throws Exception { // Note: we can't cache the result of the expression, because the // execution can change: eg. delegateExpression='${mySpringBeanFactory.randomSpringBean()}' Object delegate = expression.getValue(execution); applyFieldDeclaration(fieldDeclarations, delegate); if (delegate instanceof ExecutionListener) { Context.getProcessEngineConfiguration() .getDelegateInterceptor() .handleInvocation(new ExecutionListenerInvocation((ExecutionListener) delegate, execution)); } else if (delegate instanceof JavaDelegate) { Context.getProcessEngineConfiguration() .getDelegateInterceptor() .handleInvocation(new JavaDelegateInvocation((JavaDelegate) delegate, execution)); } else { throw LOG.resolveDelegateExpressionException(expression, ExecutionListener.class, JavaDelegate.class); } }
public void notify(DelegateExecution execution) throws Exception { // Note: we can't cache the result of the expression, because the // execution can change: eg. delegateExpression='${mySpringBeanFactory.randomSpringBean()}' Object delegate = expression.getValue(execution); applyFieldDeclaration(fieldDeclarations, delegate); if (delegate instanceof ExecutionListener) { Context.getProcessEngineConfiguration() .getDelegateInterceptor() .handleInvocation(new ExecutionListenerInvocation((ExecutionListener) delegate, execution)); } else if (delegate instanceof JavaDelegate) { Context.getProcessEngineConfiguration() .getDelegateInterceptor() .handleInvocation(new JavaDelegateInvocation((JavaDelegate) delegate, execution)); } else { throw LOG.resolveDelegateExpressionException(expression, ExecutionListener.class, JavaDelegate.class); } }
@Override public Void call() throws Exception { // Note: we can't cache the result of the expression, because the // execution can change: eg. delegateExpression='${mySpringBeanFactory.randomSpringBean()}' Object delegate = expression.getValue(execution); applyFieldDeclaration(fieldDeclarations, delegate); if (delegate instanceof ActivityBehavior) { Context.getProcessEngineConfiguration() .getDelegateInterceptor() .handleInvocation(new ActivityBehaviorInvocation((ActivityBehavior) delegate, execution)); } else if (delegate instanceof JavaDelegate) { Context.getProcessEngineConfiguration() .getDelegateInterceptor() .handleInvocation(new JavaDelegateInvocation((JavaDelegate) delegate, execution)); leave(execution); } else { throw LOG.resolveDelegateExpressionException(expression, ActivityBehavior.class, JavaDelegate.class); } return null; } };
@Override public Void call() throws Exception { // Note: we can't cache the result of the expression, because the // execution can change: eg. delegateExpression='${mySpringBeanFactory.randomSpringBean()}' Object delegate = expression.getValue(execution); applyFieldDeclaration(fieldDeclarations, delegate); if (delegate instanceof ActivityBehavior) { Context.getProcessEngineConfiguration() .getDelegateInterceptor() .handleInvocation(new ActivityBehaviorInvocation((ActivityBehavior) delegate, execution)); } else if (delegate instanceof JavaDelegate) { Context.getProcessEngineConfiguration() .getDelegateInterceptor() .handleInvocation(new JavaDelegateInvocation((JavaDelegate) delegate, execution)); leave(execution); } else { throw LOG.resolveDelegateExpressionException(expression, ActivityBehavior.class, JavaDelegate.class); } return null; } };
public static Object instantiateDelegate(String className, List<FieldDeclaration> fieldDeclarations) { ArtifactFactory artifactFactory = Context.getProcessEngineConfiguration().getArtifactFactory(); try { Class<?> clazz = ReflectUtil.loadClass(className); Object object = artifactFactory.getArtifact(clazz); applyFieldDeclaration(fieldDeclarations, object); return object; } catch (Exception e) { throw LOG.exceptionWhileInstantiatingClass(className, e); } }
public void notify(DelegateCaseExecution caseExecution) throws Exception { // Note: we can't cache the result of the expression, because the // caseExecution can change: eg. delegateExpression='${mySpringBeanFactory.randomSpringBean()}' Object delegate = expression.getValue(caseExecution); applyFieldDeclaration(fieldDeclarations, delegate); if (delegate instanceof CaseExecutionListener) { CaseExecutionListener listenerInstance = (CaseExecutionListener) delegate; Context .getProcessEngineConfiguration() .getDelegateInterceptor() .handleInvocation(new CaseExecutionListenerInvocation(listenerInstance, caseExecution)); } else { throw new ProcessEngineException("Delegate expression " + expression + " did not resolve to an implementation of " + CaseExecutionListener.class); } }
public void notify(DelegateCaseVariableInstance variableInstance) throws Exception { Object delegate = expression.getValue(variableInstance.getSourceExecution()); applyFieldDeclaration(fieldDeclarations, delegate); if (delegate instanceof CaseVariableListener) { CaseVariableListener listenerInstance = (CaseVariableListener) delegate; Context .getProcessEngineConfiguration() .getDelegateInterceptor() .handleInvocation(new CaseVariableListenerInvocation(listenerInstance, variableInstance)); } else { throw new ProcessEngineException("Delegate expression " + expression + " did not resolve to an implementation of " + CaseVariableListener.class); } }