Search in sources :

Example 1 with DecisionResultMapper

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;
}
Also used : ParameterValueProvider(org.camunda.bpm.engine.impl.core.variable.mapping.value.ParameterValueProvider) DecisionResultMapper(org.camunda.bpm.engine.impl.dmn.result.DecisionResultMapper)

Example 2 with DecisionResultMapper

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;
}
Also used : DecisionResultMapper(org.camunda.bpm.engine.impl.dmn.result.DecisionResultMapper)

Example 3 with DecisionResultMapper

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);
}
Also used : DmnDecisionTaskActivityBehavior(org.camunda.bpm.engine.impl.cmmn.behavior.DmnDecisionTaskActivityBehavior) DecisionTask(org.camunda.bpm.model.cmmn.instance.DecisionTask) DecisionResultMapper(org.camunda.bpm.engine.impl.dmn.result.DecisionResultMapper)

Example 4 with 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);
}
Also used : DmnDecisionTaskActivityBehavior(org.camunda.bpm.engine.impl.cmmn.behavior.DmnDecisionTaskActivityBehavior) ResultListDecisionTableResultMapper(org.camunda.bpm.engine.impl.dmn.result.ResultListDecisionTableResultMapper) SingleResultDecisionResultMapper(org.camunda.bpm.engine.impl.dmn.result.SingleResultDecisionResultMapper) DecisionResultMapper(org.camunda.bpm.engine.impl.dmn.result.DecisionResultMapper) CmmnActivity(org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity) Test(org.junit.Test)

Example 5 with DecisionResultMapper

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);
}
Also used : DmnDecisionTaskActivityBehavior(org.camunda.bpm.engine.impl.cmmn.behavior.DmnDecisionTaskActivityBehavior) SingleResultDecisionResultMapper(org.camunda.bpm.engine.impl.dmn.result.SingleResultDecisionResultMapper) DecisionResultMapper(org.camunda.bpm.engine.impl.dmn.result.DecisionResultMapper) CmmnActivity(org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity) SingleResultDecisionResultMapper(org.camunda.bpm.engine.impl.dmn.result.SingleResultDecisionResultMapper) Test(org.junit.Test)

Aggregations

DecisionResultMapper (org.camunda.bpm.engine.impl.dmn.result.DecisionResultMapper)5 DmnDecisionTaskActivityBehavior (org.camunda.bpm.engine.impl.cmmn.behavior.DmnDecisionTaskActivityBehavior)3 CmmnActivity (org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity)2 SingleResultDecisionResultMapper (org.camunda.bpm.engine.impl.dmn.result.SingleResultDecisionResultMapper)2 Test (org.junit.Test)2 ParameterValueProvider (org.camunda.bpm.engine.impl.core.variable.mapping.value.ParameterValueProvider)1 ResultListDecisionTableResultMapper (org.camunda.bpm.engine.impl.dmn.result.ResultListDecisionTableResultMapper)1 DecisionTask (org.camunda.bpm.model.cmmn.instance.DecisionTask)1