use of org.kie.workbench.common.forms.jbpm.model.authoring.process.BusinessProcessFormModel in project kie-wb-common by kiegroup.
the class BusinessProcessFormModelHandlerTest method init.
@Before
public void init() throws ClassNotFoundException {
super.init();
model = new BusinessProcessFormModel(PROCESS_ID, PROCESS_ID, propertyList);
handler = new BusinessProcessFormModelHandler(moduleService, moduleClassLoaderHelper, new TestFieldManager(), finderService);
handler.init(model, path);
}
use of org.kie.workbench.common.forms.jbpm.model.authoring.process.BusinessProcessFormModel in project kie-wb-common by kiegroup.
the class BPMNFormModelGeneratorImpl method generateProcessFormModel.
@Override
public BusinessProcessFormModel generateProcessFormModel(Definitions source, Path path) {
Process process = getProcess(source);
if (process != null) {
final ClassLoader projectClassLoader = projectClassLoaderHelper.getModuleClassLoader(moduleService.resolveModule(path));
List<ModelProperty> properties = process.getProperties().stream().map(property -> {
String varName = property.getId();
String varType = BPMNVariableUtils.getRealTypeForInput(property.getItemSubjectRef().getStructureRef());
Variable variable = new Variable(varName, varType);
variable.setInput(true);
variable.setOutput(true);
return createModelProperty(variable, projectClassLoader);
}).filter(modelProperty -> modelProperty != null).sorted((property1, property2) -> property1.getName().compareToIgnoreCase(property2.getName())).collect(Collectors.toList());
return new BusinessProcessFormModel(process.getId(), process.getName(), properties);
}
return null;
}
use of org.kie.workbench.common.forms.jbpm.model.authoring.process.BusinessProcessFormModel in project kie-wb-common by kiegroup.
the class FormDefinitionGeneratorImpl method generateProcessForm.
@Override
public void generateProcessForm(Diagram diagram) {
try {
LOGGER.finest("Generating form for process ");
final Definitions definitions = toDefinitions(diagram);
final Path path = diagram.getMetadata().getPath();
final BusinessProcessFormModel formModel = bpmnFormModelGenerator.generateProcessFormModel(definitions, path);
createFormForModel(formModel, Paths.convert(path));
} catch (Exception ex) {
LOGGER.severe("Error generating process form");
throw new RuntimeException(ex);
}
}
use of org.kie.workbench.common.forms.jbpm.model.authoring.process.BusinessProcessFormModel in project kie-wb-common by kiegroup.
the class FormDefinitionGeneratorImpl method generateAllForms.
@Override
public void generateAllForms(Diagram diagram) {
try {
LOGGER.finest("Generating all forms");
final Path path = diagram.getMetadata().getPath();
final org.uberfire.java.nio.file.Path nioPath = Paths.convert(path);
ioService.startBatch(ioService.getFileSystem(nioPath.toUri()));
final Definitions definitions = toDefinitions(diagram);
final BusinessProcessFormModel processFormModel = bpmnFormModelGenerator.generateProcessFormModel(definitions, path);
createFormForModel(processFormModel, nioPath);
List<TaskFormModel> taskFormModels = bpmnFormModelGenerator.generateTaskFormModels(definitions, path);
for (TaskFormModel taskFormModel : taskFormModels) {
createFormForModel(taskFormModel, nioPath);
}
} catch (Exception ex) {
LOGGER.severe("Error generating all diagram forms");
throw new RuntimeException(ex);
} finally {
ioService.endBatch();
}
}
use of org.kie.workbench.common.forms.jbpm.model.authoring.process.BusinessProcessFormModel in project kie-wb-common by kiegroup.
the class BPMNAnalyzer method read.
public BPMNProcess read(InputStream inputStream) {
Definitions definitions = BPMN2Utils.getDefinitions(inputStream);
Optional<Process> processOptional = findProcess(definitions);
if (!processOptional.isPresent()) {
throw new RuntimeException("Cannot find Process on definitions");
}
Process process = processOptional.get();
BusinessProcessFormModel formModel = new BusinessProcessFormModel(process.getId(), process.getName(), new ArrayList<>());
BPMNProcess bpmmProcess = new BPMNProcess(formModel);
readContainerUserTasks(process, bpmmProcess::addTaskFormModel);
return bpmmProcess;
}
Aggregations