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);
}
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));
}
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));
}
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);
}
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());
}
Aggregations