DDMFormTemplateContextFactoryHelper { public Set<String> getEvaluableDDMFormFieldNames( DDMForm ddmForm, DDMFormLayout ddmFormLayout) { Set<String> evaluableDDMFormFieldNames = new HashSet<>(); Map<String, DDMFormField> ddmFormFieldsMap = ddmForm.getDDMFormFieldsMap(true); Set<String> ddmFormFieldNames = ddmFormFieldsMap.keySet(); List<DDMFormRule> ddmFormRules = ddmFormLayout.getDDMFormRules(); if (ListUtil.isEmpty(ddmFormRules)) { ddmFormRules = ddmForm.getDDMFormRules(); } evaluableDDMFormFieldNames.addAll( getReferencedFieldNamesByDDMFormRules( ddmFormRules, ddmFormFieldNames)); for (DDMFormField ddmFormField : ddmFormFieldsMap.values()) { if (isDDMFormFieldEvaluable(ddmFormField)) { evaluableDDMFormFieldNames.add(ddmFormField.getName()); } evaluableDDMFormFieldNames.addAll( getReferencedFieldNamesByExpression( ddmFormField.getVisibilityExpression(), ddmFormFieldNames)); } return evaluableDDMFormFieldNames; }  Set<String> getEvaluableDDMFormFieldNames(
		DDMForm ddmForm, DDMFormLayout ddmFormLayout);  }
@Test public void testGetEvaluableFieldNames() throws Exception { DDMForm ddmForm = DDMFormTestUtil.createDDMForm(); ddmForm.addDDMFormField( DDMFormTestUtil.createTextDDMFormField( "Field0", false, false, false)); ddmForm.addDDMFormField( DDMFormTestUtil.createTextDDMFormField( "Field1", false, false, false)); ddmForm.addDDMFormField( DDMFormTestUtil.createTextDDMFormField( "Field2", false, false, true)); DDMFormField ddmFormField3 = DDMFormTestUtil.createTextDDMFormField( "Field3", false, false, false); ddmFormField3.setVisibilityExpression("equals(Field0, 'Joe')"); ddmForm.addDDMFormField(ddmFormField3); DDMFormField ddmFormField4 = DDMFormTestUtil.createTextDDMFormField( "Field4", false, false, false); DDMFormFieldValidation ddmFormFieldValidation = new DDMFormFieldValidation(); ddmFormFieldValidation.setDDMFormFieldValidationExpression( new DDMFormFieldValidationExpression() { { setValue("isEmailAddress(Field4)"); } }); ddmFormField4.setDDMFormFieldValidation(ddmFormFieldValidation); ddmForm.addDDMFormField(ddmFormField4); Set<String> expectedEvaluableFieldNames = SetUtil.fromArray( new String[] {"Field0", "Field2", "Field4"}); Set<String> actualEvaluableFieldNames = _ddmFormTemplateContextFactoryHelper.getEvaluableDDMFormFieldNames( ddmForm, new DDMFormLayout()); Assert.assertEquals( expectedEvaluableFieldNames, actualEvaluableFieldNames); }