use of org.camunda.bpm.engine.runtime.ConditionEvaluationBuilder in project camunda-bpm-platform by camunda.
the class ConditionRestServiceImpl method createConditionEvaluationBuilder.
protected ConditionEvaluationBuilder createConditionEvaluationBuilder(EvaluationConditionDto conditionDto) {
RuntimeService runtimeService = processEngine.getRuntimeService();
ObjectMapper objectMapper = getObjectMapper();
VariableMap variables = VariableValueDto.toMap(conditionDto.getVariables(), processEngine, objectMapper);
ConditionEvaluationBuilder builder = runtimeService.createConditionEvaluation();
if (variables != null && !variables.isEmpty()) {
builder.setVariables(variables);
}
if (conditionDto.getBusinessKey() != null) {
builder.processInstanceBusinessKey(conditionDto.getBusinessKey());
}
if (conditionDto.getProcessDefinitionId() != null) {
builder.processDefinitionId(conditionDto.getProcessDefinitionId());
}
if (conditionDto.getTenantId() != null) {
builder.tenantId(conditionDto.getTenantId());
} else if (conditionDto.isWithoutTenantId()) {
builder.withoutTenantId();
}
return builder;
}
use of org.camunda.bpm.engine.runtime.ConditionEvaluationBuilder in project camunda-bpm-platform by camunda.
the class ConditionRestServiceImpl method evaluateCondition.
@Override
public List<ProcessInstanceDto> evaluateCondition(EvaluationConditionDto conditionDto) {
if (conditionDto.getTenantId() != null && conditionDto.isWithoutTenantId()) {
throw new InvalidRequestException(Status.BAD_REQUEST, "Parameter 'tenantId' cannot be used together with parameter 'withoutTenantId'.");
}
ConditionEvaluationBuilder builder = createConditionEvaluationBuilder(conditionDto);
List<ProcessInstance> processInstances = builder.evaluateStartConditions();
List<ProcessInstanceDto> result = new ArrayList<ProcessInstanceDto>();
for (ProcessInstance processInstance : processInstances) {
result.add(ProcessInstanceDto.fromProcessInstance(processInstance));
}
return result;
}
Aggregations