@Override public String toString() { return this.getClass().getSimpleName() + "[id=" + id + ", revision=" + revision + ", name=" + name + ", processInstanceId=" + processInstanceId + ", executionId=" + executionId + ", caseInstanceId=" + caseInstanceId + ", caseExecutionId=" + caseExecutionId + ", taskId=" + taskId + ", activityInstanceId=" + activityInstanceId + ", tenantId=" + tenantId + ", longValue=" + longValue + ", doubleValue=" + doubleValue + ", textValue=" + textValue + ", textValue2=" + textValue2 + ", byteArrayValueId=" + getByteArrayValueId() + ", configuration=" + configuration + ", isConcurrentLocal=" + isConcurrentLocal + "]"; }
@Override public String toString() { return this.getClass().getSimpleName() + "[id=" + id + ", revision=" + revision + ", name=" + name + ", processInstanceId=" + processInstanceId + ", executionId=" + executionId + ", caseInstanceId=" + caseInstanceId + ", caseExecutionId=" + caseExecutionId + ", taskId=" + taskId + ", activityInstanceId=" + activityInstanceId + ", tenantId=" + tenantId + ", longValue=" + longValue + ", doubleValue=" + doubleValue + ", textValue=" + textValue + ", textValue2=" + textValue2 + ", byteArrayValueId=" + getByteArrayValueId() + ", configuration=" + configuration + ", isConcurrentLocal=" + isConcurrentLocal + "]"; }
@Override public Map<String, Class> getReferencedEntitiesIdAndClass() { Map<String, Class> referenceIdAndClass = new HashMap<String, Class>(); if (processInstanceId != null){ referenceIdAndClass.put(processInstanceId, ExecutionEntity.class); } if (executionId != null){ referenceIdAndClass.put(executionId, ExecutionEntity.class); } if (caseInstanceId != null){ referenceIdAndClass.put(caseInstanceId, CaseExecutionEntity.class); } if (caseExecutionId != null){ referenceIdAndClass.put(caseExecutionId, CaseExecutionEntity.class); } if (getByteArrayValueId() != null){ referenceIdAndClass.put(getByteArrayValueId(), ByteArrayEntity.class); } return referenceIdAndClass; } }
@Override public Map<String, Class> getReferencedEntitiesIdAndClass() { Map<String, Class> referenceIdAndClass = new HashMap<String, Class>(); if (processInstanceId != null){ referenceIdAndClass.put(processInstanceId, ExecutionEntity.class); } if (executionId != null){ referenceIdAndClass.put(executionId, ExecutionEntity.class); } if (caseInstanceId != null){ referenceIdAndClass.put(caseInstanceId, CaseExecutionEntity.class); } if (caseExecutionId != null){ referenceIdAndClass.put(caseExecutionId, CaseExecutionEntity.class); } if (getByteArrayValueId() != null){ referenceIdAndClass.put(getByteArrayValueId(), ByteArrayEntity.class); } return referenceIdAndClass; } }
@Override public Void execute(CommandContext commandContext) { //create a variable VariableInstanceEntity variable = VariableInstanceEntity.createAndInsert("aVariable", Variables.byteArrayValue(new byte[0])); String byteArrayId = variable.getByteArrayValueId(); //delete the variable variable.delete(); //check if the variable is deleted transient //-> no insert and delete stmt will be flushed DbEntityManager dbEntityManager = commandContext.getDbEntityManager(); CachedDbEntity cachedEntity = dbEntityManager.getDbEntityCache().getCachedEntity(ByteArrayEntity.class, byteArrayId); DbEntityState entityState = cachedEntity.getEntityState(); assertEquals(DbEntityState.DELETED_TRANSIENT, entityState); return null; } });
@Test public void testVariableBinary() { 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); id = task.getId(); taskService.setVariablesLocal(id, variables); String byteArrayValueId = ((VariableInstanceEntity)runtimeService.createVariableInstanceQuery().singleResult()).getByteArrayValueId(); // when ByteArrayEntity byteArrayEntity = configuration.getCommandExecutorTxRequired() .execute(new GetByteArrayCommand(byteArrayValueId)); checkBinary(byteArrayEntity); }
@Override public String toString() { return this.getClass().getSimpleName() + "[id=" + id + ", revision=" + revision + ", name=" + name + ", processInstanceId=" + processInstanceId + ", executionId=" + executionId + ", caseInstanceId=" + caseInstanceId + ", caseExecutionId=" + caseExecutionId + ", taskId=" + taskId + ", activityInstanceId=" + activityInstanceId + ", tenantId=" + tenantId + ", longValue=" + longValue + ", doubleValue=" + doubleValue + ", textValue=" + textValue + ", textValue2=" + textValue2 + ", byteArrayValueId=" + getByteArrayValueId() + ", configuration=" + configuration + ", isConcurrentLocal=" + isConcurrentLocal + "]"; }
@Override public Map<String, Class> getReferencedEntitiesIdAndClass() { Map<String, Class> referenceIdAndClass = new HashMap<String, Class>(); if (processInstanceId != null){ referenceIdAndClass.put(processInstanceId, ExecutionEntity.class); } if (executionId != null){ referenceIdAndClass.put(executionId, ExecutionEntity.class); } if (caseInstanceId != null){ referenceIdAndClass.put(caseInstanceId, CaseExecutionEntity.class); } if (caseExecutionId != null){ referenceIdAndClass.put(caseExecutionId, CaseExecutionEntity.class); } if (getByteArrayValueId() != null){ referenceIdAndClass.put(getByteArrayValueId(), ByteArrayEntity.class); } return referenceIdAndClass; } }
public Void execute(CommandContext commandContext) { ExecutionEntity execution = commandContext.getExecutionManager() .findExecutionById(executionId); // fetch the variable instance but not the value (make sure the byte array is lazily fetched) VariableInstanceEntity varInstance = (VariableInstanceEntity) execution.getVariableInstanceLocal(varName); String byteArrayValueId = varInstance.getByteArrayValueId(); assertNotNull("Byte array id is expected to be not null", byteArrayValueId); CachedDbEntity cachedByteArray = commandContext.getDbEntityManager().getDbEntityCache() .getCachedEntity(ByteArrayEntity.class, byteArrayValueId); assertNull("Byte array is expected to be not fetched yet / lazily fetched.", cachedByteArray); monitor.sync(); // now update the value execution.setVariableLocal(varInstance.getName(), newValue); return null; }
public Void execute(CommandContext commandContext) { ExecutionEntity execution = commandContext.getExecutionManager() .findExecutionById(executionId); // fetch the variable instance but not the value (make sure the byte array is lazily fetched) VariableInstanceEntity varInstance = (VariableInstanceEntity) execution.getVariableInstanceLocal(varName); String byteArrayValueId = varInstance.getByteArrayValueId(); assertNotNull("Byte array id is expected to be not null", byteArrayValueId); CachedDbEntity cachedByteArray = commandContext.getDbEntityManager().getDbEntityCache() .getCachedEntity(ByteArrayEntity.class, byteArrayValueId); assertNull("Byte array is expected to be not fetched yet / lazily fetched.", cachedByteArray); monitor.sync(); // now trigger the fetching of the byte array Object value = varInstance.getValue(); assertNull("Expecting the value to be null (deleted)", value); return null; }
@Test public void testVariableBinaryForFileValues() { // given BpmnModelInstance instance = createProcess(); testRule.deploy(instance); FileValue fileValue = createFile(); runtimeService.startProcessInstanceByKey("Process", Variables.createVariables().putValueTyped("fileVar", fileValue)); String byteArrayValueId = ((VariableInstanceEntity)runtimeService.createVariableInstanceQuery().singleResult()).getByteArrayValueId(); // when ByteArrayEntity byteArrayEntity = configuration.getCommandExecutorTxRequired() .execute(new GetByteArrayCommand(byteArrayValueId)); checkBinary(byteArrayEntity); }
evt.setDoubleValue(variableInstance.getDoubleValue()); evt.setLongValue(variableInstance.getLongValue()); if (variableInstance.getByteArrayValueId() != null) { evt.setByteValue(variableInstance.getByteArrayValue());
evt.setDoubleValue(variableInstance.getDoubleValue()); evt.setLongValue(variableInstance.getLongValue()); if (variableInstance.getByteArrayValueId() != null) { evt.setByteValue(variableInstance.getByteArrayValue());
@Override public Void execute(CommandContext commandContext) { //create a variable VariableInstanceEntity variable = VariableInstanceEntity.createAndInsert("aVariable", Variables.byteArrayValue(new byte[0])); String byteArrayId = variable.getByteArrayValueId(); //delete the variable variable.delete(); //check if the variable is deleted transient //-> no insert and delete stmt will be flushed DbEntityManager dbEntityManager = commandContext.getDbEntityManager(); CachedDbEntity cachedEntity = dbEntityManager.getDbEntityCache().getCachedEntity(ByteArrayEntity.class, byteArrayId); DbEntityState entityState = cachedEntity.getEntityState(); assertEquals(DbEntityState.DELETED_TRANSIENT, entityState); return null; } });
@Test public void testVariableBinary() { 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); id = task.getId(); taskService.setVariablesLocal(id, variables); String byteArrayValueId = ((VariableInstanceEntity)runtimeService.createVariableInstanceQuery().singleResult()).getByteArrayValueId(); // when ByteArrayEntity byteArrayEntity = configuration.getCommandExecutorTxRequired() .execute(new GetByteArrayCommand(byteArrayValueId)); checkBinary(byteArrayEntity); }
public Void execute(CommandContext commandContext) { ExecutionEntity execution = commandContext.getExecutionManager() .findExecutionById(executionId); // fetch the variable instance but not the value (make sure the byte array is lazily fetched) VariableInstanceEntity varInstance = (VariableInstanceEntity) execution.getVariableInstanceLocal(varName); String byteArrayValueId = varInstance.getByteArrayValueId(); assertNotNull("Byte array id is expected to be not null", byteArrayValueId); CachedDbEntity cachedByteArray = commandContext.getDbEntityManager().getDbEntityCache() .getCachedEntity(ByteArrayEntity.class, byteArrayValueId); assertNull("Byte array is expected to be not fetched yet / lazily fetched.", cachedByteArray); monitor.sync(); // now update the value execution.setVariableLocal(varInstance.getName(), newValue); return null; }
public Void execute(CommandContext commandContext) { ExecutionEntity execution = commandContext.getExecutionManager() .findExecutionById(executionId); // fetch the variable instance but not the value (make sure the byte array is lazily fetched) VariableInstanceEntity varInstance = (VariableInstanceEntity) execution.getVariableInstanceLocal(varName); String byteArrayValueId = varInstance.getByteArrayValueId(); assertNotNull("Byte array id is expected to be not null", byteArrayValueId); CachedDbEntity cachedByteArray = commandContext.getDbEntityManager().getDbEntityCache() .getCachedEntity(ByteArrayEntity.class, byteArrayValueId); assertNull("Byte array is expected to be not fetched yet / lazily fetched.", cachedByteArray); monitor.sync(); // now trigger the fetching of the byte array Object value = varInstance.getValue(); assertNull("Expecting the value to be null (deleted)", value); return null; }
@Test public void testVariableBinaryForFileValues() { // given BpmnModelInstance instance = createProcess(); testRule.deploy(instance); FileValue fileValue = createFile(); runtimeService.startProcessInstanceByKey("Process", Variables.createVariables().putValueTyped("fileVar", fileValue)); String byteArrayValueId = ((VariableInstanceEntity)runtimeService.createVariableInstanceQuery().singleResult()).getByteArrayValueId(); // when ByteArrayEntity byteArrayEntity = configuration.getCommandExecutorTxRequired() .execute(new GetByteArrayCommand(byteArrayValueId)); checkBinary(byteArrayEntity); }
evt.setDoubleValue(variableInstance.getDoubleValue()); evt.setLongValue(variableInstance.getLongValue()); if (variableInstance.getByteArrayValueId() != null) { evt.setByteValue(variableInstance.getByteArrayValue());