Example #1
0
        protected internal virtual ProcessApplicationReference getPaReference(ProcessApplicationIdentifier processApplicationIdentifier)
        {
            if (processApplicationIdentifier.Reference != null)
            {
                return(processApplicationIdentifier.Reference);
            }
            else if (processApplicationIdentifier.ProcessApplication != null)
            {
                return(processApplicationIdentifier.ProcessApplication.Reference);
            }
            else if (!string.ReferenceEquals(processApplicationIdentifier.Name, null))
            {
                RuntimeContainerDelegate    runtimeContainerDelegate = org.camunda.bpm.container.RuntimeContainerDelegate_Fields.INSTANCE.get();
                ProcessApplicationReference reference = runtimeContainerDelegate.getDeployedProcessApplication(processApplicationIdentifier.Name);

                if (reference == null)
                {
                    throw LOG.paWithNameNotRegistered(processApplicationIdentifier.Name);
                }
                else
                {
                    return(reference);
                }
            }
            else
            {
                throw LOG.cannotReolvePa(processApplicationIdentifier);
            }
        }
Example #2
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));
            }
        }