@Test public void testCorrectTaskFormModelIsGeneratedForTaskWithTheInputsAndOutputsBoundToTheSameNamesInSwimlane() { final String TASK_ID = "_9903B013-C42D-486B-A41D-2DEBC60911E3", TASK_NAME = "taskWithTheSameInputsAndOutputs"; final Map<String, String> EXPECTED_TASK_VARIABLES = new HashMap<String, String>() {{ put("_string_", String.class.getName()); put("_integer_", Integer.class.getName()); put("_boolean_", Boolean.class.getName()); put("_float_", Float.class.getName()); put("_object_", Object.class.getName()); put("_dataObject_", DATA_OBJECT_TYPE); put("_customType_", CUSTOM_TYPE); put("_list_", Object.class.getName()); }}; TaskFormModel taskFormModel = generator.generateTaskFormModel(processWithAllVariablesDefinitions, TASK_ID, path); assertTaskFormModelIsCorrect(taskFormModel, PROCESS_WITH_ALL_VARIABLES_ID, TASK_NAME); assertJBPMVariablesAreCorrect(taskFormModel, EXPECTED_TASK_VARIABLES); }
@Override public TaskFormModel generateTaskFormModel(Definitions source, String taskId, Path path) { Process process = getProcess(source); if (process != null) { ProcessTaskFormsGenerationResult generationResult = readUserTaskFormVariables(process); Optional<TaskFormVariables> resultTaskFormVariables = Optional.ofNullable(generationResult.getTaskFormVariablesByTaskId(taskId)); if (resultTaskFormVariables.isPresent()) { TaskFormVariables formVariables = resultTaskFormVariables.get(); if (!formVariables.isValid()) { throw new IllegalStateException(generateErrorMessage(formVariables)); } final ClassLoader projectClassLoader = projectClassLoaderHelper.getModuleClassLoader(moduleService.resolveModule(path)); return formVariables.toFormModel(variable -> createModelProperty(variable, projectClassLoader)); } } return null; }
BPMNFormModelGeneratorImpl implements BPMNFormModelGenerator { @Override public TaskFormModel generateTaskFormModel(Definitions source, String taskId, Path path) { Process process = getProcess(source); if (process != null) { ProcessTaskFormsGenerationResult generationResult = readUserTaskFormVariables(process); Optional<TaskFormVariables> resultTaskFormVariables = Optional.ofNullable(generationResult.getTaskFormVariablesByTaskId(taskId)); if (resultTaskFormVariables.isPresent()) { TaskFormVariables formVariables = resultTaskFormVariables.get(); if (!formVariables.isValid()) { throw new IllegalStateException(generateErrorMessage(formVariables)); } final ClassLoader projectClassLoader = projectClassLoaderHelper.getModuleClassLoader(moduleService.resolveModule(path)); return formVariables.toFormModel(variable -> createModelProperty(variable, projectClassLoader)); } } return null; } }
BPMNFormModelGeneratorImpl implements BPMNFormModelGenerator { @Override public TaskFormModel generateTaskFormModel(Definitions source, String taskId, Path path) { Process process = getProcess(source); if (process != null) { ProcessTaskFormsGenerationResult generationResult = readUserTaskFormVariables(process); Optional<TaskFormVariables> resultTaskFormVariables = Optional.ofNullable(generationResult.getTaskFormVariablesByTaskId(taskId)); if (resultTaskFormVariables.isPresent()) { TaskFormVariables formVariables = resultTaskFormVariables.get(); if (!formVariables.isValid()) { throw new IllegalStateException(generateErrorMessage(formVariables)); } final ClassLoader projectClassLoader = projectClassLoaderHelper.getModuleClassLoader(moduleService.resolveModule(path)); return formVariables.toFormModel(variable -> createModelProperty(variable, projectClassLoader)); } } return null; } @Inject  BPMNFormModelGeneratorImpl(KieModuleService moduleService,
                                      ModuleClassLoaderHelper projectClassLoaderHelper); }
BPMNFormModelGeneratorImpl implements BPMNFormModelGenerator { @Override public TaskFormModel generateTaskFormModel(Definitions source, String taskId, Path path) { Process process = getProcess(source); if (process != null) { ProcessTaskFormsGenerationResult generationResult = readUserTaskFormVariables(process); Optional<TaskFormVariables> resultTaskFormVariables = Optional.ofNullable(generationResult.getTaskFormVariablesByTaskId(taskId)); if (resultTaskFormVariables.isPresent()) { TaskFormVariables formVariables = resultTaskFormVariables.get(); if (!formVariables.isValid()) { throw new IllegalStateException(generateErrorMessage(formVariables)); } final ClassLoader projectClassLoader = projectClassLoaderHelper.getModuleClassLoader(moduleService.resolveModule(path)); return formVariables.toFormModel(variable -> createModelProperty(variable, projectClassLoader)); } } return null; } @Inject  BPMNFormModelGeneratorImpl(KieModuleService moduleService,
                                      ModuleClassLoaderHelper projectClassLoaderHelper); @Override BusinessProcessFormModel generateProcessFormModel(Definitions source,
                                                             Path path); @Override List<TaskFormModel> generateTaskFormModels(Definitions source,
                                                      Path path); @Override TaskFormModel generateTaskFormModel(Definitions source,
                                               String taskId,
                                               Path path); @Override Process getProcess(Definitions source); }
BPMNFormModelGeneratorImpl implements BPMNFormModelGenerator { @Override public TaskFormModel generateTaskFormModel(Definitions source, String taskId, Path path) { Process process = getProcess(source); if (process != null) { ProcessTaskFormsGenerationResult generationResult = readUserTaskFormVariables(process); Optional<TaskFormVariables> resultTaskFormVariables = Optional.ofNullable(generationResult.getTaskFormVariablesByTaskId(taskId)); if (resultTaskFormVariables.isPresent()) { TaskFormVariables formVariables = resultTaskFormVariables.get(); if (!formVariables.isValid()) { throw new IllegalStateException(generateErrorMessage(formVariables)); } final ClassLoader projectClassLoader = projectClassLoaderHelper.getModuleClassLoader(moduleService.resolveModule(path)); return formVariables.toFormModel(variable -> createModelProperty(variable, projectClassLoader)); } } return null; } @Inject  BPMNFormModelGeneratorImpl(KieModuleService moduleService,
                                      ModuleClassLoaderHelper projectClassLoaderHelper); @Override BusinessProcessFormModel generateProcessFormModel(Definitions source,
                                                             Path path); @Override List<TaskFormModel> generateTaskFormModels(Definitions source,
                                                      Path path); @Override TaskFormModel generateTaskFormModel(Definitions source,
                                               String taskId,
                                               Path path); @Override Process getProcess(Definitions source);  }