Search in sources :

Example 11 with DmnDecision

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

the class DefaultDmnEngine method parseDecision.

public DmnDecision parseDecision(String decisionKey, InputStream inputStream) {
    ensureNotNull("decisionKey", decisionKey);
    List<DmnDecision> decisions = parseDecisions(inputStream);
    for (DmnDecision decision : decisions) {
        if (decisionKey.equals(decision.getKey())) {
            return decision;
        }
    }
    throw LOG.unableToFindDecisionWithKey(decisionKey);
}
Also used : DmnDecision(org.camunda.bpm.dmn.engine.DmnDecision)

Example 12 with DmnDecision

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

the class DefaultDmnEngine method parseDecision.

public DmnDecision parseDecision(String decisionKey, DmnModelInstance dmnModelInstance) {
    ensureNotNull("decisionKey", decisionKey);
    List<DmnDecision> decisions = parseDecisions(dmnModelInstance);
    for (DmnDecision decision : decisions) {
        if (decisionKey.equals(decision.getKey())) {
            return decision;
        }
    }
    throw LOG.unableToFindDecisionWithKey(decisionKey);
}
Also used : DmnDecision(org.camunda.bpm.dmn.engine.DmnDecision)

Example 13 with DmnDecision

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

the class DefaultDmnEngine method evaluateDecision.

public DmnDecisionResult evaluateDecision(String decisionKey, InputStream inputStream, VariableContext variableContext) {
    ensureNotNull("decisionKey", decisionKey);
    List<DmnDecision> decisions = parseDecisions(inputStream);
    for (DmnDecision decision : decisions) {
        if (decisionKey.equals(decision.getKey())) {
            return evaluateDecision(decision, variableContext);
        }
    }
    throw LOG.unableToFindDecisionWithKey(decisionKey);
}
Also used : DmnDecision(org.camunda.bpm.dmn.engine.DmnDecision)

Example 14 with DmnDecision

use of org.camunda.bpm.dmn.engine.DmnDecision in project camunda-bpm-platform by camunda.

the class DecisionDefinitionDeployer method transformDefinitions.

@Override
protected List<DecisionDefinitionEntity> transformDefinitions(DeploymentEntity deployment, ResourceEntity resource, Properties properties) {
    List<DecisionDefinitionEntity> decisions = new ArrayList<DecisionDefinitionEntity>();
    // get the decisions from the deployed drd instead of parse the DMN again
    DecisionRequirementsDefinitionEntity deployedDrd = findDeployedDrdForResource(deployment, resource.getName());
    if (deployedDrd == null) {
        throw LOG.exceptionNoDrdForResource(resource.getName());
    }
    Collection<DmnDecision> decisionsOfDrd = deployedDrd.getDecisions();
    for (DmnDecision decisionOfDrd : decisionsOfDrd) {
        DecisionDefinitionEntity decisionEntity = (DecisionDefinitionEntity) decisionOfDrd;
        if (DecisionRequirementsDefinitionDeployer.isDecisionRequirementsDefinitionPersistable(deployedDrd)) {
            decisionEntity.setDecisionRequirementsDefinitionId(deployedDrd.getId());
            decisionEntity.setDecisionRequirementsDefinitionKey(deployedDrd.getKey());
        }
        decisions.add(decisionEntity);
    }
    if (!DecisionRequirementsDefinitionDeployer.isDecisionRequirementsDefinitionPersistable(deployedDrd)) {
        deployment.removeArtifact(deployedDrd);
    }
    return decisions;
}
Also used : ArrayList(java.util.ArrayList) DecisionDefinitionEntity(org.camunda.bpm.engine.impl.dmn.entity.repository.DecisionDefinitionEntity) DecisionRequirementsDefinitionEntity(org.camunda.bpm.engine.impl.dmn.entity.repository.DecisionRequirementsDefinitionEntity) DmnDecision(org.camunda.bpm.dmn.engine.DmnDecision)

Example 15 with DmnDecision

use of org.camunda.bpm.dmn.engine.DmnDecision in project camunda-bpm-platform by camunda.

the class DecisionInvocation method invoke.

@Override
protected void invoke() throws Exception {
    final DmnEngine dmnEngine = Context.getProcessEngineConfiguration().getDmnEngine();
    invocationResult = dmnEngine.evaluateDecision((DmnDecision) decisionDefinition, variableContext);
}
Also used : DmnEngine(org.camunda.bpm.dmn.engine.DmnEngine) DmnDecision(org.camunda.bpm.dmn.engine.DmnDecision)

Aggregations

DmnDecision (org.camunda.bpm.dmn.engine.DmnDecision)27 DmnEngineTest (org.camunda.bpm.dmn.engine.test.DmnEngineTest)9 Test (org.junit.Test)9 InputStream (java.io.InputStream)8 Decision (org.camunda.bpm.model.dmn.instance.Decision)7 ArrayList (java.util.ArrayList)5 DmnModelInstance (org.camunda.bpm.model.dmn.DmnModelInstance)5 DmnDecisionImpl (org.camunda.bpm.dmn.engine.impl.DmnDecisionImpl)3 DmnDecisionLiteralExpressionImpl (org.camunda.bpm.dmn.engine.impl.DmnDecisionLiteralExpressionImpl)2 DmnDecisionTableImpl (org.camunda.bpm.dmn.engine.impl.DmnDecisionTableImpl)2 Definitions (org.camunda.bpm.model.dmn.instance.Definitions)2 List (java.util.List)1 DmnDecisionRequirementsGraph (org.camunda.bpm.dmn.engine.DmnDecisionRequirementsGraph)1 DmnDecisionResult (org.camunda.bpm.dmn.engine.DmnDecisionResult)1 DmnEngine (org.camunda.bpm.dmn.engine.DmnEngine)1 DmnDecisionLogicEvaluationEvent (org.camunda.bpm.dmn.engine.delegate.DmnDecisionLogicEvaluationEvent)1 DmnDecisionRequirementsGraphImpl (org.camunda.bpm.dmn.engine.impl.DmnDecisionRequirementsGraphImpl)1 DmnExpressionImpl (org.camunda.bpm.dmn.engine.impl.DmnExpressionImpl)1 DmnVariableImpl (org.camunda.bpm.dmn.engine.impl.DmnVariableImpl)1 DmnDecisionLogicEvaluationHandler (org.camunda.bpm.dmn.engine.impl.evaluation.DmnDecisionLogicEvaluationHandler)1