Search in sources :

Example 1 with FormSection

use of org.activityinfo.model.form.FormSection in project activityinfo by bedatadriven.

the class CloneDatabaseTest method assertFormClass.

private void assertFormClass(FormClass sourceFormClass, FormClass targetFormClass) {
    assertNotEquals(sourceFormClass.getId(), targetFormClass.getId());
    assertEquals(sourceFormClass.getLabel(), targetFormClass.getLabel());
    assertEquals(sourceFormClass.getDescription(), targetFormClass.getDescription());
    // fields
    for (FormField sourceField : sourceFormClass.getFields()) {
        FormField targetField = (FormField) elementByName(targetFormClass.getElements(), sourceField.getLabel());
        assertNotEquals(sourceField.getId(), targetField.getId());
        assertEquals(sourceField.getDescription(), targetField.getDescription());
        assertEquals(sourceField.getCode(), targetField.getCode());
        assertEquals(sourceField.getRelevanceConditionExpression(), targetField.getRelevanceConditionExpression());
        assertEquals(sourceField.getType().getTypeClass(), targetField.getType().getTypeClass());
        // todo
        if (sourceField.getType() instanceof ReferenceType) {
        // need something more sophisticated to check equality of ReferenceType
        } else if (sourceField.getType() instanceof EnumType) {
        // need something more sophisticated to check equality of ReferenceType
        }
    }
    // sections
    for (FormSection sourceSection : sourceFormClass.getSections()) {
        FormSection targetSection = (FormSection) elementByName(targetFormClass.getElements(), sourceSection.getLabel());
        assertNotEquals(sourceSection.getId(), targetSection.getId());
        assertEquals(sourceSection.getLabel(), targetSection.getLabel());
    }
}
Also used : FormSection(org.activityinfo.model.form.FormSection) EnumType(org.activityinfo.model.type.enumerated.EnumType) FormField(org.activityinfo.model.form.FormField) ReferenceType(org.activityinfo.model.type.ReferenceType)

Aggregations

FormField (org.activityinfo.model.form.FormField)1 FormSection (org.activityinfo.model.form.FormSection)1 ReferenceType (org.activityinfo.model.type.ReferenceType)1 EnumType (org.activityinfo.model.type.enumerated.EnumType)1