Search in sources :

Example 11 with BusinessProcessFormModel

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

the class FormDefinitionGeneratorImplTest method testGenerateAllForms.

@Test
public void testGenerateAllForms() {
    generator.generateAllForms(diagram);
    verify(generator, times(4)).createFormForModel(formModelArgumentCaptor.capture(), any());
    verify(formDefinitionSerializer, times(4)).serialize(formDefinitionArgumentCaptor.capture());
    verify(ioService, times(1)).startBatch(any());
    verify(ioService, times(1)).getFileSystem(any());
    verify(ioService, times(4)).createFile(any());
    verify(ioService, times(4)).write(any(), Mockito.<String>any());
    verify(ioService, times(1)).endBatch();
    List<JBPMFormModel> formModels = formModelArgumentCaptor.getAllValues();
    List<FormDefinition> forms = formDefinitionArgumentCaptor.getAllValues();
    Assertions.assertThat(formModels).isNotEmpty().hasSize(forms.size()).hasSize(4);
    for (int i = 0; i < formModels.size(); i++) {
        JBPMFormModel formModel = formModels.get(i);
        FormDefinition form = forms.get(i);
        if (formModel instanceof BusinessProcessFormModel) {
            checkProcessFormGenerated((BusinessProcessFormModel) formModel, form);
        } else {
            TaskFormModel taskFormModel = (TaskFormModel) formModel;
            checkTaskFormGenerated(taskFormModel, taskFormModel.getTaskName(), form);
        }
    }
}
Also used : BusinessProcessFormModel(org.kie.workbench.common.forms.jbpm.model.authoring.process.BusinessProcessFormModel) JBPMFormModel(org.kie.workbench.common.forms.jbpm.model.authoring.JBPMFormModel) FormDefinition(org.kie.workbench.common.forms.model.FormDefinition) TaskFormModel(org.kie.workbench.common.forms.jbpm.model.authoring.task.TaskFormModel) BPMNDiagramMarshallerBaseTest(org.kie.workbench.common.stunner.bpmn.backend.service.diagram.marshalling.BPMNDiagramMarshallerBaseTest) Test(org.junit.Test)

Example 12 with BusinessProcessFormModel

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

the class AbstractBPMNFormGeneratorServiceTest method launchNestedFormsTest.

protected FormGenerationResult launchNestedFormsTest() {
    List<ModelProperty> variableList = new ArrayList<>();
    variableList.add(new ModelPropertyImpl(EXPENSE_VARIABLE, new TypeInfoImpl(TypeKind.OBJECT, Expense.class.getName(), false)));
    variableList.add(new ModelPropertyImpl(TEXT_VARIABLE, new TypeInfoImpl(String.class.getName())));
    BusinessProcessFormModel model = new BusinessProcessFormModel(PROCESS_ID, PROCESS_ID, variableList);
    FormGenerationResult result = service.generateForms(model, source);
    assertNotNull(result);
    assertNotNull(result.getRootForm());
    checkRootForm(model, result, variableList);
    return result;
}
Also used : FormGenerationResult(org.kie.workbench.common.forms.jbpm.server.service.formGeneration.FormGenerationResult) Expense(org.kie.workbench.common.forms.jbpm.server.service.formGeneration.model.Expense) ModelProperty(org.kie.workbench.common.forms.model.ModelProperty) ArrayList(java.util.ArrayList) BusinessProcessFormModel(org.kie.workbench.common.forms.jbpm.model.authoring.process.BusinessProcessFormModel) ModelPropertyImpl(org.kie.workbench.common.forms.model.impl.ModelPropertyImpl) TypeInfoImpl(org.kie.workbench.common.forms.model.impl.TypeInfoImpl)

Example 13 with BusinessProcessFormModel

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

the class AbstractBPMNFormGeneratorServiceTest method checkSimpleVariableForms.

protected void checkSimpleVariableForms() {
    List<ModelProperty> properties = new ArrayList<>();
    properties.add(new ModelPropertyImpl(TEXT_VARIABLE, new TypeInfoImpl(String.class.getName())));
    properties.add(new ModelPropertyImpl(INTEGER_VARIABLE, new TypeInfoImpl(Integer.class.getName())));
    properties.add(new ModelPropertyImpl(DOUBLE_VARIABLE, new TypeInfoImpl(Double.class.getName())));
    properties.add(new ModelPropertyImpl(BOOLEAN_VARIABLE, new TypeInfoImpl(Boolean.class.getName())));
    properties.add(new ModelPropertyImpl(DATE_VARIABLE, new TypeInfoImpl(Date.class.getName())));
    BusinessProcessFormModel model = new BusinessProcessFormModel(PROCESS_ID, PROCESS_ID, properties);
    FormGenerationResult result = service.generateForms(model, source);
    assertNotNull(result);
    assertNotNull(result.getRootForm());
    assertTrue(result.getNestedForms().isEmpty());
    checkRootForm(model, result, properties);
}
Also used : FormGenerationResult(org.kie.workbench.common.forms.jbpm.server.service.formGeneration.FormGenerationResult) ModelProperty(org.kie.workbench.common.forms.model.ModelProperty) ArrayList(java.util.ArrayList) BusinessProcessFormModel(org.kie.workbench.common.forms.jbpm.model.authoring.process.BusinessProcessFormModel) ModelPropertyImpl(org.kie.workbench.common.forms.model.impl.ModelPropertyImpl) TypeInfoImpl(org.kie.workbench.common.forms.model.impl.TypeInfoImpl) Date(java.util.Date)

Example 14 with BusinessProcessFormModel

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

the class AbstractBPMNFormGeneratorServiceTest method launchNestedFormWithCyclicReference.

protected FormGenerationResult launchNestedFormWithCyclicReference() {
    List<ModelProperty> variableList = new ArrayList<>();
    variableList.add(new ModelPropertyImpl("person", new TypeInfoImpl(TypeKind.OBJECT, Person.class.getName(), false)));
    BusinessProcessFormModel model = new BusinessProcessFormModel(PROCESS_ID, PROCESS_ID, variableList);
    FormGenerationResult result = service.generateForms(model, source);
    assertNotNull(result);
    assertNotNull(result.getRootForm());
    checkRootForm(model, result, variableList);
    return result;
}
Also used : FormGenerationResult(org.kie.workbench.common.forms.jbpm.server.service.formGeneration.FormGenerationResult) ModelProperty(org.kie.workbench.common.forms.model.ModelProperty) ArrayList(java.util.ArrayList) BusinessProcessFormModel(org.kie.workbench.common.forms.jbpm.model.authoring.process.BusinessProcessFormModel) ModelPropertyImpl(org.kie.workbench.common.forms.model.impl.ModelPropertyImpl) TypeInfoImpl(org.kie.workbench.common.forms.model.impl.TypeInfoImpl) Person(org.kie.workbench.common.forms.jbpm.server.service.formGeneration.model.Person)

Example 15 with BusinessProcessFormModel

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

the class BPMFinderServiceImpl method parseToModel.

private JBPMProcessModel parseToModel(final Definitions definitions, final Path path) {
    BusinessProcessFormModel processFormModel = bpmnFormModelGenerator.generateProcessFormModel(definitions, path);
    List<TaskFormModel> taskModels = bpmnFormModelGenerator.generateTaskFormModels(definitions, path);
    return new JBPMProcessModel(processFormModel, taskModels);
}
Also used : JBPMProcessModel(org.kie.workbench.common.forms.jbpm.model.authoring.JBPMProcessModel) BusinessProcessFormModel(org.kie.workbench.common.forms.jbpm.model.authoring.process.BusinessProcessFormModel) TaskFormModel(org.kie.workbench.common.forms.jbpm.model.authoring.task.TaskFormModel)

Aggregations

BusinessProcessFormModel (org.kie.workbench.common.forms.jbpm.model.authoring.process.BusinessProcessFormModel)16 TaskFormModel (org.kie.workbench.common.forms.jbpm.model.authoring.task.TaskFormModel)9 ArrayList (java.util.ArrayList)6 Definitions (org.eclipse.bpmn2.Definitions)5 Test (org.junit.Test)5 ModelProperty (org.kie.workbench.common.forms.model.ModelProperty)4 ModelPropertyImpl (org.kie.workbench.common.forms.model.impl.ModelPropertyImpl)4 TypeInfoImpl (org.kie.workbench.common.forms.model.impl.TypeInfoImpl)4 Path (org.uberfire.backend.vfs.Path)4 HashMap (java.util.HashMap)3 List (java.util.List)3 Process (org.eclipse.bpmn2.Process)3 FormGenerationResult (org.kie.workbench.common.forms.jbpm.server.service.formGeneration.FormGenerationResult)3 IOException (java.io.IOException)2 Optional (java.util.Optional)2 Dependent (javax.enterprise.context.Dependent)2 Inject (javax.inject.Inject)2 JBPMProcessModel (org.kie.workbench.common.forms.jbpm.model.authoring.JBPMProcessModel)2 BPMNFormModelGenerator (org.kie.workbench.common.forms.jbpm.server.service.BPMNFormModelGenerator)2 KieModuleService (org.kie.workbench.common.services.shared.project.KieModuleService)2