@Test public void calculateInputVariablesShouldPassAllVariablesWhenThereIsNoMapping() throws Exception { ObjectMapper objectMapper = new ObjectMapper(); ProcessExtensionModel extensions = objectMapper.readValue(new File("src/test/resources/task-variable-no-mapping-extensions.json"), ProcessExtensionModel.class); Extension processExtensions = extensions.getExtensions("Process_taskVariableNoMapping"); DelegateExecution execution = buildExecution(processExtensions); ExpressionResolver expressionResolver = ExpressionResolverHelper.initContext(execution, processExtensions); ReflectionTestUtils.setField(variablesMappingProvider, "expressionResolver", expressionResolver); Map<String, Object> variables = map( "var-one", "one", "var-two", 2 ); given(execution.getVariables()).willReturn(variables); Map<String, Object> inputVariables = variablesMappingProvider.calculateInputVariables(execution); assertThat(inputVariables).isEqualTo(variables); }
public Map<String, Object> calculateInputVariables(DelegateExecution execution) { Extension extensions = processExtensionService.getExtensionsForId(execution.getProcessDefinitionId()); Map<String, Object> constants = calculateConstants(execution, extensions); if (!extensions.hasMapping(execution.getCurrentActivityId())) { return constants; } Map<String, Object> inboundVariables; if (extensions.shouldMapAllInputs(execution.getCurrentActivityId())) { inboundVariables = execution.getVariables(); } else { inboundVariables = calculateInputVariables(execution, extensions); } inboundVariables = expressionResolver.resolveExpressionsMap(new VariableScopeExpressionEvaluator(execution), inboundVariables); inboundVariables.putAll(constants); return inboundVariables; }
ExtensionsVariablesMappingProvider implements VariablesCalculator { public Map<String, Object> calculateInputVariables(DelegateExecution execution) { Extension extensions = processExtensionService.getExtensionsForId(execution.getProcessDefinitionId()); Map<String, Object> constants = calculateConstants(execution, extensions); if (!extensions.hasMapping(execution.getCurrentActivityId())) { return constants; } Map<String, Object> inboundVariables; if (extensions.shouldMapAllInputs(execution.getCurrentActivityId())) { inboundVariables = execution.getVariables(); } else { inboundVariables = calculateInputVariables(execution, extensions); } inboundVariables = expressionResolver.resolveExpressionsMap(new VariableScopeExpressionEvaluator(execution), inboundVariables); inboundVariables.putAll(constants); return inboundVariables; } }
ExtensionsVariablesMappingProvider implements VariablesCalculator { public Map<String, Object> calculateInputVariables(DelegateExecution execution) { Extension extensions = processExtensionService.getExtensionsForId(execution.getProcessDefinitionId()); Map<String, Object> constants = calculateConstants(execution, extensions); if (!extensions.hasMapping(execution.getCurrentActivityId())) { return constants; } Map<String, Object> inboundVariables; if (extensions.shouldMapAllInputs(execution.getCurrentActivityId())) { inboundVariables = execution.getVariables(); } else { inboundVariables = calculateInputVariables(execution, extensions); } inboundVariables = expressionResolver.resolveExpressionsMap(new VariableScopeExpressionEvaluator(execution), inboundVariables); inboundVariables.putAll(constants); return inboundVariables; } ExtensionsVariablesMappingProvider(ProcessExtensionService processExtensionService,
                                    ExpressionResolver expressionResolver); }
ExtensionsVariablesMappingProvider implements VariablesCalculator { public Map<String, Object> calculateInputVariables(DelegateExecution execution) { Extension extensions = processExtensionService.getExtensionsForId(execution.getProcessDefinitionId()); Map<String, Object> constants = calculateConstants(execution, extensions); if (!extensions.hasMapping(execution.getCurrentActivityId())) { return constants; } Map<String, Object> inboundVariables; if (extensions.shouldMapAllInputs(execution.getCurrentActivityId())) { inboundVariables = execution.getVariables(); } else { inboundVariables = calculateInputVariables(execution, extensions); } inboundVariables = expressionResolver.resolveExpressionsMap(new VariableScopeExpressionEvaluator(execution), inboundVariables); inboundVariables.putAll(constants); return inboundVariables; } ExtensionsVariablesMappingProvider(ProcessExtensionService processExtensionService,
                                    ExpressionResolver expressionResolver); Map<String, Object> calculateInputVariables(DelegateExecution execution); Map<String, Object> calculateOutPutVariables(MappingExecutionContext mappingExecutionContext,
                                                        Map<String, Object> availableVariables); }
ExtensionsVariablesMappingProvider implements VariablesCalculator { public Map<String, Object> calculateInputVariables(DelegateExecution execution) { Extension extensions = processExtensionService.getExtensionsForId(execution.getProcessDefinitionId()); Map<String, Object> constants = calculateConstants(execution, extensions); if (!extensions.hasMapping(execution.getCurrentActivityId())) { return constants; } Map<String, Object> inboundVariables; if (extensions.shouldMapAllInputs(execution.getCurrentActivityId())) { inboundVariables = execution.getVariables(); } else { inboundVariables = calculateInputVariables(execution, extensions); } inboundVariables = expressionResolver.resolveExpressionsMap(new VariableScopeExpressionEvaluator(execution), inboundVariables); inboundVariables.putAll(constants); return inboundVariables; } ExtensionsVariablesMappingProvider(ProcessExtensionService processExtensionService,
                                    ExpressionResolver expressionResolver); Map<String, Object> calculateInputVariables(DelegateExecution execution); Map<String, Object> calculateOutPutVariables(MappingExecutionContext mappingExecutionContext,
                                                        Map<String, Object> availableVariables);  }