public Void execute(CommandContext commandContext) { ExecutionEntity execution = commandContext.getExecutionManager().findExecutionById(processInstanceId); VariableInstanceEntity varInstance = (VariableInstanceEntity) execution.getVariableInstance(VARIABLE_NAME); HistoricVariableInstanceEntity historicVariableInstance = commandContext.getHistoricVariableInstanceManager() .findHistoricVariableInstanceByVariableInstanceId(varInstance.getId()); historicByteArrayId[0] = historicVariableInstance.getByteArrayValueId(); return null; } });
@Test public void testHistoricVariableBinary() { byte[] binaryContent = "some binary content".getBytes(); // given Map<String, Object> variables = new HashMap<String, Object>(); variables.put("binaryVariable", binaryContent); Task task = taskService.newTask(); taskService.saveTask(task); taskId = task.getId(); taskService.setVariablesLocal(taskId, variables); String byteArrayValueId = ((HistoricVariableInstanceEntity)historyService.createHistoricVariableInstanceQuery().singleResult()).getByteArrayValueId(); // when ByteArrayEntity byteArrayEntity = configuration.getCommandExecutorTxRequired() .execute(new GetByteArrayCommand(byteArrayValueId)); checkBinary(byteArrayEntity); }
@Test public void testHistoricVariableBinaryForFileValues() { // given BpmnModelInstance instance = createProcess(); testRule.deploy(instance); FileValue fileValue = createFile(); runtimeService.startProcessInstanceByKey("Process", Variables.createVariables().putValueTyped("fileVar", fileValue)); String byteArrayValueId = ((HistoricVariableInstanceEntity)historyService.createHistoricVariableInstanceQuery().singleResult()).getByteArrayValueId(); // when ByteArrayEntity byteArrayEntity = configuration.getCommandExecutorTxRequired() .execute(new GetByteArrayCommand(byteArrayValueId)); checkBinary(byteArrayEntity); }
@Test public void testHistoricVariableBinary() { byte[] binaryContent = "some binary content".getBytes(); // given Map<String, Object> variables = new HashMap<String, Object>(); variables.put("binaryVariable", binaryContent); Task task = taskService.newTask(); taskService.saveTask(task); taskId = task.getId(); taskService.setVariablesLocal(taskId, variables); String byteArrayValueId = ((HistoricVariableInstanceEntity)historyService.createHistoricVariableInstanceQuery().singleResult()).getByteArrayValueId(); // when ByteArrayEntity byteArrayEntity = configuration.getCommandExecutorTxRequired() .execute(new GetByteArrayCommand(byteArrayValueId)); checkBinary(byteArrayEntity); }
public Void execute(CommandContext commandContext) { ExecutionEntity execution = commandContext.getExecutionManager().findExecutionById(processInstanceId); VariableInstanceEntity varInstance = (VariableInstanceEntity) execution.getVariableInstance(VARIABLE_NAME); HistoricVariableInstanceEntity historicVariableInstance = commandContext.getHistoricVariableInstanceManager() .findHistoricVariableInstanceByVariableInstanceId(varInstance.getId()); historicByteArrayId[0] = historicVariableInstance.getByteArrayValueId(); return null; } });
@Test public void testHistoricVariableBinaryForFileValues() { // given BpmnModelInstance instance = createProcess(); testRule.deploy(instance); FileValue fileValue = createFile(); runtimeService.startProcessInstanceByKey("Process", Variables.createVariables().putValueTyped("fileVar", fileValue)); String byteArrayValueId = ((HistoricVariableInstanceEntity)historyService.createHistoricVariableInstanceQuery().singleResult()).getByteArrayValueId(); // when ByteArrayEntity byteArrayEntity = configuration.getCommandExecutorTxRequired() .execute(new GetByteArrayCommand(byteArrayValueId)); checkBinary(byteArrayEntity); }