Example #1
0
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
//ORIGINAL LINE: @Override public <T> T execute(final Command<T> command)
        public override T execute <T>(Command <T> command)
        {
            ProcessApplicationIdentifier processApplicationIdentifier = ProcessApplicationContextImpl.get();

            if (processApplicationIdentifier != null)
            {
                // clear the identifier so this interceptor does not apply to nested commands
                ProcessApplicationContextImpl.clear();

                try
                {
                    ProcessApplicationReference reference = getPaReference(processApplicationIdentifier);
                    return(Context.executeWithinProcessApplication(new CallableAnonymousInnerClass(this, command)
                                                                   , reference));
                }
                finally
                {
                    // restore the identifier for subsequent commands
                    ProcessApplicationContextImpl.set(processApplicationIdentifier);
                }
            }
            else
            {
                return(next.execute(command));
            }
        }
Example #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void handleInvocation(final DelegateInvocation invocation) throws Exception
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
        public virtual void handleInvocation(DelegateInvocation invocation)
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.camunda.bpm.application.ProcessApplicationReference processApplication = getProcessApplicationForInvocation(invocation);
            ProcessApplicationReference processApplication = getProcessApplicationForInvocation(invocation);

            if (processApplication != null && ProcessApplicationContextUtil.requiresContextSwitch(processApplication))
            {
                Context.executeWithinProcessApplication(new CallableAnonymousInnerClass(this, invocation)
                                                        , processApplication, new InvocationContext(invocation.ContextExecution));
            }
            else
            {
                handleInvocationInContext(invocation);
            }
        }
Example #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") public void testExecuteWithInvocationContext() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
        public virtual void testExecuteWithInvocationContext()
        {
            // given a process application which extends the default one
            // - using a spy for verify the invocations
            TestApplicationWithoutEngine processApplication          = spy(pa);
            ProcessApplicationReference  processApplicationReference = mock(typeof(ProcessApplicationReference));

            when(processApplicationReference.ProcessApplication).thenReturn(processApplication);

            // when execute with context
            InvocationContext invocationContext = new InvocationContext(mock(typeof(BaseDelegateExecution)));

            Context.executeWithinProcessApplication(mock(typeof(Callable)), processApplicationReference, invocationContext);

            // then the execute method should be invoked with context
            verify(processApplication).execute(any(typeof(Callable)), eq(invocationContext));
            // and forward to call to the default execute method
            verify(processApplication).execute(any(typeof(Callable)));
        }
Example #4
0
 public ScriptEngine execute(CommandContext commandContext)
 {
     return(Context.executeWithinProcessApplication(new CallableAnonymousInnerClass(this)
                                                    , processApplication.Reference));
 }