Search in sources :

Example 1 with JBPMProcessModel

use of org.kie.workbench.common.forms.jbpm.model.authoring.JBPMProcessModel in project kie-wb-common by kiegroup.

the class BPMFinderServiceImpl method scannProcessesForType.

protected void scannProcessesForType(final Path path, final String extension, final GenerationConfig generationConfig) {
    List<org.uberfire.java.nio.file.Path> nioPaths = new ArrayList<>();
    nioPaths.add(Paths.convert(path));
    Collection<FileUtils.ScanResult> processes = fileUtils.scan(ioService, nioPaths, extension, true);
    processes.stream().map(scanResult -> parse(scanResult)).filter(definitions -> definitions != null && generationConfig.getPredicate().test(definitions)).forEach(definitions -> {
        BusinessProcessFormModel processFormModel = bpmnFormModelGenerator.generateProcessFormModel(definitions.get(), path);
        List<TaskFormModel> taskModels = bpmnFormModelGenerator.generateTaskFormModels(definitions.get(), path);
        generationConfig.getConsumer().accept(new JBPMProcessModel(processFormModel, taskModels));
    });
}
Also used : Path(org.uberfire.backend.vfs.Path) URI(org.eclipse.emf.common.util.URI) BPMFinderService(org.kie.workbench.common.forms.jbpm.service.shared.BPMFinderService) XMLResource(org.eclipse.emf.ecore.xmi.XMLResource) LoggerFactory(org.slf4j.LoggerFactory) HashMap(java.util.HashMap) ResourceSet(org.eclipse.emf.ecore.resource.ResourceSet) ArrayList(java.util.ArrayList) Paths(org.uberfire.backend.server.util.Paths) Inject(javax.inject.Inject) KieModuleService(org.kie.workbench.common.services.shared.project.KieModuleService) Map(java.util.Map) Service(org.jboss.errai.bus.server.annotations.Service) Named(javax.inject.Named) Path(org.uberfire.backend.vfs.Path) Definitions(org.eclipse.bpmn2.Definitions) DroolsResourceFactoryImpl(org.jboss.drools.util.DroolsResourceFactoryImpl) FileUtils(org.kie.workbench.common.services.datamodeller.util.FileUtils) Process(org.eclipse.bpmn2.Process) Logger(org.slf4j.Logger) DroolsPackage(org.jboss.drools.DroolsPackage) DocumentRoot(org.eclipse.bpmn2.DocumentRoot) Predicate(java.util.function.Predicate) Collection(java.util.Collection) JBPMProcessModel(org.kie.workbench.common.forms.jbpm.model.authoring.JBPMProcessModel) BusinessProcessFormModel(org.kie.workbench.common.forms.jbpm.model.authoring.process.BusinessProcessFormModel) ResourceSetImpl(org.eclipse.emf.ecore.resource.impl.ResourceSetImpl) TaskFormModel(org.kie.workbench.common.forms.jbpm.model.authoring.task.TaskFormModel) Consumer(java.util.function.Consumer) List(java.util.List) Dependent(javax.enterprise.context.Dependent) PostConstruct(javax.annotation.PostConstruct) Bpmn2ResourceFactoryImpl(org.eclipse.bpmn2.util.Bpmn2ResourceFactoryImpl) Resource(org.eclipse.emf.ecore.resource.Resource) IOService(org.uberfire.io.IOService) Optional(java.util.Optional) BPMNFormModelGenerator(org.kie.workbench.common.forms.jbpm.server.service.BPMNFormModelGenerator) Bpmn2Package(org.eclipse.bpmn2.Bpmn2Package) JBPMProcessModel(org.kie.workbench.common.forms.jbpm.model.authoring.JBPMProcessModel) ArrayList(java.util.ArrayList) BusinessProcessFormModel(org.kie.workbench.common.forms.jbpm.model.authoring.process.BusinessProcessFormModel) TaskFormModel(org.kie.workbench.common.forms.jbpm.model.authoring.task.TaskFormModel)

Example 2 with JBPMProcessModel

use of org.kie.workbench.common.forms.jbpm.model.authoring.JBPMProcessModel in project kie-wb-common by kiegroup.

the class GetProcessModelsTest method assertModelWithName.

private void assertModelWithName(String process, Map<String, String> variables, Map<String, Map<String, String>> tasks) {
    for (JBPMProcessModel model : availableProcessModels) {
        if (process.equals(model.getProcessFormModel().getProcessName())) {
            assertThat(getProcessVariables(model)).isEqualTo(variables);
            assertThat(getTaskModels(model)).isEqualTo(tasks);
        }
    }
}
Also used : JBPMProcessModel(org.kie.workbench.common.forms.jbpm.model.authoring.JBPMProcessModel)

Example 3 with JBPMProcessModel

use of org.kie.workbench.common.forms.jbpm.model.authoring.JBPMProcessModel in project kie-wb-common by kiegroup.

the class TaskFormModelHandlerTest method getFullProcessModel.

protected JBPMProcessModel getFullProcessModel() {
    JBPMProcessModel processModel = getBaseProcessModel();
    processModel.getTaskFormModels().add(new TaskFormModel(PROCESS_ID, TASK_NAME, propertyList));
    return processModel;
}
Also used : JBPMProcessModel(org.kie.workbench.common.forms.jbpm.model.authoring.JBPMProcessModel) TaskFormModel(org.kie.workbench.common.forms.jbpm.model.authoring.task.TaskFormModel)

Example 4 with JBPMProcessModel

use of org.kie.workbench.common.forms.jbpm.model.authoring.JBPMProcessModel in project kie-wb-common by kiegroup.

the class JBPMFormModelCreationViewImpl method init.

@PostConstruct
protected void init() {
    processes.addValueChangeHandler(event -> {
        JBPMProcessModel model = processes.getValue();
        if (model != null) {
            List<JBPMFormModel> models = new ArrayList<JBPMFormModel>();
            models.add(model.getProcessFormModel());
            models.addAll(model.getTaskFormModels());
            tasks.setValue(null);
            tasks.setAcceptableValues(models);
        } else {
            tasks.setAcceptableValues(new ArrayList<>());
            tasks.setValue(null, true);
        }
    });
    tasks.addValueChangeHandler(event -> {
        presenter.setModel(event.getValue());
        clearValidationErrors();
    });
}
Also used : JBPMProcessModel(org.kie.workbench.common.forms.jbpm.model.authoring.JBPMProcessModel) ArrayList(java.util.ArrayList) JBPMFormModel(org.kie.workbench.common.forms.jbpm.model.authoring.JBPMFormModel) PostConstruct(javax.annotation.PostConstruct)

Example 5 with JBPMProcessModel

use of org.kie.workbench.common.forms.jbpm.model.authoring.JBPMProcessModel in project kie-wb-common by kiegroup.

the class BPMFinderServiceImplTest method testFindProcess.

protected void testFindProcess(String processId, int expectedTasks) {
    JBPMProcessModel model = bpmFinderService.getModelForProcess(processId, currentModulePath);
    assertNotNull(model);
    assertNotNull(model.getProcessFormModel());
    assertEquals(processId, model.getProcessFormModel().getProcessId());
    assertEquals(expectedTasks, model.getTaskFormModels().size());
}
Also used : JBPMProcessModel(org.kie.workbench.common.forms.jbpm.model.authoring.JBPMProcessModel)

Aggregations

JBPMProcessModel (org.kie.workbench.common.forms.jbpm.model.authoring.JBPMProcessModel)7 TaskFormModel (org.kie.workbench.common.forms.jbpm.model.authoring.task.TaskFormModel)4 ArrayList (java.util.ArrayList)3 BusinessProcessFormModel (org.kie.workbench.common.forms.jbpm.model.authoring.process.BusinessProcessFormModel)3 PostConstruct (javax.annotation.PostConstruct)2 Collection (java.util.Collection)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 Optional (java.util.Optional)1 Consumer (java.util.function.Consumer)1 Predicate (java.util.function.Predicate)1 Dependent (javax.enterprise.context.Dependent)1 Inject (javax.inject.Inject)1 Named (javax.inject.Named)1 Bpmn2Package (org.eclipse.bpmn2.Bpmn2Package)1 Definitions (org.eclipse.bpmn2.Definitions)1 DocumentRoot (org.eclipse.bpmn2.DocumentRoot)1 Process (org.eclipse.bpmn2.Process)1 Bpmn2ResourceFactoryImpl (org.eclipse.bpmn2.util.Bpmn2ResourceFactoryImpl)1