Search in sources :

Example 1 with BaseCallableElement

use of org.camunda.bpm.engine.impl.core.model.BaseCallableElement in project camunda-bpm-platform by camunda.

the class CallingTaskItemHandler method initializeCallableElement.

protected void initializeCallableElement(CmmnElement element, CmmnActivity activity, CmmnHandlerContext context) {
    Deployment deployment = context.getDeployment();
    String deploymentId = null;
    if (deployment != null) {
        deploymentId = deployment.getId();
    }
    BaseCallableElement callableElement = createCallableElement();
    callableElement.setDeploymentId(deploymentId);
    // set callableElement on behavior
    CallingTaskActivityBehavior behavior = (CallingTaskActivityBehavior) activity.getActivityBehavior();
    behavior.setCallableElement(callableElement);
    // definition key
    initializeDefinitionKey(element, activity, context, callableElement);
    // binding
    initializeBinding(element, activity, context, callableElement);
    // version
    initializeVersion(element, activity, context, callableElement);
    // tenant-id
    initializeTenantId(element, activity, context, callableElement);
}
Also used : CallingTaskActivityBehavior(org.camunda.bpm.engine.impl.cmmn.behavior.CallingTaskActivityBehavior) BaseCallableElement(org.camunda.bpm.engine.impl.core.model.BaseCallableElement) Deployment(org.camunda.bpm.engine.repository.Deployment)

Example 2 with BaseCallableElement

use of org.camunda.bpm.engine.impl.core.model.BaseCallableElement in project camunda-bpm-platform by camunda.

the class DecisionTaskPlanItemHandlerTest method testVersionConstant.

@Test
public void testVersionConstant() {
    // given:
    String caseVersion = "2";
    decisionTask.setCamundaDecisionVersion(caseVersion);
    // when
    CmmnActivity activity = handler.handleElement(planItem, context);
    // then
    DecisionTaskActivityBehavior behavior = (DecisionTaskActivityBehavior) activity.getActivityBehavior();
    BaseCallableElement callableElement = behavior.getCallableElement();
    ParameterValueProvider caseVersionValueProvider = callableElement.getVersionValueProvider();
    assertNotNull(caseVersionValueProvider);
    assertTrue(caseVersionValueProvider instanceof ConstantValueProvider);
    assertEquals(caseVersion, caseVersionValueProvider.getValue(null));
}
Also used : ParameterValueProvider(org.camunda.bpm.engine.impl.core.variable.mapping.value.ParameterValueProvider) DecisionTaskActivityBehavior(org.camunda.bpm.engine.impl.cmmn.behavior.DecisionTaskActivityBehavior) DmnDecisionTaskActivityBehavior(org.camunda.bpm.engine.impl.cmmn.behavior.DmnDecisionTaskActivityBehavior) BaseCallableElement(org.camunda.bpm.engine.impl.core.model.BaseCallableElement) CmmnActivity(org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity) ConstantValueProvider(org.camunda.bpm.engine.impl.core.variable.mapping.value.ConstantValueProvider) Test(org.junit.Test)

Example 3 with BaseCallableElement

use of org.camunda.bpm.engine.impl.core.model.BaseCallableElement in project camunda-bpm-platform by camunda.

the class DecisionTaskPlanItemHandlerTest method testConstantDecisionRefExpression.

@Test
public void testConstantDecisionRefExpression() {
    // given:
    String decision = "aDecisionToCall";
    DecisionRefExpression decisionRefExpression = createElement(decisionTask, DecisionRefExpression.class);
    decisionRefExpression.setText(decision);
    // when
    CmmnActivity activity = handler.handleElement(planItem, context);
    // then
    DecisionTaskActivityBehavior behavior = (DecisionTaskActivityBehavior) activity.getActivityBehavior();
    BaseCallableElement callableElement = behavior.getCallableElement();
    ParameterValueProvider decisionRefValueProvider = callableElement.getDefinitionKeyValueProvider();
    assertNotNull(decisionRefValueProvider);
    assertTrue(decisionRefValueProvider instanceof ConstantValueProvider);
    ConstantValueProvider valueProvider = (ConstantValueProvider) decisionRefValueProvider;
    assertEquals(decision, valueProvider.getValue(null));
}
Also used : ParameterValueProvider(org.camunda.bpm.engine.impl.core.variable.mapping.value.ParameterValueProvider) DecisionTaskActivityBehavior(org.camunda.bpm.engine.impl.cmmn.behavior.DecisionTaskActivityBehavior) DmnDecisionTaskActivityBehavior(org.camunda.bpm.engine.impl.cmmn.behavior.DmnDecisionTaskActivityBehavior) BaseCallableElement(org.camunda.bpm.engine.impl.core.model.BaseCallableElement) CmmnActivity(org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity) ConstantValueProvider(org.camunda.bpm.engine.impl.core.variable.mapping.value.ConstantValueProvider) DecisionRefExpression(org.camunda.bpm.model.cmmn.instance.DecisionRefExpression) Test(org.junit.Test)

Example 4 with BaseCallableElement

use of org.camunda.bpm.engine.impl.core.model.BaseCallableElement in project camunda-bpm-platform by camunda.

the class DecisionTaskPlanItemHandlerTest method testBinding.

@Test
public void testBinding() {
    // given:
    CallableElementBinding caseBinding = CallableElementBinding.LATEST;
    decisionTask.setCamundaDecisionBinding(caseBinding.getValue());
    // when
    CmmnActivity activity = handler.handleElement(planItem, context);
    // then
    DecisionTaskActivityBehavior behavior = (DecisionTaskActivityBehavior) activity.getActivityBehavior();
    BaseCallableElement callableElement = behavior.getCallableElement();
    CallableElementBinding binding = callableElement.getBinding();
    assertNotNull(binding);
    assertEquals(caseBinding, binding);
}
Also used : DecisionTaskActivityBehavior(org.camunda.bpm.engine.impl.cmmn.behavior.DecisionTaskActivityBehavior) DmnDecisionTaskActivityBehavior(org.camunda.bpm.engine.impl.cmmn.behavior.DmnDecisionTaskActivityBehavior) BaseCallableElement(org.camunda.bpm.engine.impl.core.model.BaseCallableElement) CallableElementBinding(org.camunda.bpm.engine.impl.core.model.BaseCallableElement.CallableElementBinding) CmmnActivity(org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity) Test(org.junit.Test)

Example 5 with BaseCallableElement

use of org.camunda.bpm.engine.impl.core.model.BaseCallableElement in project camunda-bpm-platform by camunda.

the class DecisionTaskPlanItemHandlerTest method testExpressionDecisionRef.

@Test
public void testExpressionDecisionRef() {
    // given:
    String decisionRef = "${aDecisionToCall}";
    decisionTask.setDecision(decisionRef);
    // when
    CmmnActivity activity = handler.handleElement(planItem, context);
    // then
    DecisionTaskActivityBehavior behavior = (DecisionTaskActivityBehavior) activity.getActivityBehavior();
    BaseCallableElement callableElement = behavior.getCallableElement();
    ParameterValueProvider caseRefValueProvider = callableElement.getDefinitionKeyValueProvider();
    assertNotNull(caseRefValueProvider);
    assertTrue(caseRefValueProvider instanceof ElValueProvider);
    ElValueProvider valueProvider = (ElValueProvider) caseRefValueProvider;
    assertEquals(decisionRef, valueProvider.getExpression().getExpressionText());
}
Also used : ParameterValueProvider(org.camunda.bpm.engine.impl.core.variable.mapping.value.ParameterValueProvider) DecisionTaskActivityBehavior(org.camunda.bpm.engine.impl.cmmn.behavior.DecisionTaskActivityBehavior) DmnDecisionTaskActivityBehavior(org.camunda.bpm.engine.impl.cmmn.behavior.DmnDecisionTaskActivityBehavior) BaseCallableElement(org.camunda.bpm.engine.impl.core.model.BaseCallableElement) ElValueProvider(org.camunda.bpm.engine.impl.el.ElValueProvider) CmmnActivity(org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity) Test(org.junit.Test)

Aggregations

BaseCallableElement (org.camunda.bpm.engine.impl.core.model.BaseCallableElement)8 DecisionTaskActivityBehavior (org.camunda.bpm.engine.impl.cmmn.behavior.DecisionTaskActivityBehavior)7 DmnDecisionTaskActivityBehavior (org.camunda.bpm.engine.impl.cmmn.behavior.DmnDecisionTaskActivityBehavior)7 CmmnActivity (org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity)7 Test (org.junit.Test)7 ParameterValueProvider (org.camunda.bpm.engine.impl.core.variable.mapping.value.ParameterValueProvider)6 ConstantValueProvider (org.camunda.bpm.engine.impl.core.variable.mapping.value.ConstantValueProvider)3 ElValueProvider (org.camunda.bpm.engine.impl.el.ElValueProvider)3 DecisionRefExpression (org.camunda.bpm.model.cmmn.instance.DecisionRefExpression)2 CallingTaskActivityBehavior (org.camunda.bpm.engine.impl.cmmn.behavior.CallingTaskActivityBehavior)1 CallableElementBinding (org.camunda.bpm.engine.impl.core.model.BaseCallableElement.CallableElementBinding)1 Deployment (org.camunda.bpm.engine.repository.Deployment)1