Exemple #1
0
 protected internal virtual string getStringFromField(Expression expression, DelegateExecution execution)
 {
     if (expression != null)
     {
         object value = expression.getValue(execution);
         if (value != null)
         {
             return(value.ToString());
         }
     }
     return(null);
 }
Exemple #2
0
        public virtual void verify(FieldDeclaration field)
        {
            assertEquals(fieldName, field.Name);

            object fieldValue = field.Value;

            assertNotNull(fieldValue);

            assertTrue(fieldValue is Expression);
            Expression expressionValue = (Expression)fieldValue;

            assertEquals(ExpectedExpression, expressionValue.ExpressionText);
        }
Exemple #3
0
 /// <summary>
 /// Creates a new <seealso cref="ExecutableScript"/> from a source. It excepts static and dynamic sources.
 /// Dynamic means that the source is an expression which will be evaluated during execution.
 /// </summary>
 /// <param name="language"> the language of the script </param>
 /// <param name="source"> the source code of the script or an expression which evaluates to the source code </param>
 /// <param name="expressionManager"> the expression manager to use to generate the expressions of dynamic scripts </param>
 /// <param name="scriptFactory"> the script factory used to create the script </param>
 /// <returns> the newly created script </returns>
 /// <exception cref="NotValidException"> if language is null or empty or source is null </exception>
 public static ExecutableScript getScriptFormSource(string language, string source, ExpressionManager expressionManager, ScriptFactory scriptFactory)
 {
     ensureNotEmpty(typeof(NotValidException), "Script language", language);
     ensureNotNull(typeof(NotValidException), "Script source", source);
     if (isDynamicScriptExpression(language, source))
     {
         Expression sourceExpression = expressionManager.createExpression(source);
         return(getScriptFromSourceExpression(language, sourceExpression, scriptFactory));
     }
     else
     {
         return(getScriptFromSource(language, source, scriptFactory));
     }
 }
Exemple #4
0
        public virtual string execute(CommandContext commandContext)
        {
            ProcessEngineConfigurationImpl processEngineConfiguration = Context.ProcessEngineConfiguration;
            DeploymentCache         deploymentCache   = processEngineConfiguration.DeploymentCache;
            ProcessDefinitionEntity processDefinition = deploymentCache.findDeployedProcessDefinitionById(processDefinitionId);

            foreach (CommandChecker checker in commandContext.ProcessEngineConfiguration.CommandCheckers)
            {
                checker.checkReadProcessDefinition(processDefinition);
            }

            Expression formKeyExpression = null;

            if (string.ReferenceEquals(taskDefinitionKey, null))
            {
                // TODO: Maybe add getFormKey() to FormHandler interface to avoid the following cast
                FormHandler formHandler = processDefinition.StartFormHandler;

                if (formHandler is DelegateStartFormHandler)
                {
                    DelegateStartFormHandler delegateFormHandler = (DelegateStartFormHandler)formHandler;
                    formHandler = delegateFormHandler.FormHandler;
                }

                // Sorry!!! In case of a custom start form handler (which does not extend
                // the DefaultFormHandler) a formKey would never be returned. So a custom
                // form handler (for a startForm) has always to extend the DefaultStartFormHandler!
                if (formHandler is DefaultStartFormHandler)
                {
                    DefaultStartFormHandler startFormHandler = (DefaultStartFormHandler)formHandler;
                    formKeyExpression = startFormHandler.FormKey;
                }
            }
            else
            {
                TaskDefinition taskDefinition = processDefinition.TaskDefinitions[taskDefinitionKey];
                formKeyExpression = taskDefinition.FormKey;
            }

            string formKey = null;

            if (formKeyExpression != null)
            {
                formKey = formKeyExpression.ExpressionText;
            }
            return(formKey);
        }
Exemple #5
0
        public override void parseConfiguration(Element activityElement, DeploymentEntity deployment, ProcessDefinitionEntity processDefinition, BpmnParse bpmnParse)
        {
            base.parseConfiguration(activityElement, deployment, processDefinition, bpmnParse);

            ExpressionManager expressionManager = Context.ProcessEngineConfiguration.ExpressionManager;

            string formKeyAttribute = activityElement.attributeNS(BpmnParse.CAMUNDA_BPMN_EXTENSIONS_NS, "formKey");

            if (!string.ReferenceEquals(formKeyAttribute, null))
            {
                this.formKey = expressionManager.createExpression(formKeyAttribute);
            }

            if (formKey != null)
            {
                processDefinition.StartFormKey = true;
            }
        }
Exemple #6
0
        public virtual TaskFormData createTaskForm(TaskEntity task)
        {
            TaskFormDataImpl taskFormData = new TaskFormDataImpl();

            Expression formKey = task.TaskDefinition.FormKey;

            if (formKey != null)
            {
                object formValue = formKey.getValue(task);
                if (formValue != null)
                {
                    taskFormData.FormKey = formValue.ToString();
                }
            }

            taskFormData.DeploymentId = deploymentId;
            taskFormData.Task         = task;
            initializeFormProperties(taskFormData, task.getExecution());
            initializeFormFields(taskFormData, task.getExecution());
            return(taskFormData);
        }
Exemple #7
0
 public virtual ExecutableScript createScriptFromSource(string language, Expression sourceExpression)
 {
     return(new DynamicSourceExecutableScript(language, sourceExpression));
 }
Exemple #8
0
 public CallActivityBehavior(Expression expression) : base(expression)
 {
 }
Exemple #9
0
 /// <summary>
 /// Creates a new <seealso cref="ExecutableScript"/> from a dynamic resource. Dynamic means that the source
 /// is an expression which will be evaluated during execution.
 /// </summary>
 /// <param name="language"> the language of the script </param>
 /// <param name="resourceExpression"> the expression which evaluates to the resource path </param>
 /// <param name="scriptFactory"> the script factory used to create the script </param>
 /// <returns> the newly created script </returns>
 /// <exception cref="NotValidException"> if language is null or empty or resourceExpression is null </exception>
 public static ExecutableScript getScriptFromResourceExpression(string language, Expression resourceExpression, ScriptFactory scriptFactory)
 {
     ensureNotEmpty(typeof(NotValidException), "Script language", language);
     ensureNotNull(typeof(NotValidException), "Script resource expression", resourceExpression);
     return(scriptFactory.createScriptFromResource(language, resourceExpression));
 }
Exemple #10
0
 public DynamicResourceExecutableScript(string language, Expression scriptResourceExpression) : base(scriptResourceExpression, language)
 {
 }
Exemple #11
0
 public ExpressionTaskListener(Expression expression)
 {
     this.expression = expression;
 }
Exemple #12
0
 public ExpressionCaseVariableListener(Expression expression)
 {
     this.expression = expression;
 }
Exemple #13
0
 protected internal DataAssociation(Expression businessKeyExpression)
 {
     this.businessKeyExpression = businessKeyExpression;
 }
Exemple #14
0
 public CaseControlRuleImpl(Expression expression)
 {
     this.expression = expression;
 }
Exemple #15
0
 protected internal DataAssociation(Expression sourceExpression, string target)
 {
     this.sourceExpression = sourceExpression;
     this.target           = target;
 }
Exemple #16
0
 public ServiceTaskExpressionActivityBehavior(Expression expression, string resultVariable)
 {
     this.expression     = expression;
     this.resultVariable = resultVariable;
 }
Exemple #17
0
 protected internal DynamicExecutableScript(Expression scriptExpression, string language) : base(language)
 {
     this.scriptExpression = scriptExpression;
 }
Exemple #18
0
 public ExpressionExecutionListener(Expression expression)
 {
     this.expression = expression;
 }