From 7646fd8daedc0505fdbcba4c8863a00bfc4912ea Mon Sep 17 00:00:00 2001 From: amentis Date: Thu, 16 May 2024 14:46:37 +0300 Subject: [PATCH] remove valid url backend validator --- .../persist/descriptionproperties/FieldPersist.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/backend/core/src/main/java/org/opencdmp/model/persist/descriptionproperties/FieldPersist.java b/backend/core/src/main/java/org/opencdmp/model/persist/descriptionproperties/FieldPersist.java index d87ecc736..7b2f76dc6 100644 --- a/backend/core/src/main/java/org/opencdmp/model/persist/descriptionproperties/FieldPersist.java +++ b/backend/core/src/main/java/org/opencdmp/model/persist/descriptionproperties/FieldPersist.java @@ -128,17 +128,18 @@ public class FieldPersist { protected List specifications(FieldPersist item) { FieldType fieldType = this.fieldEntity != null && this.fieldEntity.getData() != null ? this.fieldEntity.getData().getFieldType() : FieldType.FREE_TEXT; boolean required = this.fieldEntity != null && this.fieldEntity.getValidations() != null ? this.fieldEntity.getValidations().contains(FieldValidationType.Required) : false; - boolean isUrlRequired = this.fieldEntity != null && this.fieldEntity.getValidations() != null ? this.fieldEntity.getValidations().contains(FieldValidationType.Url) : false; +// boolean isUrlRequired = this.fieldEntity != null && this.fieldEntity.getValidations() != null ? this.fieldEntity.getValidations().contains(FieldValidationType.Url) : false; boolean isVisible = this.fieldEntity != null ? this.visibilityService.isVisible(this.fieldEntity.getId(), this.ordinal) : true; return Arrays.asList( this.spec() .iff(()-> FieldType.isTextType(fieldType) && DescriptionStatus.Finalized.equals(this.status) && isVisible && required) .must(() -> !this.isEmpty(item.getTextValue())) .failOn(FieldPersist._textValue).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{FieldPersist._textValue}, LocaleContextHolder.getLocale())), - this.spec() - .iff(()-> fieldType.equals(FieldType.FREE_TEXT) && DescriptionStatus.Finalized.equals(this.status) && isVisible && isUrlRequired && (required || !this.isEmpty(item.getTextValue()))) - .must(() -> this.isValidURL(item.getTextValue())) - .failOn(FieldPersist._textValue).failWith(this.messageSource.getMessage("Validation_UrlRequired", new Object[]{FieldPersist._textValue}, LocaleContextHolder.getLocale())), + //TODO +// this.spec() +// .iff(()-> fieldType.equals(FieldType.FREE_TEXT) && DescriptionStatus.Finalized.equals(this.status) && isVisible && isUrlRequired && (required || !this.isEmpty(item.getTextValue()))) +// .must(() -> this.isValidURL(item.getTextValue())) +// .failOn(FieldPersist._textValue).failWith(this.messageSource.getMessage("Validation_UrlRequired", new Object[]{FieldPersist._textValue}, LocaleContextHolder.getLocale())), this.spec() .iff(()-> FieldType.isDateType(fieldType) && DescriptionStatus.Finalized.equals(this.status) && isVisible && required) .must(() -> !this.isNull(item.getDateValue()))