use of org.camunda.bpm.engine.variable.VariableMap 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;
}
use of org.camunda.bpm.engine.variable.VariableMap in project camunda-bpm-platform by camunda.
the class ExternalTaskResourceImpl method complete.
@Override
public void complete(CompleteExternalTaskDto dto) {
ExternalTaskService externalTaskService = engine.getExternalTaskService();
VariableMap variables = VariableValueDto.toMap(dto.getVariables(), engine, objectMapper);
VariableMap localVariables = VariableValueDto.toMap(dto.getLocalVariables(), engine, objectMapper);
try {
externalTaskService.complete(externalTaskId, dto.getWorkerId(), variables, localVariables);
} catch (NotFoundException e) {
throw new RestException(Status.NOT_FOUND, e, "External task with id " + externalTaskId + " does not exist");
} catch (BadUserRequestException e) {
throw new RestException(Status.BAD_REQUEST, e, e.getMessage());
}
}
use of org.camunda.bpm.engine.variable.VariableMap in project camunda-bpm-platform by camunda.
the class MockProvider method createMockFormVariables.
public static VariableMap createMockFormVariables() {
VariableMap mock = Variables.createVariables();
mock.putValueTyped(EXAMPLE_VARIABLE_INSTANCE_NAME, EXAMPLE_PRIMITIVE_VARIABLE_VALUE);
return mock;
}
use of org.camunda.bpm.engine.variable.VariableMap in project camunda-bpm-platform by camunda.
the class ThrowSignalEventActivityBehavior method execute.
@Override
public void execute(ActivityExecution execution) throws Exception {
String businessKey = signalDefinition.getEventPayload().getBusinessKey(execution);
VariableMap variableMap = signalDefinition.getEventPayload().getInputVariables(execution);
String eventName = signalDefinition.resolveExpressionOfEventName(execution);
// trigger all event subscriptions for the signal (start and intermediate)
List<EventSubscriptionEntity> signalEventSubscriptions = findSignalEventSubscriptions(eventName, execution.getTenantId());
for (EventSubscriptionEntity signalEventSubscription : signalEventSubscriptions) {
if (isActiveEventSubscription(signalEventSubscription)) {
signalEventSubscription.eventReceived(variableMap, businessKey, signalDefinition.isAsync());
}
}
leave(execution);
}
use of org.camunda.bpm.engine.variable.VariableMap in project camunda-bpm-platform by camunda.
the class HistoricDecisionInstanceSerializationTest method testListJsonProperty.
@Deployment(resources = { "org/camunda/spin/plugin/DecisionSingleOutput.dmn11.xml" })
public void testListJsonProperty() {
JsonListSerializable<String> list = new JsonListSerializable<String>();
list.addElement("foo");
ObjectValue objectValue = Variables.objectValue(list).serializationDataFormat(DataFormats.JSON_DATAFORMAT_NAME).create();
VariableMap variables = Variables.createVariables().putValueTyped("input1", objectValue);
decisionService.evaluateDecisionTableByKey("testDecision", variables);
HistoricDecisionInstance testDecision = historyService.createHistoricDecisionInstanceQuery().decisionDefinitionKey("testDecision").includeInputs().includeOutputs().singleResult();
assertNotNull(testDecision);
List<HistoricDecisionInputInstance> inputs = testDecision.getInputs();
assertEquals(1, inputs.size());
HistoricDecisionInputInstance inputInstance = inputs.get(0);
assertEquals(list.getListProperty(), inputInstance.getValue());
List<HistoricDecisionOutputInstance> outputs = testDecision.getOutputs();
assertEquals(1, outputs.size());
HistoricDecisionOutputInstance outputInstance = outputs.get(0);
assertEquals(list.getListProperty(), outputInstance.getValue());
}
Aggregations