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); }
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); }
/// <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)); } }
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); }
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; } }
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); }
public virtual ExecutableScript createScriptFromSource(string language, Expression sourceExpression) { return(new DynamicSourceExecutableScript(language, sourceExpression)); }
public CallActivityBehavior(Expression expression) : base(expression) { }
/// <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)); }
public DynamicResourceExecutableScript(string language, Expression scriptResourceExpression) : base(scriptResourceExpression, language) { }
public ExpressionTaskListener(Expression expression) { this.expression = expression; }
public ExpressionCaseVariableListener(Expression expression) { this.expression = expression; }
protected internal DataAssociation(Expression businessKeyExpression) { this.businessKeyExpression = businessKeyExpression; }
public CaseControlRuleImpl(Expression expression) { this.expression = expression; }
protected internal DataAssociation(Expression sourceExpression, string target) { this.sourceExpression = sourceExpression; this.target = target; }
public ServiceTaskExpressionActivityBehavior(Expression expression, string resultVariable) { this.expression = expression; this.resultVariable = resultVariable; }
protected internal DynamicExecutableScript(Expression scriptExpression, string language) : base(language) { this.scriptExpression = scriptExpression; }
public ExpressionExecutionListener(Expression expression) { this.expression = expression; }