Пример #1
0
 /// <summary>
 /// Provide a context execution or resource definition in which context the invocation
 ///   should be performed. If both parameters are null, the invocation is performed in the
 ///   current context.
 /// </summary>
 /// <param name="contextExecution"> set to an execution </param>
 public DelegateInvocation(BaseDelegateExecution contextExecution, ResourceDefinitionEntity contextResource)
 {
     // This constructor forces sub classes to call it, thereby making it more visible
     // whether a context switch is going to be performed for them.
     this.contextExecution = contextExecution;
     this.contextResource  = contextResource;
 }
Пример #2
0
        protected internal virtual bool isCurrentContextExecution(BaseDelegateExecution execution)
        {
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: org.camunda.bpm.engine.impl.context.CoreExecutionContext<?> coreExecutionContext = org.camunda.bpm.engine.impl.context.Context.getCoreExecutionContext();
            CoreExecutionContext <object> coreExecutionContext = Context.CoreExecutionContext;

            return(coreExecutionContext != null && coreExecutionContext.Execution == execution);
        }
Пример #3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: protected void handleInvocationInContext(final DelegateInvocation invocation) throws Exception
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
        protected internal virtual void handleInvocationInContext(DelegateInvocation invocation)
        {
            CommandContext        commandContext = Context.CommandContext;
            bool                  wasAuthorizationCheckEnabled = commandContext.AuthorizationCheckEnabled;
            bool                  wasUserOperationLogEnabled   = commandContext.UserOperationLogEnabled;
            BaseDelegateExecution contextExecution             = invocation.ContextExecution;

            ProcessEngineConfigurationImpl configuration = Context.ProcessEngineConfiguration;

            bool popExecutionContext = false;

            try
            {
                if (!configuration.AuthorizationEnabledForCustomCode)
                {
                    // the custom code should be executed without authorization
                    commandContext.disableAuthorizationCheck();
                }

                try
                {
                    commandContext.disableUserOperationLog();

                    try
                    {
                        if (contextExecution != null && !isCurrentContextExecution(contextExecution))
                        {
                            popExecutionContext = setExecutionContext(contextExecution);
                        }

                        invocation.proceed();
                    }
                    finally
                    {
                        if (popExecutionContext)
                        {
                            Context.removeExecutionContext();
                        }
                    }
                }
                finally
                {
                    if (wasUserOperationLogEnabled)
                    {
                        commandContext.enableUserOperationLog();
                    }
                }
            }
            finally
            {
                if (wasAuthorizationCheckEnabled)
                {
                    commandContext.enableAuthorizationCheck();
                }
            }
        }
Пример #4
0
 /// <returns> true if the execution context is modified by this invocation </returns>
 protected internal virtual bool setExecutionContext(BaseDelegateExecution execution)
 {
     if (execution is ExecutionEntity)
     {
         Context.ExecutionContext = (ExecutionEntity)execution;
         return(true);
     }
     else if (execution is CaseExecutionEntity)
     {
         Context.ExecutionContext = (CaseExecutionEntity)execution;
         return(true);
     }
     return(false);
 }
Пример #5
0
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
//ORIGINAL LINE: protected org.camunda.bpm.application.ProcessApplicationReference getProcessApplicationForInvocation(final DelegateInvocation invocation)
        protected internal virtual ProcessApplicationReference getProcessApplicationForInvocation(DelegateInvocation invocation)
        {
            BaseDelegateExecution    contextExecution = invocation.ContextExecution;
            ResourceDefinitionEntity contextResource  = invocation.ContextResource;

            if (contextExecution != null)
            {
                return(ProcessApplicationContextUtil.getTargetProcessApplication((CoreExecution)contextExecution));
            }
            else if (contextResource != null)
            {
                return(ProcessApplicationContextUtil.getTargetProcessApplication(contextResource));
            }
            else
            {
                return(null);
            }
        }
Пример #6
0
 public TaskListenerInvocation(TaskListener taskListenerInstance, DelegateTask delegateTask, BaseDelegateExecution contextExecution) : base(contextExecution, null)
 {
     this.taskListenerInstance = taskListenerInstance;
     this.delegateTask         = delegateTask;
 }
Пример #7
0
 public ExpressionGetInvocation(ValueExpression valueExpression, ELContext elContext, BaseDelegateExecution contextExecution) : base(contextExecution, null)
 {
     this.valueExpression = valueExpression;
     this.elContext       = elContext;
 }
Пример #8
0
 public ScriptInvocation(ExecutableScript script, VariableScope scope, BaseDelegateExecution contextExecution) : base(contextExecution, null)
 {
     this.script = script;
     this.scope  = scope;
 }
Пример #9
0
 public InvocationContext(BaseDelegateExecution execution)
 {
     this.execution = execution;
 }
Пример #10
0
 public virtual object getValue(VariableScope variableScope, BaseDelegateExecution contextExecution)
 {
     return(getValue(variableScope));
 }
Пример #11
0
 public CaseVariableListenerInvocation(CaseVariableListener variableListenerInstance, DelegateCaseVariableInstance variableInstance, BaseDelegateExecution contextExecution) : base(contextExecution, null)
 {
     this.variableListenerInstance = variableListenerInstance;
     this.variableInstance         = variableInstance;
 }