move old validation logic

This commit is contained in:
Efstratios Giannopoulos 2023-12-19 15:46:31 +02:00
parent 4fa4cdc671
commit f09e031e0c
58 changed files with 211 additions and 250 deletions

View File

@ -0,0 +1,115 @@
package eu.eudat.commons.validation;
import eu.eudat.commons.validation.specification.*;
import eu.eudat.convention.ConventionService;
import eu.eudat.errorcode.ErrorThesaurusProperties;
import gr.cite.tools.exception.MyValidationException;
import org.springframework.validation.BeanPropertyBindingResult;
import org.springframework.validation.Errors;
import org.springframework.validation.FieldError;
import org.springframework.validation.ValidationUtils;
import java.text.MessageFormat;
import java.util.*;
public abstract class AbstractValidator<T> implements Validator {
private BeanPropertyBindingResult bindingResult;
protected abstract Class<T> modelClass();
protected abstract List<Specification> specifications(T item);
@Override
public boolean supports(Class clazz) {
return clazz == null ? false : this.modelClass().equals(clazz);
}
@Override
public void validate(Object obj, Errors e) {
if (obj == null) return;
T item = this.modelClass().cast(obj);
List<Specification> specifications = this.specifications(item);
if (specifications == null) return;;
List<PropertySpecification> propertySpecifications = specifications.stream().filter(x-> x instanceof PropertySpecification).map(x-> (PropertySpecification)x).toList();
for (PropertySpecification propertySpecification : propertySpecifications){
if ((propertySpecification.getPrecondition() == null || propertySpecification.getPrecondition().get()) &&
(propertySpecification.getSpecification() == null || !propertySpecification.getSpecification().get())
){
e.rejectValue(propertySpecification.getErrorKey(), propertySpecification.getErrorCode(), propertySpecification.getErrorMessage());
}
}
List<NavigationReferenceSpecification> navigationReferenceSpecifications = specifications.stream().filter(x-> x instanceof NavigationReferenceSpecification).map(x-> (NavigationReferenceSpecification)x).toList();
for (NavigationReferenceSpecification navigationReferenceSpecification : navigationReferenceSpecifications){
if (navigationReferenceSpecification.getReference() != null && (navigationReferenceSpecification.getPrecondition() == null || navigationReferenceSpecification.getPrecondition().get())){
try {
e.pushNestedPath(navigationReferenceSpecification.getKey());
ValidationUtils.invokeValidator(navigationReferenceSpecification.getValidator().get(), navigationReferenceSpecification.getReference(), e);
} finally {
e.popNestedPath();
}
}
}
List<NavigationDetailsSpecification> navigationDetailsSpecifications = specifications.stream().filter(x-> x instanceof NavigationDetailsSpecification).map(x-> (NavigationDetailsSpecification)x).toList();
for (NavigationDetailsSpecification navigationDetailsSpecification : navigationDetailsSpecifications){
if (navigationDetailsSpecification.getDetails() != null && (navigationDetailsSpecification.getPrecondition() == null || navigationDetailsSpecification.getPrecondition().get())){
for (int i = 0; i < navigationDetailsSpecification.getDetails().size(); i++) {
try {
e.pushNestedPath(MessageFormat.format("{0}[{1}]", navigationDetailsSpecification.getKey(), i));
ValidationUtils.invokeValidator(navigationDetailsSpecification.getValidator().get(), navigationDetailsSpecification.getDetails().get(i), e);
} finally {
e.popNestedPath();
}
}
}
}
}
@Override
public void validate(Object target){
this.bindingResult = new BeanPropertyBindingResult(target, target.getClass().getName());
this.validate(target, this.bindingResult);
}
@Override
public ValidationResult result() {
ValidationResult validationResult = new ValidationResult();
if (this.bindingResult != null && bindingResult.hasErrors()){
for (FieldError fieldError : bindingResult.getFieldErrors()){
validationResult.add(new ValidationFailure(fieldError.getField(), fieldError.getDefaultMessage()));
}
}
return validationResult;
}
protected List<Map.Entry<String, List<String>>> flattenValidationResult() {
ValidationResult result = result();
List<Map.Entry<String, List<String>>> errorsMap = new ArrayList<>();
for (ValidationFailure fieldError : result.getErrors()){
Map.Entry<String, List<String>> entry = errorsMap.stream().filter(x-> Objects.equals(x.getKey(), fieldError.getErrorKey())).findFirst().orElse(null);
if (entry == null) {
entry = new AbstractMap.SimpleEntry<>(fieldError.getErrorKey(), new ArrayList<>());
errorsMap.add(entry);
}
entry.getValue().add(fieldError.getErrorMessage());
}
return errorsMap;
}
protected PropertySpecificationBuilder spec() {
return new PropertySpecificationBuilder();
}
protected NavigationReferenceSpecificationBuilder refSpec() {
return new NavigationReferenceSpecificationBuilder();
}
protected NavigationDetailsSpecificationBuilder navSpec()
{
return new NavigationDetailsSpecificationBuilder();
}
}

View File

@ -1,19 +1,11 @@
package eu.eudat.commons.validation; package eu.eudat.commons.validation;
import eu.eudat.commons.validation.specification.*;
import eu.eudat.convention.ConventionService; import eu.eudat.convention.ConventionService;
import eu.eudat.errorcode.ErrorThesaurusProperties; import eu.eudat.errorcode.ErrorThesaurusProperties;
import gr.cite.tools.exception.MyValidationException; import gr.cite.tools.exception.MyValidationException;
import org.springframework.validation.BeanPropertyBindingResult;
import org.springframework.validation.Errors;
import org.springframework.validation.FieldError;
import org.springframework.validation.ValidationUtils;
import java.text.MessageFormat;
import java.util.*; import java.util.*;
public abstract class BaseValidator<T> implements Validator { public abstract class BaseValidator<T> extends AbstractValidator<T> {
private BeanPropertyBindingResult bindingResult;
protected final ConventionService conventionService; protected final ConventionService conventionService;
protected final ErrorThesaurusProperties errors; protected final ErrorThesaurusProperties errors;
@ -22,64 +14,6 @@ public abstract class BaseValidator<T> implements Validator {
this.errors = errors; this.errors = errors;
} }
protected abstract Class<T> modelClass();
protected abstract List<Specification> specifications(T item);
@Override
public boolean supports(Class clazz) {
return clazz == null ? false : this.modelClass().equals(clazz);
}
@Override
public void validate(Object obj, Errors e) {
if (obj == null) return;
T item = this.modelClass().cast(obj);
List<Specification> specifications = this.specifications(item);
if (specifications == null) return;;
List<PropertySpecification> propertySpecifications = specifications.stream().filter(x-> x instanceof PropertySpecification).map(x-> (PropertySpecification)x).toList();
for (PropertySpecification propertySpecification : propertySpecifications){
if ((propertySpecification.getPrecondition() == null || propertySpecification.getPrecondition().get()) &&
(propertySpecification.getSpecification() == null || !propertySpecification.getSpecification().get())
){
e.rejectValue(propertySpecification.getErrorKey(), propertySpecification.getErrorCode(), propertySpecification.getErrorMessage());
}
}
List<NavigationReferenceSpecification> navigationReferenceSpecifications = specifications.stream().filter(x-> x instanceof NavigationReferenceSpecification).map(x-> (NavigationReferenceSpecification)x).toList();
for (NavigationReferenceSpecification navigationReferenceSpecification : navigationReferenceSpecifications){
if (navigationReferenceSpecification.getReference() != null && (navigationReferenceSpecification.getPrecondition() == null || navigationReferenceSpecification.getPrecondition().get())){
try {
e.pushNestedPath(navigationReferenceSpecification.getKey());
ValidationUtils.invokeValidator(navigationReferenceSpecification.getValidator().get(), navigationReferenceSpecification.getReference(), e);
} finally {
e.popNestedPath();
}
}
}
List<NavigationDetailsSpecification> navigationDetailsSpecifications = specifications.stream().filter(x-> x instanceof NavigationDetailsSpecification).map(x-> (NavigationDetailsSpecification)x).toList();
for (NavigationDetailsSpecification navigationDetailsSpecification : navigationDetailsSpecifications){
if (navigationDetailsSpecification.getDetails() != null && (navigationDetailsSpecification.getPrecondition() == null || navigationDetailsSpecification.getPrecondition().get())){
for (int i = 0; i < navigationDetailsSpecification.getDetails().size(); i++) {
try {
e.pushNestedPath(MessageFormat.format("{0}[{1}]", navigationDetailsSpecification.getKey(), i));
ValidationUtils.invokeValidator(navigationDetailsSpecification.getValidator().get(), navigationDetailsSpecification.getDetails().get(i), e);
} finally {
e.popNestedPath();
}
}
}
}
}
@Override
public void validate(Object target){
this.bindingResult = new org.springframework.validation.BeanPropertyBindingResult(target, target.getClass().getName());
this.validate(target, this.bindingResult);
}
@Override @Override
public void validateForce(Object target) { public void validateForce(Object target) {
this.validate(target); this.validate(target);
@ -88,50 +22,8 @@ public abstract class BaseValidator<T> implements Validator {
List<Map.Entry<String, List<String>>> errorsMap = this.flattenValidationResult(); List<Map.Entry<String, List<String>>> errorsMap = this.flattenValidationResult();
throw new MyValidationException(this.errors.getModelValidation().getCode(), errorsMap); throw new MyValidationException(this.errors.getModelValidation().getCode(), errorsMap);
} }
} }
protected List<Map.Entry<String, List<String>>> flattenValidationResult() {
ValidationResult result = result();
List<Map.Entry<String, List<String>>> errorsMap = new ArrayList<>();
for (ValidationFailure fieldError : result.getErrors()){
Map.Entry<String, List<String>> entry = errorsMap.stream().filter(x-> Objects.equals(x.getKey(), fieldError.getErrorKey())).findFirst().orElse(null);
if (entry == null) {
entry = new AbstractMap.SimpleEntry<>(fieldError.getErrorKey(), new ArrayList<>());
errorsMap.add(entry);
}
entry.getValue().add(fieldError.getErrorMessage());
}
return errorsMap;
}
protected PropertySpecificationBuilder spec() {
return new PropertySpecificationBuilder();
}
protected NavigationReferenceSpecificationBuilder refSpec() {
return new NavigationReferenceSpecificationBuilder();
}
protected NavigationDetailsSpecificationBuilder navSpec()
{
return new NavigationDetailsSpecificationBuilder();
}
@Override
public ValidationResult result() {
ValidationResult validationResult = new ValidationResult();
if (this.bindingResult != null && bindingResult.hasErrors()){
for (FieldError fieldError : bindingResult.getFieldErrors()){
validationResult.add(new ValidationFailure(fieldError.getField(), fieldError.getDefaultMessage()));
}
}
return validationResult;
}
protected Boolean isValidGuid(UUID guid) { protected Boolean isValidGuid(UUID guid) {
return this.conventionService.isValidGuid(guid); return this.conventionService.isValidGuid(guid);
} }

View File

@ -1,4 +1,4 @@
package eu.eudat.commons.validation; package eu.eudat.commons.validation.old;
import jakarta.validation.ConstraintValidator; import jakarta.validation.ConstraintValidator;
import jakarta.validation.ConstraintValidatorContext; import jakarta.validation.ConstraintValidatorContext;

View File

@ -1,4 +1,4 @@
package eu.eudat.commons.validation; package eu.eudat.commons.validation.old;
import jakarta.validation.Constraint; import jakarta.validation.Constraint;

View File

@ -1,5 +1,6 @@
package eu.eudat.commons.validation; package eu.eudat.commons.validation.old;
import eu.eudat.commons.validation.old.FieldNotNullIfOtherSet;
import org.springframework.beans.BeanWrapperImpl; import org.springframework.beans.BeanWrapperImpl;
import jakarta.validation.ConstraintValidator; import jakarta.validation.ConstraintValidator;

View File

@ -1,4 +1,4 @@
package eu.eudat.commons.validation; package eu.eudat.commons.validation.old;
import jakarta.validation.Constraint; import jakarta.validation.Constraint;
import jakarta.validation.Payload; import jakarta.validation.Payload;

View File

@ -1,5 +1,6 @@
package eu.eudat.commons.validation; package eu.eudat.commons.validation.old;
import eu.eudat.commons.validation.old.FieldsValueMatch;
import org.springframework.beans.BeanWrapperImpl; import org.springframework.beans.BeanWrapperImpl;
import jakarta.validation.ConstraintValidator; import jakarta.validation.ConstraintValidator;

View File

@ -1,4 +1,4 @@
package eu.eudat.commons.validation; package eu.eudat.commons.validation.old;
import jakarta.validation.Constraint; import jakarta.validation.Constraint;
import jakarta.validation.Payload; import jakarta.validation.Payload;

View File

@ -1,5 +1,6 @@
package eu.eudat.commons.validation; package eu.eudat.commons.validation.old;
import eu.eudat.commons.validation.old.RequiredOneField;
import jakarta.validation.ConstraintValidator; import jakarta.validation.ConstraintValidator;
import jakarta.validation.ConstraintValidatorContext; import jakarta.validation.ConstraintValidatorContext;
import org.apache.commons.beanutils.PropertyUtils; import org.apache.commons.beanutils.PropertyUtils;

View File

@ -1,5 +1,6 @@
package eu.eudat.commons.validation; package eu.eudat.commons.validation.old;
import eu.eudat.commons.validation.old.EnumNotNull;
import jakarta.validation.Constraint; import jakarta.validation.Constraint;
import jakarta.validation.Payload; import jakarta.validation.Payload;
import java.lang.annotation.*; import java.lang.annotation.*;

View File

@ -1,4 +1,4 @@
package eu.eudat.commons.validation; package eu.eudat.commons.validation.old;
import jakarta.validation.Constraint; import jakarta.validation.Constraint;

View File

@ -1,5 +1,6 @@
package eu.eudat.commons.validation; package eu.eudat.commons.validation.old;
import eu.eudat.commons.validation.old.ValidId;
import eu.eudat.convention.ConventionService; import eu.eudat.convention.ConventionService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;

View File

@ -1,4 +1,4 @@
package eu.eudat.commons.validation; package eu.eudat.commons.validation.old;
import eu.eudat.errorcode.ErrorThesaurusProperties; import eu.eudat.errorcode.ErrorThesaurusProperties;
import gr.cite.tools.exception.MyValidationException; import gr.cite.tools.exception.MyValidationException;

View File

@ -2,9 +2,9 @@ package eu.eudat.model.persist;
import eu.eudat.commons.enums.ActionConfirmationStatus; import eu.eudat.commons.enums.ActionConfirmationStatus;
import eu.eudat.commons.enums.ActionConfirmationType; import eu.eudat.commons.enums.ActionConfirmationType;
import eu.eudat.commons.validation.FieldNotNullIfOtherSet; import eu.eudat.commons.validation.old.FieldNotNullIfOtherSet;
import eu.eudat.commons.validation.ValidEnum; import eu.eudat.commons.validation.old.ValidEnum;
import eu.eudat.commons.validation.ValidId; import eu.eudat.commons.validation.old.ValidId;
import eu.eudat.model.persist.actionconfirmation.DmpInvitationPersist; import eu.eudat.model.persist.actionconfirmation.DmpInvitationPersist;
import eu.eudat.model.persist.actionconfirmation.EmailConfirmationPersist; import eu.eudat.model.persist.actionconfirmation.EmailConfirmationPersist;
import jakarta.validation.Valid; import jakarta.validation.Valid;

View File

@ -1,6 +1,6 @@
package eu.eudat.model.persist; package eu.eudat.model.persist;
import eu.eudat.commons.validation.ValidId; import eu.eudat.commons.validation.old.ValidId;
import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import org.apache.commons.compress.utils.Lists; import org.apache.commons.compress.utils.Lists;

View File

@ -1,9 +1,9 @@
package eu.eudat.model.persist; package eu.eudat.model.persist;
import eu.eudat.commons.enums.DescriptionStatus; import eu.eudat.commons.enums.DescriptionStatus;
import eu.eudat.commons.validation.FieldNotNullIfOtherSet; import eu.eudat.commons.validation.old.FieldNotNullIfOtherSet;
import eu.eudat.commons.validation.ValidEnum; import eu.eudat.commons.validation.old.ValidEnum;
import eu.eudat.commons.validation.ValidId; import eu.eudat.commons.validation.old.ValidId;
import eu.eudat.data.DescriptionEntity; import eu.eudat.data.DescriptionEntity;
import eu.eudat.model.persist.descriptionproperties.PropertyDefinitionPersist; import eu.eudat.model.persist.descriptionproperties.PropertyDefinitionPersist;
import jakarta.validation.Valid; import jakarta.validation.Valid;

View File

@ -1,18 +1,11 @@
package eu.eudat.model.persist; package eu.eudat.model.persist;
import eu.eudat.commons.enums.DescriptionTemplateStatus; import eu.eudat.commons.validation.old.FieldNotNullIfOtherSet;
import eu.eudat.commons.validation.FieldNotNullIfOtherSet; import eu.eudat.commons.validation.old.ValidId;
import eu.eudat.commons.validation.ValidEnum;
import eu.eudat.commons.validation.ValidId;
import eu.eudat.data.DescriptionTemplateEntity;
import eu.eudat.model.persist.descriptiontemplatedefinition.DefinitionPersist;
import jakarta.validation.Valid; import jakarta.validation.Valid;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import java.util.List;
import java.util.UUID; import java.util.UUID;
@FieldNotNullIfOtherSet(message = "{validation.hashempty}") @FieldNotNullIfOtherSet(message = "{validation.hashempty}")

View File

@ -1,17 +1,12 @@
package eu.eudat.model.persist; package eu.eudat.model.persist;
import eu.eudat.commons.enums.DescriptionStatus; import eu.eudat.commons.enums.DescriptionStatus;
import eu.eudat.commons.validation.FieldNotNullIfOtherSet; import eu.eudat.commons.validation.old.FieldNotNullIfOtherSet;
import eu.eudat.commons.validation.ValidEnum; import eu.eudat.commons.validation.old.ValidEnum;
import eu.eudat.commons.validation.ValidId; import eu.eudat.commons.validation.old.ValidId;
import eu.eudat.data.DescriptionEntity;
import eu.eudat.model.persist.descriptionproperties.PropertyDefinitionPersist;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import java.util.List;
import java.util.UUID; import java.util.UUID;
@FieldNotNullIfOtherSet(message = "{validation.hashempty}") @FieldNotNullIfOtherSet(message = "{validation.hashempty}")

View File

@ -2,19 +2,15 @@ package eu.eudat.model.persist;
import eu.eudat.commons.enums.DescriptionTemplateStatus; import eu.eudat.commons.enums.DescriptionTemplateStatus;
import eu.eudat.commons.enums.UserDescriptionTemplateRole; import eu.eudat.commons.validation.old.FieldNotNullIfOtherSet;
import eu.eudat.commons.validation.FieldNotNullIfOtherSet; import eu.eudat.commons.validation.old.ValidEnum;
import eu.eudat.commons.validation.ValidEnum; import eu.eudat.commons.validation.old.ValidId;
import eu.eudat.commons.validation.ValidId;
import eu.eudat.data.DescriptionTemplateEntity; import eu.eudat.data.DescriptionTemplateEntity;
import eu.eudat.model.persist.descriptiontemplatedefinition.DefinitionPersist; import eu.eudat.model.persist.descriptiontemplatedefinition.DefinitionPersist;
import jakarta.validation.Valid; import jakarta.validation.Valid;
import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size; import jakarta.validation.constraints.Size;
import org.springframework.validation.Errors;
import org.springframework.validation.ValidationUtils;
import org.springframework.validation.Validator;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;

View File

@ -8,9 +8,6 @@ import eu.eudat.commons.validation.specification.Specification;
import eu.eudat.convention.ConventionService; import eu.eudat.convention.ConventionService;
import eu.eudat.data.DescriptionTemplateTypeEntity; import eu.eudat.data.DescriptionTemplateTypeEntity;
import eu.eudat.errorcode.ErrorThesaurusProperties; import eu.eudat.errorcode.ErrorThesaurusProperties;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.MessageSource; import org.springframework.context.MessageSource;
import org.springframework.context.annotation.Scope; import org.springframework.context.annotation.Scope;

View File

@ -1,11 +1,10 @@
package eu.eudat.model.persist; package eu.eudat.model.persist;
import eu.eudat.commons.enums.DmpBlueprintStatus; import eu.eudat.commons.enums.DmpBlueprintStatus;
import eu.eudat.commons.validation.FieldNotNullIfOtherSet; import eu.eudat.commons.validation.old.FieldNotNullIfOtherSet;
import eu.eudat.commons.validation.ValidEnum; import eu.eudat.commons.validation.old.ValidEnum;
import eu.eudat.commons.validation.ValidId; import eu.eudat.commons.validation.old.ValidId;
import eu.eudat.data.DmpBlueprintEntity; import eu.eudat.data.DmpBlueprintEntity;
import eu.eudat.model.dmpblueprintdefinition.Definition;
import eu.eudat.model.persist.dmpblueprintdefinition.DefinitionPersist; import eu.eudat.model.persist.dmpblueprintdefinition.DefinitionPersist;
import jakarta.validation.Valid; import jakarta.validation.Valid;
import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotEmpty;

View File

@ -1,7 +1,7 @@
package eu.eudat.model.persist; package eu.eudat.model.persist;
import eu.eudat.commons.validation.FieldNotNullIfOtherSet; import eu.eudat.commons.validation.old.FieldNotNullIfOtherSet;
import eu.eudat.commons.validation.ValidId; import eu.eudat.commons.validation.old.ValidId;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import java.util.UUID; import java.util.UUID;

View File

@ -2,10 +2,9 @@ package eu.eudat.model.persist;
import eu.eudat.commons.enums.DmpAccessType; import eu.eudat.commons.enums.DmpAccessType;
import eu.eudat.commons.enums.DmpStatus; import eu.eudat.commons.enums.DmpStatus;
import eu.eudat.commons.validation.FieldNotNullIfOtherSet; import eu.eudat.commons.validation.old.FieldNotNullIfOtherSet;
import eu.eudat.commons.validation.ValidEnum; import eu.eudat.commons.validation.old.ValidEnum;
import eu.eudat.commons.validation.ValidId; import eu.eudat.commons.validation.old.ValidId;
import eu.eudat.data.DescriptionEntity;
import eu.eudat.data.DmpEntity; import eu.eudat.data.DmpEntity;
import eu.eudat.model.persist.dmpproperties.DmpPropertiesPersist; import eu.eudat.model.persist.dmpproperties.DmpPropertiesPersist;
import jakarta.validation.Valid; import jakarta.validation.Valid;

View File

@ -1,7 +1,7 @@
package eu.eudat.model.persist; package eu.eudat.model.persist;
import eu.eudat.commons.validation.FieldNotNullIfOtherSet; import eu.eudat.commons.validation.old.FieldNotNullIfOtherSet;
import eu.eudat.commons.validation.ValidId; import eu.eudat.commons.validation.old.ValidId;
import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;

View File

@ -1,7 +1,7 @@
package eu.eudat.model.persist; package eu.eudat.model.persist;
import eu.eudat.commons.enums.DmpUserRole; import eu.eudat.commons.enums.DmpUserRole;
import eu.eudat.commons.validation.ValidEnum; import eu.eudat.commons.validation.old.ValidEnum;
import jakarta.validation.Valid; import jakarta.validation.Valid;
import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;

View File

@ -1,6 +1,6 @@
package eu.eudat.model.persist; package eu.eudat.model.persist;
import eu.eudat.commons.validation.RequiredOneField; import eu.eudat.commons.validation.old.RequiredOneField;
import java.util.UUID; import java.util.UUID;

View File

@ -1,19 +1,10 @@
package eu.eudat.model.persist; package eu.eudat.model.persist;
import eu.eudat.commons.enums.DmpAccessType;
import eu.eudat.commons.enums.DmpStatus;
import eu.eudat.commons.enums.DmpUserRole; import eu.eudat.commons.enums.DmpUserRole;
import eu.eudat.commons.validation.FieldNotNullIfOtherSet; import eu.eudat.commons.validation.old.ValidEnum;
import eu.eudat.commons.validation.ValidEnum; import eu.eudat.commons.validation.old.ValidId;
import eu.eudat.commons.validation.ValidId;
import eu.eudat.data.DmpEntity;
import eu.eudat.model.persist.dmpproperties.DmpPropertiesPersist;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import java.util.List;
import java.util.UUID; import java.util.UUID;
public class DmpUserRemovePersist { public class DmpUserRemovePersist {

View File

@ -1,7 +1,7 @@
package eu.eudat.model.persist; package eu.eudat.model.persist;
import eu.eudat.commons.validation.FieldNotNullIfOtherSet; import eu.eudat.commons.validation.old.FieldNotNullIfOtherSet;
import eu.eudat.commons.validation.ValidId; import eu.eudat.commons.validation.old.ValidId;
import java.util.UUID; import java.util.UUID;

View File

@ -1,6 +1,6 @@
package eu.eudat.model.persist; package eu.eudat.model.persist;
import eu.eudat.commons.validation.ValidId; import eu.eudat.commons.validation.old.ValidId;
import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size; import jakarta.validation.constraints.Size;

View File

@ -1,9 +1,9 @@
package eu.eudat.model.persist; package eu.eudat.model.persist;
import eu.eudat.commons.enums.LockTargetType; import eu.eudat.commons.enums.LockTargetType;
import eu.eudat.commons.validation.FieldNotNullIfOtherSet; import eu.eudat.commons.validation.old.FieldNotNullIfOtherSet;
import eu.eudat.commons.validation.ValidEnum; import eu.eudat.commons.validation.old.ValidEnum;
import eu.eudat.commons.validation.ValidId; import eu.eudat.commons.validation.old.ValidId;
import jakarta.validation.Valid; import jakarta.validation.Valid;
import java.util.UUID; import java.util.UUID;

View File

@ -2,9 +2,9 @@ package eu.eudat.model.persist;
import eu.eudat.commons.enums.DescriptionTemplateStatus; import eu.eudat.commons.enums.DescriptionTemplateStatus;
import eu.eudat.commons.validation.FieldNotNullIfOtherSet; import eu.eudat.commons.validation.old.FieldNotNullIfOtherSet;
import eu.eudat.commons.validation.ValidEnum; import eu.eudat.commons.validation.old.ValidEnum;
import eu.eudat.commons.validation.ValidId; import eu.eudat.commons.validation.old.ValidId;
import eu.eudat.data.DescriptionTemplateEntity; import eu.eudat.data.DescriptionTemplateEntity;
import eu.eudat.model.persist.descriptiontemplatedefinition.DefinitionPersist; import eu.eudat.model.persist.descriptiontemplatedefinition.DefinitionPersist;
import jakarta.validation.Valid; import jakarta.validation.Valid;

View File

@ -1,7 +1,7 @@
package eu.eudat.model.persist; package eu.eudat.model.persist;
import eu.eudat.commons.validation.FieldNotNullIfOtherSet; import eu.eudat.commons.validation.old.FieldNotNullIfOtherSet;
import eu.eudat.commons.validation.ValidId; import eu.eudat.commons.validation.old.ValidId;
import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import org.apache.commons.compress.utils.Lists; import org.apache.commons.compress.utils.Lists;

View File

@ -2,9 +2,9 @@ package eu.eudat.model.persist;
import eu.eudat.commons.enums.ReferenceType; import eu.eudat.commons.enums.ReferenceType;
import eu.eudat.commons.enums.ReferenceSourceType; import eu.eudat.commons.enums.ReferenceSourceType;
import eu.eudat.commons.validation.FieldNotNullIfOtherSet; import eu.eudat.commons.validation.old.FieldNotNullIfOtherSet;
import eu.eudat.commons.validation.ValidEnum; import eu.eudat.commons.validation.old.ValidEnum;
import eu.eudat.commons.validation.ValidId; import eu.eudat.commons.validation.old.ValidId;
import eu.eudat.model.persist.referencedefinition.DefinitionPersist; import eu.eudat.model.persist.referencedefinition.DefinitionPersist;
import jakarta.validation.Valid; import jakarta.validation.Valid;
import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotEmpty;

View File

@ -1,7 +1,7 @@
package eu.eudat.model.persist; package eu.eudat.model.persist;
import eu.eudat.commons.validation.FieldNotNullIfOtherSet; import eu.eudat.commons.validation.old.FieldNotNullIfOtherSet;
import eu.eudat.commons.validation.ValidId; import eu.eudat.commons.validation.old.ValidId;
import eu.eudat.model.persist.referencetypedefinition.ReferenceTypeDefinitionPersist; import eu.eudat.model.persist.referencetypedefinition.ReferenceTypeDefinitionPersist;
import jakarta.validation.Valid; import jakarta.validation.Valid;
import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotEmpty;

View File

@ -1,7 +1,7 @@
package eu.eudat.model.persist; package eu.eudat.model.persist;
import eu.eudat.commons.enums.StorageType; import eu.eudat.commons.enums.StorageType;
import eu.eudat.commons.validation.ValidEnum; import eu.eudat.commons.validation.old.ValidEnum;
import eu.eudat.data.StorageFileEntity; import eu.eudat.data.StorageFileEntity;
import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;

View File

@ -1,9 +1,8 @@
package eu.eudat.model.persist; package eu.eudat.model.persist;
import eu.eudat.commons.enums.SupportiveMaterialFieldType; import eu.eudat.commons.enums.SupportiveMaterialFieldType;
import eu.eudat.commons.validation.ValidEnum; import eu.eudat.commons.validation.old.ValidEnum;
import eu.eudat.commons.validation.ValidId; import eu.eudat.commons.validation.old.ValidId;
import eu.eudat.data.DmpBlueprintEntity;
import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size; import jakarta.validation.constraints.Size;

View File

@ -1,7 +1,7 @@
package eu.eudat.model.persist; package eu.eudat.model.persist;
import eu.eudat.commons.validation.FieldNotNullIfOtherSet; import eu.eudat.commons.validation.old.FieldNotNullIfOtherSet;
import eu.eudat.commons.validation.ValidId; import eu.eudat.commons.validation.old.ValidId;
import eu.eudat.model.persist.tenantconfig.TenantConfigPersist; import eu.eudat.model.persist.tenantconfig.TenantConfigPersist;
import jakarta.validation.constraints.*; import jakarta.validation.constraints.*;

View File

@ -1,6 +1,6 @@
package eu.eudat.model.persist; package eu.eudat.model.persist;
import eu.eudat.commons.validation.ValidId; import eu.eudat.commons.validation.old.ValidId;
import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;

View File

@ -1,9 +1,9 @@
package eu.eudat.model.persist; package eu.eudat.model.persist;
import eu.eudat.commons.enums.UserDescriptionTemplateRole; import eu.eudat.commons.enums.UserDescriptionTemplateRole;
import eu.eudat.commons.validation.FieldNotNullIfOtherSet; import eu.eudat.commons.validation.old.FieldNotNullIfOtherSet;
import eu.eudat.commons.validation.ValidEnum; import eu.eudat.commons.validation.old.ValidEnum;
import eu.eudat.commons.validation.ValidId; import eu.eudat.commons.validation.old.ValidId;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import java.util.UUID; import java.util.UUID;

View File

@ -1,25 +1,14 @@
package eu.eudat.model.persist; package eu.eudat.model.persist;
import eu.eudat.commons.enums.DescriptionTemplateTypeStatus; import eu.eudat.commons.validation.old.FieldNotNullIfOtherSet;
import eu.eudat.commons.enums.IsActive; import eu.eudat.commons.validation.old.ValidId;
import eu.eudat.commons.validation.FieldNotNullIfOtherSet;
import eu.eudat.commons.validation.ValidEnum;
import eu.eudat.commons.validation.ValidId;
import eu.eudat.data.DescriptionEntity;
import eu.eudat.data.DescriptionTemplateTypeEntity;
import eu.eudat.data.UserEntity; import eu.eudat.data.UserEntity;
import eu.eudat.model.UserAdditionalInfo;
import eu.eudat.model.UserContactInfo;
import eu.eudat.model.UserCredential;
import eu.eudat.model.UserRole;
import jakarta.validation.Valid; import jakarta.validation.Valid;
import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size; import jakarta.validation.constraints.Size;
import java.time.Instant;
import java.util.List;
import java.util.UUID; import java.util.UUID;
@FieldNotNullIfOtherSet(message = "{validation.hashempty}") @FieldNotNullIfOtherSet(message = "{validation.hashempty}")

View File

@ -1,13 +1,9 @@
package eu.eudat.model.persist; package eu.eudat.model.persist;
import eu.eudat.commons.validation.FieldNotNullIfOtherSet; import eu.eudat.commons.validation.old.FieldNotNullIfOtherSet;
import eu.eudat.commons.validation.ValidId; import eu.eudat.commons.validation.old.ValidId;
import eu.eudat.data.UserEntity;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;

View File

@ -1,8 +1,8 @@
package eu.eudat.model.persist; package eu.eudat.model.persist;
import eu.eudat.commons.enums.UserSettingsType; import eu.eudat.commons.enums.UserSettingsType;
import eu.eudat.commons.validation.FieldNotNullIfOtherSet; import eu.eudat.commons.validation.old.FieldNotNullIfOtherSet;
import eu.eudat.commons.validation.ValidId; import eu.eudat.commons.validation.old.ValidId;
import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;

View File

@ -1,14 +1,10 @@
package eu.eudat.model.persist.actionconfirmation; package eu.eudat.model.persist.actionconfirmation;
import eu.eudat.commons.enums.DmpUserRole; import eu.eudat.commons.enums.DmpUserRole;
import eu.eudat.commons.validation.ValidEnum; import eu.eudat.commons.validation.old.ValidEnum;
import jakarta.validation.Valid; import jakarta.validation.Valid;
import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlAttribute;
import jakarta.xml.bind.annotation.XmlRootElement;
import java.util.UUID; import java.util.UUID;

View File

@ -1,6 +1,6 @@
package eu.eudat.model.persist.deposit; package eu.eudat.model.persist.deposit;
import eu.eudat.commons.validation.ValidId; import eu.eudat.commons.validation.old.ValidId;
import gr.cite.tools.fieldset.BaseFieldSet; import gr.cite.tools.fieldset.BaseFieldSet;
import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;

View File

@ -1,7 +1,7 @@
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata; package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
import eu.eudat.commons.types.descriptiontemplate.fielddata.AutoCompleteDataEntity; import eu.eudat.commons.types.descriptiontemplate.fielddata.AutoCompleteDataEntity;
import eu.eudat.commons.validation.ValidEnum; import eu.eudat.commons.validation.old.ValidEnum;
import jakarta.validation.Valid; import jakarta.validation.Valid;
import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;

View File

@ -3,7 +3,7 @@ package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeInfo;
import eu.eudat.commons.enums.FieldType; import eu.eudat.commons.enums.FieldType;
import eu.eudat.commons.validation.ValidEnum; import eu.eudat.commons.validation.old.ValidEnum;
import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;

View File

@ -2,7 +2,7 @@ package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
import eu.eudat.commons.enums.FieldDataExternalDatasetType; import eu.eudat.commons.enums.FieldDataExternalDatasetType;
import eu.eudat.commons.validation.ValidEnum; import eu.eudat.commons.validation.old.ValidEnum;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
public class ExternalDatasetDataPersist extends BaseFieldDataPersist { public class ExternalDatasetDataPersist extends BaseFieldDataPersist {

View File

@ -1,6 +1,6 @@
package eu.eudat.model.persist.dmpblueprintdefinition; package eu.eudat.model.persist.dmpblueprintdefinition;
import eu.eudat.commons.validation.ValidId; import eu.eudat.commons.validation.old.ValidId;
import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;

View File

@ -1,7 +1,7 @@
package eu.eudat.model.persist.dmpblueprintdefinition; package eu.eudat.model.persist.dmpblueprintdefinition;
import eu.eudat.commons.enums.DmpBlueprintExtraFieldDataType; import eu.eudat.commons.enums.DmpBlueprintExtraFieldDataType;
import eu.eudat.commons.validation.ValidEnum; import eu.eudat.commons.validation.old.ValidEnum;
public class ExtraFieldPersist extends FieldPersist { public class ExtraFieldPersist extends FieldPersist {

View File

@ -3,8 +3,8 @@ package eu.eudat.model.persist.dmpblueprintdefinition;
import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeInfo;
import eu.eudat.commons.enums.DmpBlueprintFieldCategory; import eu.eudat.commons.enums.DmpBlueprintFieldCategory;
import eu.eudat.commons.validation.ValidEnum; import eu.eudat.commons.validation.old.ValidEnum;
import eu.eudat.commons.validation.ValidId; import eu.eudat.commons.validation.old.ValidId;
import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;

View File

@ -1,7 +1,7 @@
package eu.eudat.model.persist.dmpblueprintdefinition; package eu.eudat.model.persist.dmpblueprintdefinition;
import eu.eudat.commons.validation.ValidId; import eu.eudat.commons.validation.old.ValidId;
import jakarta.validation.Valid; import jakarta.validation.Valid;
import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;

View File

@ -1,7 +1,7 @@
package eu.eudat.model.persist.dmpblueprintdefinition; package eu.eudat.model.persist.dmpblueprintdefinition;
import eu.eudat.commons.enums.DmpBlueprintSystemFieldType; import eu.eudat.commons.enums.DmpBlueprintSystemFieldType;
import eu.eudat.commons.validation.ValidEnum; import eu.eudat.commons.validation.old.ValidEnum;
public class SystemFieldPersist extends FieldPersist { public class SystemFieldPersist extends FieldPersist {
@ValidEnum(message = "{validation.empty}") @ValidEnum(message = "{validation.empty}")

View File

@ -4,8 +4,8 @@ import eu.eudat.commons.enums.notification.NotificationContactType;
import eu.eudat.commons.enums.notification.NotificationNotifyState; import eu.eudat.commons.enums.notification.NotificationNotifyState;
import eu.eudat.commons.enums.notification.NotificationTrackingProcess; import eu.eudat.commons.enums.notification.NotificationTrackingProcess;
import eu.eudat.commons.enums.notification.NotificationTrackingState; import eu.eudat.commons.enums.notification.NotificationTrackingState;
import eu.eudat.commons.validation.FieldNotNullIfOtherSet; import eu.eudat.commons.validation.old.FieldNotNullIfOtherSet;
import eu.eudat.commons.validation.ValidId; import eu.eudat.commons.validation.old.ValidId;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;

View File

@ -1,7 +1,7 @@
package eu.eudat.model.persist.referencedefinition; package eu.eudat.model.persist.referencedefinition;
import eu.eudat.commons.enums.ReferenceFieldDataType; import eu.eudat.commons.enums.ReferenceFieldDataType;
import eu.eudat.commons.validation.ValidEnum; import eu.eudat.commons.validation.old.ValidEnum;
import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;

View File

@ -1,7 +1,7 @@
package eu.eudat.model.persist.referencetypedefinition; package eu.eudat.model.persist.referencetypedefinition;
import eu.eudat.commons.enums.ReferenceTypeExternalApiHTTPMethodType; import eu.eudat.commons.enums.ReferenceTypeExternalApiHTTPMethodType;
import eu.eudat.commons.validation.ValidEnum; import eu.eudat.commons.validation.old.ValidEnum;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
public class AuthenticationConfigurationPersist { public class AuthenticationConfigurationPersist {

View File

@ -1,7 +1,7 @@
package eu.eudat.model.persist.referencetypedefinition; package eu.eudat.model.persist.referencetypedefinition;
import eu.eudat.commons.enums.ReferenceFieldDataType; import eu.eudat.commons.enums.ReferenceFieldDataType;
import eu.eudat.commons.validation.ValidEnum; import eu.eudat.commons.validation.old.ValidEnum;
import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;

View File

@ -3,7 +3,7 @@ package eu.eudat.model.persist.referencetypedefinition;
import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeInfo;
import eu.eudat.commons.enums.ReferenceTypeSourceType; import eu.eudat.commons.enums.ReferenceTypeSourceType;
import eu.eudat.commons.validation.ValidEnum; import eu.eudat.commons.validation.old.ValidEnum;
import jakarta.validation.Valid; import jakarta.validation.Valid;
import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;

View File

@ -1,8 +1,7 @@
package eu.eudat.model.persist.referencetypedefinition; package eu.eudat.model.persist.referencetypedefinition;
import eu.eudat.commons.enums.ReferenceTypeExternalApiHTTPMethodType; import eu.eudat.commons.enums.ReferenceTypeExternalApiHTTPMethodType;
import eu.eudat.commons.enums.ReferenceTypeSourceType; import eu.eudat.commons.validation.old.ValidEnum;
import eu.eudat.commons.validation.ValidEnum;
import jakarta.validation.Valid; import jakarta.validation.Valid;
import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;