Search in sources :

Example 16 with Decision

use of org.camunda.bpm.model.dmn.instance.Decision in project camunda-engine-dmn by camunda.

the class DefaultDmnTransform method getRequiredDmnDecisions.

protected List<DmnDecision> getRequiredDmnDecisions(Decision decision, Map<String, DmnDecisionImpl> dmnDecisions) {
    List<DmnDecision> requiredDecisionList = new ArrayList<DmnDecision>();
    for (InformationRequirement informationRequirement : decision.getInformationRequirements()) {
        Decision requiredDecision = informationRequirement.getRequiredDecision();
        if (requiredDecision != null) {
            DmnDecision requiredDmnDecision = dmnDecisions.get(requiredDecision.getId());
            requiredDecisionList.add(requiredDmnDecision);
        }
    }
    return requiredDecisionList;
}
Also used : InformationRequirement(org.camunda.bpm.model.dmn.instance.InformationRequirement) ArrayList(java.util.ArrayList) DmnDecision(org.camunda.bpm.dmn.engine.DmnDecision) Decision(org.camunda.bpm.model.dmn.instance.Decision) DmnDecision(org.camunda.bpm.dmn.engine.DmnDecision)

Example 17 with Decision

use of org.camunda.bpm.model.dmn.instance.Decision 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 18 with Decision

use of org.camunda.bpm.model.dmn.instance.Decision in project camunda-engine-dmn by camunda.

the class DefaultDmnTransform method transformDecision.

protected DmnDecisionImpl transformDecision(Decision decision) {
    DmnElementTransformHandler<Decision, DmnDecisionImpl> handler = handlerRegistry.getHandler(Decision.class);
    DmnDecisionImpl dmnDecision = handler.handleElement(this, decision);
    this.decision = dmnDecision;
    // validate decision id
    if (dmnDecision.getKey() == null) {
        throw LOG.decisionIdIsMissing(dmnDecision);
    }
    Expression expression = decision.getExpression();
    if (expression == null) {
        LOG.decisionWithoutExpression(decision);
        return null;
    }
    if (expression instanceof DecisionTable) {
        DmnDecisionTableImpl dmnDecisionTable = transformDecisionTable((DecisionTable) expression);
        dmnDecision.setDecisionLogic(dmnDecisionTable);
    } else if (expression instanceof LiteralExpression) {
        DmnDecisionLiteralExpressionImpl dmnDecisionLiteralExpression = transformDecisionLiteralExpression(decision, (LiteralExpression) expression);
        dmnDecision.setDecisionLogic(dmnDecisionLiteralExpression);
    } else {
        LOG.decisionTypeNotSupported(expression, decision);
        return null;
    }
    return dmnDecision;
}
Also used : DecisionTable(org.camunda.bpm.model.dmn.instance.DecisionTable) DmnDecisionTableImpl(org.camunda.bpm.dmn.engine.impl.DmnDecisionTableImpl) LiteralExpression(org.camunda.bpm.model.dmn.instance.LiteralExpression) InputExpression(org.camunda.bpm.model.dmn.instance.InputExpression) Expression(org.camunda.bpm.model.dmn.instance.Expression) DmnDecisionImpl(org.camunda.bpm.dmn.engine.impl.DmnDecisionImpl) LiteralExpression(org.camunda.bpm.model.dmn.instance.LiteralExpression) DmnDecisionLiteralExpressionImpl(org.camunda.bpm.dmn.engine.impl.DmnDecisionLiteralExpressionImpl) DmnDecision(org.camunda.bpm.dmn.engine.DmnDecision) Decision(org.camunda.bpm.model.dmn.instance.Decision)

Aggregations

Decision (org.camunda.bpm.model.dmn.instance.Decision)18 Definitions (org.camunda.bpm.model.dmn.instance.Definitions)9 DecisionTable (org.camunda.bpm.model.dmn.instance.DecisionTable)8 Test (org.junit.Test)8 DmnDecision (org.camunda.bpm.dmn.engine.DmnDecision)7 Output (org.camunda.bpm.model.dmn.instance.Output)7 Input (org.camunda.bpm.model.dmn.instance.Input)5 InputExpression (org.camunda.bpm.model.dmn.instance.InputExpression)5 ArrayList (java.util.ArrayList)4 DmnModelInstance (org.camunda.bpm.model.dmn.DmnModelInstance)4 Rule (org.camunda.bpm.model.dmn.instance.Rule)4 DmnDecisionImpl (org.camunda.bpm.dmn.engine.impl.DmnDecisionImpl)3 InputEntry (org.camunda.bpm.model.dmn.instance.InputEntry)3 InputValues (org.camunda.bpm.model.dmn.instance.InputValues)3 OutputEntry (org.camunda.bpm.model.dmn.instance.OutputEntry)3 OutputValues (org.camunda.bpm.model.dmn.instance.OutputValues)3 Text (org.camunda.bpm.model.dmn.instance.Text)3 DrgElement (org.camunda.bpm.model.dmn.instance.DrgElement)2 InputStream (java.io.InputStream)1 List (java.util.List)1