Search in sources :

Example 1 with VariableValueDto

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

the class HistoricVariableUpdateDto method fromHistoricVariableUpdate.

public static HistoricVariableUpdateDto fromHistoricVariableUpdate(HistoricVariableUpdate historicVariableUpdate) {
    HistoricVariableUpdateDto dto = new HistoricVariableUpdateDto();
    dto.revision = historicVariableUpdate.getRevision();
    dto.variableName = historicVariableUpdate.getVariableName();
    dto.variableInstanceId = historicVariableUpdate.getVariableInstanceId();
    if (historicVariableUpdate.getErrorMessage() == null) {
        VariableValueDto variableValueDto = VariableValueDto.fromTypedValue(historicVariableUpdate.getTypedValue());
        dto.value = variableValueDto.getValue();
        dto.variableType = variableValueDto.getType();
        dto.valueInfo = variableValueDto.getValueInfo();
    } else {
        dto.errorMessage = historicVariableUpdate.getErrorMessage();
        dto.variableType = VariableValueDto.toRestApiTypeName(historicVariableUpdate.getTypeName());
    }
    return dto;
}
Also used : VariableValueDto(org.camunda.bpm.engine.rest.dto.VariableValueDto)

Example 2 with VariableValueDto

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

the class ProcessInstanceWithVariablesDto method fromProcessInstance.

public static ProcessInstanceDto fromProcessInstance(ProcessInstanceWithVariables instance) {
    ProcessInstanceWithVariablesDto result = new ProcessInstanceWithVariablesDto(instance);
    VariableMap variables = instance.getVariables();
    Map<String, VariableValueDto> values = new HashMap<String, VariableValueDto>();
    for (String variableName : variables.keySet()) {
        VariableValueDto valueDto = VariableValueDto.fromTypedValue(variables.getValueTyped(variableName), true);
        values.put(variableName, valueDto);
    }
    result.variables = values;
    return result;
}
Also used : VariableValueDto(org.camunda.bpm.engine.rest.dto.VariableValueDto) VariableMap(org.camunda.bpm.engine.variable.VariableMap) HashMap(java.util.HashMap)

Example 3 with VariableValueDto

use of org.camunda.bpm.engine.rest.dto.VariableValueDto 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)

Example 4 with VariableValueDto

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

the class AbstractVariablesResource method getVariables.

@Override
public Map<String, VariableValueDto> getVariables(boolean deserializeValues) {
    VariableMap variables = getVariableEntities(deserializeValues);
    Map<String, VariableValueDto> values = new HashMap<String, VariableValueDto>();
    for (String variableName : variables.keySet()) {
        VariableValueDto valueDto = VariableValueDto.fromTypedValue(variables.getValueTyped(variableName));
        values.put(variableName, valueDto);
    }
    return values;
}
Also used : VariableValueDto(org.camunda.bpm.engine.rest.dto.VariableValueDto) VariableMap(org.camunda.bpm.engine.variable.VariableMap) HashMap(java.util.HashMap)

Example 5 with VariableValueDto

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

the class DecisionDefinitionResourceImpl method createDecisionResultDto.

protected List<Map<String, VariableValueDto>> createDecisionResultDto(DmnDecisionResult decisionResult) {
    List<Map<String, VariableValueDto>> dto = new ArrayList<Map<String, VariableValueDto>>();
    for (DmnDecisionResultEntries entries : decisionResult) {
        Map<String, VariableValueDto> resultEntriesDto = createResultEntriesDto(entries);
        dto.add(resultEntriesDto);
    }
    return dto;
}
Also used : DmnDecisionResultEntries(org.camunda.bpm.dmn.engine.DmnDecisionResultEntries) VariableValueDto(org.camunda.bpm.engine.rest.dto.VariableValueDto) ArrayList(java.util.ArrayList) Map(java.util.Map) VariableMap(org.camunda.bpm.engine.variable.VariableMap)

Aggregations

VariableValueDto (org.camunda.bpm.engine.rest.dto.VariableValueDto)7 VariableMap (org.camunda.bpm.engine.variable.VariableMap)3 HashMap (java.util.HashMap)2 ArrayList (java.util.ArrayList)1 Map (java.util.Map)1 DmnDecisionResultEntries (org.camunda.bpm.dmn.engine.DmnDecisionResultEntries)1 AuthorizationException (org.camunda.bpm.engine.AuthorizationException)1 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)1 RuntimeService (org.camunda.bpm.engine.RuntimeService)1 InvalidRequestException (org.camunda.bpm.engine.rest.exception.InvalidRequestException)1 RestException (org.camunda.bpm.engine.rest.exception.RestException)1 FormPart (org.camunda.bpm.engine.rest.mapper.MultipartFormData.FormPart)1 SignalEventReceivedBuilder (org.camunda.bpm.engine.runtime.SignalEventReceivedBuilder)1 TypedValue (org.camunda.bpm.engine.variable.value.TypedValue)1