@Override public void validate(DDMForm ddmForm) throws DDMFormValidationException { validateDDMFormLocales(ddmForm); validateDDMFormFields( ddmForm.getDDMFormFields(), new HashSet<String>(), ddmForm.getAvailableLocales(), ddmForm.getDefaultLocale()); }
protected void validateDDMFormLocales(DDMForm ddmForm) throws DDMFormValidationException { Locale defaultLocale = ddmForm.getDefaultLocale(); if (defaultLocale == null) { throw new DDMFormValidationException( "The default locale property was never set for DDM form"); } validateDDMFormAvailableLocales(ddmForm.getAvailableLocales(), defaultLocale); }
protected String getAvailableLanguagesIds(DDMForm ddmForm) { List<Locale> availableLocales = ddmForm.getAvailableLocales(); StringBuilder sb = new StringBuilder(2 * availableLocales.size() - 1); for (int i = 0; i < availableLocales.size(); i++) { if (i != 0) { sb.append(","); } sb.append(LocaleUtil.toLanguageId(availableLocales.get(i))); } return sb.toString(); }