Search in sources :

Example 1 with DecisionService

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

the class DecisionServiceDelegate method execute.

@Override
public void execute(DelegateExecution execution) throws Exception {
    DecisionService decisionService = execution.getProcessEngineServices().getDecisionService();
    evaluateDecision(decisionService, execution);
}
Also used : DecisionService(org.camunda.bpm.engine.DecisionService)

Example 2 with DecisionService

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

the class EvaluateDecisionTableStep method execute.

@Override
public void execute(PerfTestRunContext context) {
    DecisionService decisionService = processEngine.getDecisionService();
    decisionService.evaluateDecisionTableByKey(decisionDefinitionKey, variables);
}
Also used : DecisionService(org.camunda.bpm.engine.DecisionService)

Example 3 with DecisionService

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

the class DecisionDefinitionResourceImpl method evaluateDecision.

@Override
public List<Map<String, VariableValueDto>> evaluateDecision(UriInfo context, EvaluateDecisionDto parameters) {
    DecisionService decisionService = engine.getDecisionService();
    Map<String, Object> variables = VariableValueDto.toMap(parameters.getVariables(), engine, objectMapper);
    try {
        DmnDecisionResult decisionResult = decisionService.evaluateDecisionById(decisionDefinitionId).variables(variables).evaluate();
        return createDecisionResultDto(decisionResult);
    } catch (AuthorizationException e) {
        throw e;
    } catch (NotFoundException e) {
        String errorMessage = String.format("Cannot evaluate decision %s: %s", decisionDefinitionId, e.getMessage());
        throw new InvalidRequestException(Status.NOT_FOUND, e, errorMessage);
    } catch (NotValidException e) {
        String errorMessage = String.format("Cannot evaluate decision %s: %s", decisionDefinitionId, e.getMessage());
        throw new InvalidRequestException(Status.BAD_REQUEST, e, errorMessage);
    } catch (ProcessEngineException e) {
        String errorMessage = String.format("Cannot evaluate decision %s: %s", decisionDefinitionId, e.getMessage());
        throw new RestException(Status.INTERNAL_SERVER_ERROR, e, errorMessage);
    } catch (DmnEngineException e) {
        String errorMessage = String.format("Cannot evaluate decision %s: %s", decisionDefinitionId, e.getMessage());
        throw new RestException(Status.INTERNAL_SERVER_ERROR, e, errorMessage);
    }
}
Also used : DmnDecisionResult(org.camunda.bpm.dmn.engine.DmnDecisionResult) NotValidException(org.camunda.bpm.engine.exception.NotValidException) AuthorizationException(org.camunda.bpm.engine.AuthorizationException) RestException(org.camunda.bpm.engine.rest.exception.RestException) NotFoundException(org.camunda.bpm.engine.exception.NotFoundException) InvalidRequestException(org.camunda.bpm.engine.rest.exception.InvalidRequestException) ProcessEngineException(org.camunda.bpm.engine.ProcessEngineException) DmnEngineException(org.camunda.bpm.dmn.engine.DmnEngineException) DecisionService(org.camunda.bpm.engine.DecisionService)

Example 4 with DecisionService

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

the class DecisionServiceDelegate method notify.

public void notify(DelegateCaseExecution caseExecution) throws Exception {
    DecisionService decisionService = caseExecution.getProcessEngineServices().getDecisionService();
    evaluateDecision(decisionService, caseExecution);
}
Also used : DecisionService(org.camunda.bpm.engine.DecisionService)

Example 5 with DecisionService

use of org.camunda.bpm.engine.DecisionService 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();
}
Also used : DmnDecisionTableResult(org.camunda.bpm.dmn.engine.DmnDecisionTableResult) DmnDecisionRuleResult(org.camunda.bpm.dmn.engine.DmnDecisionRuleResult) DecisionService(org.camunda.bpm.engine.DecisionService)

Aggregations

DecisionService (org.camunda.bpm.engine.DecisionService)5 DmnDecisionResult (org.camunda.bpm.dmn.engine.DmnDecisionResult)1 DmnDecisionRuleResult (org.camunda.bpm.dmn.engine.DmnDecisionRuleResult)1 DmnDecisionTableResult (org.camunda.bpm.dmn.engine.DmnDecisionTableResult)1 DmnEngineException (org.camunda.bpm.dmn.engine.DmnEngineException)1 AuthorizationException (org.camunda.bpm.engine.AuthorizationException)1 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)1 NotFoundException (org.camunda.bpm.engine.exception.NotFoundException)1 NotValidException (org.camunda.bpm.engine.exception.NotValidException)1 InvalidRequestException (org.camunda.bpm.engine.rest.exception.InvalidRequestException)1 RestException (org.camunda.bpm.engine.rest.exception.RestException)1