Search in sources :

Example 1 with PersonalData

use of org.kie.workbench.common.forms.jbpm.server.service.impl.model.PersonalData in project kie-wb-common by kiegroup.

the class BPMNFormGenerationTest method checkPersonForm.

private void checkPersonForm(FormDefinition form, Map<String, FormDefinition> allForms) {
    assertNotNull(form);
    assertTrue(form.getModel() instanceof JavaFormModel);
    assertEquals(4, form.getFields().size());
    FieldDefinition field = form.getFieldByBinding("name");
    assertFieldStatus(field, "name", String.class.getName());
    field = form.getFieldByBinding("type");
    assertFieldStatus(field, "type", PersonType.class.getName());
    assertTrue(field instanceof EnumListBoxFieldDefinition);
    field = form.getFieldByBinding("personalData");
    assertFieldStatus(field, "personalData", PersonalData.class.getName());
    assertTrue(field instanceof SubFormFieldDefinition);
    SubFormFieldDefinition subForm = (SubFormFieldDefinition) field;
    assertNotNull(subForm.getNestedForm());
    assertNotNull(allForms.get(subForm.getNestedForm()));
    field = form.getFieldByBinding("log");
    assertFieldStatus(field, "log", LogEntry.class.getName());
    assertTrue(field instanceof MultipleSubFormFieldDefinition);
    MultipleSubFormFieldDefinition multipleSubForm = (MultipleSubFormFieldDefinition) field;
    assertNotNull(multipleSubForm.getCreationForm());
    assertEquals(multipleSubForm.getCreationForm(), multipleSubForm.getEditionForm());
    FormDefinition nestedForm = allForms.get(multipleSubForm.getCreationForm());
    assertNotNull(nestedForm);
    assertNotNull(multipleSubForm.getColumnMetas());
    assertEquals(nestedForm.getFields().size(), multipleSubForm.getColumnMetas().size());
    multipleSubForm.getColumnMetas().forEach(columnMeta -> {
        FieldDefinition nestedField = nestedForm.getFieldByBinding(columnMeta.getProperty());
        assertNotNull(nestedField);
        assertEquals(nestedField.getLabel(), columnMeta.getLabel());
    });
}
Also used : PersonalData(org.kie.workbench.common.forms.jbpm.server.service.impl.model.PersonalData) SubFormFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.relations.subForm.definition.SubFormFieldDefinition) MultipleSubFormFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.relations.multipleSubform.definition.MultipleSubFormFieldDefinition) FieldDefinition(org.kie.workbench.common.forms.model.FieldDefinition) EnumListBoxFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.selectors.listBox.definition.EnumListBoxFieldDefinition) SubFormFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.relations.subForm.definition.SubFormFieldDefinition) MultipleSubFormFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.relations.multipleSubform.definition.MultipleSubFormFieldDefinition) PersonType(org.kie.workbench.common.forms.jbpm.server.service.impl.model.PersonType) Mockito.anyString(org.mockito.Mockito.anyString) FormDefinition(org.kie.workbench.common.forms.model.FormDefinition) JavaFormModel(org.kie.workbench.common.forms.model.JavaFormModel) EnumListBoxFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.selectors.listBox.definition.EnumListBoxFieldDefinition) LogEntry(org.kie.workbench.common.forms.jbpm.server.service.impl.model.LogEntry) MultipleSubFormFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.relations.multipleSubform.definition.MultipleSubFormFieldDefinition)

Aggregations

EnumListBoxFieldDefinition (org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.selectors.listBox.definition.EnumListBoxFieldDefinition)1 MultipleSubFormFieldDefinition (org.kie.workbench.common.forms.fields.shared.fieldTypes.relations.multipleSubform.definition.MultipleSubFormFieldDefinition)1 SubFormFieldDefinition (org.kie.workbench.common.forms.fields.shared.fieldTypes.relations.subForm.definition.SubFormFieldDefinition)1 LogEntry (org.kie.workbench.common.forms.jbpm.server.service.impl.model.LogEntry)1 PersonType (org.kie.workbench.common.forms.jbpm.server.service.impl.model.PersonType)1 PersonalData (org.kie.workbench.common.forms.jbpm.server.service.impl.model.PersonalData)1 FieldDefinition (org.kie.workbench.common.forms.model.FieldDefinition)1 FormDefinition (org.kie.workbench.common.forms.model.FormDefinition)1 JavaFormModel (org.kie.workbench.common.forms.model.JavaFormModel)1 Mockito.anyString (org.mockito.Mockito.anyString)1