@Override protected TypedValue transformQueryResultIntoTypedValue(VariableInstance queryResult) { return queryResult.getTypedValue(); }
@Override protected TypedValue transformQueryResultIntoTypedValue(VariableInstance queryResult) { return queryResult.getTypedValue(); }
public static HalVariableValue fromVariableInstance(VariableInstance variableInstance) { HalVariableValue dto = new HalVariableValue(); VariableValueDto variableValueDto = VariableValueDto.fromTypedValue(variableInstance.getTypedValue()); dto.name = variableInstance.getName(); dto.value = variableValueDto.getValue(); dto.type = variableValueDto.getType(); dto.valueInfo = variableValueDto.getValueInfo(); return dto; }
public static HalVariableValue fromVariableInstance(VariableInstance variableInstance) { HalVariableValue dto = new HalVariableValue(); VariableValueDto variableValueDto = VariableValueDto.fromTypedValue(variableInstance.getTypedValue()); dto.name = variableInstance.getName(); dto.value = variableValueDto.getValue(); dto.type = variableValueDto.getType(); dto.valueInfo = variableValueDto.getValueInfo(); return dto; }
protected <T extends VariableInstance> T build(T mockVariable) { when(mockVariable.getId()).thenReturn(id); when(mockVariable.getName()).thenReturn(name); when(mockVariable.getTypeName()).thenReturn(typedValue.getType().getName()); if (ObjectValue.class.isAssignableFrom(typedValue.getClass())) { ObjectValue objectValue = (ObjectValue) typedValue; if (objectValue.isDeserialized()) { when(mockVariable.getValue()).thenReturn(typedValue.getValue()); } else { when(mockVariable.getValue()).thenReturn(null); } } else { when(mockVariable.getValue()).thenReturn(typedValue.getValue()); } when(mockVariable.getTypedValue()).thenReturn(typedValue); when(mockVariable.getProcessInstanceId()).thenReturn(processInstanceId); when(mockVariable.getExecutionId()).thenReturn(executionId); when(mockVariable.getCaseInstanceId()).thenReturn(caseInstanceId); when(mockVariable.getCaseExecutionId()).thenReturn(caseExecutionId); when(mockVariable.getTaskId()).thenReturn(taskId); when(mockVariable.getActivityInstanceId()).thenReturn(activityInstanceId); when(mockVariable.getTenantId()).thenReturn(tenantId); when(mockVariable.getErrorMessage()).thenReturn(errorMessage); return mockVariable; }
@Override protected TypedValue transformQueryResultIntoTypedValue(VariableInstance queryResult) { return queryResult.getTypedValue(); }
public static DelegateCaseVariableInstanceImpl fromVariableInstance(VariableInstance variableInstance) { DelegateCaseVariableInstanceImpl delegateInstance = new DelegateCaseVariableInstanceImpl(); delegateInstance.variableId = variableInstance.getId(); delegateInstance.processInstanceId = variableInstance.getProcessInstanceId(); delegateInstance.executionId = variableInstance.getExecutionId(); delegateInstance.caseExecutionId = variableInstance.getCaseExecutionId(); delegateInstance.caseInstanceId = variableInstance.getCaseInstanceId(); delegateInstance.taskId = variableInstance.getTaskId(); delegateInstance.activityInstanceId = variableInstance.getActivityInstanceId(); delegateInstance.tenantId = variableInstance.getTenantId(); delegateInstance.errorMessage = variableInstance.getErrorMessage(); delegateInstance.name = variableInstance.getName(); delegateInstance.value = variableInstance.getTypedValue(); return delegateInstance; }
public static DelegateCaseVariableInstanceImpl fromVariableInstance(VariableInstance variableInstance) { DelegateCaseVariableInstanceImpl delegateInstance = new DelegateCaseVariableInstanceImpl(); delegateInstance.variableId = variableInstance.getId(); delegateInstance.processInstanceId = variableInstance.getProcessInstanceId(); delegateInstance.executionId = variableInstance.getExecutionId(); delegateInstance.caseExecutionId = variableInstance.getCaseExecutionId(); delegateInstance.caseInstanceId = variableInstance.getCaseInstanceId(); delegateInstance.taskId = variableInstance.getTaskId(); delegateInstance.activityInstanceId = variableInstance.getActivityInstanceId(); delegateInstance.tenantId = variableInstance.getTenantId(); delegateInstance.errorMessage = variableInstance.getErrorMessage(); delegateInstance.name = variableInstance.getName(); delegateInstance.value = variableInstance.getTypedValue(); return delegateInstance; }
public static VariableInstanceDto fromVariableInstance(VariableInstance variableInstance) { VariableInstanceDto dto = new VariableInstanceDto(); dto.id = variableInstance.getId(); dto.name = variableInstance.getName(); dto.processInstanceId = variableInstance.getProcessInstanceId(); dto.executionId = variableInstance.getExecutionId(); dto.caseExecutionId = variableInstance.getCaseExecutionId(); dto.caseInstanceId = variableInstance.getCaseInstanceId(); dto.taskId = variableInstance.getTaskId(); dto.activityInstanceId = variableInstance.getActivityInstanceId(); dto.tenantId = variableInstance.getTenantId(); if(variableInstance.getErrorMessage() == null) { VariableValueDto.fromTypedValue(dto, variableInstance.getTypedValue()); } else { dto.errorMessage = variableInstance.getErrorMessage(); dto.type = VariableValueDto.toRestApiTypeName(variableInstance.getTypeName()); } return dto; }
public static VariableInstanceDto fromVariableInstance(VariableInstance variableInstance) { VariableInstanceDto dto = new VariableInstanceDto(); dto.id = variableInstance.getId(); dto.name = variableInstance.getName(); dto.processInstanceId = variableInstance.getProcessInstanceId(); dto.executionId = variableInstance.getExecutionId(); dto.caseExecutionId = variableInstance.getCaseExecutionId(); dto.caseInstanceId = variableInstance.getCaseInstanceId(); dto.taskId = variableInstance.getTaskId(); dto.activityInstanceId = variableInstance.getActivityInstanceId(); dto.tenantId = variableInstance.getTenantId(); if(variableInstance.getErrorMessage() == null) { VariableValueDto.fromTypedValue(dto, variableInstance.getTypedValue()); } else { dto.errorMessage = variableInstance.getErrorMessage(); dto.type = VariableValueDto.toRestApiTypeName(variableInstance.getTypeName()); } return dto; }
@Test public void testSerializeFileVariable() { BpmnModelInstance modelInstance = Bpmn.createExecutableProcess("process").startEvent().userTask().endEvent().done(); org.camunda.bpm.engine.repository.Deployment deployment = repositoryService.createDeployment().addModelInstance("process.bpmn", modelInstance).deploy(); VariableMap variables = Variables.createVariables(); String filename = "test.txt"; String type = "text/plain"; FileValue fileValue = Variables.fileValue(filename).file("ABC".getBytes()).encoding("UTF-8").mimeType(type).create(); variables.put("file", fileValue); runtimeService.startProcessInstanceByKey("process", variables); Task task = taskService.createTaskQuery().singleResult(); VariableInstance result = runtimeService.createVariableInstanceQuery().processInstanceIdIn(task.getProcessInstanceId()).singleResult(); FileValue value = (FileValue) result.getTypedValue(); assertThat(value.getFilename(), is(filename)); assertThat(value.getMimeType(), is(type)); assertThat(value.getEncoding(), is("UTF-8")); assertThat(value.getEncodingAsCharset(), is(Charset.forName("UTF-8"))); Scanner scanner = new Scanner(value.getValue()); assertThat(scanner.nextLine(), is("ABC")); // clean up repositoryService.deleteDeployment(deployment.getId(), true); }
assertNull(variableInstance.getErrorMessage()); ObjectValue typedValue = (ObjectValue) variableInstance.getTypedValue(); assertNotNull(typedValue); assertFalse(typedValue.isDeserialized());
assertEquals(stringValue("abc"), variable.getTypedValue()); } else if (variable.getName().equals("anotherVariableName")) { assertEquals("anotherVariableName", variable.getName()); assertEquals(integerValue(null), variable.getTypedValue()); } else if (variable.getName().equals("aThirdVariable")) { assertEquals("aThirdVariable", variable.getName()); assertEquals(booleanValue(null), variable.getTypedValue()); } else { fail("Unexpected variable: " + variable.getName());
assertEquals(stringValue("abc"), variable.getTypedValue()); } else if (variable.getName().equals("anotherVariableName")) { assertEquals("anotherVariableName", variable.getName()); assertEquals(integerValue(null), variable.getTypedValue()); } else { fail("Unexpected variable: " + variable.getName());
assertEquals(stringValue("abc"), variable.getTypedValue()); } else if (variable.getName().equals("anotherVariableName")) { assertEquals("anotherVariableName", variable.getName()); assertEquals(integerValue(null), variable.getTypedValue()); } else { fail("Unexpected variable: " + variable.getName());
assertEquals(stringValue("abc"), variable.getTypedValue()); } else if (variable.getName().equals("anotherVariableName")) { assertEquals("anotherVariableName", variable.getName()); assertEquals(integerValue(null), variable.getTypedValue()); } else { fail("Unexpected variable: " + variable.getName());
FileValue typedValue = (FileValue) fileVariableInstance.getTypedValue(); assertNull(typedValue.getValue());
public static HalVariableValue fromVariableInstance(VariableInstance variableInstance) { HalVariableValue dto = new HalVariableValue(); VariableValueDto variableValueDto = VariableValueDto.fromTypedValue(variableInstance.getTypedValue()); dto.name = variableInstance.getName(); dto.value = variableValueDto.getValue(); dto.type = variableValueDto.getType(); dto.valueInfo = variableValueDto.getValueInfo(); return dto; }
public static DelegateCaseVariableInstanceImpl fromVariableInstance(VariableInstance variableInstance) { DelegateCaseVariableInstanceImpl delegateInstance = new DelegateCaseVariableInstanceImpl(); delegateInstance.variableId = variableInstance.getId(); delegateInstance.processInstanceId = variableInstance.getProcessInstanceId(); delegateInstance.executionId = variableInstance.getExecutionId(); delegateInstance.caseExecutionId = variableInstance.getCaseExecutionId(); delegateInstance.caseInstanceId = variableInstance.getCaseInstanceId(); delegateInstance.taskId = variableInstance.getTaskId(); delegateInstance.activityInstanceId = variableInstance.getActivityInstanceId(); delegateInstance.tenantId = variableInstance.getTenantId(); delegateInstance.errorMessage = variableInstance.getErrorMessage(); delegateInstance.name = variableInstance.getName(); delegateInstance.value = variableInstance.getTypedValue(); return delegateInstance; }
public static VariableInstanceDto fromVariableInstance(VariableInstance variableInstance) { VariableInstanceDto dto = new VariableInstanceDto(); dto.id = variableInstance.getId(); dto.name = variableInstance.getName(); dto.processInstanceId = variableInstance.getProcessInstanceId(); dto.executionId = variableInstance.getExecutionId(); dto.caseExecutionId = variableInstance.getCaseExecutionId(); dto.caseInstanceId = variableInstance.getCaseInstanceId(); dto.taskId = variableInstance.getTaskId(); dto.activityInstanceId = variableInstance.getActivityInstanceId(); dto.tenantId = variableInstance.getTenantId(); if(variableInstance.getErrorMessage() == null) { VariableValueDto.fromTypedValue(dto, variableInstance.getTypedValue()); } else { dto.errorMessage = variableInstance.getErrorMessage(); dto.type = VariableValueDto.toRestApiTypeName(variableInstance.getTypeName()); } return dto; }