Search in sources :

Example 1 with TriggerVariableValueDto

use of org.camunda.bpm.engine.rest.dto.runtime.TriggerVariableValueDto in project camunda-bpm-platform by camunda.

the class CaseExecutionResourceImpl method initializeCommandWithVariables.

protected void initializeCommandWithVariables(CaseExecutionCommandBuilder commandBuilder, Map<String, TriggerVariableValueDto> variables, String transition) {
    for (String variableName : variables.keySet()) {
        try {
            TriggerVariableValueDto variableValue = variables.get(variableName);
            TypedValue typedValue = variableValue.toTypedValue(engine, objectMapper);
            if (variableValue.isLocal()) {
                commandBuilder.setVariableLocal(variableName, typedValue);
            } else {
                commandBuilder.setVariable(variableName, typedValue);
            }
        } catch (RestException e) {
            String errorMessage = String.format("Cannot %s case execution %s due to invalid variable %s: %s", transition, caseExecutionId, variableName, e.getMessage());
            throw new RestException(e.getStatus(), e, errorMessage);
        }
    }
}
Also used : TriggerVariableValueDto(org.camunda.bpm.engine.rest.dto.runtime.TriggerVariableValueDto) RestException(org.camunda.bpm.engine.rest.exception.RestException) TypedValue(org.camunda.bpm.engine.variable.value.TypedValue)

Aggregations

TriggerVariableValueDto (org.camunda.bpm.engine.rest.dto.runtime.TriggerVariableValueDto)1 RestException (org.camunda.bpm.engine.rest.exception.RestException)1 TypedValue (org.camunda.bpm.engine.variable.value.TypedValue)1