use of org.camunda.bpm.model.cmmn.instance.DecisionRefExpression 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.model.cmmn.instance.DecisionRefExpression in project camunda-bpm-platform by camunda.
the class DecisionTaskPlanItemHandlerTest method testExpressionDecisionRefExpression.
@Test
public void testExpressionDecisionRefExpression() {
// 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 caseRefValueProvider = callableElement.getDefinitionKeyValueProvider();
assertNotNull(caseRefValueProvider);
assertTrue(caseRefValueProvider instanceof ElValueProvider);
ElValueProvider valueProvider = (ElValueProvider) caseRefValueProvider;
assertEquals(decision, valueProvider.getExpression().getExpressionText());
}
use of org.camunda.bpm.model.cmmn.instance.DecisionRefExpression in project camunda-bpm-platform by camunda.
the class DecisionTaskItemHandler method getDefinitionKey.
protected String getDefinitionKey(CmmnElement element, CmmnActivity activity, CmmnHandlerContext context) {
DecisionTask definition = getDefinition(element);
String decision = definition.getDecision();
if (decision == null) {
DecisionRefExpression decisionExpression = definition.getDecisionExpression();
if (decisionExpression != null) {
decision = decisionExpression.getText();
}
}
return decision;
}
use of org.camunda.bpm.model.cmmn.instance.DecisionRefExpression in project camunda-cmmn-model by camunda.
the class DecisionRefExpressionImpl method registerType.
public static void registerType(ModelBuilder modelBuilder) {
ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(DecisionRefExpression.class, CMMN_ELEMENT_DECISION_REF_EXPRESSION).namespaceUri(CMMN11_NS).extendsType(Expression.class).instanceProvider(new ModelElementTypeBuilder.ModelTypeInstanceProvider<DecisionRefExpression>() {
public DecisionRefExpression newInstance(ModelTypeInstanceContext instanceContext) {
return new DecisionRefExpressionImpl(instanceContext);
}
});
typeBuilder.build();
}
Aggregations