Search in sources :

Example 1 with SignalEventReceivedBuilder

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

the class SignalRestServiceImpl method throwSignal.

@Override
public void throwSignal(SignalDto dto) {
    String name = dto.getName();
    if (name == null) {
        throw new InvalidRequestException(Status.BAD_REQUEST, "No signal name given");
    }
    SignalEventReceivedBuilder signalEvent = createSignalEventReceivedBuilder(dto);
    signalEvent.send();
}
Also used : SignalEventReceivedBuilder(org.camunda.bpm.engine.runtime.SignalEventReceivedBuilder) InvalidRequestException(org.camunda.bpm.engine.rest.exception.InvalidRequestException)

Example 2 with SignalEventReceivedBuilder

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

the class SignalRestServiceImpl method createSignalEventReceivedBuilder.

protected SignalEventReceivedBuilder createSignalEventReceivedBuilder(SignalDto dto) {
    RuntimeService runtimeService = processEngine.getRuntimeService();
    String name = dto.getName();
    SignalEventReceivedBuilder signalEvent = runtimeService.createSignalEvent(name);
    String executionId = dto.getExecutionId();
    if (executionId != null) {
        signalEvent.executionId(executionId);
    }
    Map<String, VariableValueDto> variablesDto = dto.getVariables();
    if (variablesDto != null) {
        Map<String, Object> variables = VariableValueDto.toMap(variablesDto, processEngine, objectMapper);
        signalEvent.setVariables(variables);
    }
    String tenantId = dto.getTenantId();
    if (tenantId != null) {
        signalEvent.tenantId(tenantId);
    }
    boolean isWithoutTenantId = dto.isWithoutTenantId();
    if (isWithoutTenantId) {
        signalEvent.withoutTenantId();
    }
    return signalEvent;
}
Also used : SignalEventReceivedBuilder(org.camunda.bpm.engine.runtime.SignalEventReceivedBuilder) VariableValueDto(org.camunda.bpm.engine.rest.dto.VariableValueDto) RuntimeService(org.camunda.bpm.engine.RuntimeService)

Aggregations

SignalEventReceivedBuilder (org.camunda.bpm.engine.runtime.SignalEventReceivedBuilder)2 RuntimeService (org.camunda.bpm.engine.RuntimeService)1 VariableValueDto (org.camunda.bpm.engine.rest.dto.VariableValueDto)1 InvalidRequestException (org.camunda.bpm.engine.rest.exception.InvalidRequestException)1