Search in sources :

Example 6 with DmnDecisionImpl

use of org.camunda.bpm.dmn.engine.impl.DmnDecisionImpl in project camunda-engine-dmn by camunda.

the class DefaultDmnTransform method buildDecisionRequirements.

protected void buildDecisionRequirements(Collection<Decision> decisions, Map<String, DmnDecisionImpl> dmnDecisions) {
    for (Decision decision : decisions) {
        List<DmnDecision> requiredDmnDecisions = getRequiredDmnDecisions(decision, dmnDecisions);
        DmnDecisionImpl dmnDecision = dmnDecisions.get(decision.getId());
        if (requiredDmnDecisions.size() > 0) {
            dmnDecision.setRequiredDecision(requiredDmnDecisions);
        }
    }
}
Also used : DmnDecisionImpl(org.camunda.bpm.dmn.engine.impl.DmnDecisionImpl) DmnDecision(org.camunda.bpm.dmn.engine.DmnDecision) Decision(org.camunda.bpm.model.dmn.instance.Decision) DmnDecision(org.camunda.bpm.dmn.engine.DmnDecision)

Example 7 with DmnDecisionImpl

use of org.camunda.bpm.dmn.engine.impl.DmnDecisionImpl in project camunda-engine-dmn by camunda.

the class DmnTransformTest method shouldTransformInputs.

@Test
public void shouldTransformInputs() {
    DmnDecisionImpl decisionEntity = (DmnDecisionImpl) parseDecisionFromFile("decision1", TRANSFORM_DMN);
    DmnDecisionTableImpl decisionTable = (DmnDecisionTableImpl) decisionEntity.getDecisionLogic();
    List<DmnDecisionTableInputImpl> inputs = decisionTable.getInputs();
    assertThat(inputs).hasSize(2);
    DmnDecisionTableInputImpl input = inputs.get(0);
    assertThat(input.getId()).isEqualTo("input1");
    assertThat(input.getName()).isEqualTo("camunda");
    assertThat(input.getInputVariable()).isEqualTo("camunda");
    DmnExpressionImpl inputExpression = input.getExpression();
    assertThat(inputExpression).isNotNull();
    assertThat(inputExpression.getId()).isEqualTo("inputExpression");
    assertThat(inputExpression.getName()).isNull();
    assertThat(inputExpression.getExpressionLanguage()).isEqualTo("camunda");
    assertThat(inputExpression.getExpression()).isEqualTo("camunda");
    assertThat(inputExpression.getTypeDefinition()).isNotNull();
    assertThat(inputExpression.getTypeDefinition().getTypeName()).isEqualTo("string");
    input = inputs.get(1);
    assertThat(input.getId()).isEqualTo("input2");
    assertThat(input.getName()).isNull();
    assertThat(input.getInputVariable()).isEqualTo(DmnDecisionTableInputImpl.DEFAULT_INPUT_VARIABLE_NAME);
    inputExpression = input.getExpression();
    assertThat(inputExpression).isNotNull();
    assertThat(inputExpression.getId()).isNull();
    assertThat(inputExpression.getName()).isNull();
    assertThat(inputExpression.getExpressionLanguage()).isNull();
    assertThat(inputExpression.getExpression()).isNull();
    assertThat(inputExpression.getTypeDefinition()).isNotNull();
    assertThat(inputExpression.getTypeDefinition()).isEqualTo(new DefaultTypeDefinition());
}
Also used : DmnDecisionTableInputImpl(org.camunda.bpm.dmn.engine.impl.DmnDecisionTableInputImpl) DefaultTypeDefinition(org.camunda.bpm.dmn.engine.impl.type.DefaultTypeDefinition) DmnDecisionTableImpl(org.camunda.bpm.dmn.engine.impl.DmnDecisionTableImpl) DmnExpressionImpl(org.camunda.bpm.dmn.engine.impl.DmnExpressionImpl) DmnDecisionImpl(org.camunda.bpm.dmn.engine.impl.DmnDecisionImpl) Test(org.junit.Test) DmnEngineTest(org.camunda.bpm.dmn.engine.test.DmnEngineTest)

Example 8 with DmnDecisionImpl

use of org.camunda.bpm.dmn.engine.impl.DmnDecisionImpl in project camunda-engine-dmn by camunda.

the class DmnDecisionTransformHandler method createFromDecision.

protected DmnDecisionImpl createFromDecision(DmnElementTransformContext context, Decision decision) {
    DmnDecisionImpl decisionEntity = createDmnElement();
    decisionEntity.setKey(decision.getId());
    decisionEntity.setName(decision.getName());
    return decisionEntity;
}
Also used : DmnDecisionImpl(org.camunda.bpm.dmn.engine.impl.DmnDecisionImpl)

Aggregations

DmnDecisionImpl (org.camunda.bpm.dmn.engine.impl.DmnDecisionImpl)8 DmnDecisionTableImpl (org.camunda.bpm.dmn.engine.impl.DmnDecisionTableImpl)4 DmnEngineTest (org.camunda.bpm.dmn.engine.test.DmnEngineTest)4 Test (org.junit.Test)4 DmnDecision (org.camunda.bpm.dmn.engine.DmnDecision)3 Decision (org.camunda.bpm.model.dmn.instance.Decision)3 DmnExpressionImpl (org.camunda.bpm.dmn.engine.impl.DmnExpressionImpl)2 DefaultTypeDefinition (org.camunda.bpm.dmn.engine.impl.type.DefaultTypeDefinition)2 ArrayList (java.util.ArrayList)1 DmnDecisionLogic (org.camunda.bpm.dmn.engine.DmnDecisionLogic)1 DmnEngineException (org.camunda.bpm.dmn.engine.DmnEngineException)1 DmnDecisionLiteralExpressionImpl (org.camunda.bpm.dmn.engine.impl.DmnDecisionLiteralExpressionImpl)1 DmnDecisionTableInputImpl (org.camunda.bpm.dmn.engine.impl.DmnDecisionTableInputImpl)1 DmnDecisionTableOutputImpl (org.camunda.bpm.dmn.engine.impl.DmnDecisionTableOutputImpl)1 DmnDecisionTableRuleImpl (org.camunda.bpm.dmn.engine.impl.DmnDecisionTableRuleImpl)1 DecisionTable (org.camunda.bpm.model.dmn.instance.DecisionTable)1 Expression (org.camunda.bpm.model.dmn.instance.Expression)1 InputExpression (org.camunda.bpm.model.dmn.instance.InputExpression)1 LiteralExpression (org.camunda.bpm.model.dmn.instance.LiteralExpression)1