use of org.camunda.bpm.engine.impl.dmn.result.DecisionResultMapper in project camunda-bpm-platform by camunda.
the class BpmnParse method parseDmnBusinessRuleTask.
/**
* Parse a Business Rule Task which references a decision.
*/
protected ActivityImpl parseDmnBusinessRuleTask(Element businessRuleTaskElement, ScopeImpl scope) {
ActivityImpl activity = createActivityOnScope(businessRuleTaskElement, scope);
// the activity is a scope since the result variable is stored as local variable
activity.setScope(true);
parseAsynchronousContinuationForActivity(businessRuleTaskElement, activity);
String decisionRef = businessRuleTaskElement.attributeNS(CAMUNDA_BPMN_EXTENSIONS_NS, "decisionRef");
BaseCallableElement callableElement = new BaseCallableElement();
callableElement.setDeploymentId(deployment.getId());
ParameterValueProvider definitionKeyProvider = createParameterValueProvider(decisionRef, expressionManager);
callableElement.setDefinitionKeyValueProvider(definitionKeyProvider);
parseBinding(businessRuleTaskElement, activity, callableElement, "decisionRefBinding");
parseVersion(businessRuleTaskElement, activity, callableElement, "decisionRefBinding", "decisionRefVersion");
parseTenantId(businessRuleTaskElement, activity, callableElement, "decisionRefTenantId");
String resultVariable = parseResultVariable(businessRuleTaskElement);
DecisionResultMapper decisionResultMapper = parseDecisionResultMapper(businessRuleTaskElement);
DmnBusinessRuleTaskActivityBehavior behavior = new DmnBusinessRuleTaskActivityBehavior(callableElement, resultVariable, decisionResultMapper);
activity.setActivityBehavior(behavior);
parseExecutionListenersOnScope(businessRuleTaskElement, activity);
for (BpmnParseListener parseListener : parseListeners) {
parseListener.parseBusinessRuleTask(businessRuleTaskElement, scope, activity);
}
return activity;
}
use of org.camunda.bpm.engine.impl.dmn.result.DecisionResultMapper in project camunda-bpm-platform by camunda.
the class BpmnParse method parseDecisionResultMapper.
protected DecisionResultMapper parseDecisionResultMapper(Element businessRuleTaskElement) {
// default mapper is 'resultList'
String decisionResultMapper = businessRuleTaskElement.attributeNS(CAMUNDA_BPMN_EXTENSIONS_NS, "mapDecisionResult");
DecisionResultMapper mapper = DecisionEvaluationUtil.getDecisionResultMapperForName(decisionResultMapper);
if (mapper == null) {
addError("No decision result mapper found for name '" + decisionResultMapper + "'. Supported mappers are 'singleEntry', 'singleResult', 'collectEntries' and 'resultList'.", businessRuleTaskElement);
}
return mapper;
}
use of org.camunda.bpm.engine.impl.dmn.result.DecisionResultMapper in project camunda-bpm-platform by camunda.
the class DecisionTaskItemHandler method initializeDecisionTableResultMapper.
protected void initializeDecisionTableResultMapper(CmmnElement element, CmmnActivity activity, CmmnHandlerContext context) {
DecisionTask decisionTask = getDefinition(element);
DmnDecisionTaskActivityBehavior behavior = getActivityBehavior(activity);
String mapper = decisionTask.getCamundaMapDecisionResult();
DecisionResultMapper decisionResultMapper = getDecisionResultMapperForName(mapper);
behavior.setDecisionTableResultMapper(decisionResultMapper);
}
use of org.camunda.bpm.engine.impl.dmn.result.DecisionResultMapper in project camunda-bpm-platform by camunda.
the class DecisionTaskPlanItemHandlerTest method testDefaultMapDecisionResult.
@Test
public void testDefaultMapDecisionResult() {
// given:
// when
CmmnActivity activity = handler.handleElement(planItem, context);
// then
DmnDecisionTaskActivityBehavior behavior = (DmnDecisionTaskActivityBehavior) activity.getActivityBehavior();
DecisionResultMapper mapper = behavior.getDecisionTableResultMapper();
assertTrue(mapper instanceof ResultListDecisionTableResultMapper);
}
use of org.camunda.bpm.engine.impl.dmn.result.DecisionResultMapper in project camunda-bpm-platform by camunda.
the class DecisionTaskPlanItemHandlerTest method testMapDecisionResult.
@Test
public void testMapDecisionResult() {
// given:
decisionTask.setCamundaMapDecisionResult("singleResult");
// when
CmmnActivity activity = handler.handleElement(planItem, context);
// then
DmnDecisionTaskActivityBehavior behavior = (DmnDecisionTaskActivityBehavior) activity.getActivityBehavior();
DecisionResultMapper mapper = behavior.getDecisionTableResultMapper();
assertTrue(mapper instanceof SingleResultDecisionResultMapper);
}
Aggregations