public virtual void Notify(IDelegateTask delegateTask) { // Note: we can't cache the result of the expression, because the // execution can change: eg. delegateExpression='${mySpringBeanFactory.randomSpringBean()}' IVariableScope variableScope = delegateTask.Execution; if (variableScope == null) { variableScope = delegateTask.CaseExecution; } var @delegate = Expression.GetValue(variableScope); ClassDelegateUtil.ApplyFieldDeclaration(FieldDeclarations, @delegate); if (@delegate is ITaskListener) { try { Context.ProcessEngineConfiguration.DelegateInterceptor.HandleInvocation( new TaskListenerInvocation((ITaskListener)@delegate, delegateTask)); } catch (System.Exception e) { throw new ProcessEngineException("Exception while invoking TaskListener: " + e.Message, e); } } else { throw new ProcessEngineException("Delegate expression " + Expression + " did not resolve to an implementation of " + typeof(ITaskListener)); } }
protected override void PerformExecution(IActivityExecution execution) { ExecuteWithErrorPropagation(execution, () => { // Note: we can't cache the result of the expression, because the // execution can change: eg. delegateExpression='${mySpringBeanFactory.randomSpringBean()}' var @delegate = _expression.GetValue(execution); if (@delegate is ESS.FW.Bpm.Engine.Variable.Value.Impl.UntypedValueImpl) { var del = (Engine.Variable.Value.Impl.UntypedValueImpl)@delegate; var r = del.Value; ClassDelegateUtil.ApplyFieldDeclaration(_fieldDeclarations, r); if (r is IActivityBehavior) { Context.ProcessEngineConfiguration.DelegateInterceptor.HandleInvocation( new ActivityBehaviorInvocation((IActivityBehavior)r, execution)); } else if (r is IJavaDelegate) { Context.ProcessEngineConfiguration.DelegateInterceptor.HandleInvocation( new JavaDelegateInvocation((IJavaDelegate)r, execution)); Leave(execution); } else { throw Log.ResolveDelegateExpressionException(_expression, typeof(IActivityBehavior), typeof(IJavaDelegate)); } return; } ClassDelegateUtil.ApplyFieldDeclaration(_fieldDeclarations, @delegate); if (@delegate is IActivityBehavior) { Context.ProcessEngineConfiguration.DelegateInterceptor.HandleInvocation( new ActivityBehaviorInvocation((IActivityBehavior)@delegate, execution)); } else if (@delegate is IJavaDelegate) { Context.ProcessEngineConfiguration.DelegateInterceptor.HandleInvocation( new JavaDelegateInvocation((IJavaDelegate)@delegate, execution)); Leave(execution); } else { throw Log.ResolveDelegateExpressionException(_expression, typeof(IActivityBehavior), typeof(IJavaDelegate)); } } ); }
protected internal virtual object instantiateDelegateClass(ActivityExecution execution) { object @delegate = null; if (expression != null) { @delegate = expression.getValue(execution); } else if (!string.ReferenceEquals(className, null)) { @delegate = ClassDelegateUtil.instantiateDelegate(className, null); } return(@delegate); }
protected internal virtual object InstantiateDelegateClass(IActivityExecution execution) { object @delegate = null; if (Expression != null) { @delegate = Expression.GetValue(execution); } else if (!ReferenceEquals(ClassName, null)) { @delegate = ClassDelegateUtil.InstantiateDelegate(ClassName, null); } return(@delegate); }
protected internal virtual IActivityBehavior GetActivityBehaviorInstance(IActivityExecution execution) { var delegateInstance = ClassDelegateUtil.InstantiateDelegate(ClassName, FieldDeclarations); if (delegateInstance is IActivityBehavior) { return(new CustomActivityBehavior((IActivityBehavior)delegateInstance)); } if (delegateInstance is IJavaDelegate) { return(new ServiceTaskJavaDelegateActivityBehavior((IJavaDelegate)delegateInstance)); } throw Log.MissingDelegateParentClassException(delegateInstance.GetType() .FullName, typeof(IJavaDelegate).FullName, typeof(IActivityBehavior).FullName); }
public virtual void Notify(IDelegateCaseVariableInstance variableInstance) { var @delegate = Expression.GetValue(variableInstance.SourceExecution); ClassDelegateUtil.ApplyFieldDeclaration(FieldDeclarations, @delegate); if (@delegate is ICaseVariableListener) { var listenerInstance = (ICaseVariableListener)@delegate; Context.ProcessEngineConfiguration.DelegateInterceptor.HandleInvocation( new CaseVariableListenerInvocation(listenerInstance, variableInstance)); } else { throw new ProcessEngineException("Delegate expression " + Expression + " did not resolve to an implementation of " + typeof(ICaseVariableListener)); } }
public virtual void DoSignal(IActivityExecution execution, string signalName, object signalData) { var @delegate = _expression.GetValue(execution); ClassDelegateUtil.ApplyFieldDeclaration(_fieldDeclarations, @delegate); var activityBehaviorInstance = GetActivityBehaviorInstance(execution, @delegate); if (activityBehaviorInstance is CustomActivityBehavior) { var behavior = (CustomActivityBehavior)activityBehaviorInstance; var delegateActivityBehavior = behavior.DelegateActivityBehavior; if (!(delegateActivityBehavior is ISignallableActivityBehavior)) { // legacy behavior: do nothing when it is not a signallable activity behavior } } ExecuteWithErrorPropagation(execution, () => ((ISignallableActivityBehavior)activityBehaviorInstance).Signal(execution, signalName, signalData)); }
public virtual void Notify(IBaseDelegateExecution execution) { // Note: we can't cache the result of the expression, because the // execution can change: eg. delegateExpression='${mySpringBeanFactory.randomSpringBean()}' var @delegate = Expression.GetValue(execution); ClassDelegateUtil.ApplyFieldDeclaration(_fieldDeclarations, @delegate); if (@delegate is IDelegateListener <IBaseDelegateExecution> ) { Context.ProcessEngineConfiguration.DelegateInterceptor.HandleInvocation( new ExecutionListenerInvocation((IDelegateListener <IBaseDelegateExecution>)@delegate, (IDelegateExecution)execution)); } else if (@delegate is IJavaDelegate) { Context.ProcessEngineConfiguration.DelegateInterceptor.HandleInvocation( new JavaDelegateInvocation((IJavaDelegate)@delegate, (IDelegateExecution)execution)); } else { throw Log.ResolveDelegateExpressionException(Expression, typeof(IDelegateListener <IBaseDelegateExecution>), typeof(IJavaDelegate)); } }