use of org.camunda.bpm.dmn.engine.DmnDecisionRuleResult in project camunda-engine-dmn by camunda.
the class DmnDecisionTableResultImpl method getResultList.
@Override
public List<Map<String, Object>> getResultList() {
List<Map<String, Object>> entryMapList = new ArrayList<Map<String, Object>>();
for (DmnDecisionRuleResult ruleResult : ruleResults) {
Map<String, Object> entryMap = ruleResult.getEntryMap();
entryMapList.add(entryMap);
}
return entryMapList;
}
use of org.camunda.bpm.dmn.engine.DmnDecisionRuleResult in project camunda-bpm-platform by camunda.
the class DecisionServiceDelegate method evaluate.
public boolean evaluate(DelegateCaseExecution caseExecution) {
DecisionService decisionService = caseExecution.getProcessEngineServices().getDecisionService();
DmnDecisionTableResult result = evaluateDecision(decisionService, caseExecution);
DmnDecisionRuleResult singleResult = result.getSingleResult();
return (Boolean) singleResult.getSingleEntry();
}
use of org.camunda.bpm.dmn.engine.DmnDecisionRuleResult in project camunda-engine-dmn by camunda.
the class DmnDecisionTableResultTest method testMultipleResults.
@Test
@DecisionResource(resource = RESULT_TEST_DMN)
public void testMultipleResults() {
DmnDecisionTableResult decisionResult = evaluateWithMatchingRules(NO_OUTPUT_VALUE, SINGLE_OUTPUT_VALUE, MULTIPLE_OUTPUT_VALUES);
assertThat(decisionResult).hasSize(3);
DmnDecisionRuleResult ruleResult = decisionResult.get(0);
assertNoOutputValue(ruleResult);
ruleResult = decisionResult.get(1);
assertSingleOutputValue(ruleResult);
ruleResult = decisionResult.get(2);
assertMultipleOutputValues(ruleResult);
ruleResult = decisionResult.getFirstResult();
assertNoOutputValue(ruleResult);
try {
decisionResult.getSingleResult();
failBecauseExceptionWasNotThrown(DmnDecisionResultException.class);
} catch (DmnDecisionResultException e) {
assertThat(e).hasMessageStartingWith("DMN-01008").hasMessageContaining("singleValue").hasMessageContaining("multipleValues1").hasMessageContaining("multipleValues2");
}
try {
decisionResult.getSingleEntry();
failBecauseExceptionWasNotThrown(DmnDecisionResultException.class);
} catch (DmnDecisionResultException e) {
assertThat(e).hasMessageStartingWith("DMN-01008").hasMessageContaining("singleValue").hasMessageContaining("multipleValues1").hasMessageContaining("multipleValues2");
}
}
use of org.camunda.bpm.dmn.engine.DmnDecisionRuleResult in project camunda-engine-dmn by camunda.
the class DmnDecisionTableResultImpl method wrap.
public static DmnDecisionTableResultImpl wrap(DmnDecisionResult decisionResult) {
List<DmnDecisionRuleResult> ruleResults = new ArrayList<DmnDecisionRuleResult>();
for (DmnDecisionResultEntries result : decisionResult) {
DmnDecisionRuleResultImpl ruleResult = new DmnDecisionRuleResultImpl();
ruleResult.putAllValues(result.getEntryMapTyped());
ruleResults.add(ruleResult);
}
return new DmnDecisionTableResultImpl(ruleResults);
}
Aggregations