description template backend validator changes

This commit is contained in:
amentis 2024-02-07 16:27:14 +02:00
parent 3deb17dbea
commit 02cd51b751
6 changed files with 4 additions and 25 deletions

View File

@ -167,10 +167,6 @@ public class FieldSetPersist {
this.spec()
.must(() -> !this.isEmpty(item.getTitle()))
.failOn(FieldSetPersist._title).failWith(messageSource.getMessage("Validation_Required", new Object[]{FieldSetPersist._title}, LocaleContextHolder.getLocale())),
this.spec()
.must(() -> !this.isEmpty(item.getDescription()))
.failOn(FieldSetPersist._description).failWith(messageSource.getMessage("Validation_Required", new Object[]{FieldSetPersist._description}, LocaleContextHolder.getLocale())),
this.refSpec()
.iff(() -> !this.isNull(item.getMultiplicity()))
.on(FieldSetPersist._multiplicity)

View File

@ -151,18 +151,11 @@ public class SectionPersist {
this.spec()
.must(() -> !this.isEmpty(item.getTitle()))
.failOn(SectionPersist._title).failWith(messageSource.getMessage("Validation_Required", new Object[]{SectionPersist._title}, LocaleContextHolder.getLocale())),
this.spec()
.must(() -> !this.isEmpty(item.getDescription()))
.failOn(SectionPersist._description).failWith(messageSource.getMessage("Validation_Required", new Object[]{SectionPersist._description}, LocaleContextHolder.getLocale())),
this.navSpec()
.iff(() -> !this.isListNullOrEmpty(item.getSections()))
.on(SectionPersist._sections)
.over(item.getSections())
.using((itm) -> this.validatorFactory.validator(SectionPersistValidator.class)),
this.spec()
.must(() -> !this.isListNullOrEmpty(item.getFieldSets()))
.failOn(SectionPersist._fieldSets).failWith(messageSource.getMessage("Validation_Required", new Object[]{SectionPersist._fieldSets}, LocaleContextHolder.getLocale())),
this.navSpec()
.iff(() -> !this.isListNullOrEmpty(item.getFieldSets()))
.on(SectionPersist._fieldSets)

View File

@ -87,9 +87,6 @@ public abstract class BaseFieldDataPersist {
protected List<Specification> getBaseSpecifications(T item) {
List<Specification> specifications = new ArrayList<>();
specifications.addAll(Arrays.asList(
this.spec()
.must(() -> !this.isEmpty(item.getLabel()))
.failOn(BaseFieldDataPersist._label).failWith(messageSource.getMessage("Validation_Required", new Object[]{BaseFieldDataPersist._label}, LocaleContextHolder.getLocale())),
this.spec()
.must(() -> !this.isNull(item.getFieldType()))
.failOn(BaseFieldDataPersist._fieldType).failWith(messageSource.getMessage("Validation_Required", new Object[]{BaseFieldDataPersist._fieldType}, LocaleContextHolder.getLocale()))

View File

@ -60,11 +60,7 @@ public class ExternalDatasetDataPersist extends BaseFieldDataPersist {
specifications.addAll(Arrays.asList(
this.spec()
.must(() -> !this.isNull(item.getMultipleSelect()))
.failOn(ExternalDatasetDataPersist._multipleSelect).failWith(messageSource.getMessage("Validation_Required", new Object[]{ExternalDatasetDataPersist._multipleSelect}, LocaleContextHolder.getLocale())),
this.spec()
.must(() -> !this.isNull(item.getType()))
.failOn(ExternalDatasetDataPersist._type).failWith(messageSource.getMessage("Validation_Required", new Object[]{ExternalDatasetDataPersist._type}, LocaleContextHolder.getLocale()))
.failOn(ExternalDatasetDataPersist._multipleSelect).failWith(messageSource.getMessage("Validation_Required", new Object[]{ExternalDatasetDataPersist._multipleSelect}, LocaleContextHolder.getLocale()))
));
return specifications;
}

View File

@ -55,11 +55,8 @@ public class RadioBoxDataPersist extends BaseFieldDataPersist {
this.spec()
.must(() -> !this.isNull(item.getFieldType()))
.failOn(BaseFieldDataPersist._fieldType).failWith(messageSource.getMessage("Validation_Required", new Object[]{BaseFieldDataPersist._fieldType}, LocaleContextHolder.getLocale())),
this.spec()
.must(() -> !this.isNull(item.getOptions()))
.failOn(RadioBoxDataPersist._options).failWith(messageSource.getMessage("Validation_Required", new Object[]{RadioBoxDataPersist._options}, LocaleContextHolder.getLocale())),
this.navSpec()
.iff(() -> !this.isNull(item.getOptions()))
.iff(() -> !this.isListNullOrEmpty(item.getOptions()))
.on(RadioBoxDataPersist._options)
.over(item.getOptions())
.using((itm) -> this.validatorFactory.validator(RadioBoxOptionPersist.RadioBoxOptionPersistValidator.class))

View File

@ -68,10 +68,10 @@ public class SelectDataPersist extends BaseFieldDataPersist {
.failOn(SelectDataPersist._multipleSelect).failWith(messageSource.getMessage("Validation_Required", new Object[]{SelectDataPersist._multipleSelect}, LocaleContextHolder.getLocale())),
this.spec()
.must(() -> !this.isNull(item.getOptions()))
.must(() -> !this.isListNullOrEmpty(item.getOptions()))
.failOn(SelectDataPersist._options).failWith(messageSource.getMessage("Validation_Required", new Object[]{SelectDataPersist._options}, LocaleContextHolder.getLocale())),
this.navSpec()
.iff(() -> !this.isNull(item.getOptions()))
.iff(() -> !this.isListNullOrEmpty(item.getOptions()))
.on(SelectDataPersist._options)
.over(item.getOptions())
.using((itm) -> this.validatorFactory.validator(OptionPersist.ComboBoxOptionPersistValidator.class))