@Test public void testGenerateTaskFormModelForTaskWithSharedForm() { final String[] TASK_IDS = new String[]{"_77BDDEC9-0D5E-4C46-8AD6-1B528836A22B", "_C976E341-8E35-42C7-B878-67049CE63E5F", "_27F23135-87E9-47C5-9B97-DA793699E8CF"}; final String TASK_NAME = "task"; TaskFormModel[] generatedModels = new TaskFormModel[TASK_IDS.length]; for (int i = 0; i < TASK_IDS.length; i++) { generatedModels[i] = generator.generateTaskFormModel(processWithSharedForms, TASK_IDS[i], path); assertNotNull(generatedModels[i]); assertTaskFormModelIsCorrect(generatedModels[i], PROCESS_WITH_SHARED_FORMS_ID, TASK_NAME); checkExpectedMergedFormVariables(generatedModels[i]); } }
@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);  }