Search in sources :

Example 11 with ExpressionManager

use of org.camunda.bpm.engine.impl.el.ExpressionManager in project camunda-bpm-platform by camunda.

the class DefaultStartFormHandler method parseConfiguration.

@Override
public void parseConfiguration(Element activityElement, DeploymentEntity deployment, ProcessDefinitionEntity processDefinition, BpmnParse bpmnParse) {
    super.parseConfiguration(activityElement, deployment, processDefinition, bpmnParse);
    ExpressionManager expressionManager = Context.getProcessEngineConfiguration().getExpressionManager();
    String formKeyAttribute = activityElement.attributeNS(BpmnParse.CAMUNDA_BPMN_EXTENSIONS_NS, "formKey");
    if (formKeyAttribute != null) {
        this.formKey = expressionManager.createExpression(formKeyAttribute);
    }
    if (formKey != null) {
        processDefinition.setStartFormKey(true);
    }
}
Also used : ExpressionManager(org.camunda.bpm.engine.impl.el.ExpressionManager)

Example 12 with ExpressionManager

use of org.camunda.bpm.engine.impl.el.ExpressionManager in project camunda-bpm-platform by camunda.

the class CmmnElementHandlerTest method setup.

@Before
public void setup() {
    modelInstance = Cmmn.createEmptyModel();
    definitions = modelInstance.newInstance(Definitions.class);
    definitions.setTargetNamespace("http://camunda.org/examples");
    modelInstance.setDefinitions(definitions);
    caseDefinition = createElement(definitions, "aCaseDefinition", Case.class);
    casePlanModel = createElement(caseDefinition, "aCasePlanModel", CasePlanModel.class);
    context = new CmmnHandlerContext();
    CaseDefinitionEntity caseDefinition = new CaseDefinitionEntity();
    caseDefinition.setTaskDefinitions(new HashMap<String, TaskDefinition>());
    context.setCaseDefinition(caseDefinition);
    ExpressionManager expressionManager = new ExpressionManager();
    context.setExpressionManager(expressionManager);
}
Also used : ExpressionManager(org.camunda.bpm.engine.impl.el.ExpressionManager) TaskDefinition(org.camunda.bpm.engine.impl.task.TaskDefinition) CasePlanModel(org.camunda.bpm.model.cmmn.instance.CasePlanModel) Definitions(org.camunda.bpm.model.cmmn.instance.Definitions) CmmnHandlerContext(org.camunda.bpm.engine.impl.cmmn.handler.CmmnHandlerContext) CaseDefinitionEntity(org.camunda.bpm.engine.impl.cmmn.entity.repository.CaseDefinitionEntity) Case(org.camunda.bpm.model.cmmn.instance.Case) Before(org.junit.Before)

Example 13 with ExpressionManager

use of org.camunda.bpm.engine.impl.el.ExpressionManager in project camunda-bpm-platform by camunda.

the class ProcessEngineConfigurationImpl method initExpressionManager.

protected void initExpressionManager() {
    if (expressionManager == null) {
        expressionManager = new ExpressionManager(beans);
    }
    // add function mapper for command context (eg currentUser(), currentUserGroups())
    expressionManager.addFunctionMapper(new CommandContextFunctionMapper());
    // add function mapper for date time (eg now(), dateTime())
    expressionManager.addFunctionMapper(new DateTimeFunctionMapper());
}
Also used : ExpressionManager(org.camunda.bpm.engine.impl.el.ExpressionManager) DateTimeFunctionMapper(org.camunda.bpm.engine.impl.el.DateTimeFunctionMapper) CommandContextFunctionMapper(org.camunda.bpm.engine.impl.el.CommandContextFunctionMapper)

Example 14 with ExpressionManager

use of org.camunda.bpm.engine.impl.el.ExpressionManager in project camunda-bpm-platform by camunda.

the class HumanTaskPlanItemHandlerTest method testExpressionManager.

@Test
public void testExpressionManager() {
    // given: a plan item
    // when
    CmmnActivity activity = handler.handleElement(planItem, context);
    // then
    HumanTaskActivityBehavior behavior = (HumanTaskActivityBehavior) activity.getActivityBehavior();
    ExpressionManager expressionManager = behavior.getExpressionManager();
    assertNotNull(expressionManager);
    assertEquals(context.getExpressionManager(), expressionManager);
}
Also used : ExpressionManager(org.camunda.bpm.engine.impl.el.ExpressionManager) HumanTaskActivityBehavior(org.camunda.bpm.engine.impl.cmmn.behavior.HumanTaskActivityBehavior) CmmnActivity(org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity) Test(org.junit.Test)

Example 15 with ExpressionManager

use of org.camunda.bpm.engine.impl.el.ExpressionManager in project camunda-bpm-platform by camunda.

the class ItemHandler method initializeCaseControlRule.

protected CaseControlRule initializeCaseControlRule(ConditionExpression condition, CmmnHandlerContext context) {
    Expression expression = null;
    if (condition != null) {
        String rule = condition.getText();
        if (rule != null && !rule.isEmpty()) {
            ExpressionManager expressionManager = context.getExpressionManager();
            expression = expressionManager.createExpression(rule);
        }
    }
    return new CaseControlRuleImpl(expression);
}
Also used : ExpressionManager(org.camunda.bpm.engine.impl.el.ExpressionManager) CamundaExpression(org.camunda.bpm.model.cmmn.instance.camunda.CamundaExpression) Expression(org.camunda.bpm.engine.delegate.Expression) ConditionExpression(org.camunda.bpm.model.cmmn.instance.ConditionExpression) CaseControlRuleImpl(org.camunda.bpm.engine.impl.cmmn.behavior.CaseControlRuleImpl) CamundaString(org.camunda.bpm.model.cmmn.instance.camunda.CamundaString)

Aggregations

ExpressionManager (org.camunda.bpm.engine.impl.el.ExpressionManager)27 Expression (org.camunda.bpm.engine.delegate.Expression)14 HumanTask (org.camunda.bpm.model.cmmn.instance.HumanTask)8 ParameterValueProvider (org.camunda.bpm.engine.impl.core.variable.mapping.value.ParameterValueProvider)5 FieldDeclaration (org.camunda.bpm.engine.impl.bpmn.parser.FieldDeclaration)4 ConditionExpression (org.camunda.bpm.model.cmmn.instance.ConditionExpression)4 CamundaString (org.camunda.bpm.model.cmmn.instance.camunda.CamundaString)4 ExecutableScript (org.camunda.bpm.engine.impl.scripting.ExecutableScript)3 CamundaExpression (org.camunda.bpm.model.cmmn.instance.camunda.CamundaExpression)3 CamundaField (org.camunda.bpm.model.cmmn.instance.camunda.CamundaField)3 CamundaScript (org.camunda.bpm.model.cmmn.instance.camunda.CamundaScript)3 HumanTaskActivityBehavior (org.camunda.bpm.engine.impl.cmmn.behavior.HumanTaskActivityBehavior)2 CaseDefinitionEntity (org.camunda.bpm.engine.impl.cmmn.entity.repository.CaseDefinitionEntity)2 CallableElementParameter (org.camunda.bpm.engine.impl.core.model.CallableElementParameter)2 TaskDefinition (org.camunda.bpm.engine.impl.task.TaskDefinition)2 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)1 CaseExecutionListener (org.camunda.bpm.engine.delegate.CaseExecutionListener)1 CaseVariableListener (org.camunda.bpm.engine.delegate.CaseVariableListener)1 TaskListener (org.camunda.bpm.engine.delegate.TaskListener)1 NotValidException (org.camunda.bpm.engine.exception.NotValidException)1