Merge branch 'dmp-refactoring' of https://code-repo.d4science.org/MaDgiK-CITE/argos into dmp-refactoring
This commit is contained in:
commit
8bccb9a224
|
@ -70,8 +70,12 @@ public abstract class AbstractValidator<T> implements Validator {
|
||||||
@Override
|
@Override
|
||||||
public void validate(Object target){
|
public void validate(Object target){
|
||||||
this.bindingResult = new BeanPropertyBindingResult(target, target.getClass().getName());
|
this.bindingResult = new BeanPropertyBindingResult(target, target.getClass().getName());
|
||||||
|
if (target instanceof Collection<?>) {
|
||||||
|
((Collection<?>) target).forEach(x -> this.validate(x, this.bindingResult));
|
||||||
|
} else {
|
||||||
this.validate(target, this.bindingResult);
|
this.validate(target, this.bindingResult);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ValidationResult result() {
|
public ValidationResult result() {
|
||||||
|
|
|
@ -17,9 +17,10 @@ public class LanguageEntity extends TenantScopedBaseEntity {
|
||||||
private UUID id;
|
private UUID id;
|
||||||
public static final String _id = "id";
|
public static final String _id = "id";
|
||||||
|
|
||||||
@Column(name = "code", length = 20, nullable = false)
|
@Column(name = "code", length = _codeLength, nullable = false)
|
||||||
private String code;
|
private String code;
|
||||||
public static final String _code = "code";
|
public static final String _code = "code";
|
||||||
|
public static final int _codeLength = 20;
|
||||||
|
|
||||||
@Column(name = "payload")
|
@Column(name = "payload")
|
||||||
private String payload;
|
private String payload;
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package eu.eudat.data;
|
package eu.eudat.data;
|
||||||
|
|
||||||
import eu.eudat.commons.enums.ReferenceType;
|
|
||||||
import eu.eudat.commons.enums.IsActive;
|
import eu.eudat.commons.enums.IsActive;
|
||||||
import eu.eudat.commons.enums.ReferenceSourceType;
|
import eu.eudat.commons.enums.ReferenceSourceType;
|
||||||
|
import eu.eudat.commons.enums.ReferenceType;
|
||||||
|
import eu.eudat.data.converters.enums.IsActiveConverter;
|
||||||
import eu.eudat.data.converters.enums.ReferenceSourceTypeConverter;
|
import eu.eudat.data.converters.enums.ReferenceSourceTypeConverter;
|
||||||
import eu.eudat.data.converters.enums.ReferenceTypeConverter;
|
import eu.eudat.data.converters.enums.ReferenceTypeConverter;
|
||||||
import eu.eudat.data.converters.enums.IsActiveConverter;
|
|
||||||
import eu.eudat.data.tenant.TenantScopedBaseEntity;
|
import eu.eudat.data.tenant.TenantScopedBaseEntity;
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.*;
|
||||||
|
|
||||||
|
@ -19,57 +19,78 @@ public class ReferenceEntity extends TenantScopedBaseEntity {
|
||||||
@Id
|
@Id
|
||||||
@Column(name = "id", columnDefinition = "uuid", updatable = false, nullable = false)
|
@Column(name = "id", columnDefinition = "uuid", updatable = false, nullable = false)
|
||||||
private UUID id;
|
private UUID id;
|
||||||
|
|
||||||
public static final String _id = "id";
|
public static final String _id = "id";
|
||||||
|
|
||||||
@Column(name = "label", length = 500, nullable = false)
|
@Column(name = "label", length = _labelLength, nullable = false)
|
||||||
private String label;
|
private String label;
|
||||||
|
|
||||||
public static final String _label = "label";
|
public static final String _label = "label";
|
||||||
|
|
||||||
|
public static final int _labelLength = 500;
|
||||||
|
|
||||||
@Column(name = "type", nullable = false)
|
@Column(name = "type", nullable = false)
|
||||||
@Convert(converter = ReferenceTypeConverter.class)
|
@Convert(converter = ReferenceTypeConverter.class)
|
||||||
private ReferenceType type;
|
private ReferenceType type;
|
||||||
|
|
||||||
public static final String _type = "type";
|
public static final String _type = "type";
|
||||||
|
|
||||||
@Column(name = "description")
|
@Column(name = "description")
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
public static final String _description = "description";
|
public static final String _description = "description";
|
||||||
|
|
||||||
@Column(name = "definition")
|
@Column(name = "definition")
|
||||||
private String definition;
|
private String definition;
|
||||||
|
|
||||||
public static final String _definition = "definition";
|
public static final String _definition = "definition";
|
||||||
|
|
||||||
@Column(name = "reference", length = 1024, nullable = false)
|
@Column(name = "reference", length = _referenceLength, nullable = false)
|
||||||
private String reference;
|
private String reference;
|
||||||
|
|
||||||
public static final String _reference = "reference";
|
public static final String _reference = "reference";
|
||||||
|
|
||||||
@Column(name = "abbreviation", length = 50)
|
public static final int _referenceLength = 1024;
|
||||||
|
|
||||||
|
@Column(name = "abbreviation", length = _abbreviationLength)
|
||||||
private String abbreviation;
|
private String abbreviation;
|
||||||
|
|
||||||
public static final String _abbreviation = "abbreviation";
|
public static final String _abbreviation = "abbreviation";
|
||||||
|
|
||||||
@Column(name = "source", length = 1024)
|
public static final int _abbreviationLength = 50;
|
||||||
|
|
||||||
|
@Column(name = "source", length = _sourceLength)
|
||||||
private String source;
|
private String source;
|
||||||
|
|
||||||
public static final String _source = "source";
|
public static final String _source = "source";
|
||||||
|
|
||||||
|
public static final int _sourceLength = 1024;
|
||||||
|
|
||||||
@Column(name = "source_type", nullable = false)
|
@Column(name = "source_type", nullable = false)
|
||||||
@Convert(converter = ReferenceSourceTypeConverter.class)
|
@Convert(converter = ReferenceSourceTypeConverter.class)
|
||||||
private ReferenceSourceType sourceType;
|
private ReferenceSourceType sourceType;
|
||||||
|
|
||||||
public static final String _sourceType = "sourceType";
|
public static final String _sourceType = "sourceType";
|
||||||
|
|
||||||
@Column(name = "is_active", nullable = false)
|
@Column(name = "is_active", nullable = false)
|
||||||
@Convert(converter = IsActiveConverter.class)
|
@Convert(converter = IsActiveConverter.class)
|
||||||
private IsActive isActive;
|
private IsActive isActive;
|
||||||
|
|
||||||
public static final String _isActive = "isActive";
|
public static final String _isActive = "isActive";
|
||||||
|
|
||||||
@Column(name = "created_at", nullable = false)
|
@Column(name = "created_at", nullable = false)
|
||||||
private Instant createdAt;
|
private Instant createdAt;
|
||||||
|
|
||||||
public static final String _createdAt = "createdAt";
|
public static final String _createdAt = "createdAt";
|
||||||
|
|
||||||
@Column(name = "updated_at", nullable = false)
|
@Column(name = "updated_at", nullable = false)
|
||||||
private Instant updatedAt;
|
private Instant updatedAt;
|
||||||
|
|
||||||
public static final String _updatedAt = "updatedAt";
|
public static final String _updatedAt = "updatedAt";
|
||||||
|
|
||||||
@Column(name = "created_by", columnDefinition = "uuid")
|
@Column(name = "created_by", columnDefinition = "uuid")
|
||||||
private UUID createdById;
|
private UUID createdById;
|
||||||
|
|
||||||
public static final String _createdById = "createdBy";
|
public static final String _createdById = "createdBy";
|
||||||
|
|
||||||
public UUID getId() {
|
public UUID getId() {
|
||||||
|
@ -175,4 +196,5 @@ public class ReferenceEntity extends TenantScopedBaseEntity {
|
||||||
public void setCreatedById(UUID createdById) {
|
public void setCreatedById(UUID createdById) {
|
||||||
this.createdById = createdById;
|
this.createdById = createdById;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,31 +15,42 @@ public class ReferenceTypeEntity extends TenantScopedBaseEntity {
|
||||||
@Id
|
@Id
|
||||||
@Column(name = "id", columnDefinition = "uuid", updatable = false, nullable = false)
|
@Column(name = "id", columnDefinition = "uuid", updatable = false, nullable = false)
|
||||||
private UUID id;
|
private UUID id;
|
||||||
|
|
||||||
public static final String _id = "id";
|
public static final String _id = "id";
|
||||||
|
|
||||||
@Column(name = "name", length = 250, nullable = false)
|
@Column(name = "name", length = _nameLength, nullable = false)
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
public static final String _name = "name";
|
public static final String _name = "name";
|
||||||
|
|
||||||
@Column(name = "code", length = 100, nullable = false)
|
public static final int _nameLength = 250;
|
||||||
|
|
||||||
|
@Column(name = "code", length = _codeLength, nullable = false)
|
||||||
private String code;
|
private String code;
|
||||||
|
|
||||||
public static final String _code = "code";
|
public static final String _code = "code";
|
||||||
|
|
||||||
|
public static final int _codeLength = 100;
|
||||||
|
|
||||||
@Column(name = "definition")
|
@Column(name = "definition")
|
||||||
private String definition;
|
private String definition;
|
||||||
|
|
||||||
public static final String _definition = "definition";
|
public static final String _definition = "definition";
|
||||||
|
|
||||||
@Column(name = "is_active", nullable = false)
|
@Column(name = "is_active", nullable = false)
|
||||||
@Convert(converter = IsActiveConverter.class)
|
@Convert(converter = IsActiveConverter.class)
|
||||||
private IsActive isActive;
|
private IsActive isActive;
|
||||||
|
|
||||||
public static final String _isActive = "isActive";
|
public static final String _isActive = "isActive";
|
||||||
|
|
||||||
@Column(name = "created_at", nullable = false)
|
@Column(name = "created_at", nullable = false)
|
||||||
private Instant createdAt;
|
private Instant createdAt;
|
||||||
|
|
||||||
public static final String _createdAt = "createdAt";
|
public static final String _createdAt = "createdAt";
|
||||||
|
|
||||||
@Column(name = "updated_at", nullable = false)
|
@Column(name = "updated_at", nullable = false)
|
||||||
private Instant updatedAt;
|
private Instant updatedAt;
|
||||||
|
|
||||||
public static final String _updatedAt = "updatedAt";
|
public static final String _updatedAt = "updatedAt";
|
||||||
|
|
||||||
public UUID getId() {
|
public UUID getId() {
|
||||||
|
|
|
@ -5,10 +5,9 @@ import eu.eudat.commons.validation.BaseValidator;
|
||||||
import eu.eudat.commons.validation.ValidatorFactory;
|
import eu.eudat.commons.validation.ValidatorFactory;
|
||||||
import eu.eudat.commons.validation.specification.Specification;
|
import eu.eudat.commons.validation.specification.Specification;
|
||||||
import eu.eudat.convention.ConventionService;
|
import eu.eudat.convention.ConventionService;
|
||||||
|
import eu.eudat.data.DescriptionTemplateEntity;
|
||||||
import eu.eudat.errorcode.ErrorThesaurusProperties;
|
import eu.eudat.errorcode.ErrorThesaurusProperties;
|
||||||
import eu.eudat.model.persist.descriptiontemplatedefinition.DefinitionPersist;
|
import eu.eudat.model.persist.descriptiontemplatedefinition.DefinitionPersist;
|
||||||
import jakarta.validation.Valid;
|
|
||||||
import jakarta.validation.constraints.NotNull;
|
|
||||||
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;
|
||||||
|
@ -27,8 +26,6 @@ public class DescriptionTemplatePersist {
|
||||||
|
|
||||||
public static final String _label = "label";
|
public static final String _label = "label";
|
||||||
|
|
||||||
public static final int _labelLength = 250;
|
|
||||||
|
|
||||||
private String description = null;
|
private String description = null;
|
||||||
|
|
||||||
public static final String _description = "description";
|
public static final String _description = "description";
|
||||||
|
@ -45,13 +42,10 @@ public class DescriptionTemplatePersist {
|
||||||
|
|
||||||
public static final String _status = "status";
|
public static final String _status = "status";
|
||||||
|
|
||||||
@NotNull(message = "{validation.empty}")
|
|
||||||
@Valid
|
|
||||||
private DefinitionPersist definition = null;
|
private DefinitionPersist definition = null;
|
||||||
|
|
||||||
public static final String _definition = "definition";
|
public static final String _definition = "definition";
|
||||||
|
|
||||||
@Valid
|
|
||||||
private List<UserDescriptionTemplatePersist> users = null;
|
private List<UserDescriptionTemplatePersist> users = null;
|
||||||
|
|
||||||
public static final String _users = "users";
|
public static final String _users = "users";
|
||||||
|
@ -169,7 +163,7 @@ public class DescriptionTemplatePersist {
|
||||||
.failOn(DescriptionTemplatePersist._label).failWith(messageSource.getMessage("Validation_Required", new Object[]{DescriptionTemplatePersist._label}, LocaleContextHolder.getLocale())),
|
.failOn(DescriptionTemplatePersist._label).failWith(messageSource.getMessage("Validation_Required", new Object[]{DescriptionTemplatePersist._label}, LocaleContextHolder.getLocale())),
|
||||||
this.spec()
|
this.spec()
|
||||||
.iff(() -> !this.isEmpty(item.getLabel()))
|
.iff(() -> !this.isEmpty(item.getLabel()))
|
||||||
.must(() -> this.lessEqualLength(item.getLabel(), DescriptionTemplatePersist._labelLength))
|
.must(() -> this.lessEqualLength(item.getLabel(), DescriptionTemplateEntity._labelLength))
|
||||||
.failOn(DescriptionTemplatePersist._label).failWith(messageSource.getMessage("Validation_MaxLength", new Object[]{DescriptionTemplatePersist._label}, LocaleContextHolder.getLocale())),
|
.failOn(DescriptionTemplatePersist._label).failWith(messageSource.getMessage("Validation_MaxLength", new Object[]{DescriptionTemplatePersist._label}, LocaleContextHolder.getLocale())),
|
||||||
this.spec()
|
this.spec()
|
||||||
.must(() -> !this.isEmpty(item.getDescription()))
|
.must(() -> !this.isEmpty(item.getDescription()))
|
||||||
|
|
|
@ -1,23 +1,30 @@
|
||||||
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.old.ValidEnum;
|
import eu.eudat.commons.validation.BaseValidator;
|
||||||
import jakarta.validation.Valid;
|
import eu.eudat.commons.validation.ValidatorFactory;
|
||||||
import jakarta.validation.constraints.NotEmpty;
|
import eu.eudat.commons.validation.specification.Specification;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import eu.eudat.convention.ConventionService;
|
||||||
|
import eu.eudat.errorcode.ErrorThesaurusProperties;
|
||||||
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
|
import org.springframework.context.MessageSource;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.context.i18n.LocaleContextHolder;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class DmpUserInvitePersist {
|
public class DmpUserInvitePersist {
|
||||||
|
|
||||||
@Valid
|
|
||||||
@NotNull
|
|
||||||
@NotEmpty
|
|
||||||
private List<DmpUserInviteTypePersist> users;
|
private List<DmpUserInviteTypePersist> users;
|
||||||
|
|
||||||
@ValidEnum(message = "{validation.empty}")
|
public static final String _users = "users";
|
||||||
|
|
||||||
private DmpUserRole role;
|
private DmpUserRole role;
|
||||||
|
|
||||||
|
public static final String _role = "role";
|
||||||
|
|
||||||
public List<DmpUserInviteTypePersist> getUsers() {
|
public List<DmpUserInviteTypePersist> getUsers() {
|
||||||
return users;
|
return users;
|
||||||
}
|
}
|
||||||
|
@ -33,4 +40,45 @@ public class DmpUserInvitePersist {
|
||||||
public void setRole(DmpUserRole role) {
|
public void setRole(DmpUserRole role) {
|
||||||
this.role = role;
|
this.role = role;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Component(DmpUserInvitePersistValidator.ValidatorName)
|
||||||
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public static class DmpUserInvitePersistValidator extends BaseValidator<DmpUserInvitePersist> {
|
||||||
|
|
||||||
|
public static final String ValidatorName = "DmpUserInvitePersistValidator";
|
||||||
|
|
||||||
|
private final MessageSource messageSource;
|
||||||
|
|
||||||
|
private final ValidatorFactory validatorFactory;
|
||||||
|
|
||||||
|
protected DmpUserInvitePersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource, ValidatorFactory validatorFactory) {
|
||||||
|
super(conventionService, errors);
|
||||||
|
this.messageSource = messageSource;
|
||||||
|
this.validatorFactory = validatorFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<DmpUserInvitePersist> modelClass() {
|
||||||
|
return DmpUserInvitePersist.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<Specification> specifications(DmpUserInvitePersist item) {
|
||||||
|
return Arrays.asList(
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isNull(item.getRole()))
|
||||||
|
.failOn(DmpUserInvitePersist._role).failWith(messageSource.getMessage("Validation_Required", new Object[]{DmpUserInvitePersist._role}, LocaleContextHolder.getLocale())),
|
||||||
|
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isNull(item.getUsers()))
|
||||||
|
.failOn(DmpUserInvitePersist._users).failWith(messageSource.getMessage("Validation_Required", new Object[]{DmpUserInvitePersist._users}, LocaleContextHolder.getLocale())),
|
||||||
|
this.navSpec()
|
||||||
|
.iff(() -> !this.isNull(item.getUsers()))
|
||||||
|
.on(DmpUserInvitePersist._users)
|
||||||
|
.over(item.getUsers())
|
||||||
|
.using(() -> this.validatorFactory.validator(DmpUserInviteTypePersist.DmpUserInviteTypePersistValidator.class))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,16 +1,29 @@
|
||||||
package eu.eudat.model.persist;
|
package eu.eudat.model.persist;
|
||||||
|
|
||||||
import eu.eudat.commons.validation.old.RequiredOneField;
|
import eu.eudat.commons.validation.BaseValidator;
|
||||||
|
import eu.eudat.commons.validation.specification.Specification;
|
||||||
|
import eu.eudat.convention.ConventionService;
|
||||||
|
import eu.eudat.errorcode.ErrorThesaurusProperties;
|
||||||
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
|
import org.springframework.context.MessageSource;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.context.i18n.LocaleContextHolder;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@RequiredOneField(fieldNames={"userId","email"})
|
|
||||||
public class DmpUserInviteTypePersist {
|
public class DmpUserInviteTypePersist {
|
||||||
|
|
||||||
private UUID userId;
|
private UUID userId;
|
||||||
|
|
||||||
|
public static final String _userId = "userId";
|
||||||
|
|
||||||
private String email;
|
private String email;
|
||||||
|
|
||||||
|
public static final String _email = "email";
|
||||||
|
|
||||||
public UUID getUserId() {
|
public UUID getUserId() {
|
||||||
return userId;
|
return userId;
|
||||||
}
|
}
|
||||||
|
@ -26,4 +39,39 @@ public class DmpUserInviteTypePersist {
|
||||||
public void setEmail(String email) {
|
public void setEmail(String email) {
|
||||||
this.email = email;
|
this.email = email;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Component(DmpUserInviteTypePersistValidator.ValidatorName)
|
||||||
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public static class DmpUserInviteTypePersistValidator extends BaseValidator<DmpUserInviteTypePersist> {
|
||||||
|
|
||||||
|
public static final String ValidatorName = "DmpUserInviteTypePersistValidator";
|
||||||
|
|
||||||
|
private final MessageSource messageSource;
|
||||||
|
|
||||||
|
protected DmpUserInviteTypePersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource) {
|
||||||
|
super(conventionService, errors);
|
||||||
|
this.messageSource = messageSource;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<DmpUserInviteTypePersist> modelClass() {
|
||||||
|
return DmpUserInviteTypePersist.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<Specification> specifications(DmpUserInviteTypePersist item) {
|
||||||
|
return Arrays.asList(
|
||||||
|
this.spec()
|
||||||
|
.iff(() -> this.isEmpty(item.getEmail()))
|
||||||
|
.must(() -> !this.isValidGuid(item.getUserId()))
|
||||||
|
.failOn(DmpUserInviteTypePersist._userId).failWith(messageSource.getMessage("Validation_Required", new Object[]{DmpUserInviteTypePersist._userId}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.iff(() -> !this.isValidGuid(item.getUserId()))
|
||||||
|
.must(() -> !this.isEmpty(item.getEmail()))
|
||||||
|
.failOn(DmpUserInviteTypePersist._email).failWith(messageSource.getMessage("Validation_Required", new Object[]{DmpUserInviteTypePersist._email}, LocaleContextHolder.getLocale()))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,15 +1,30 @@
|
||||||
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.BaseValidator;
|
||||||
|
import eu.eudat.commons.validation.specification.Specification;
|
||||||
|
import eu.eudat.convention.ConventionService;
|
||||||
|
import eu.eudat.errorcode.ErrorThesaurusProperties;
|
||||||
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
|
import org.springframework.context.MessageSource;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.context.i18n.LocaleContextHolder;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class DmpUserPersist {
|
public class DmpUserPersist {
|
||||||
|
|
||||||
private UUID user;
|
private UUID user;
|
||||||
|
|
||||||
|
public static final String _user = "user";
|
||||||
|
|
||||||
private DmpUserRole role;
|
private DmpUserRole role;
|
||||||
|
|
||||||
|
public static final String _role = "role";
|
||||||
|
|
||||||
public UUID getUser() {
|
public UUID getUser() {
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
|
@ -25,4 +40,36 @@ public class DmpUserPersist {
|
||||||
public void setRole(DmpUserRole role) {
|
public void setRole(DmpUserRole role) {
|
||||||
this.role = role;
|
this.role = role;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Component(DmpUserPersistValidator.ValidatorName)
|
||||||
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public static class DmpUserPersistValidator extends BaseValidator<DmpUserPersist> {
|
||||||
|
|
||||||
|
public static final String ValidatorName = "DmpUserPersistValidator";
|
||||||
|
|
||||||
|
private final MessageSource messageSource;
|
||||||
|
|
||||||
|
protected DmpUserPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource) {
|
||||||
|
super(conventionService, errors);
|
||||||
|
this.messageSource = messageSource;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<DmpUserPersist> modelClass() {
|
||||||
|
return DmpUserPersist.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<Specification> specifications(DmpUserPersist item) {
|
||||||
|
return Arrays.asList(
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isValidGuid(item.getUser()))
|
||||||
|
.failOn(DmpUserPersist._user).failWith(messageSource.getMessage("Validation_Required", new Object[]{DmpUserPersist._user}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isNull(item.getRole()))
|
||||||
|
.failOn(DmpUserPersist._role).failWith(messageSource.getMessage("Validation_Required", new Object[]{DmpUserPersist._role}, LocaleContextHolder.getLocale()))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,27 +1,34 @@
|
||||||
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.old.ValidEnum;
|
import eu.eudat.commons.validation.BaseValidator;
|
||||||
import eu.eudat.commons.validation.old.ValidId;
|
import eu.eudat.commons.validation.specification.Specification;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import eu.eudat.convention.ConventionService;
|
||||||
|
import eu.eudat.errorcode.ErrorThesaurusProperties;
|
||||||
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
|
import org.springframework.context.MessageSource;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.context.i18n.LocaleContextHolder;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class DmpUserRemovePersist {
|
public class DmpUserRemovePersist {
|
||||||
|
|
||||||
@NotNull(message = "{validation.empty}")
|
|
||||||
@ValidId(message = "{validation.invalidid}")
|
|
||||||
private UUID id;
|
private UUID id;
|
||||||
|
|
||||||
@NotNull(message = "{validation.empty}")
|
public static final String _id = "id";
|
||||||
@ValidId(message = "{validation.invalidid}")
|
|
||||||
private UUID dmpId;
|
private UUID dmpId;
|
||||||
|
|
||||||
|
public static final String _dmpId = "dmpId";
|
||||||
|
|
||||||
@NotNull(message = "{validation.empty}")
|
|
||||||
@ValidEnum(message = "{validation.empty}")
|
|
||||||
private DmpUserRole role;
|
private DmpUserRole role;
|
||||||
|
|
||||||
|
public static final String _role = "role";
|
||||||
|
|
||||||
public UUID getId() {
|
public UUID getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
@ -45,4 +52,39 @@ public class DmpUserRemovePersist {
|
||||||
public void setRole(DmpUserRole role) {
|
public void setRole(DmpUserRole role) {
|
||||||
this.role = role;
|
this.role = role;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Component(DmpUserRemovePersistValidator.ValidatorName)
|
||||||
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public static class DmpUserRemovePersistValidator extends BaseValidator<DmpUserRemovePersist> {
|
||||||
|
|
||||||
|
public static final String ValidatorName = "DmpUserRemovePersistValidator";
|
||||||
|
|
||||||
|
private final MessageSource messageSource;
|
||||||
|
|
||||||
|
protected DmpUserRemovePersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource) {
|
||||||
|
super(conventionService, errors);
|
||||||
|
this.messageSource = messageSource;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<DmpUserRemovePersist> modelClass() {
|
||||||
|
return DmpUserRemovePersist.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<Specification> specifications(DmpUserRemovePersist item) {
|
||||||
|
return Arrays.asList(
|
||||||
|
this.spec()
|
||||||
|
.must(() -> this.isValidGuid(item.getId()))
|
||||||
|
.failOn(DmpUserRemovePersist._id).failWith(messageSource.getMessage("Validation_Required", new Object[]{DmpUserRemovePersist._id}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.must(() -> this.isValidGuid(item.getDmpId()))
|
||||||
|
.failOn(DmpUserRemovePersist._dmpId).failWith(messageSource.getMessage("Validation_Required", new Object[]{DmpUserRemovePersist._dmpId}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isNull(item.getRole()))
|
||||||
|
.failOn(DmpUserRemovePersist._role).failWith(messageSource.getMessage("Validation_Required", new Object[]{DmpUserRemovePersist._role}, LocaleContextHolder.getLocale()))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,24 +1,39 @@
|
||||||
package eu.eudat.model.persist;
|
package eu.eudat.model.persist;
|
||||||
|
|
||||||
import eu.eudat.commons.validation.old.FieldNotNullIfOtherSet;
|
import eu.eudat.commons.validation.BaseValidator;
|
||||||
import eu.eudat.commons.validation.old.ValidId;
|
import eu.eudat.commons.validation.specification.Specification;
|
||||||
|
import eu.eudat.convention.ConventionService;
|
||||||
|
import eu.eudat.errorcode.ErrorThesaurusProperties;
|
||||||
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
|
import org.springframework.context.MessageSource;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.context.i18n.LocaleContextHolder;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@FieldNotNullIfOtherSet(message = "{validation.hashempty}")
|
|
||||||
public class EntityDoiPersist {
|
public class EntityDoiPersist {
|
||||||
|
|
||||||
@ValidId(message = "{validation.invalidid}")
|
|
||||||
private UUID id;
|
private UUID id;
|
||||||
|
|
||||||
private UUID entityId;
|
private UUID entityId;
|
||||||
|
|
||||||
|
public static final String _entityId = "entityId";
|
||||||
|
|
||||||
private String repositoryId;
|
private String repositoryId;
|
||||||
|
|
||||||
|
public static final String _repositoryId = "repositoryId";
|
||||||
|
|
||||||
private String doi;
|
private String doi;
|
||||||
|
|
||||||
|
public static final String _doi = "doi";
|
||||||
|
|
||||||
private String hash;
|
private String hash;
|
||||||
|
|
||||||
|
public static final String _hash = "hash";
|
||||||
|
|
||||||
public UUID getId() {
|
public UUID getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
@ -58,4 +73,47 @@ public class EntityDoiPersist {
|
||||||
public void setHash(String hash) {
|
public void setHash(String hash) {
|
||||||
this.hash = hash;
|
this.hash = hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Component(EntityDoiPersistValidator.ValidatorName)
|
||||||
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public static class EntityDoiPersistValidator extends BaseValidator<EntityDoiPersist> {
|
||||||
|
|
||||||
|
public static final String ValidatorName = "EntityDoiPersistValidator";
|
||||||
|
|
||||||
|
private final MessageSource messageSource;
|
||||||
|
|
||||||
|
protected EntityDoiPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource) {
|
||||||
|
super(conventionService, errors);
|
||||||
|
this.messageSource = messageSource;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<EntityDoiPersist> modelClass() {
|
||||||
|
return EntityDoiPersist.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<Specification> specifications(EntityDoiPersist item) {
|
||||||
|
return Arrays.asList(
|
||||||
|
this.spec()
|
||||||
|
.iff(() -> this.isValidGuid(item.getId()))
|
||||||
|
.must(() -> this.isValidHash(item.getHash()))
|
||||||
|
.failOn(EntityDoiPersist._hash).failWith(messageSource.getMessage("Validation_Required", new Object[]{EntityDoiPersist._hash}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.iff(() -> !this.isValidGuid(item.getId()))
|
||||||
|
.must(() -> !this.isValidHash(item.getHash()))
|
||||||
|
.failOn(EntityDoiPersist._hash).failWith(messageSource.getMessage("Validation_OverPosting", new Object[]{}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.must(() -> this.isValidGuid(item.getEntityId()))
|
||||||
|
.failOn(EntityDoiPersist._entityId).failWith(messageSource.getMessage("Validation_Required", new Object[]{EntityDoiPersist._entityId}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isEmpty(item.getRepositoryId()))
|
||||||
|
.failOn(EntityDoiPersist._repositoryId).failWith(messageSource.getMessage("Validation_Required", new Object[]{EntityDoiPersist._repositoryId}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isEmpty(item.getDoi()))
|
||||||
|
.failOn(EntityDoiPersist._doi).failWith(messageSource.getMessage("Validation_Required", new Object[]{EntityDoiPersist._doi}, LocaleContextHolder.getLocale()))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,28 +1,38 @@
|
||||||
package eu.eudat.model.persist;
|
package eu.eudat.model.persist;
|
||||||
|
|
||||||
import eu.eudat.commons.validation.old.ValidId;
|
import eu.eudat.commons.validation.BaseValidator;
|
||||||
import jakarta.validation.constraints.NotEmpty;
|
import eu.eudat.commons.validation.specification.Specification;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import eu.eudat.convention.ConventionService;
|
||||||
import jakarta.validation.constraints.Size;
|
import eu.eudat.data.LanguageEntity;
|
||||||
|
import eu.eudat.errorcode.ErrorThesaurusProperties;
|
||||||
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
|
import org.springframework.context.MessageSource;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.context.i18n.LocaleContextHolder;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class LanguagePersist {
|
public class LanguagePersist {
|
||||||
@ValidId(message = "{validation.invalidid}")
|
|
||||||
private UUID id;
|
private UUID id;
|
||||||
|
|
||||||
@NotNull(message = "{validation.empty}")
|
|
||||||
@NotEmpty(message = "{validation.empty}")
|
|
||||||
@Size(max = 20, message = "{validation.largerthanmax}")
|
|
||||||
private String code;
|
private String code;
|
||||||
|
|
||||||
|
public static final String _code = "code";
|
||||||
|
|
||||||
private String payload;
|
private String payload;
|
||||||
|
|
||||||
@NotNull(message = "{validation.empty}")
|
|
||||||
private Integer ordinal;
|
private Integer ordinal;
|
||||||
|
|
||||||
|
public static final String _ordinal = "ordinal";
|
||||||
|
|
||||||
private String hash;
|
private String hash;
|
||||||
|
|
||||||
|
public static final String _hash = "hash";
|
||||||
|
|
||||||
public UUID getId() {
|
public UUID getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
@ -62,4 +72,48 @@ public class LanguagePersist {
|
||||||
public void setHash(String hash) {
|
public void setHash(String hash) {
|
||||||
this.hash = hash;
|
this.hash = hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Component(LanguagePersistValidator.ValidatorName)
|
||||||
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public static class LanguagePersistValidator extends BaseValidator<LanguagePersist> {
|
||||||
|
|
||||||
|
public static final String ValidatorName = "LanguagePersistValidator";
|
||||||
|
|
||||||
|
private final MessageSource messageSource;
|
||||||
|
|
||||||
|
protected LanguagePersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource) {
|
||||||
|
super(conventionService, errors);
|
||||||
|
this.messageSource = messageSource;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<LanguagePersist> modelClass() {
|
||||||
|
return LanguagePersist.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<Specification> specifications(LanguagePersist item) {
|
||||||
|
return Arrays.asList(
|
||||||
|
this.spec()
|
||||||
|
.iff(() -> this.isValidGuid(item.getId()))
|
||||||
|
.must(() -> this.isValidHash(item.getHash()))
|
||||||
|
.failOn(LanguagePersist._hash).failWith(messageSource.getMessage("Validation_Required", new Object[]{LanguagePersist._hash}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.iff(() -> !this.isValidGuid(item.getId()))
|
||||||
|
.must(() -> !this.isValidHash(item.getHash()))
|
||||||
|
.failOn(LanguagePersist._hash).failWith(messageSource.getMessage("Validation_OverPosting", new Object[]{}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isEmpty(item.getCode()))
|
||||||
|
.failOn(LanguagePersist._code).failWith(messageSource.getMessage("Validation_Required", new Object[]{LanguagePersist._code}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.iff(() -> !this.isEmpty(item.getCode()))
|
||||||
|
.must(() -> this.lessEqualLength(item.getCode(), LanguageEntity._codeLength))
|
||||||
|
.failOn(LanguagePersist._code).failWith(messageSource.getMessage("Validation_MaxLength", new Object[]{LanguagePersist._code}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isNull(item.getOrdinal()))
|
||||||
|
.failOn(LanguagePersist._ordinal).failWith(messageSource.getMessage("Validation_Required", new Object[]{LanguagePersist._ordinal}, LocaleContextHolder.getLocale()))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,29 +1,35 @@
|
||||||
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.old.FieldNotNullIfOtherSet;
|
import eu.eudat.commons.validation.BaseValidator;
|
||||||
import eu.eudat.commons.validation.old.ValidEnum;
|
import eu.eudat.commons.validation.specification.Specification;
|
||||||
import eu.eudat.commons.validation.old.ValidId;
|
import eu.eudat.convention.ConventionService;
|
||||||
import jakarta.validation.Valid;
|
import eu.eudat.errorcode.ErrorThesaurusProperties;
|
||||||
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
|
import org.springframework.context.MessageSource;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.context.i18n.LocaleContextHolder;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@FieldNotNullIfOtherSet(message = "{validation.hashempty}")
|
|
||||||
public class LockPersist {
|
public class LockPersist {
|
||||||
|
|
||||||
@ValidId(message = "{validation.invalidid}")
|
|
||||||
private UUID id;
|
private UUID id;
|
||||||
|
|
||||||
@Valid
|
|
||||||
private UUID target;
|
private UUID target;
|
||||||
|
|
||||||
@ValidEnum(message = "{validation.empty}")
|
public static final String _target = "target";
|
||||||
|
|
||||||
private LockTargetType targetType;
|
private LockTargetType targetType;
|
||||||
|
|
||||||
@Valid
|
public static final String _targetType = "targetType";
|
||||||
|
|
||||||
private UUID lockedBy;
|
private UUID lockedBy;
|
||||||
|
|
||||||
public static final String _touchedAt = "touchedAt";
|
public static final String _lockedBy = "lockedBy";
|
||||||
|
|
||||||
private String hash;
|
private String hash;
|
||||||
|
|
||||||
|
@ -68,4 +74,47 @@ public class LockPersist {
|
||||||
public void setHash(String hash) {
|
public void setHash(String hash) {
|
||||||
this.hash = hash;
|
this.hash = hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Component(LockPersistValidator.ValidatorName)
|
||||||
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public static class LockPersistValidator extends BaseValidator<LockPersist> {
|
||||||
|
|
||||||
|
public static final String ValidatorName = "LockPersistValidator";
|
||||||
|
|
||||||
|
private final MessageSource messageSource;
|
||||||
|
|
||||||
|
protected LockPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource) {
|
||||||
|
super(conventionService, errors);
|
||||||
|
this.messageSource = messageSource;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<LockPersist> modelClass() {
|
||||||
|
return LockPersist.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<Specification> specifications(LockPersist item) {
|
||||||
|
return Arrays.asList(
|
||||||
|
this.spec()
|
||||||
|
.iff(() -> this.isValidGuid(item.getId()))
|
||||||
|
.must(() -> this.isValidHash(item.getHash()))
|
||||||
|
.failOn(LockPersist._hash).failWith(messageSource.getMessage("Validation_Required", new Object[]{LockPersist._hash}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.iff(() -> !this.isValidGuid(item.getId()))
|
||||||
|
.must(() -> !this.isValidHash(item.getHash()))
|
||||||
|
.failOn(LockPersist._hash).failWith(messageSource.getMessage("Validation_OverPosting", new Object[]{}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.must(() -> this.isValidGuid(item.getTarget()))
|
||||||
|
.failOn(LockPersist._target).failWith(messageSource.getMessage("Validation_Required", new Object[]{LockPersist._target}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isNull(item.getTargetType()))
|
||||||
|
.failOn(LockPersist._targetType).failWith(messageSource.getMessage("Validation_Required", new Object[]{LockPersist._targetType}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.must(() -> this.isValidGuid(item.getLockedBy()))
|
||||||
|
.failOn(LockPersist._lockedBy).failWith(messageSource.getMessage("Validation_Required", new Object[]{LockPersist._lockedBy}, LocaleContextHolder.getLocale()))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,55 +1,59 @@
|
||||||
package eu.eudat.model.persist;
|
package eu.eudat.model.persist;
|
||||||
|
|
||||||
|
|
||||||
import eu.eudat.commons.enums.DescriptionTemplateStatus;
|
import eu.eudat.commons.enums.DescriptionTemplateStatus;
|
||||||
import eu.eudat.commons.validation.old.FieldNotNullIfOtherSet;
|
import eu.eudat.commons.validation.BaseValidator;
|
||||||
import eu.eudat.commons.validation.old.ValidEnum;
|
import eu.eudat.commons.validation.ValidatorFactory;
|
||||||
import eu.eudat.commons.validation.old.ValidId;
|
import eu.eudat.commons.validation.specification.Specification;
|
||||||
|
import eu.eudat.convention.ConventionService;
|
||||||
import eu.eudat.data.DescriptionTemplateEntity;
|
import eu.eudat.data.DescriptionTemplateEntity;
|
||||||
|
import eu.eudat.errorcode.ErrorThesaurusProperties;
|
||||||
import eu.eudat.model.persist.descriptiontemplatedefinition.DefinitionPersist;
|
import eu.eudat.model.persist.descriptiontemplatedefinition.DefinitionPersist;
|
||||||
import jakarta.validation.Valid;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
import jakarta.validation.constraints.NotEmpty;
|
import org.springframework.context.MessageSource;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import org.springframework.context.annotation.Scope;
|
||||||
import jakarta.validation.constraints.Size;
|
import org.springframework.context.i18n.LocaleContextHolder;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@FieldNotNullIfOtherSet(message = "{validation.hashempty}")
|
|
||||||
public class NewVersionDescriptionTemplatePersist {
|
public class NewVersionDescriptionTemplatePersist {
|
||||||
@NotNull(message = "{validation.empty}")
|
|
||||||
@ValidId(message = "{validation.invalidid}")
|
|
||||||
private UUID id = null;
|
private UUID id = null;
|
||||||
|
|
||||||
@NotNull(message = "{validation.empty}")
|
|
||||||
@NotEmpty(message = "{validation.empty}")
|
|
||||||
@Size(max = DescriptionTemplateEntity._labelLength, message = "{validation.largerthanmax}")
|
|
||||||
private String label = null;
|
private String label = null;
|
||||||
|
|
||||||
@NotNull(message = "{validation.empty}")
|
public static final String _label = "label";
|
||||||
@NotEmpty(message = "{validation.empty}")
|
|
||||||
private String description = null;
|
private String description = null;
|
||||||
|
|
||||||
@NotNull(message = "{validation.empty}")
|
public static final String _description = "description";
|
||||||
@NotEmpty(message = "{validation.empty}")
|
|
||||||
private String language = null;
|
private String language = null;
|
||||||
|
|
||||||
@NotNull(message = "{validation.empty}")
|
public static final String _language = "language";
|
||||||
@ValidId(message = "{validation.invalidid}")
|
|
||||||
private UUID type = null;
|
private UUID type = null;
|
||||||
|
|
||||||
@ValidEnum(message = "{validation.empty}")
|
public static final String _type = "type";
|
||||||
|
|
||||||
private DescriptionTemplateStatus status;
|
private DescriptionTemplateStatus status;
|
||||||
|
|
||||||
@NotNull(message = "{validation.empty}")
|
public static final String _status = "status";
|
||||||
@Valid
|
|
||||||
private DefinitionPersist definition = null;
|
private DefinitionPersist definition = null;
|
||||||
|
|
||||||
@Valid
|
public static final String _definition = "definition";
|
||||||
|
|
||||||
private List<UserDescriptionTemplatePersist> users = null;
|
private List<UserDescriptionTemplatePersist> users = null;
|
||||||
|
|
||||||
|
public static final String _users = "users";
|
||||||
|
|
||||||
private String hash;
|
private String hash;
|
||||||
|
|
||||||
|
public static final String _hash = "hash";
|
||||||
|
|
||||||
public UUID getId() {
|
public UUID getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
@ -121,5 +125,74 @@ public class NewVersionDescriptionTemplatePersist {
|
||||||
public void setUsers(List<UserDescriptionTemplatePersist> users) {
|
public void setUsers(List<UserDescriptionTemplatePersist> users) {
|
||||||
this.users = users;
|
this.users = users;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Component(NewVersionDescriptionTemplatePersistValidator.ValidatorName)
|
||||||
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public static class NewVersionDescriptionTemplatePersistValidator extends BaseValidator<NewVersionDescriptionTemplatePersist> {
|
||||||
|
|
||||||
|
public static final String ValidatorName = "NewVersionDescriptionTemplatePersistValidator";
|
||||||
|
|
||||||
|
private final MessageSource messageSource;
|
||||||
|
|
||||||
|
private final ValidatorFactory validatorFactory;
|
||||||
|
|
||||||
|
protected NewVersionDescriptionTemplatePersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource, ValidatorFactory validatorFactory) {
|
||||||
|
super(conventionService, errors);
|
||||||
|
this.messageSource = messageSource;
|
||||||
|
this.validatorFactory = validatorFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<NewVersionDescriptionTemplatePersist> modelClass() {
|
||||||
|
return NewVersionDescriptionTemplatePersist.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<Specification> specifications(NewVersionDescriptionTemplatePersist item) {
|
||||||
|
return Arrays.asList(
|
||||||
|
this.spec()
|
||||||
|
.iff(() -> this.isValidGuid(item.getId()))
|
||||||
|
.must(() -> this.isValidHash(item.getHash()))
|
||||||
|
.failOn(NewVersionDescriptionTemplatePersist._hash).failWith(messageSource.getMessage("Validation_Required", new Object[]{NewVersionDescriptionTemplatePersist._hash}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isEmpty(item.getLabel()))
|
||||||
|
.failOn(NewVersionDescriptionTemplatePersist._label).failWith(messageSource.getMessage("Validation_Required", new Object[]{NewVersionDescriptionTemplatePersist._label}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.iff(() -> !this.isEmpty(item.getLabel()))
|
||||||
|
.must(() -> this.lessEqualLength(item.getLabel(), DescriptionTemplateEntity._labelLength))
|
||||||
|
.failOn(NewVersionDescriptionTemplatePersist._label).failWith(messageSource.getMessage("Validation_MaxLength", new Object[]{NewVersionDescriptionTemplatePersist._label}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isEmpty(item.getDescription()))
|
||||||
|
.failOn(NewVersionDescriptionTemplatePersist._description).failWith(messageSource.getMessage("Validation_Required", new Object[]{NewVersionDescriptionTemplatePersist._description}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isEmpty(item.getLanguage()))
|
||||||
|
.failOn(NewVersionDescriptionTemplatePersist._language).failWith(messageSource.getMessage("Validation_Required", new Object[]{NewVersionDescriptionTemplatePersist._language}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isNull(item.getType()))
|
||||||
|
.failOn(NewVersionDescriptionTemplatePersist._type).failWith(messageSource.getMessage("Validation_Required", new Object[]{NewVersionDescriptionTemplatePersist._type}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isNull(item.getStatus()))
|
||||||
|
.failOn(NewVersionDescriptionTemplatePersist._status).failWith(messageSource.getMessage("Validation_Required", new Object[]{NewVersionDescriptionTemplatePersist._status}, LocaleContextHolder.getLocale())),
|
||||||
|
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isNull(item.getDefinition()))
|
||||||
|
.failOn(NewVersionDescriptionTemplatePersist._definition).failWith(messageSource.getMessage("Validation_Required", new Object[]{NewVersionDescriptionTemplatePersist._definition}, LocaleContextHolder.getLocale())),
|
||||||
|
this.refSpec()
|
||||||
|
.iff(() -> !this.isNull(item.getDefinition()))
|
||||||
|
.on(NewVersionDescriptionTemplatePersist._definition)
|
||||||
|
.over(item.getDefinition())
|
||||||
|
.using(() -> this.validatorFactory.validator(DefinitionPersist.DefinitionPersistValidator.class)),
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isNull(item.getUsers()))
|
||||||
|
.failOn(NewVersionDescriptionTemplatePersist._users).failWith(messageSource.getMessage("Validation_Required", new Object[]{NewVersionDescriptionTemplatePersist._users}, LocaleContextHolder.getLocale())),
|
||||||
|
this.navSpec()
|
||||||
|
.iff(() -> !this.isNull(item.getUsers()))
|
||||||
|
.on(NewVersionDescriptionTemplatePersist._users)
|
||||||
|
.over(item.getUsers())
|
||||||
|
.using(() -> this.validatorFactory.validator(UserDescriptionTemplatePersist.UserDescriptionTemplatePersistValidator.class))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,38 +1,42 @@
|
||||||
package eu.eudat.model.persist;
|
package eu.eudat.model.persist;
|
||||||
|
|
||||||
import eu.eudat.commons.validation.old.FieldNotNullIfOtherSet;
|
import eu.eudat.commons.validation.BaseValidator;
|
||||||
import eu.eudat.commons.validation.old.ValidId;
|
import eu.eudat.commons.validation.specification.Specification;
|
||||||
import jakarta.validation.constraints.NotEmpty;
|
import eu.eudat.convention.ConventionService;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import eu.eudat.data.DmpEntity;
|
||||||
|
import eu.eudat.errorcode.ErrorThesaurusProperties;
|
||||||
import org.apache.commons.compress.utils.Lists;
|
import org.apache.commons.compress.utils.Lists;
|
||||||
|
import org.springframework.context.MessageSource;
|
||||||
|
import org.springframework.context.i18n.LocaleContextHolder;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@FieldNotNullIfOtherSet(message = "{validation.hashempty}")
|
|
||||||
public class NewVersionDmpPersist {
|
public class NewVersionDmpPersist {
|
||||||
|
|
||||||
@NotNull(message = "{validation.empty}")
|
|
||||||
@ValidId(message = "{validation.invalidid}")
|
|
||||||
private UUID id = null;
|
private UUID id = null;
|
||||||
|
|
||||||
@NotNull(message = "{validation.empty}")
|
|
||||||
@NotEmpty(message = "{validation.empty}")
|
|
||||||
private String label = null;
|
private String label = null;
|
||||||
|
|
||||||
@NotNull(message = "{validation.empty}")
|
public static final String _label = "label";
|
||||||
@NotEmpty(message = "{validation.empty}")
|
|
||||||
private String description = null;
|
private String description = null;
|
||||||
|
|
||||||
@NotNull(message = "{validation.empty}")
|
public static final String _description = "description";
|
||||||
@ValidId(message = "{validation.invalidid}")
|
|
||||||
private UUID blueprintId = null;
|
private UUID blueprintId = null;
|
||||||
|
|
||||||
@NotNull(message = "{validation.empty}")
|
public static final String _blueprintId = "blueprintId";
|
||||||
|
|
||||||
private List<UUID> descriptions = Lists.newArrayList();
|
private List<UUID> descriptions = Lists.newArrayList();
|
||||||
|
|
||||||
|
public static final String _descriptions = "descriptions";
|
||||||
|
|
||||||
private String hash;
|
private String hash;
|
||||||
|
|
||||||
|
public static final String _hash = "hash";
|
||||||
|
|
||||||
public UUID getId() {
|
public UUID getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
@ -81,4 +85,47 @@ public class NewVersionDmpPersist {
|
||||||
this.hash = hash;
|
this.hash = hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class NewVersionDmpPersistValidator extends BaseValidator<NewVersionDmpPersist> {
|
||||||
|
|
||||||
|
public static final String ValidatorName = "NewVersionDmpPersistValidator";
|
||||||
|
|
||||||
|
private final MessageSource messageSource;
|
||||||
|
|
||||||
|
protected NewVersionDmpPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource) {
|
||||||
|
super(conventionService, errors);
|
||||||
|
this.messageSource = messageSource;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<NewVersionDmpPersist> modelClass() {
|
||||||
|
return NewVersionDmpPersist.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<Specification> specifications(NewVersionDmpPersist item) {
|
||||||
|
return Arrays.asList(
|
||||||
|
this.spec()
|
||||||
|
.iff(() -> this.isValidGuid(item.getId()))
|
||||||
|
.must(() -> this.isValidHash(item.getHash()))
|
||||||
|
.failOn(NewVersionDmpPersist._hash).failWith(messageSource.getMessage("Validation_Required", new Object[]{NewVersionDmpPersist._hash}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isEmpty(item.getLabel()))
|
||||||
|
.failOn(NewVersionDmpPersist._label).failWith(messageSource.getMessage("Validation_Required", new Object[]{NewVersionDmpPersist._label}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.iff(() -> !this.isEmpty(item.getLabel()))
|
||||||
|
.must(() -> this.lessEqualLength(item.getLabel(), DmpEntity._labelLength))
|
||||||
|
.failOn(NewVersionDmpPersist._label).failWith(messageSource.getMessage("Validation_MaxLength", new Object[]{NewVersionDmpPersist._label}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isEmpty(item.getDescription()))
|
||||||
|
.failOn(NewVersionDmpPersist._description).failWith(messageSource.getMessage("Validation_Required", new Object[]{NewVersionDmpPersist._description}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isValidGuid(item.getBlueprintId()))
|
||||||
|
.failOn(NewVersionDmpPersist._blueprintId).failWith(messageSource.getMessage("Validation_Required", new Object[]{NewVersionDmpPersist._blueprintId}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isNull(item.getDescriptions()))
|
||||||
|
.failOn(NewVersionDmpPersist._descriptions).failWith(messageSource.getMessage("Validation_Required", new Object[]{NewVersionDmpPersist._descriptions}, LocaleContextHolder.getLocale()))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,12 +4,11 @@ import eu.eudat.commons.enums.ReferenceSourceType;
|
||||||
import eu.eudat.commons.enums.ReferenceType;
|
import eu.eudat.commons.enums.ReferenceType;
|
||||||
import eu.eudat.commons.validation.BaseValidator;
|
import eu.eudat.commons.validation.BaseValidator;
|
||||||
import eu.eudat.commons.validation.ValidatorFactory;
|
import eu.eudat.commons.validation.ValidatorFactory;
|
||||||
import eu.eudat.commons.validation.old.ValidEnum;
|
|
||||||
import eu.eudat.commons.validation.specification.Specification;
|
import eu.eudat.commons.validation.specification.Specification;
|
||||||
import eu.eudat.convention.ConventionService;
|
import eu.eudat.convention.ConventionService;
|
||||||
|
import eu.eudat.data.ReferenceEntity;
|
||||||
import eu.eudat.errorcode.ErrorThesaurusProperties;
|
import eu.eudat.errorcode.ErrorThesaurusProperties;
|
||||||
import eu.eudat.model.persist.referencedefinition.DefinitionPersist;
|
import eu.eudat.model.persist.referencedefinition.DefinitionPersist;
|
||||||
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;
|
||||||
|
@ -28,8 +27,6 @@ public class ReferencePersist {
|
||||||
|
|
||||||
public static final String _label = "label";
|
public static final String _label = "label";
|
||||||
|
|
||||||
public static final int _labelLength = 250;
|
|
||||||
|
|
||||||
private ReferenceType type;
|
private ReferenceType type;
|
||||||
|
|
||||||
public static final String _type = "type";
|
public static final String _type = "type";
|
||||||
|
@ -44,23 +41,14 @@ public class ReferencePersist {
|
||||||
|
|
||||||
public static final String _reference = "reference";
|
public static final String _reference = "reference";
|
||||||
|
|
||||||
public static final int _referenceLength = 1024;
|
|
||||||
|
|
||||||
@Size(max = 50, message = "{validation.largerthanmax}")
|
|
||||||
private String abbreviation;
|
private String abbreviation;
|
||||||
|
|
||||||
public static final String _abbreviation = "abbreviation";
|
public static final String _abbreviation = "abbreviation";
|
||||||
|
|
||||||
public static final int _abbreviationLength = 50;
|
|
||||||
|
|
||||||
@Size(max = 1024, message = "{validation.largerthanmax}")
|
|
||||||
private String source;
|
private String source;
|
||||||
|
|
||||||
public static final String _source = "source";
|
public static final String _source = "source";
|
||||||
|
|
||||||
public static final int _sourceLength = 1024;
|
|
||||||
|
|
||||||
@ValidEnum(message = "{validation.empty}")
|
|
||||||
private ReferenceSourceType sourceType;
|
private ReferenceSourceType sourceType;
|
||||||
|
|
||||||
public static final String _sourceType = "sourceType";
|
public static final String _sourceType = "sourceType";
|
||||||
|
@ -186,7 +174,7 @@ public class ReferencePersist {
|
||||||
.failOn(ReferencePersist._label).failWith(messageSource.getMessage("Validation_Required", new Object[]{ReferencePersist._label}, LocaleContextHolder.getLocale())),
|
.failOn(ReferencePersist._label).failWith(messageSource.getMessage("Validation_Required", new Object[]{ReferencePersist._label}, LocaleContextHolder.getLocale())),
|
||||||
this.spec()
|
this.spec()
|
||||||
.iff(() -> !this.isEmpty(item.getLabel()))
|
.iff(() -> !this.isEmpty(item.getLabel()))
|
||||||
.must(() -> this.lessEqualLength(item.getLabel(), ReferencePersist._labelLength))
|
.must(() -> this.lessEqualLength(item.getLabel(), ReferenceEntity._labelLength))
|
||||||
.failOn(ReferencePersist._label).failWith(messageSource.getMessage("Validation_MaxLength", new Object[]{ReferencePersist._label}, LocaleContextHolder.getLocale())),
|
.failOn(ReferencePersist._label).failWith(messageSource.getMessage("Validation_MaxLength", new Object[]{ReferencePersist._label}, LocaleContextHolder.getLocale())),
|
||||||
this.spec()
|
this.spec()
|
||||||
.must(() -> !this.isNull(item.getType()))
|
.must(() -> !this.isNull(item.getType()))
|
||||||
|
@ -196,21 +184,21 @@ public class ReferencePersist {
|
||||||
.failOn(ReferencePersist._reference).failWith(messageSource.getMessage("Validation_Required", new Object[]{ReferencePersist._reference}, LocaleContextHolder.getLocale())),
|
.failOn(ReferencePersist._reference).failWith(messageSource.getMessage("Validation_Required", new Object[]{ReferencePersist._reference}, LocaleContextHolder.getLocale())),
|
||||||
this.spec()
|
this.spec()
|
||||||
.iff(() -> !this.isEmpty(item.getReference()))
|
.iff(() -> !this.isEmpty(item.getReference()))
|
||||||
.must(() -> this.lessEqualLength(item.getReference(), ReferencePersist._referenceLength))
|
.must(() -> this.lessEqualLength(item.getReference(), ReferenceEntity._referenceLength))
|
||||||
.failOn(ReferencePersist._reference).failWith(messageSource.getMessage("Validation_MaxLength", new Object[]{ReferencePersist._reference}, LocaleContextHolder.getLocale())),
|
.failOn(ReferencePersist._reference).failWith(messageSource.getMessage("Validation_MaxLength", new Object[]{ReferencePersist._reference}, LocaleContextHolder.getLocale())),
|
||||||
this.spec()
|
this.spec()
|
||||||
.must(() -> !this.isEmpty(item.getAbbreviation()))
|
.must(() -> !this.isEmpty(item.getAbbreviation()))
|
||||||
.failOn(ReferencePersist._abbreviation).failWith(messageSource.getMessage("Validation_Required", new Object[]{ReferencePersist._abbreviation}, LocaleContextHolder.getLocale())),
|
.failOn(ReferencePersist._abbreviation).failWith(messageSource.getMessage("Validation_Required", new Object[]{ReferencePersist._abbreviation}, LocaleContextHolder.getLocale())),
|
||||||
this.spec()
|
this.spec()
|
||||||
.iff(() -> !this.isEmpty(item.getAbbreviation()))
|
.iff(() -> !this.isEmpty(item.getAbbreviation()))
|
||||||
.must(() -> this.lessEqualLength(item.getAbbreviation(), ReferencePersist._abbreviationLength))
|
.must(() -> this.lessEqualLength(item.getAbbreviation(), ReferenceEntity._abbreviationLength))
|
||||||
.failOn(ReferencePersist._abbreviation).failWith(messageSource.getMessage("Validation_MaxLength", new Object[]{ReferencePersist._abbreviation}, LocaleContextHolder.getLocale())),
|
.failOn(ReferencePersist._abbreviation).failWith(messageSource.getMessage("Validation_MaxLength", new Object[]{ReferencePersist._abbreviation}, LocaleContextHolder.getLocale())),
|
||||||
this.spec()
|
this.spec()
|
||||||
.must(() -> !this.isEmpty(item.getSource()))
|
.must(() -> !this.isEmpty(item.getSource()))
|
||||||
.failOn(ReferencePersist._source).failWith(messageSource.getMessage("Validation_Required", new Object[]{ReferencePersist._source}, LocaleContextHolder.getLocale())),
|
.failOn(ReferencePersist._source).failWith(messageSource.getMessage("Validation_Required", new Object[]{ReferencePersist._source}, LocaleContextHolder.getLocale())),
|
||||||
this.spec()
|
this.spec()
|
||||||
.iff(() -> !this.isEmpty(item.getSource()))
|
.iff(() -> !this.isEmpty(item.getSource()))
|
||||||
.must(() -> this.lessEqualLength(item.getSource(), ReferencePersist._sourceLength))
|
.must(() -> this.lessEqualLength(item.getSource(), ReferenceEntity._sourceLength))
|
||||||
.failOn(ReferencePersist._source).failWith(messageSource.getMessage("Validation_MaxLength", new Object[]{ReferencePersist._source}, LocaleContextHolder.getLocale())),
|
.failOn(ReferencePersist._source).failWith(messageSource.getMessage("Validation_MaxLength", new Object[]{ReferencePersist._source}, LocaleContextHolder.getLocale())),
|
||||||
this.spec()
|
this.spec()
|
||||||
.must(() -> !this.isNull(item.getSourceType()))
|
.must(() -> !this.isNull(item.getSourceType()))
|
||||||
|
|
|
@ -1,37 +1,42 @@
|
||||||
package eu.eudat.model.persist;
|
package eu.eudat.model.persist;
|
||||||
|
|
||||||
import eu.eudat.commons.validation.old.FieldNotNullIfOtherSet;
|
import eu.eudat.commons.validation.BaseValidator;
|
||||||
import eu.eudat.commons.validation.old.ValidId;
|
import eu.eudat.commons.validation.ValidatorFactory;
|
||||||
|
import eu.eudat.commons.validation.specification.Specification;
|
||||||
|
import eu.eudat.convention.ConventionService;
|
||||||
|
import eu.eudat.data.ReferenceTypeEntity;
|
||||||
|
import eu.eudat.errorcode.ErrorThesaurusProperties;
|
||||||
import eu.eudat.model.persist.referencetypedefinition.ReferenceTypeDefinitionPersist;
|
import eu.eudat.model.persist.referencetypedefinition.ReferenceTypeDefinitionPersist;
|
||||||
import jakarta.validation.Valid;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
import jakarta.validation.constraints.NotEmpty;
|
import org.springframework.context.MessageSource;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import org.springframework.context.annotation.Scope;
|
||||||
import jakarta.validation.constraints.Size;
|
import org.springframework.context.i18n.LocaleContextHolder;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@FieldNotNullIfOtherSet(message = "{validation.hashempty}")
|
|
||||||
public class ReferenceTypePersist {
|
public class ReferenceTypePersist {
|
||||||
|
|
||||||
@ValidId(message = "{validation.invalidid}")
|
|
||||||
private UUID id;
|
private UUID id;
|
||||||
|
|
||||||
@NotNull(message = "{validation.empty}")
|
|
||||||
@NotEmpty(message = "{validation.empty}")
|
|
||||||
@Size(max = 250, message = "{validation.largerthanmax}")
|
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@NotNull(message = "{validation.empty}")
|
public static final String _name = "name";
|
||||||
@NotEmpty(message = "{validation.empty}")
|
|
||||||
@Size(max = 100, message = "{validation.largerthanmax}")
|
|
||||||
private String code;
|
private String code;
|
||||||
|
|
||||||
@NotNull(message = "{validation.empty}")
|
public static final String _code = "code";
|
||||||
@Valid
|
|
||||||
private ReferenceTypeDefinitionPersist definition;
|
private ReferenceTypeDefinitionPersist definition;
|
||||||
|
|
||||||
|
public static final String _definition = "definition";
|
||||||
|
|
||||||
private String hash;
|
private String hash;
|
||||||
|
|
||||||
|
public static final String _hash = "hash";
|
||||||
|
|
||||||
public UUID getId() {
|
public UUID getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
@ -71,4 +76,64 @@ public class ReferenceTypePersist {
|
||||||
public void setHash(String hash) {
|
public void setHash(String hash) {
|
||||||
this.hash = hash;
|
this.hash = hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Component(ReferenceTypePersistValidator.ValidatorName)
|
||||||
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public static class ReferenceTypePersistValidator extends BaseValidator<ReferenceTypePersist> {
|
||||||
|
|
||||||
|
public static final String ValidatorName = "ReferenceTypePersistValidator";
|
||||||
|
|
||||||
|
private final MessageSource messageSource;
|
||||||
|
|
||||||
|
private final ValidatorFactory validatorFactory;
|
||||||
|
|
||||||
|
protected ReferenceTypePersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource, ValidatorFactory validatorFactory) {
|
||||||
|
super(conventionService, errors);
|
||||||
|
this.messageSource = messageSource;
|
||||||
|
this.validatorFactory = validatorFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<ReferenceTypePersist> modelClass() {
|
||||||
|
return ReferenceTypePersist.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<Specification> specifications(ReferenceTypePersist item) {
|
||||||
|
return Arrays.asList(
|
||||||
|
this.spec()
|
||||||
|
.iff(() -> this.isValidGuid(item.getId()))
|
||||||
|
.must(() -> this.isValidHash(item.getHash()))
|
||||||
|
.failOn(ReferenceTypePersist._hash).failWith(messageSource.getMessage("Validation_Required", new Object[]{ReferenceTypePersist._hash}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.iff(() -> !this.isValidGuid(item.getId()))
|
||||||
|
.must(() -> !this.isValidHash(item.getHash()))
|
||||||
|
.failOn(ReferenceTypePersist._hash).failWith(messageSource.getMessage("Validation_OverPosting", new Object[]{}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isEmpty(item.getName()))
|
||||||
|
.failOn(ReferenceTypePersist._name).failWith(messageSource.getMessage("Validation_Required", new Object[]{ReferenceTypePersist._name}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.iff(() -> !this.isEmpty(item.getName()))
|
||||||
|
.must(() -> this.lessEqualLength(item.getName(), ReferenceTypeEntity._nameLength))
|
||||||
|
.failOn(ReferenceTypePersist._name).failWith(messageSource.getMessage("Validation_MaxLength", new Object[]{ReferenceTypePersist._name}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isEmpty(item.getCode()))
|
||||||
|
.failOn(ReferenceTypePersist._code).failWith(messageSource.getMessage("Validation_Required", new Object[]{ReferenceTypePersist._code}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.iff(() -> !this.isEmpty(item.getCode()))
|
||||||
|
.must(() -> this.lessEqualLength(item.getCode(), ReferenceTypeEntity._codeLength))
|
||||||
|
.failOn(ReferenceTypePersist._code).failWith(messageSource.getMessage("Validation_MaxLength", new Object[]{ReferenceTypePersist._code}, LocaleContextHolder.getLocale())),
|
||||||
|
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isNull(item.getDefinition()))
|
||||||
|
.failOn(ReferenceTypePersist._definition).failWith(messageSource.getMessage("Validation_Required", new Object[]{ReferenceTypePersist._definition}, LocaleContextHolder.getLocale())),
|
||||||
|
this.refSpec()
|
||||||
|
.iff(() -> !this.isNull(item.getDefinition()))
|
||||||
|
.on(ReferenceTypePersist._definition)
|
||||||
|
.over(item.getDefinition())
|
||||||
|
.using(() -> this.validatorFactory.validator(ReferenceTypeDefinitionPersist.ReferenceTypeDefinitionPersistValidator.class))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,19 +1,32 @@
|
||||||
package eu.eudat.model.persist.referencetypedefinition;
|
package eu.eudat.model.persist.referencetypedefinition;
|
||||||
|
|
||||||
import jakarta.validation.Valid;
|
import eu.eudat.commons.enums.ReferenceTypeSourceType;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import eu.eudat.commons.validation.BaseValidator;
|
||||||
|
import eu.eudat.commons.validation.ValidatorFactory;
|
||||||
|
import eu.eudat.commons.validation.specification.Specification;
|
||||||
|
import eu.eudat.convention.ConventionService;
|
||||||
|
import eu.eudat.errorcode.ErrorThesaurusProperties;
|
||||||
|
import eu.eudat.model.persist.DescriptionPersist;
|
||||||
|
import eu.eudat.model.persist.descriptionproperties.PropertyDefinitionPersist;
|
||||||
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
|
import org.springframework.context.MessageSource;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.context.i18n.LocaleContextHolder;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class ReferenceTypeDefinitionPersist {
|
public class ReferenceTypeDefinitionPersist {
|
||||||
|
|
||||||
@Valid
|
|
||||||
private List<ReferenceTypeFieldPersist> fields = null;
|
private List<ReferenceTypeFieldPersist> fields = null;
|
||||||
|
|
||||||
@NotNull(message = "{validation.empty}")
|
public static final String _fields = "fields";
|
||||||
@Valid
|
|
||||||
private List<ReferenceTypeSourceBaseConfigurationPersist> sources = null;
|
private List<ReferenceTypeSourceBaseConfigurationPersist> sources = null;
|
||||||
|
|
||||||
|
public static final String _sources = "sources";
|
||||||
|
|
||||||
public List<ReferenceTypeFieldPersist> getFields() {
|
public List<ReferenceTypeFieldPersist> getFields() {
|
||||||
return fields;
|
return fields;
|
||||||
}
|
}
|
||||||
|
@ -29,4 +42,54 @@ public class ReferenceTypeDefinitionPersist {
|
||||||
public void setSources(List<ReferenceTypeSourceBaseConfigurationPersist> sources) {
|
public void setSources(List<ReferenceTypeSourceBaseConfigurationPersist> sources) {
|
||||||
this.sources = sources;
|
this.sources = sources;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Component(ReferenceTypeDefinitionPersistValidator.ValidatorName)
|
||||||
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public static class ReferenceTypeDefinitionPersistValidator extends BaseValidator<ReferenceTypeDefinitionPersist> {
|
||||||
|
|
||||||
|
public static final String ValidatorName = "ReferenceTypeDefinitionPersistValidator";
|
||||||
|
|
||||||
|
private final MessageSource messageSource;
|
||||||
|
|
||||||
|
private final ValidatorFactory validatorFactory;
|
||||||
|
|
||||||
|
protected ReferenceTypeDefinitionPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource, ValidatorFactory validatorFactory) {
|
||||||
|
super(conventionService, errors);
|
||||||
|
this.messageSource = messageSource;
|
||||||
|
this.validatorFactory = validatorFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<ReferenceTypeDefinitionPersist> modelClass() {
|
||||||
|
return ReferenceTypeDefinitionPersist.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<Specification> specifications(ReferenceTypeDefinitionPersist item) {
|
||||||
|
return Arrays.asList(
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isNull(item.getFields()))
|
||||||
|
.failOn(ReferenceTypeDefinitionPersist._fields).failWith(messageSource.getMessage("Validation_Required", new Object[]{ReferenceTypeDefinitionPersist._fields}, LocaleContextHolder.getLocale())),
|
||||||
|
this.navSpec()
|
||||||
|
.iff(() -> !this.isNull(item.getFields()))
|
||||||
|
.on(ReferenceTypeDefinitionPersist._fields)
|
||||||
|
.over(item.getFields())
|
||||||
|
.using(() -> this.validatorFactory.validator(ReferenceTypeFieldPersist.ReferenceTypeFieldPersistValidator.class)),
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isNull(item.getSources()))
|
||||||
|
.failOn(ReferenceTypeDefinitionPersist._sources).failWith(messageSource.getMessage("Validation_Required", new Object[]{ReferenceTypeDefinitionPersist._sources}, LocaleContextHolder.getLocale())),
|
||||||
|
this.navSpec()
|
||||||
|
.iff(() -> !this.isNull(item.getSources()))
|
||||||
|
.on(ReferenceTypeDefinitionPersist._sources)
|
||||||
|
.over(item.getSources().stream().filter(x -> x.getType() == ReferenceTypeSourceType.API).toList())
|
||||||
|
.using(() -> this.validatorFactory.validator(ReferenceTypeSourceExternalApiConfigurationPersist.ReferenceTypeSourceExternalApiConfigurationPersistValidator.class)),
|
||||||
|
this.navSpec()
|
||||||
|
.iff(() -> !this.isNull(item.getSources()))
|
||||||
|
.on(ReferenceTypeDefinitionPersist._sources)
|
||||||
|
.over(item.getSources().stream().filter(x -> x.getType() == ReferenceTypeSourceType.STATIC).toList())
|
||||||
|
.using(() -> this.validatorFactory.validator(ReferenceTypeSourceStaticOptionConfigurationPersist.ReferenceTypeSourceStaticOptionConfigurationPersistValidator.class))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,16 @@
|
||||||
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.BaseValidator;
|
||||||
import eu.eudat.commons.validation.old.ValidEnum;
|
import eu.eudat.commons.validation.old.ValidEnum;
|
||||||
|
import eu.eudat.commons.validation.specification.Specification;
|
||||||
|
import eu.eudat.convention.ConventionService;
|
||||||
|
import eu.eudat.errorcode.ErrorThesaurusProperties;
|
||||||
import jakarta.validation.constraints.NotEmpty;
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class ReferenceTypeFieldPersist {
|
public class ReferenceTypeFieldPersist {
|
||||||
|
|
||||||
@NotNull(message = "{validation.empty}")
|
@NotNull(message = "{validation.empty}")
|
||||||
|
@ -53,6 +59,24 @@ public class ReferenceTypeFieldPersist {
|
||||||
public void setDataType(ReferenceFieldDataType dataType) {
|
public void setDataType(ReferenceFieldDataType dataType) {
|
||||||
this.dataType = dataType;
|
this.dataType = dataType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class ReferenceTypeFieldPersistValidator extends BaseValidator<ReferenceTypeFieldPersist> {
|
||||||
|
|
||||||
|
protected ReferenceTypeFieldPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors) {
|
||||||
|
super(conventionService, errors);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<ReferenceTypeFieldPersist> modelClass() {
|
||||||
|
return ReferenceTypeFieldPersist.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<Specification> specifications(ReferenceTypeFieldPersist item) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,11 +3,15 @@ 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.old.ValidEnum;
|
import eu.eudat.commons.validation.BaseValidator;
|
||||||
import jakarta.validation.Valid;
|
import eu.eudat.commons.validation.ValidatorFactory;
|
||||||
import jakarta.validation.constraints.NotEmpty;
|
import eu.eudat.commons.validation.specification.Specification;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import eu.eudat.convention.ConventionService;
|
||||||
|
import eu.eudat.errorcode.ErrorThesaurusProperties;
|
||||||
|
import org.springframework.context.MessageSource;
|
||||||
|
import org.springframework.context.i18n.LocaleContextHolder;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@JsonTypeInfo(
|
@JsonTypeInfo(
|
||||||
|
@ -21,23 +25,26 @@ import java.util.List;
|
||||||
})
|
})
|
||||||
public abstract class ReferenceTypeSourceBaseConfigurationPersist {
|
public abstract class ReferenceTypeSourceBaseConfigurationPersist {
|
||||||
|
|
||||||
@NotNull(message = "{validation.empty}")
|
|
||||||
@NotEmpty(message = "{validation.empty}")
|
|
||||||
private String key = null;
|
private String key = null;
|
||||||
|
|
||||||
@NotNull(message = "{validation.empty}")
|
public static final String _key = "key";
|
||||||
@NotEmpty(message = "{validation.empty}")
|
|
||||||
private String label = null;
|
private String label = null;
|
||||||
|
|
||||||
@NotNull(message = "{validation.empty}")
|
public static final String _label = "label";
|
||||||
|
|
||||||
private Integer ordinal = null;
|
private Integer ordinal = null;
|
||||||
|
|
||||||
@ValidEnum(message = "{validation.empty}")
|
public static final String _ordinal = "ordinal";
|
||||||
|
|
||||||
private ReferenceTypeSourceType type;
|
private ReferenceTypeSourceType type;
|
||||||
|
|
||||||
@Valid
|
public static final String _type = "type";
|
||||||
|
|
||||||
private List<ReferenceTypeSourceBaseDependencyPersist> dependencies;
|
private List<ReferenceTypeSourceBaseDependencyPersist> dependencies;
|
||||||
|
|
||||||
|
public static final String _dependencies = "dependencies";
|
||||||
|
|
||||||
public String getKey() {
|
public String getKey() {
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
@ -77,4 +84,45 @@ public abstract class ReferenceTypeSourceBaseConfigurationPersist {
|
||||||
public void setDependencies(List<ReferenceTypeSourceBaseDependencyPersist> dependencies) {
|
public void setDependencies(List<ReferenceTypeSourceBaseDependencyPersist> dependencies) {
|
||||||
this.dependencies = dependencies;
|
this.dependencies = dependencies;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static abstract class ReferenceTypeSourceBaseConfigurationPersistValidator<T extends ReferenceTypeSourceBaseConfigurationPersist> extends BaseValidator<T> {
|
||||||
|
|
||||||
|
protected final MessageSource messageSource;
|
||||||
|
|
||||||
|
protected final ValidatorFactory validatorFactory;
|
||||||
|
|
||||||
|
protected ReferenceTypeSourceBaseConfigurationPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource, ValidatorFactory validatorFactory) {
|
||||||
|
super(conventionService, errors);
|
||||||
|
this.messageSource = messageSource;
|
||||||
|
this.validatorFactory = validatorFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected List<Specification> getBaseSpecifications(T item) {
|
||||||
|
return Arrays.asList(
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isEmpty(item.getKey()))
|
||||||
|
.failOn(ReferenceTypeSourceBaseConfigurationPersist._key).failWith(messageSource.getMessage("Validation_Required", new Object[]{ReferenceTypeSourceBaseConfigurationPersist._label}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isEmpty(item.getLabel()))
|
||||||
|
.failOn(ReferenceTypeSourceBaseConfigurationPersist._label).failWith(messageSource.getMessage("Validation_Required", new Object[]{ReferenceTypeSourceBaseConfigurationPersist._label}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isNull(item.getOrdinal()))
|
||||||
|
.failOn(ReferenceTypeSourceBaseConfigurationPersist._ordinal).failWith(messageSource.getMessage("Validation_Required", new Object[]{ReferenceTypeSourceBaseConfigurationPersist._label}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isNull(item.getType()))
|
||||||
|
.failOn(ReferenceTypeSourceBaseConfigurationPersist._type).failWith(messageSource.getMessage("Validation_Required", new Object[]{ReferenceTypeSourceBaseConfigurationPersist._label}, LocaleContextHolder.getLocale())),
|
||||||
|
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isNull(item.getDependencies()))
|
||||||
|
.failOn(ReferenceTypeSourceBaseConfigurationPersist._dependencies).failWith(messageSource.getMessage("Validation_Required", new Object[]{ReferenceTypeSourceBaseConfigurationPersist._dependencies}, LocaleContextHolder.getLocale())),
|
||||||
|
this.navSpec()
|
||||||
|
.iff(() -> !this.isNull(item.getDependencies()))
|
||||||
|
.on(ReferenceTypeSourceBaseConfigurationPersist._dependencies)
|
||||||
|
.over(item.getDependencies())
|
||||||
|
.using(() -> this.validatorFactory.validator(ReferenceTypeSourceBaseDependencyPersist.ReferenceTypeSourceBaseDependencyPersistValidator.class))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,28 +1,37 @@
|
||||||
package eu.eudat.model.persist.referencetypedefinition;
|
package eu.eudat.model.persist.referencetypedefinition;
|
||||||
|
|
||||||
|
import eu.eudat.commons.validation.BaseValidator;
|
||||||
|
import eu.eudat.commons.validation.specification.Specification;
|
||||||
|
import eu.eudat.convention.ConventionService;
|
||||||
|
import eu.eudat.errorcode.ErrorThesaurusProperties;
|
||||||
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 org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
|
import org.springframework.context.MessageSource;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class ReferenceTypeSourceBaseDependencyPersist {
|
public class ReferenceTypeSourceBaseDependencyPersist {
|
||||||
|
|
||||||
@NotNull(message = "{validation.empty}")
|
|
||||||
@NotEmpty(message = "{validation.empty}")
|
|
||||||
private String referenceTypeCode;
|
private String referenceTypeCode;
|
||||||
|
|
||||||
@NotNull(message = "{validation.empty}")
|
public static final String _referenceTypeCode = "referenceTypeCode";
|
||||||
@NotEmpty(message = "{validation.empty}")
|
|
||||||
private String key;
|
private String key;
|
||||||
|
|
||||||
@NotNull(message = "{validation.empty}")
|
public static final String _key = "key";
|
||||||
|
|
||||||
private Boolean required;
|
private Boolean required;
|
||||||
|
|
||||||
@NotNull(message = "{validation.empty}")
|
public static final String _required = "required";
|
||||||
@Valid
|
|
||||||
private List<DependencyPropertyPersist> properties;
|
private List<DependencyPropertyPersist> properties;
|
||||||
|
|
||||||
|
public static final String _properties = "properties";
|
||||||
|
|
||||||
public String getReferenceTypeCode() {
|
public String getReferenceTypeCode() {
|
||||||
return referenceTypeCode;
|
return referenceTypeCode;
|
||||||
|
@ -55,4 +64,31 @@ public class ReferenceTypeSourceBaseDependencyPersist {
|
||||||
public void setProperties(List<DependencyPropertyPersist> properties) {
|
public void setProperties(List<DependencyPropertyPersist> properties) {
|
||||||
this.properties = properties;
|
this.properties = properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Component(ReferenceTypeSourceBaseDependencyPersistValidator.ValidatorName)
|
||||||
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public static class ReferenceTypeSourceBaseDependencyPersistValidator extends BaseValidator<ReferenceTypeSourceBaseDependencyPersist> {
|
||||||
|
|
||||||
|
public static final String ValidatorName = "ReferenceTypeSourceBaseDependencyPersistValidator";
|
||||||
|
|
||||||
|
private final MessageSource messageSource;
|
||||||
|
|
||||||
|
protected ReferenceTypeSourceBaseDependencyPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource) {
|
||||||
|
super(conventionService, errors);
|
||||||
|
this.messageSource = messageSource;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<ReferenceTypeSourceBaseDependencyPersist> modelClass() {
|
||||||
|
return ReferenceTypeSourceBaseDependencyPersist.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<Specification> specifications(ReferenceTypeSourceBaseDependencyPersist item) {
|
||||||
|
return Arrays.asList(
|
||||||
|
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,19 @@
|
||||||
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.ValidatorFactory;
|
||||||
import eu.eudat.commons.validation.old.ValidEnum;
|
import eu.eudat.commons.validation.old.ValidEnum;
|
||||||
|
import eu.eudat.commons.validation.specification.Specification;
|
||||||
|
import eu.eudat.convention.ConventionService;
|
||||||
|
import eu.eudat.errorcode.ErrorThesaurusProperties;
|
||||||
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 org.springframework.context.MessageSource;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class ReferenceTypeSourceExternalApiConfigurationPersist extends ReferenceTypeSourceBaseConfigurationPersist{
|
public class ReferenceTypeSourceExternalApiConfigurationPersist extends ReferenceTypeSourceBaseConfigurationPersist {
|
||||||
|
|
||||||
@NotNull(message = "{validation.empty}")
|
@NotNull(message = "{validation.empty}")
|
||||||
@NotEmpty(message = "{validation.empty}")
|
@NotEmpty(message = "{validation.empty}")
|
||||||
|
@ -31,7 +36,9 @@ public class ReferenceTypeSourceExternalApiConfigurationPersist extends Referenc
|
||||||
|
|
||||||
@ValidEnum(message = "{validation.empty}")
|
@ValidEnum(message = "{validation.empty}")
|
||||||
private ReferenceTypeExternalApiHTTPMethodType httpMethod;
|
private ReferenceTypeExternalApiHTTPMethodType httpMethod;
|
||||||
|
|
||||||
private String requestBody = "";
|
private String requestBody = "";
|
||||||
|
|
||||||
private String filterType = "remote";
|
private String filterType = "remote";
|
||||||
|
|
||||||
@Valid
|
@Valid
|
||||||
|
@ -56,7 +63,6 @@ public class ReferenceTypeSourceExternalApiConfigurationPersist extends Referenc
|
||||||
this.results = results;
|
this.results = results;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public String getPaginationPath() {
|
public String getPaginationPath() {
|
||||||
return paginationPath;
|
return paginationPath;
|
||||||
}
|
}
|
||||||
|
@ -73,7 +79,6 @@ public class ReferenceTypeSourceExternalApiConfigurationPersist extends Referenc
|
||||||
this.contentType = contentType;
|
this.contentType = contentType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public String getFirstPage() {
|
public String getFirstPage() {
|
||||||
return firstPage;
|
return firstPage;
|
||||||
}
|
}
|
||||||
|
@ -121,4 +126,22 @@ public class ReferenceTypeSourceExternalApiConfigurationPersist extends Referenc
|
||||||
public void setQueries(List<QueryConfigPersist> queries) {
|
public void setQueries(List<QueryConfigPersist> queries) {
|
||||||
this.queries = queries;
|
this.queries = queries;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class ReferenceTypeSourceExternalApiConfigurationPersistValidator extends ReferenceTypeSourceBaseConfigurationPersistValidator<ReferenceTypeSourceExternalApiConfigurationPersist> {
|
||||||
|
|
||||||
|
protected ReferenceTypeSourceExternalApiConfigurationPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource, ValidatorFactory validatorFactory) {
|
||||||
|
super(conventionService, errors, messageSource, validatorFactory);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<ReferenceTypeSourceExternalApiConfigurationPersist> modelClass() {
|
||||||
|
return ReferenceTypeSourceExternalApiConfigurationPersist.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<Specification> specifications(ReferenceTypeSourceExternalApiConfigurationPersist item) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,12 @@
|
||||||
package eu.eudat.model.persist.referencetypedefinition;
|
package eu.eudat.model.persist.referencetypedefinition;
|
||||||
|
|
||||||
|
|
||||||
|
import eu.eudat.commons.validation.ValidatorFactory;
|
||||||
|
import eu.eudat.commons.validation.specification.Specification;
|
||||||
|
import eu.eudat.convention.ConventionService;
|
||||||
|
import eu.eudat.errorcode.ErrorThesaurusProperties;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
import org.springframework.context.MessageSource;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -17,4 +22,22 @@ public class ReferenceTypeSourceStaticOptionConfigurationPersist extends Referen
|
||||||
public void setOptions(List<ReferenceTypeStaticOptionPersist> options) {
|
public void setOptions(List<ReferenceTypeStaticOptionPersist> options) {
|
||||||
this.options = options;
|
this.options = options;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class ReferenceTypeSourceStaticOptionConfigurationPersistValidator extends ReferenceTypeSourceBaseConfigurationPersistValidator<ReferenceTypeSourceStaticOptionConfigurationPersist> {
|
||||||
|
|
||||||
|
protected ReferenceTypeSourceStaticOptionConfigurationPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource, ValidatorFactory validatorFactory) {
|
||||||
|
super(conventionService, errors, messageSource, validatorFactory);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<ReferenceTypeSourceStaticOptionConfigurationPersist> modelClass() {
|
||||||
|
return ReferenceTypeSourceStaticOptionConfigurationPersist.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<Specification> specifications(ReferenceTypeSourceStaticOptionConfigurationPersist item) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package eu.eudat.controllers.v2;
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import eu.eudat.audit.AuditableAction;
|
import eu.eudat.audit.AuditableAction;
|
||||||
import eu.eudat.authorization.AuthorizationFlags;
|
import eu.eudat.authorization.AuthorizationFlags;
|
||||||
|
import eu.eudat.commons.validation.ValidationFilterAnnotation;
|
||||||
import eu.eudat.data.DescriptionTemplateEntity;
|
import eu.eudat.data.DescriptionTemplateEntity;
|
||||||
import eu.eudat.model.DescriptionTemplate;
|
import eu.eudat.model.DescriptionTemplate;
|
||||||
import eu.eudat.model.DmpBlueprint;
|
import eu.eudat.model.DmpBlueprint;
|
||||||
|
@ -31,8 +32,8 @@ import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.context.MessageSource;
|
import org.springframework.context.MessageSource;
|
||||||
import org.springframework.context.i18n.LocaleContextHolder;
|
import org.springframework.context.i18n.LocaleContextHolder;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
|
|
||||||
|
@ -40,7 +41,10 @@ import javax.management.InvalidApplicationException;
|
||||||
import javax.xml.parsers.ParserConfigurationException;
|
import javax.xml.parsers.ParserConfigurationException;
|
||||||
import javax.xml.transform.TransformerException;
|
import javax.xml.transform.TransformerException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.*;
|
import java.util.AbstractMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping(path = "api/description-template")
|
@RequestMapping(path = "api/description-template")
|
||||||
|
@ -88,7 +92,6 @@ public class DescriptionTemplateController {
|
||||||
long count = (lookup.getMetadata() != null && lookup.getMetadata().getCountAll()) ? query.count() : models.size();
|
long count = (lookup.getMetadata() != null && lookup.getMetadata().getCountAll()) ? query.count() : models.size();
|
||||||
|
|
||||||
this.auditService.track(AuditableAction.DescriptionTemplate_Query, "lookup", lookup);
|
this.auditService.track(AuditableAction.DescriptionTemplate_Query, "lookup", lookup);
|
||||||
//this.auditService.trackIdentity(AuditableAction.IdentityTracking_Action);
|
|
||||||
|
|
||||||
return new QueryResult<>(models, count);
|
return new QueryResult<>(models, count);
|
||||||
}
|
}
|
||||||
|
@ -108,14 +111,14 @@ public class DescriptionTemplateController {
|
||||||
new AbstractMap.SimpleEntry<String, Object>("id", id),
|
new AbstractMap.SimpleEntry<String, Object>("id", id),
|
||||||
new AbstractMap.SimpleEntry<String, Object>("fields", fieldSet)
|
new AbstractMap.SimpleEntry<String, Object>("fields", fieldSet)
|
||||||
));
|
));
|
||||||
//this.auditService.trackIdentity(AuditableAction.IdentityTracking_Action);
|
|
||||||
|
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("persist")
|
@PostMapping("persist")
|
||||||
@Transactional
|
@Transactional
|
||||||
public DescriptionTemplate persist(@MyValidate @RequestBody DescriptionTemplatePersist model, FieldSet fieldSet) throws MyApplicationException, MyForbiddenException, MyNotFoundException, InvalidApplicationException, JAXBException, ParserConfigurationException, JsonProcessingException, TransformerException {
|
@ValidationFilterAnnotation(validator = DescriptionTemplatePersist.DescriptionTemplatePersistValidator.ValidatorName, argumentName = "model")
|
||||||
|
public DescriptionTemplate persist(@RequestBody DescriptionTemplatePersist model, FieldSet fieldSet) throws MyApplicationException, MyForbiddenException, MyNotFoundException, InvalidApplicationException, JAXBException, ParserConfigurationException, JsonProcessingException, TransformerException {
|
||||||
logger.debug(new MapLogEntry("persisting" + DescriptionTemplate.class.getSimpleName()).And("model", model).And("fieldSet", fieldSet));
|
logger.debug(new MapLogEntry("persisting" + DescriptionTemplate.class.getSimpleName()).And("model", model).And("fieldSet", fieldSet));
|
||||||
DescriptionTemplate persisted = this.descriptionTemplateTypeService.persist(model, fieldSet);
|
DescriptionTemplate persisted = this.descriptionTemplateTypeService.persist(model, fieldSet);
|
||||||
|
|
||||||
|
@ -123,7 +126,7 @@ public class DescriptionTemplateController {
|
||||||
new AbstractMap.SimpleEntry<String, Object>("model", model),
|
new AbstractMap.SimpleEntry<String, Object>("model", model),
|
||||||
new AbstractMap.SimpleEntry<String, Object>("fields", fieldSet)
|
new AbstractMap.SimpleEntry<String, Object>("fields", fieldSet)
|
||||||
));
|
));
|
||||||
//this.auditService.trackIdentity(AuditableAction.IdentityTracking_Action);
|
|
||||||
return persisted;
|
return persisted;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,7 +138,6 @@ public class DescriptionTemplateController {
|
||||||
this.descriptionTemplateTypeService.deleteAndSave(id);
|
this.descriptionTemplateTypeService.deleteAndSave(id);
|
||||||
|
|
||||||
this.auditService.track(AuditableAction.DescriptionTemplate_Delete, "id", id);
|
this.auditService.track(AuditableAction.DescriptionTemplate_Delete, "id", id);
|
||||||
//this.auditService.trackIdentity(AuditableAction.IdentityTracking_Action);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("clone/{id}")
|
@GetMapping("clone/{id}")
|
||||||
|
@ -150,14 +152,14 @@ public class DescriptionTemplateController {
|
||||||
new AbstractMap.SimpleEntry<String, Object>("id", id),
|
new AbstractMap.SimpleEntry<String, Object>("id", id),
|
||||||
new AbstractMap.SimpleEntry<String, Object>("fields", fieldSet)
|
new AbstractMap.SimpleEntry<String, Object>("fields", fieldSet)
|
||||||
));
|
));
|
||||||
//this.auditService.trackIdentity(AuditableAction.IdentityTracking_Action);
|
|
||||||
|
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("new-version")
|
@PostMapping("new-version")
|
||||||
@Transactional
|
@Transactional
|
||||||
public DescriptionTemplate createNewVersion(@MyValidate @RequestBody NewVersionDescriptionTemplatePersist model, FieldSet fieldSet) throws MyApplicationException, MyForbiddenException, MyNotFoundException, InvalidApplicationException, JAXBException, ParserConfigurationException, JsonProcessingException, TransformerException {
|
@ValidationFilterAnnotation(validator = NewVersionDescriptionTemplatePersist.NewVersionDescriptionTemplatePersistValidator.ValidatorName, argumentName = "model")
|
||||||
|
public DescriptionTemplate createNewVersion(@RequestBody NewVersionDescriptionTemplatePersist model, FieldSet fieldSet) throws MyApplicationException, MyForbiddenException, MyNotFoundException, InvalidApplicationException, JAXBException, ParserConfigurationException, JsonProcessingException, TransformerException {
|
||||||
logger.debug(new MapLogEntry("persisting" + NewVersionDescriptionTemplatePersist.class.getSimpleName()).And("model", model).And("fieldSet", fieldSet));
|
logger.debug(new MapLogEntry("persisting" + NewVersionDescriptionTemplatePersist.class.getSimpleName()).And("model", model).And("fieldSet", fieldSet));
|
||||||
DescriptionTemplate persisted = this.descriptionTemplateTypeService.createNewVersion(model, fieldSet);
|
DescriptionTemplate persisted = this.descriptionTemplateTypeService.createNewVersion(model, fieldSet);
|
||||||
|
|
||||||
|
@ -165,21 +167,20 @@ public class DescriptionTemplateController {
|
||||||
new AbstractMap.SimpleEntry<String, Object>("model", model),
|
new AbstractMap.SimpleEntry<String, Object>("model", model),
|
||||||
new AbstractMap.SimpleEntry<String, Object>("fields", fieldSet)
|
new AbstractMap.SimpleEntry<String, Object>("fields", fieldSet)
|
||||||
));
|
));
|
||||||
//this.auditService.trackIdentity(AuditableAction.IdentityTracking_Action);
|
|
||||||
return persisted;
|
return persisted;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@RequestMapping(method = RequestMethod.GET, value = {"/xml/export/{id}"}, produces = "application/xml")
|
@RequestMapping(method = RequestMethod.GET, value = {"/xml/export/{id}"}, produces = "application/xml")
|
||||||
public @ResponseBody ResponseEntity getXml(@PathVariable UUID id) throws JAXBException, ParserConfigurationException, IOException, TransformerException, InstantiationException, IllegalAccessException, SAXException, InvalidApplicationException {
|
public @ResponseBody ResponseEntity<byte[]> getXml(@PathVariable UUID id) throws JAXBException, ParserConfigurationException, IOException, TransformerException, InstantiationException, IllegalAccessException, SAXException, InvalidApplicationException {
|
||||||
logger.debug(new MapLogEntry("export" + DescriptionTemplate.class.getSimpleName()).And("id", id));
|
logger.debug(new MapLogEntry("export" + DescriptionTemplate.class.getSimpleName()).And("id", id));
|
||||||
|
|
||||||
ResponseEntity response = this.descriptionTemplateTypeService.exportXml(id);
|
ResponseEntity<byte[]> response = this.descriptionTemplateTypeService.exportXml(id);
|
||||||
|
|
||||||
this.auditService.track(AuditableAction.DescriptionTemplate_GetXml, Map.ofEntries(
|
this.auditService.track(AuditableAction.DescriptionTemplate_GetXml, Map.ofEntries(
|
||||||
new AbstractMap.SimpleEntry<String, Object>("id", id)
|
new AbstractMap.SimpleEntry<String, Object>("id", id)
|
||||||
));
|
));
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -196,7 +197,6 @@ public class DescriptionTemplateController {
|
||||||
new AbstractMap.SimpleEntry<String, Object>("id", id),
|
new AbstractMap.SimpleEntry<String, Object>("id", id),
|
||||||
new AbstractMap.SimpleEntry<String, Object>("fields", fieldSet)
|
new AbstractMap.SimpleEntry<String, Object>("fields", fieldSet)
|
||||||
));
|
));
|
||||||
//this.auditService.trackIdentity(AuditableAction.IdentityTracking_Action);
|
|
||||||
|
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
|
@ -210,7 +210,6 @@ public class DescriptionTemplateController {
|
||||||
this.auditService.track(AuditableAction.DescriptionTemplate_GetSemantics, Map.ofEntries(
|
this.auditService.track(AuditableAction.DescriptionTemplate_GetSemantics, Map.ofEntries(
|
||||||
new AbstractMap.SimpleEntry<String, Object>("query", query)
|
new AbstractMap.SimpleEntry<String, Object>("query", query)
|
||||||
));
|
));
|
||||||
//this.auditService.trackIdentity(AuditableAction.IdentityTracking_Action);
|
|
||||||
|
|
||||||
return semantics;
|
return semantics;
|
||||||
}
|
}
|
||||||
|
|
|
@ -121,7 +121,7 @@ public class DmpController {
|
||||||
@PostMapping("persist")
|
@PostMapping("persist")
|
||||||
@Transactional
|
@Transactional
|
||||||
@ValidationFilterAnnotation(validator = DmpPersist.DmpPersistValidator.ValidatorName, argumentName = "model")
|
@ValidationFilterAnnotation(validator = DmpPersist.DmpPersistValidator.ValidatorName, argumentName = "model")
|
||||||
public Dmp Persist(@MyValidate @RequestBody DmpPersist model, FieldSet fieldSet) throws MyApplicationException, MyForbiddenException, MyNotFoundException, InvalidApplicationException, JsonProcessingException {
|
public Dmp Persist(@RequestBody DmpPersist model, FieldSet fieldSet) throws MyApplicationException, MyForbiddenException, MyNotFoundException, InvalidApplicationException, JsonProcessingException {
|
||||||
logger.debug(new MapLogEntry("persisting" + Dmp.class.getSimpleName()).And("model", model).And("fieldSet", fieldSet));
|
logger.debug(new MapLogEntry("persisting" + Dmp.class.getSimpleName()).And("model", model).And("fieldSet", fieldSet));
|
||||||
|
|
||||||
Dmp persisted = this.dmpService.persist(model, fieldSet);
|
Dmp persisted = this.dmpService.persist(model, fieldSet);
|
||||||
|
@ -164,7 +164,8 @@ public class DmpController {
|
||||||
|
|
||||||
@PostMapping("new-version")
|
@PostMapping("new-version")
|
||||||
@Transactional
|
@Transactional
|
||||||
public Dmp createNewVersion(@MyValidate @RequestBody NewVersionDmpPersist model, FieldSet fieldSet) throws MyApplicationException, MyForbiddenException, MyNotFoundException, JAXBException, JsonProcessingException, TransformerException, InvalidApplicationException, ParserConfigurationException {
|
@ValidationFilterAnnotation(validator = NewVersionDmpPersist.NewVersionDmpPersistValidator.ValidatorName, argumentName = "model")
|
||||||
|
public Dmp createNewVersion(@RequestBody NewVersionDmpPersist model, FieldSet fieldSet) throws MyApplicationException, MyForbiddenException, MyNotFoundException, JAXBException, JsonProcessingException, TransformerException, InvalidApplicationException, ParserConfigurationException {
|
||||||
logger.debug(new MapLogEntry("persisting" + NewVersionDmpPersist.class.getSimpleName()).And("model", model).And("fieldSet", fieldSet));
|
logger.debug(new MapLogEntry("persisting" + NewVersionDmpPersist.class.getSimpleName()).And("model", model).And("fieldSet", fieldSet));
|
||||||
|
|
||||||
Dmp persisted = this.dmpService.createNewVersion(model, fieldSet);
|
Dmp persisted = this.dmpService.createNewVersion(model, fieldSet);
|
||||||
|
@ -179,7 +180,8 @@ public class DmpController {
|
||||||
|
|
||||||
@PostMapping("{id}/assign-users")
|
@PostMapping("{id}/assign-users")
|
||||||
@Transactional
|
@Transactional
|
||||||
public QueryResult<DmpUser> assignUsers(@PathVariable("id") UUID id, @MyValidate @RequestBody List<DmpUserPersist> model, FieldSet fieldSet) throws InvalidApplicationException {
|
@ValidationFilterAnnotation(validator = DmpUserPersist.DmpUserPersistValidator.ValidatorName, argumentName = "model")
|
||||||
|
public QueryResult<DmpUser> assignUsers(@PathVariable("id") UUID id, @RequestBody List<DmpUserPersist> model, FieldSet fieldSet) throws InvalidApplicationException {
|
||||||
logger.debug(new MapLogEntry("assigning users to dmp").And("model", model).And("fieldSet", fieldSet));
|
logger.debug(new MapLogEntry("assigning users to dmp").And("model", model).And("fieldSet", fieldSet));
|
||||||
|
|
||||||
List<DmpUser> persisted = this.dmpService.assignUsers(id, model, fieldSet);
|
List<DmpUser> persisted = this.dmpService.assignUsers(id, model, fieldSet);
|
||||||
|
@ -194,7 +196,8 @@ public class DmpController {
|
||||||
|
|
||||||
@PostMapping("remove-user")
|
@PostMapping("remove-user")
|
||||||
@Transactional
|
@Transactional
|
||||||
public QueryResult<Dmp> removeUser(@MyValidate @RequestBody DmpUserRemovePersist model, FieldSet fieldSet) throws InvalidApplicationException {
|
@ValidationFilterAnnotation(validator = DmpUserRemovePersist.DmpUserRemovePersistValidator.ValidatorName, argumentName = "model")
|
||||||
|
public QueryResult<Dmp> removeUser(@RequestBody DmpUserRemovePersist model, FieldSet fieldSet) throws InvalidApplicationException {
|
||||||
logger.debug(new MapLogEntry("remove user from dmp").And("model", model).And("fieldSet", fieldSet));
|
logger.debug(new MapLogEntry("remove user from dmp").And("model", model).And("fieldSet", fieldSet));
|
||||||
|
|
||||||
Dmp persisted = this.dmpService.removeUser(model, fieldSet);
|
Dmp persisted = this.dmpService.removeUser(model, fieldSet);
|
||||||
|
@ -216,7 +219,8 @@ public class DmpController {
|
||||||
|
|
||||||
@PostMapping("{id}/invite-users")
|
@PostMapping("{id}/invite-users")
|
||||||
@Transactional
|
@Transactional
|
||||||
public ResponseEntity inviteUsers(@PathVariable("id") UUID id, @MyValidate @RequestBody DmpUserInvitePersist model) throws InvalidApplicationException, JAXBException {
|
@ValidationFilterAnnotation(validator = DmpUserInvitePersist.DmpUserInvitePersistValidator.ValidatorName, argumentName = "model")
|
||||||
|
public ResponseEntity<ResponseItem<String>> inviteUsers(@PathVariable("id") UUID id,@RequestBody DmpUserInvitePersist model) throws InvalidApplicationException, JAXBException {
|
||||||
logger.debug(new MapLogEntry("inviting users to dmp").And("model", model));
|
logger.debug(new MapLogEntry("inviting users to dmp").And("model", model));
|
||||||
|
|
||||||
this.dmpService.inviteUsers(id, model);
|
this.dmpService.inviteUsers(id, model);
|
||||||
|
@ -230,7 +234,7 @@ public class DmpController {
|
||||||
|
|
||||||
@GetMapping("{id}/token/{token}/invite-accept")
|
@GetMapping("{id}/token/{token}/invite-accept")
|
||||||
@Transactional
|
@Transactional
|
||||||
public ResponseEntity acceptInvitation(@PathVariable("id") UUID id, @PathVariable("token") String token) throws InvalidApplicationException, JAXBException {
|
public ResponseEntity<ResponseItem<String>> acceptInvitation(@PathVariable("id") UUID id, @PathVariable("token") String token) throws InvalidApplicationException, JAXBException {
|
||||||
logger.debug(new MapLogEntry("inviting users to dmp").And("id", id));
|
logger.debug(new MapLogEntry("inviting users to dmp").And("id", id));
|
||||||
|
|
||||||
this.dmpService.dmpInvitationAccept(token);
|
this.dmpService.dmpInvitationAccept(token);
|
||||||
|
|
|
@ -2,6 +2,7 @@ package eu.eudat.controllers.v2;
|
||||||
|
|
||||||
import eu.eudat.audit.AuditableAction;
|
import eu.eudat.audit.AuditableAction;
|
||||||
import eu.eudat.authorization.AuthorizationFlags;
|
import eu.eudat.authorization.AuthorizationFlags;
|
||||||
|
import eu.eudat.commons.validation.ValidationFilterAnnotation;
|
||||||
import eu.eudat.data.EntityDoiEntity;
|
import eu.eudat.data.EntityDoiEntity;
|
||||||
import eu.eudat.model.DescriptionTemplateType;
|
import eu.eudat.model.DescriptionTemplateType;
|
||||||
import eu.eudat.model.EntityDoi;
|
import eu.eudat.model.EntityDoi;
|
||||||
|
@ -23,7 +24,6 @@ import gr.cite.tools.exception.MyNotFoundException;
|
||||||
import gr.cite.tools.fieldset.FieldSet;
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
import gr.cite.tools.logging.LoggerService;
|
import gr.cite.tools.logging.LoggerService;
|
||||||
import gr.cite.tools.logging.MapLogEntry;
|
import gr.cite.tools.logging.MapLogEntry;
|
||||||
import gr.cite.tools.validation.MyValidate;
|
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.context.MessageSource;
|
import org.springframework.context.MessageSource;
|
||||||
import org.springframework.context.i18n.LocaleContextHolder;
|
import org.springframework.context.i18n.LocaleContextHolder;
|
||||||
|
@ -44,6 +44,7 @@ public class EntityDoiController {
|
||||||
private final AuditService auditService;
|
private final AuditService auditService;
|
||||||
|
|
||||||
private final EntityDoiService entityDoiService;
|
private final EntityDoiService entityDoiService;
|
||||||
|
|
||||||
private final DepositService repositoryDepositService;
|
private final DepositService repositoryDepositService;
|
||||||
|
|
||||||
private final CensorFactory censorFactory;
|
private final CensorFactory censorFactory;
|
||||||
|
@ -106,7 +107,8 @@ public class EntityDoiController {
|
||||||
|
|
||||||
@PostMapping("persist")
|
@PostMapping("persist")
|
||||||
@Transactional
|
@Transactional
|
||||||
public EntityDoi Persist(@MyValidate @RequestBody EntityDoiPersist model, FieldSet fieldSet) throws MyApplicationException, MyForbiddenException, MyNotFoundException, InvalidApplicationException {
|
@ValidationFilterAnnotation(validator = EntityDoiPersist.EntityDoiPersistValidator.ValidatorName, argumentName = "model")
|
||||||
|
public EntityDoi Persist(@RequestBody EntityDoiPersist model, FieldSet fieldSet) throws MyApplicationException, MyForbiddenException, MyNotFoundException, InvalidApplicationException {
|
||||||
logger.debug(new MapLogEntry("persisting" + DescriptionTemplateType.class.getSimpleName()).And("model", model).And("fieldSet", fieldSet));
|
logger.debug(new MapLogEntry("persisting" + DescriptionTemplateType.class.getSimpleName()).And("model", model).And("fieldSet", fieldSet));
|
||||||
EntityDoi persisted = this.entityDoiService.persist(model, fieldSet);
|
EntityDoi persisted = this.entityDoiService.persist(model, fieldSet);
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ package eu.eudat.controllers.v2;
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import eu.eudat.audit.AuditableAction;
|
import eu.eudat.audit.AuditableAction;
|
||||||
import eu.eudat.authorization.AuthorizationFlags;
|
import eu.eudat.authorization.AuthorizationFlags;
|
||||||
import eu.eudat.authorization.Permission;
|
import eu.eudat.commons.validation.ValidationFilterAnnotation;
|
||||||
import eu.eudat.data.LanguageEntity;
|
import eu.eudat.data.LanguageEntity;
|
||||||
import eu.eudat.model.Language;
|
import eu.eudat.model.Language;
|
||||||
import eu.eudat.model.builder.LanguageBuilder;
|
import eu.eudat.model.builder.LanguageBuilder;
|
||||||
|
@ -24,20 +24,20 @@ import gr.cite.tools.exception.MyNotFoundException;
|
||||||
import gr.cite.tools.fieldset.FieldSet;
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
import gr.cite.tools.logging.LoggerService;
|
import gr.cite.tools.logging.LoggerService;
|
||||||
import gr.cite.tools.logging.MapLogEntry;
|
import gr.cite.tools.logging.MapLogEntry;
|
||||||
import gr.cite.tools.validation.MyValidate;
|
|
||||||
import jakarta.transaction.Transactional;
|
import jakarta.transaction.Transactional;
|
||||||
import jakarta.xml.bind.JAXBException;
|
import jakarta.xml.bind.JAXBException;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.MessageSource;
|
import org.springframework.context.MessageSource;
|
||||||
import org.springframework.context.i18n.LocaleContextHolder;
|
import org.springframework.context.i18n.LocaleContextHolder;
|
||||||
import org.springframework.http.HttpStatus;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.management.InvalidApplicationException;
|
import javax.management.InvalidApplicationException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.*;
|
import java.util.AbstractMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
|
@ -45,13 +45,21 @@ import java.util.stream.Collectors;
|
||||||
public class LanguageV2Controller {
|
public class LanguageV2Controller {
|
||||||
|
|
||||||
private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(LanguageV2Controller.class));
|
private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(LanguageV2Controller.class));
|
||||||
|
|
||||||
private final BuilderFactory builderFactory;
|
private final BuilderFactory builderFactory;
|
||||||
|
|
||||||
private final AuditService auditService;
|
private final AuditService auditService;
|
||||||
|
|
||||||
private final CensorFactory censorFactory;
|
private final CensorFactory censorFactory;
|
||||||
|
|
||||||
private final QueryFactory queryFactory;
|
private final QueryFactory queryFactory;
|
||||||
|
|
||||||
private final MessageSource messageSource;
|
private final MessageSource messageSource;
|
||||||
|
|
||||||
private final AuthorizationService authorizationService;
|
private final AuthorizationService authorizationService;
|
||||||
|
|
||||||
private final LanguageService languageService;
|
private final LanguageService languageService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public LanguageV2Controller(
|
public LanguageV2Controller(
|
||||||
BuilderFactory builderFactory,
|
BuilderFactory builderFactory,
|
||||||
|
@ -82,7 +90,7 @@ public class LanguageV2Controller {
|
||||||
|
|
||||||
this.auditService.track(AuditableAction.Language_Query, "lookup", lookup);
|
this.auditService.track(AuditableAction.Language_Query, "lookup", lookup);
|
||||||
|
|
||||||
return new QueryResult(models, count);
|
return new QueryResult<>(models, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("{id}")
|
@GetMapping("{id}")
|
||||||
|
@ -116,7 +124,7 @@ public class LanguageV2Controller {
|
||||||
if (model == null)
|
if (model == null)
|
||||||
throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{code, Language.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{code, Language.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||||
|
|
||||||
if (model.getPayload() == null){
|
if (model.getPayload() == null) {
|
||||||
model.setPayload(this.languageService.getPayload(code));
|
model.setPayload(this.languageService.getPayload(code));
|
||||||
}
|
}
|
||||||
this.auditService.track(AuditableAction.Language_Lookup, Map.ofEntries(
|
this.auditService.track(AuditableAction.Language_Lookup, Map.ofEntries(
|
||||||
|
@ -139,12 +147,13 @@ public class LanguageV2Controller {
|
||||||
|
|
||||||
long count = (lookup.getMetadata() != null && lookup.getMetadata().getCountAll()) ? query.count() : models.size();
|
long count = (lookup.getMetadata() != null && lookup.getMetadata().getCountAll()) ? query.count() : models.size();
|
||||||
|
|
||||||
return new QueryResult<>(models.stream().map(x -> x.getCode()).collect(Collectors.toList()), count);
|
return new QueryResult<>(models.stream().map(Language::getCode).collect(Collectors.toList()), count);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("persist")
|
@PostMapping("persist")
|
||||||
@Transactional
|
@Transactional
|
||||||
public Language persist(@MyValidate @RequestBody LanguagePersist model, FieldSet fieldSet) throws MyApplicationException, MyForbiddenException, MyNotFoundException, InvalidApplicationException, JAXBException, JsonProcessingException, InvalidApplicationException {
|
@ValidationFilterAnnotation(validator = LanguagePersist.LanguagePersistValidator.ValidatorName, argumentName = "model")
|
||||||
|
public Language persist(@RequestBody LanguagePersist model, FieldSet fieldSet) throws MyApplicationException, MyForbiddenException, MyNotFoundException, InvalidApplicationException, JAXBException, JsonProcessingException, InvalidApplicationException {
|
||||||
logger.debug(new MapLogEntry("persisting" + Language.class.getSimpleName()).And("model", model).And("fieldSet", fieldSet));
|
logger.debug(new MapLogEntry("persisting" + Language.class.getSimpleName()).And("model", model).And("fieldSet", fieldSet));
|
||||||
this.censorFactory.censor(LanguageCensor.class).censor(fieldSet, null);
|
this.censorFactory.censor(LanguageCensor.class).censor(fieldSet, null);
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ package eu.eudat.controllers.v2;
|
||||||
import eu.eudat.audit.AuditableAction;
|
import eu.eudat.audit.AuditableAction;
|
||||||
import eu.eudat.authorization.AuthorizationFlags;
|
import eu.eudat.authorization.AuthorizationFlags;
|
||||||
import eu.eudat.authorization.Permission;
|
import eu.eudat.authorization.Permission;
|
||||||
|
import eu.eudat.commons.validation.ValidationFilterAnnotation;
|
||||||
import eu.eudat.data.LockEntity;
|
import eu.eudat.data.LockEntity;
|
||||||
import eu.eudat.model.Lock;
|
import eu.eudat.model.Lock;
|
||||||
import eu.eudat.model.builder.LockBuilder;
|
import eu.eudat.model.builder.LockBuilder;
|
||||||
|
@ -60,6 +61,7 @@ public class LockController {
|
||||||
private final QueryFactory queryFactory;
|
private final QueryFactory queryFactory;
|
||||||
|
|
||||||
private final MessageSource messageSource;
|
private final MessageSource messageSource;
|
||||||
|
|
||||||
private final AuthorizationService authService;
|
private final AuthorizationService authService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@ -115,6 +117,7 @@ public class LockController {
|
||||||
|
|
||||||
@PostMapping("persist")
|
@PostMapping("persist")
|
||||||
@Transactional
|
@Transactional
|
||||||
|
@ValidationFilterAnnotation(validator = LockPersist.LockPersistValidator.ValidatorName, argumentName = "model")
|
||||||
public Lock persist(@MyValidate @RequestBody LockPersist model, FieldSet fieldSet) throws MyApplicationException, MyForbiddenException, MyNotFoundException, InvalidApplicationException {
|
public Lock persist(@MyValidate @RequestBody LockPersist model, FieldSet fieldSet) throws MyApplicationException, MyForbiddenException, MyNotFoundException, InvalidApplicationException {
|
||||||
logger.debug(new MapLogEntry("persisting" + Lock.class.getSimpleName()).And("model", model).And("fieldSet", fieldSet));
|
logger.debug(new MapLogEntry("persisting" + Lock.class.getSimpleName()).And("model", model).And("fieldSet", fieldSet));
|
||||||
this.censorFactory.censor(LockCensor.class).censor(fieldSet, null);
|
this.censorFactory.censor(LockCensor.class).censor(fieldSet, null);
|
||||||
|
|
|
@ -4,6 +4,7 @@ import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import eu.eudat.audit.AuditableAction;
|
import eu.eudat.audit.AuditableAction;
|
||||||
import eu.eudat.authorization.AuthorizationFlags;
|
import eu.eudat.authorization.AuthorizationFlags;
|
||||||
import eu.eudat.authorization.Permission;
|
import eu.eudat.authorization.Permission;
|
||||||
|
import eu.eudat.commons.validation.ValidationFilterAnnotation;
|
||||||
import eu.eudat.controllers.BaseController;
|
import eu.eudat.controllers.BaseController;
|
||||||
import eu.eudat.data.ReferenceEntity;
|
import eu.eudat.data.ReferenceEntity;
|
||||||
import eu.eudat.logic.proxy.config.exceptions.HugeResultSet;
|
import eu.eudat.logic.proxy.config.exceptions.HugeResultSet;
|
||||||
|
@ -32,7 +33,6 @@ import gr.cite.tools.exception.MyNotFoundException;
|
||||||
import gr.cite.tools.fieldset.FieldSet;
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
import gr.cite.tools.logging.LoggerService;
|
import gr.cite.tools.logging.LoggerService;
|
||||||
import gr.cite.tools.logging.MapLogEntry;
|
import gr.cite.tools.logging.MapLogEntry;
|
||||||
import gr.cite.tools.validation.MyValidate;
|
|
||||||
import jakarta.transaction.Transactional;
|
import jakarta.transaction.Transactional;
|
||||||
import jakarta.xml.bind.JAXBException;
|
import jakarta.xml.bind.JAXBException;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -56,12 +56,19 @@ import java.util.UUID;
|
||||||
public class ReferenceController extends BaseController {
|
public class ReferenceController extends BaseController {
|
||||||
|
|
||||||
private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(ReferenceController.class));
|
private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(ReferenceController.class));
|
||||||
|
|
||||||
private final BuilderFactory builderFactory;
|
private final BuilderFactory builderFactory;
|
||||||
|
|
||||||
private final AuditService auditService;
|
private final AuditService auditService;
|
||||||
|
|
||||||
private final ReferenceService referenceService;
|
private final ReferenceService referenceService;
|
||||||
|
|
||||||
private final CensorFactory censorFactory;
|
private final CensorFactory censorFactory;
|
||||||
|
|
||||||
private final QueryFactory queryFactory;
|
private final QueryFactory queryFactory;
|
||||||
|
|
||||||
private final MessageSource messageSource;
|
private final MessageSource messageSource;
|
||||||
|
|
||||||
private final AuthorizationService authorizationService;
|
private final AuthorizationService authorizationService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@ -96,7 +103,7 @@ public class ReferenceController extends BaseController {
|
||||||
|
|
||||||
this.auditService.track(AuditableAction.Reference_Query, "lookup", lookup);
|
this.auditService.track(AuditableAction.Reference_Query, "lookup", lookup);
|
||||||
|
|
||||||
return new QueryResult(models, count);
|
return new QueryResult<>(models, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("search")
|
@PostMapping("search")
|
||||||
|
@ -104,11 +111,11 @@ public class ReferenceController extends BaseController {
|
||||||
this.authorizationService.authorizeForce(Permission.AuthenticatedRole);
|
this.authorizationService.authorizeForce(Permission.AuthenticatedRole);
|
||||||
// ReferenceType referenceType = ReferenceType.of((short) externalType);
|
// ReferenceType referenceType = ReferenceType.of((short) externalType);
|
||||||
|
|
||||||
if (lookup.getType() != null){
|
if (lookup.getType() != null) {
|
||||||
List<Reference> references = this.referenceService.searchReference(lookup);
|
List<Reference> references = this.referenceService.searchReference(lookup);
|
||||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<List<Reference>>().status(ApiMessageCode.NO_MESSAGE).payload(references));
|
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<List<Reference>>().status(ApiMessageCode.NO_MESSAGE).payload(references));
|
||||||
}
|
}
|
||||||
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem().status(ApiMessageCode.NO_MESSAGE));
|
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<List<Reference>>().status(ApiMessageCode.NO_MESSAGE));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("search-with-db-definition")
|
@PostMapping("search-with-db-definition")
|
||||||
|
@ -140,7 +147,8 @@ public class ReferenceController extends BaseController {
|
||||||
|
|
||||||
@PostMapping("persist")
|
@PostMapping("persist")
|
||||||
@Transactional
|
@Transactional
|
||||||
public Reference persist(@MyValidate @RequestBody ReferencePersist model, FieldSet fieldSet) throws MyApplicationException, MyForbiddenException, MyNotFoundException, InvalidApplicationException, JAXBException, ParserConfigurationException, JsonProcessingException, TransformerException {
|
@ValidationFilterAnnotation(validator = ReferencePersist.ReferencePersistValidator.ValidatorName, argumentName = "model")
|
||||||
|
public Reference persist(@RequestBody ReferencePersist model, FieldSet fieldSet) throws MyApplicationException, MyForbiddenException, MyNotFoundException, InvalidApplicationException, JAXBException, ParserConfigurationException, JsonProcessingException, TransformerException {
|
||||||
logger.debug(new MapLogEntry("persisting" + Reference.class.getSimpleName()).And("model", model).And("fieldSet", fieldSet));
|
logger.debug(new MapLogEntry("persisting" + Reference.class.getSimpleName()).And("model", model).And("fieldSet", fieldSet));
|
||||||
this.censorFactory.censor(ReferenceCensor.class).censor(fieldSet, null);
|
this.censorFactory.censor(ReferenceCensor.class).censor(fieldSet, null);
|
||||||
|
|
||||||
|
@ -150,7 +158,7 @@ public class ReferenceController extends BaseController {
|
||||||
new AbstractMap.SimpleEntry<String, Object>("model", model),
|
new AbstractMap.SimpleEntry<String, Object>("model", model),
|
||||||
new AbstractMap.SimpleEntry<String, Object>("fields", fieldSet)
|
new AbstractMap.SimpleEntry<String, Object>("fields", fieldSet)
|
||||||
));
|
));
|
||||||
//this.auditService.trackIdentity(AuditableAction.IdentityTracking_Action);
|
|
||||||
return persisted;
|
return persisted;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue