Merge remote-tracking branch 'origin/dmp-refactoring' into dmp-refactoring
# Conflicts: # dmp-frontend/src/app/core/model/file/file-format.model.ts
This commit is contained in:
commit
1fb516c8ef
|
@ -114,4 +114,13 @@ public class AuditableAction {
|
||||||
public static final EventId Deposit_GetAccessToken = new EventId(18001, "Deposit_GetAccessToken");
|
public static final EventId Deposit_GetAccessToken = new EventId(18001, "Deposit_GetAccessToken");
|
||||||
public static final EventId Deposit_Deposit = new EventId(18002, "Deposit_Deposit");
|
public static final EventId Deposit_Deposit = new EventId(18002, "Deposit_Deposit");
|
||||||
public static final EventId Deposit_GetLogo = new EventId(18003, "Deposit_GetLogo");
|
public static final EventId Deposit_GetLogo = new EventId(18003, "Deposit_GetLogo");
|
||||||
|
|
||||||
|
public static final EventId Tag_Query = new EventId(19000, "Tag_Query");
|
||||||
|
public static final EventId Tag_Lookup = new EventId(19001, "Tag_Lookup");
|
||||||
|
public static final EventId Tag_Persist = new EventId(19002, "Tag_Persist");
|
||||||
|
public static final EventId Tag_Delete = new EventId(19003, "Tag_Delete");
|
||||||
|
|
||||||
|
public static final EventId FileTransformer_GetAvailableConfigurations = new EventId(20000, "FileTransformer_GetAvailableConfigurations");
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,4 +50,8 @@ public class EventBroker {
|
||||||
this.applicationEventPublisher.publishEvent(event);
|
this.applicationEventPublisher.publishEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void emit(TagTouchedEvent event) {
|
||||||
|
this.applicationEventPublisher.publishEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
package eu.eudat.event;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public class TagTouchedEvent {
|
||||||
|
|
||||||
|
public TagTouchedEvent() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public TagTouchedEvent(UUID id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
private UUID id;
|
||||||
|
|
||||||
|
public UUID getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(UUID id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -12,95 +12,75 @@ import java.util.UUID;
|
||||||
public class Dmp {
|
public class Dmp {
|
||||||
|
|
||||||
private UUID id;
|
private UUID id;
|
||||||
|
|
||||||
public static final String _id = "id";
|
public static final String _id = "id";
|
||||||
|
|
||||||
private String label;
|
private String label;
|
||||||
|
|
||||||
public static final String _label = "label";
|
public static final String _label = "label";
|
||||||
|
|
||||||
private Short version;
|
private Short version;
|
||||||
|
|
||||||
public static final String _version = "version";
|
public static final String _version = "version";
|
||||||
|
|
||||||
private DmpStatus status;
|
private DmpStatus status;
|
||||||
|
|
||||||
public static final String _status = "status";
|
public static final String _status = "status";
|
||||||
|
|
||||||
private DmpVersionStatus versionStatus;
|
private DmpVersionStatus versionStatus;
|
||||||
|
|
||||||
public static final String _versionStatus = "versionStatus";
|
public static final String _versionStatus = "versionStatus";
|
||||||
|
|
||||||
private String properties;
|
private String properties;
|
||||||
|
|
||||||
public static final String _properties = "properties";
|
public static final String _properties = "properties";
|
||||||
|
|
||||||
private UUID groupId;
|
private UUID groupId;
|
||||||
|
|
||||||
public static final String _groupId = "groupId";
|
public static final String _groupId = "groupId";
|
||||||
|
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
public static final String _description = "description";
|
public static final String _description = "description";
|
||||||
|
|
||||||
private Instant createdAt;
|
private Instant createdAt;
|
||||||
|
|
||||||
public static final String _createdAt = "createdAt";
|
public static final String _createdAt = "createdAt";
|
||||||
|
|
||||||
private Instant updatedAt;
|
private Instant updatedAt;
|
||||||
|
|
||||||
public static final String _updatedAt = "updatedAt";
|
public static final String _updatedAt = "updatedAt";
|
||||||
|
|
||||||
private IsActive isActive;
|
private IsActive isActive;
|
||||||
|
|
||||||
public static final String _isActive = "isActive";
|
public static final String _isActive = "isActive";
|
||||||
|
|
||||||
private Instant finalizedAt;
|
private Instant finalizedAt;
|
||||||
|
|
||||||
public static final String _finalizedAt = "finalizedAt";
|
public static final String _finalizedAt = "finalizedAt";
|
||||||
|
|
||||||
private Instant publishedAt;
|
private Instant publishedAt;
|
||||||
|
|
||||||
public static final String _publishedAt = "publishedAt";
|
public static final String _publishedAt = "publishedAt";
|
||||||
|
|
||||||
private User creator;
|
private User creator;
|
||||||
|
|
||||||
public static final String _creator = "creator";
|
public static final String _creator = "creator";
|
||||||
|
|
||||||
private DmpAccessType accessType;
|
private DmpAccessType accessType;
|
||||||
|
|
||||||
public static final String _accessType = "accessType";
|
public static final String _accessType = "accessType";
|
||||||
|
|
||||||
private DmpBlueprint blueprint;
|
private DmpBlueprint blueprint;
|
||||||
|
|
||||||
public static final String _blueprint = "blueprint";
|
public static final String _blueprint = "blueprint";
|
||||||
|
|
||||||
private String language;
|
private String language;
|
||||||
|
|
||||||
public static final String _language = "language";
|
public static final String _language = "language";
|
||||||
|
|
||||||
private Instant publicAfter;
|
private Instant publicAfter;
|
||||||
|
|
||||||
public static final String _publicAfter = "publicAfter";
|
public static final String _publicAfter = "publicAfter";
|
||||||
|
|
||||||
private String hash;
|
private String hash;
|
||||||
|
|
||||||
public static final String _hash = "hash";
|
public static final String _hash = "hash";
|
||||||
|
|
||||||
private List<DmpReference> dmpReferences;
|
private List<DmpReference> dmpReferences;
|
||||||
|
|
||||||
public static final String _dmpReferences = "dmpReferences";
|
public static final String _dmpReferences = "dmpReferences";
|
||||||
|
|
||||||
private List<DmpUser> dmpUsers;
|
private List<DmpUser> dmpUsers;
|
||||||
|
|
||||||
public static final String _dmpUsers = "dmpUsers";
|
public static final String _dmpUsers = "dmpUsers";
|
||||||
|
|
||||||
private List<Description> descriptions;
|
private List<Description> descriptions;
|
||||||
|
|
||||||
public static final String _descriptions = "descriptions";
|
public static final String _descriptions = "descriptions";
|
||||||
|
|
||||||
private List<EntityDoi> entityDois;
|
private List<DmpDescriptionTemplate> dmpDescriptionTemplates;
|
||||||
|
public static final String _dmpDescriptionTemplates = "dmpDescriptionTemplates";
|
||||||
|
|
||||||
|
private List<EntityDoi> entityDois;
|
||||||
public static final String _entityDois = "entityDois";
|
public static final String _entityDois = "entityDois";
|
||||||
|
|
||||||
public UUID getId() {
|
public UUID getId() {
|
||||||
|
@ -279,6 +259,14 @@ public class Dmp {
|
||||||
this.descriptions = descriptions;
|
this.descriptions = descriptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<DmpDescriptionTemplate> getDmpDescriptionTemplates() {
|
||||||
|
return dmpDescriptionTemplates;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDmpDescriptionTemplates(List<DmpDescriptionTemplate> dmpDescriptionTemplates) {
|
||||||
|
this.dmpDescriptionTemplates = dmpDescriptionTemplates;
|
||||||
|
}
|
||||||
|
|
||||||
public List<EntityDoi> getEntityDois() {
|
public List<EntityDoi> getEntityDois() {
|
||||||
return entityDois;
|
return entityDois;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package eu.eudat.model.builder;
|
||||||
import eu.eudat.authorization.AuthorizationFlags;
|
import eu.eudat.authorization.AuthorizationFlags;
|
||||||
import eu.eudat.commons.enums.EntityType;
|
import eu.eudat.commons.enums.EntityType;
|
||||||
import eu.eudat.convention.ConventionService;
|
import eu.eudat.convention.ConventionService;
|
||||||
|
import eu.eudat.data.DmpDescriptionTemplateEntity;
|
||||||
import eu.eudat.data.DmpEntity;
|
import eu.eudat.data.DmpEntity;
|
||||||
import eu.eudat.model.*;
|
import eu.eudat.model.*;
|
||||||
import eu.eudat.query.*;
|
import eu.eudat.query.*;
|
||||||
|
@ -73,6 +74,9 @@ public class DmpBuilder extends BaseBuilder<Dmp, DmpEntity> {
|
||||||
FieldSet descriptionsFields = fields.extractPrefixed(this.asPrefix(Dmp._descriptions));
|
FieldSet descriptionsFields = fields.extractPrefixed(this.asPrefix(Dmp._descriptions));
|
||||||
Map<UUID, List<Description>> descriptionsMap = this.collectDmpDescriptions(descriptionsFields, data);
|
Map<UUID, List<Description>> descriptionsMap = this.collectDmpDescriptions(descriptionsFields, data);
|
||||||
|
|
||||||
|
FieldSet dmpDescriptionTemplatesFields = fields.extractPrefixed(this.asPrefix(Dmp._dmpDescriptionTemplates));
|
||||||
|
Map<UUID, List<DmpDescriptionTemplate>> dmpDescriptionTemplatesMap = this.collectDmpDescriptionTemplates(dmpDescriptionTemplatesFields, data);
|
||||||
|
|
||||||
for (DmpEntity d : data) {
|
for (DmpEntity d : data) {
|
||||||
Dmp m = new Dmp();
|
Dmp m = new Dmp();
|
||||||
if (fields.hasField(this.asIndexer(Dmp._id))) m.setId(d.getId());
|
if (fields.hasField(this.asIndexer(Dmp._id))) m.setId(d.getId());
|
||||||
|
@ -97,6 +101,7 @@ public class DmpBuilder extends BaseBuilder<Dmp, DmpEntity> {
|
||||||
if (dmpReferencesMap != null && !dmpReferencesMap.isEmpty() && dmpReferencesMap.containsKey(d.getId())) m.setDmpReferences(dmpReferencesMap.get(d.getId()));
|
if (dmpReferencesMap != null && !dmpReferencesMap.isEmpty() && dmpReferencesMap.containsKey(d.getId())) m.setDmpReferences(dmpReferencesMap.get(d.getId()));
|
||||||
if (dmpUsersMap != null && !dmpUsersMap.isEmpty() && dmpUsersMap.containsKey(d.getId())) m.setDmpUsers(dmpUsersMap.get(d.getId()));
|
if (dmpUsersMap != null && !dmpUsersMap.isEmpty() && dmpUsersMap.containsKey(d.getId())) m.setDmpUsers(dmpUsersMap.get(d.getId()));
|
||||||
if (descriptionsMap != null && !descriptionsMap.isEmpty() && descriptionsMap.containsKey(d.getId())) m.setDescriptions(descriptionsMap.get(d.getId()));
|
if (descriptionsMap != null && !descriptionsMap.isEmpty() && descriptionsMap.containsKey(d.getId())) m.setDescriptions(descriptionsMap.get(d.getId()));
|
||||||
|
if (dmpDescriptionTemplatesMap != null && !dmpDescriptionTemplatesMap.isEmpty() && dmpDescriptionTemplatesMap.containsKey(d.getId())) m.setDmpDescriptionTemplates(dmpDescriptionTemplatesMap.get(d.getId()));
|
||||||
|
|
||||||
models.add(m);
|
models.add(m);
|
||||||
}
|
}
|
||||||
|
@ -110,7 +115,7 @@ public class DmpBuilder extends BaseBuilder<Dmp, DmpEntity> {
|
||||||
this.logger.debug("checking related - {}", DmpReference.class.getSimpleName());
|
this.logger.debug("checking related - {}", DmpReference.class.getSimpleName());
|
||||||
|
|
||||||
Map<UUID, List<DmpReference>> itemMap;
|
Map<UUID, List<DmpReference>> itemMap;
|
||||||
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(DmpReference._dmp, Dmp._id));
|
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(DmpReference._dmp, DmpReference._id));
|
||||||
DmpReferenceQuery query = this.queryFactory.query(DmpReferenceQuery.class).authorize(this.authorize).dmpIds(data.stream().map(DmpEntity::getId).distinct().collect(Collectors.toList()));
|
DmpReferenceQuery query = this.queryFactory.query(DmpReferenceQuery.class).authorize(this.authorize).dmpIds(data.stream().map(DmpEntity::getId).distinct().collect(Collectors.toList()));
|
||||||
itemMap = this.builderFactory.builder(DmpReferenceBuilder.class).authorize(this.authorize).asMasterKey(query, clone, x -> x.getDmp().getId());
|
itemMap = this.builderFactory.builder(DmpReferenceBuilder.class).authorize(this.authorize).asMasterKey(query, clone, x -> x.getDmp().getId());
|
||||||
|
|
||||||
|
@ -207,7 +212,7 @@ public class DmpBuilder extends BaseBuilder<Dmp, DmpEntity> {
|
||||||
this.logger.debug("checking related - {}", DmpUser.class.getSimpleName());
|
this.logger.debug("checking related - {}", DmpUser.class.getSimpleName());
|
||||||
|
|
||||||
Map<UUID, List<DmpUser>> itemMap;
|
Map<UUID, List<DmpUser>> itemMap;
|
||||||
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(DmpUser._dmp, Dmp._id));
|
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(DmpUser._dmp, DmpUser._id));
|
||||||
DmpUserQuery query = this.queryFactory.query(DmpUserQuery.class).authorize(this.authorize).dmpIds(data.stream().map(DmpEntity::getId).distinct().collect(Collectors.toList()));
|
DmpUserQuery query = this.queryFactory.query(DmpUserQuery.class).authorize(this.authorize).dmpIds(data.stream().map(DmpEntity::getId).distinct().collect(Collectors.toList()));
|
||||||
itemMap = this.builderFactory.builder(DmpUserBuilder.class).authorize(this.authorize).asMasterKey(query, clone, x -> x.getDmp().getId());
|
itemMap = this.builderFactory.builder(DmpUserBuilder.class).authorize(this.authorize).asMasterKey(query, clone, x -> x.getDmp().getId());
|
||||||
|
|
||||||
|
@ -225,7 +230,7 @@ public class DmpBuilder extends BaseBuilder<Dmp, DmpEntity> {
|
||||||
this.logger.debug("checking related - {}", Description.class.getSimpleName());
|
this.logger.debug("checking related - {}", Description.class.getSimpleName());
|
||||||
|
|
||||||
Map<UUID, List<Description>> itemMap;
|
Map<UUID, List<Description>> itemMap;
|
||||||
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(Description._dmp, Dmp._id));
|
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(Description._dmp, Description._id));
|
||||||
DescriptionQuery query = this.queryFactory.query(DescriptionQuery.class).authorize(this.authorize).dmpIds(data.stream().map(DmpEntity::getId).distinct().collect(Collectors.toList()));
|
DescriptionQuery query = this.queryFactory.query(DescriptionQuery.class).authorize(this.authorize).dmpIds(data.stream().map(DmpEntity::getId).distinct().collect(Collectors.toList()));
|
||||||
itemMap = this.builderFactory.builder(DescriptionBuilder.class).authorize(this.authorize).asMasterKey(query, clone, x -> x.getDmp().getId());
|
itemMap = this.builderFactory.builder(DescriptionBuilder.class).authorize(this.authorize).asMasterKey(query, clone, x -> x.getDmp().getId());
|
||||||
|
|
||||||
|
@ -238,4 +243,22 @@ public class DmpBuilder extends BaseBuilder<Dmp, DmpEntity> {
|
||||||
return itemMap;
|
return itemMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Map<UUID, List<DmpDescriptionTemplate>> collectDmpDescriptionTemplates(FieldSet fields, List<DmpEntity> data) throws MyApplicationException {
|
||||||
|
if (fields.isEmpty() || data.isEmpty()) return null;
|
||||||
|
this.logger.debug("checking related - {}", Description.class.getSimpleName());
|
||||||
|
|
||||||
|
Map<UUID, List<DmpDescriptionTemplate>> itemMap;
|
||||||
|
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(DmpDescriptionTemplate._dmp, DmpDescriptionTemplate._id));
|
||||||
|
DmpDescriptionTemplateQuery query = this.queryFactory.query(DmpDescriptionTemplateQuery.class).authorize(this.authorize).dmpIds(data.stream().map(DmpEntity::getId).distinct().collect(Collectors.toList()));
|
||||||
|
itemMap = this.builderFactory.builder(DmpDescriptionTemplateBuilder.class).authorize(this.authorize).asMasterKey(query, clone, x -> x.getDmp().getId());
|
||||||
|
|
||||||
|
if (!fields.hasField(this.asIndexer(DmpDescriptionTemplate._dmp, Dmp._id))) {
|
||||||
|
itemMap.values().stream().flatMap(List::stream).filter(x -> x != null && x.getDmp() != null).peek(x -> {
|
||||||
|
x.getDmp().setId(null);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return itemMap;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,8 +8,6 @@ import eu.eudat.commons.validation.specification.Specification;
|
||||||
import eu.eudat.convention.ConventionService;
|
import eu.eudat.convention.ConventionService;
|
||||||
import eu.eudat.errorcode.ErrorThesaurusProperties;
|
import eu.eudat.errorcode.ErrorThesaurusProperties;
|
||||||
import eu.eudat.model.persist.descriptionproperties.PropertyDefinitionPersist;
|
import eu.eudat.model.persist.descriptionproperties.PropertyDefinitionPersist;
|
||||||
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;
|
||||||
|
|
|
@ -1,28 +1,34 @@
|
||||||
package eu.eudat.model.persist;
|
package eu.eudat.model.persist;
|
||||||
|
|
||||||
import eu.eudat.commons.enums.DescriptionStatus;
|
import eu.eudat.commons.enums.DescriptionStatus;
|
||||||
import eu.eudat.commons.validation.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.constraints.NotEmpty;
|
import eu.eudat.errorcode.ErrorThesaurusProperties;
|
||||||
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.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 DescriptionStatusPersist {
|
public class DescriptionStatusPersist {
|
||||||
|
|
||||||
@NotNull(message = "{validation.empty}")
|
|
||||||
@ValidId(message = "{validation.invalidid}")
|
|
||||||
private UUID id;
|
private UUID id;
|
||||||
|
|
||||||
@ValidEnum(message = "{validation.empty}")
|
public static final String _id = "id";
|
||||||
|
|
||||||
private DescriptionStatus status;
|
private DescriptionStatus status;
|
||||||
|
|
||||||
@NotNull(message = "{validation.empty}")
|
public static final String _status = "status";
|
||||||
@NotEmpty(message = "{validation.empty}")
|
|
||||||
private String hash;
|
private String hash;
|
||||||
|
|
||||||
|
public static final String _hash = "hash";
|
||||||
|
|
||||||
public UUID getId() {
|
public UUID getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
@ -46,4 +52,40 @@ public class DescriptionStatusPersist {
|
||||||
public void setHash(String hash) {
|
public void setHash(String hash) {
|
||||||
this.hash = hash;
|
this.hash = hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Component(DescriptionStatusPersistValidator.ValidatorName)
|
||||||
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public static class DescriptionStatusPersistValidator extends BaseValidator<DescriptionStatusPersist> {
|
||||||
|
|
||||||
|
public static final String ValidatorName = "DescriptionStatusPersistValidator";
|
||||||
|
|
||||||
|
private final MessageSource messageSource;
|
||||||
|
|
||||||
|
protected DescriptionStatusPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource) {
|
||||||
|
super(conventionService, errors);
|
||||||
|
this.messageSource = messageSource;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<DescriptionStatusPersist> modelClass() {
|
||||||
|
return DescriptionStatusPersist.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<Specification> specifications(DescriptionStatusPersist item) {
|
||||||
|
return Arrays.asList(
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isValidGuid(item.getId()))
|
||||||
|
.failOn(DescriptionStatusPersist._id).failWith(messageSource.getMessage("Validation_Required", new Object[]{DescriptionStatusPersist._id}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.iff(() -> this.isValidGuid(item.getId()))
|
||||||
|
.must(() -> this.isValidHash(item.getHash()))
|
||||||
|
.failOn(DescriptionStatusPersist._hash).failWith(messageSource.getMessage("Validation_Required", new Object[]{DescriptionStatusPersist._hash}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isNull(item.getStatus()))
|
||||||
|
.failOn(DescriptionStatusPersist._status).failWith(messageSource.getMessage("Validation_Required", new Object[]{DescriptionStatusPersist._status}, LocaleContextHolder.getLocale()))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,55 +1,65 @@
|
||||||
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.data.DescriptionTemplateEntity;
|
import eu.eudat.convention.ConventionService;
|
||||||
|
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.Valid;
|
||||||
import jakarta.validation.constraints.NotEmpty;
|
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
import jakarta.validation.constraints.Size;
|
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;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@FieldNotNullIfOtherSet(message = "{validation.hashempty}")
|
|
||||||
public class DescriptionTemplatePersist {
|
public class DescriptionTemplatePersist {
|
||||||
|
|
||||||
@ValidId(message = "{validation.invalidid}")
|
|
||||||
private UUID id;
|
private UUID id;
|
||||||
|
|
||||||
@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}")
|
|
||||||
|
public static final int _labelLength = 250;
|
||||||
|
|
||||||
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;
|
||||||
|
|
||||||
|
public static final String _status = "status";
|
||||||
|
|
||||||
@NotNull(message = "{validation.empty}")
|
@NotNull(message = "{validation.empty}")
|
||||||
@Valid
|
@Valid
|
||||||
private DefinitionPersist definition = null;
|
private DefinitionPersist definition = null;
|
||||||
|
|
||||||
|
public static final String _definition = "definition";
|
||||||
|
|
||||||
@Valid
|
@Valid
|
||||||
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,6 +131,79 @@ public class DescriptionTemplatePersist {
|
||||||
public void setUsers(List<UserDescriptionTemplatePersist> users) {
|
public void setUsers(List<UserDescriptionTemplatePersist> users) {
|
||||||
this.users = users;
|
this.users = users;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Component(DescriptionTemplatePersistValidator.ValidatorName)
|
||||||
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public static class DescriptionTemplatePersistValidator extends BaseValidator<DescriptionTemplatePersist> {
|
||||||
|
|
||||||
|
public static final String ValidatorName = "DescriptionTemplatePersistValidator";
|
||||||
|
|
||||||
|
private final MessageSource messageSource;
|
||||||
|
|
||||||
|
private final ValidatorFactory validatorFactory;
|
||||||
|
|
||||||
|
protected DescriptionTemplatePersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource, ValidatorFactory validatorFactory) {
|
||||||
|
super(conventionService, errors);
|
||||||
|
this.messageSource = messageSource;
|
||||||
|
this.validatorFactory = validatorFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<DescriptionTemplatePersist> modelClass() {
|
||||||
|
return DescriptionTemplatePersist.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<Specification> specifications(DescriptionTemplatePersist item) {
|
||||||
|
return Arrays.asList(
|
||||||
|
this.spec()
|
||||||
|
.iff(() -> this.isValidGuid(item.getId()))
|
||||||
|
.must(() -> this.isValidHash(item.getHash()))
|
||||||
|
.failOn(DescriptionTemplatePersist._hash).failWith(messageSource.getMessage("Validation_Required", new Object[]{DescriptionTemplatePersist._hash}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.iff(() -> !this.isValidGuid(item.getId()))
|
||||||
|
.must(() -> !this.isValidHash(item.getHash()))
|
||||||
|
.failOn(DescriptionTemplatePersist._hash).failWith(messageSource.getMessage("Validation_OverPosting", new Object[]{}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isEmpty(item.getLabel()))
|
||||||
|
.failOn(DescriptionTemplatePersist._label).failWith(messageSource.getMessage("Validation_Required", new Object[]{DescriptionTemplatePersist._label}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.iff(() -> !this.isEmpty(item.getLabel()))
|
||||||
|
.must(() -> this.lessEqual(item.getLabel(), DescriptionTemplatePersist._labelLength))
|
||||||
|
.failOn(DescriptionTemplatePersist._label).failWith(messageSource.getMessage("Validation_MaxLength", new Object[]{DescriptionTemplatePersist._label}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isEmpty(item.getDescription()))
|
||||||
|
.failOn(DescriptionTemplatePersist._description).failWith(messageSource.getMessage("Validation_Required", new Object[]{DescriptionTemplatePersist._description}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isEmpty(item.getLanguage()))
|
||||||
|
.failOn(DescriptionTemplatePersist._language).failWith(messageSource.getMessage("Validation_Required", new Object[]{DescriptionTemplatePersist._language}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.must(() -> this.isValidGuid(item.getType()))
|
||||||
|
.failOn(DescriptionTemplatePersist._type).failWith(messageSource.getMessage("Validation_Required", new Object[]{DescriptionTemplatePersist._type}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isNull(item.getStatus()))
|
||||||
|
.failOn(DescriptionTemplatePersist._status).failWith(messageSource.getMessage("Validation_Required", new Object[]{DescriptionTemplatePersist._status}, LocaleContextHolder.getLocale())),
|
||||||
|
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isNull(item.getDefinition()))
|
||||||
|
.failOn(DescriptionTemplatePersist._definition).failWith(messageSource.getMessage("Validation_Required", new Object[]{DescriptionTemplatePersist._definition}, LocaleContextHolder.getLocale())),
|
||||||
|
this.refSpec()
|
||||||
|
.iff(() -> !this.isNull(item.getDefinition()))
|
||||||
|
.on(DescriptionTemplatePersist._definition)
|
||||||
|
.over(item.getDefinition())
|
||||||
|
.using(() -> this.validatorFactory.validator(DefinitionPersist.DefinitionPersistValidator.class)),
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isNull(item.getUsers()))
|
||||||
|
.failOn(DescriptionTemplatePersist._users).failWith(messageSource.getMessage("Validation_Required", new Object[]{DescriptionTemplatePersist._users}, LocaleContextHolder.getLocale())),
|
||||||
|
this.navSpec()
|
||||||
|
.iff(() -> !this.isNull(item.getUsers()))
|
||||||
|
.on(DescriptionTemplatePersist._users)
|
||||||
|
.over(item.getUsers())
|
||||||
|
.using(() -> null) //TODO (thgiannos)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,97 @@
|
||||||
|
package eu.eudat.model.persist;
|
||||||
|
|
||||||
|
|
||||||
|
import eu.eudat.commons.validation.BaseValidator;
|
||||||
|
import eu.eudat.commons.validation.specification.Specification;
|
||||||
|
import eu.eudat.convention.ConventionService;
|
||||||
|
import eu.eudat.data.TagEntity;
|
||||||
|
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;
|
||||||
|
|
||||||
|
public class TagPersist {
|
||||||
|
|
||||||
|
private UUID id;
|
||||||
|
|
||||||
|
public final static String _id = "id";
|
||||||
|
|
||||||
|
private String label = null;
|
||||||
|
|
||||||
|
public final static String _label = "label";
|
||||||
|
|
||||||
|
private String hash;
|
||||||
|
|
||||||
|
public final static String _hash = "hash";
|
||||||
|
|
||||||
|
public UUID getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(UUID id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLabel() {
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLabel(String label) {
|
||||||
|
this.label = label;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getHash() {
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHash(String hash) {
|
||||||
|
this.hash = hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Component(TagPersistValidator.ValidatorName)
|
||||||
|
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public static class TagPersistValidator extends BaseValidator<TagPersist> {
|
||||||
|
public static final String ValidatorName = "TagPersistValidator";
|
||||||
|
|
||||||
|
private final MessageSource messageSource;
|
||||||
|
|
||||||
|
public TagPersistValidator(MessageSource messageSource, ConventionService conventionService, ErrorThesaurusProperties errors) {
|
||||||
|
super(conventionService, errors);
|
||||||
|
this.messageSource = messageSource;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<TagPersist> modelClass() {
|
||||||
|
return TagPersist.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<Specification> specifications(TagPersist item) {
|
||||||
|
return Arrays.asList(
|
||||||
|
this.spec()
|
||||||
|
.iff(() -> this.isValidGuid(item.getId()))
|
||||||
|
.must(() -> this.isValidHash(item.getHash()))
|
||||||
|
.failOn(TagPersist._hash).failWith(messageSource.getMessage("Validation_Required", new Object[]{TagPersist._hash}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.iff(() -> !this.isValidGuid(item.getId()))
|
||||||
|
.must(() -> !this.isValidHash(item.getHash()))
|
||||||
|
.failOn(TagPersist._hash).failWith(messageSource.getMessage("Validation_OverPosting", new Object[]{}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isEmpty(item.getLabel()))
|
||||||
|
.failOn(TagPersist._label).failWith(messageSource.getMessage("Validation_Required", new Object[]{TagPersist._label}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.iff(() -> !this.isEmpty(item.getLabel()))
|
||||||
|
.must(() -> this.lessEqual(item.getLabel(), TagEntity._labelLength))
|
||||||
|
.failOn(TagPersist._label).failWith(messageSource.getMessage("Validation_MaxLength", new Object[]{TagPersist._label}, LocaleContextHolder.getLocale()))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,33 +1,87 @@
|
||||||
package eu.eudat.model.persist.descriptiontemplatedefinition;
|
package eu.eudat.model.persist.descriptiontemplatedefinition;
|
||||||
|
|
||||||
import jakarta.validation.Valid;
|
import eu.eudat.commons.validation.BaseValidator;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import eu.eudat.commons.validation.ValidatorFactory;
|
||||||
|
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.List;
|
||||||
|
|
||||||
public class DefinitionPersist {
|
public class DefinitionPersist {
|
||||||
|
|
||||||
@NotNull(message = "{validation.empty}")
|
private List<SectionPersist> sections = null;
|
||||||
@Valid
|
|
||||||
private List<SectionPersist> sections = null;
|
|
||||||
|
|
||||||
@NotNull(message = "{validation.empty}")
|
public static final String _sections = "sections";
|
||||||
@Valid
|
|
||||||
private List<PagePersist> pages = null;
|
|
||||||
|
|
||||||
public List<SectionPersist> getSections() {
|
private List<PagePersist> pages = null;
|
||||||
return sections;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSections(List<SectionPersist> sections) {
|
public static final String _pages = "pages";
|
||||||
this.sections = sections;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<PagePersist> getPages() {
|
public List<SectionPersist> getSections() {
|
||||||
return pages;
|
return sections;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setSections(List<SectionPersist> sections) {
|
||||||
|
this.sections = sections;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<PagePersist> getPages() {
|
||||||
|
return pages;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPages(List<PagePersist> pages) {
|
||||||
|
this.pages = pages;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Component(DefinitionPersistValidator.ValidatorName)
|
||||||
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public static class DefinitionPersistValidator extends BaseValidator<DefinitionPersist> {
|
||||||
|
|
||||||
|
public static final String ValidatorName = "DescriptionTemplate.DefinitionPersistValidator";
|
||||||
|
|
||||||
|
private final MessageSource messageSource;
|
||||||
|
|
||||||
|
private final ValidatorFactory validatorFactory;
|
||||||
|
|
||||||
|
public DefinitionPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource, ValidatorFactory validatorFactory) {
|
||||||
|
super(conventionService, errors);
|
||||||
|
this.messageSource = messageSource;
|
||||||
|
this.validatorFactory = validatorFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<DefinitionPersist> modelClass() {
|
||||||
|
return DefinitionPersist.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<Specification> specifications(DefinitionPersist item) {
|
||||||
|
return Arrays.asList(
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isNull(item.getSections()))
|
||||||
|
.failOn(DefinitionPersist._sections).failWith(messageSource.getMessage("Validation_Required", new Object[]{DefinitionPersist._sections}, LocaleContextHolder.getLocale())),
|
||||||
|
this.refSpec()
|
||||||
|
.iff(() -> !this.isNull(item.getSections()))
|
||||||
|
.on(DefinitionPersist._sections)
|
||||||
|
.over(item.getSections())
|
||||||
|
.using(() -> this.validatorFactory.validator(SectionPersist.SectionPersistValidator.class)),
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isNull(item.getPages()))
|
||||||
|
.failOn(DefinitionPersist._pages).failWith(messageSource.getMessage("Validation_Required", new Object[]{DefinitionPersist._pages}, LocaleContextHolder.getLocale())),
|
||||||
|
this.refSpec()
|
||||||
|
.iff(() -> !this.isNull(item.getPages()))
|
||||||
|
.on(DefinitionPersist._pages)
|
||||||
|
.over(item.getPages())
|
||||||
|
.using(() -> this.validatorFactory.validator(PagePersist.PagePersistValidator.class))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void setPages(List<PagePersist> pages) {
|
|
||||||
this.pages = pages;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,99 +1,215 @@
|
||||||
package eu.eudat.model.persist.descriptiontemplatedefinition;
|
package eu.eudat.model.persist.descriptiontemplatedefinition;
|
||||||
|
|
||||||
|
import eu.eudat.commons.enums.FieldType;
|
||||||
import eu.eudat.commons.enums.FieldValidationType;
|
import eu.eudat.commons.enums.FieldValidationType;
|
||||||
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.BaseFieldDataPersist;
|
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 eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.*;
|
||||||
|
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 FieldPersist {
|
public class FieldPersist {
|
||||||
|
|
||||||
@NotNull(message = "{validation.empty}")
|
private String id = null;
|
||||||
@NotEmpty(message = "{validation.empty}")
|
|
||||||
private String id = null;
|
|
||||||
|
|
||||||
@NotNull(message = "{validation.empty}")
|
public static final String _id = "id";
|
||||||
private Integer ordinal = null;
|
|
||||||
|
|
||||||
private List<String> schematics;
|
private Integer ordinal = null;
|
||||||
|
|
||||||
private String defaultValue;
|
public static final String _ordinal = "ordinal";
|
||||||
|
|
||||||
@Valid
|
private List<String> schematics;
|
||||||
private List<RulePersist> visibilityRules;
|
|
||||||
|
|
||||||
private List<FieldValidationType> validations;
|
private String defaultValue;
|
||||||
|
|
||||||
@NotNull(message = "{validation.empty}")
|
private List<RulePersist> visibilityRules;
|
||||||
private Boolean includeInExport = null;
|
|
||||||
|
|
||||||
@NotNull(message = "{validation.empty}")
|
public static final String _visibilityRules = "visibilityRules";
|
||||||
@Valid
|
|
||||||
private BaseFieldDataPersist data = null;
|
|
||||||
|
|
||||||
public String getId() {
|
private List<FieldValidationType> validations;
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(String id) {
|
private Boolean includeInExport = null;
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getOrdinal() {
|
public static final String _includeInExport = "includeInExport";
|
||||||
return ordinal;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOrdinal(Integer ordinal) {
|
private BaseFieldDataPersist data = null;
|
||||||
this.ordinal = ordinal;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> getSchematics() {
|
public static final String _data = "data";
|
||||||
return schematics;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSchematics(List<String> schematics) {
|
public String getId() {
|
||||||
this.schematics = schematics;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDefaultValue() {
|
public void setId(String id) {
|
||||||
return defaultValue;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDefaultValue(String defaultValue) {
|
public Integer getOrdinal() {
|
||||||
this.defaultValue = defaultValue;
|
return ordinal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<RulePersist> getVisibilityRules() {
|
public void setOrdinal(Integer ordinal) {
|
||||||
return visibilityRules;
|
this.ordinal = ordinal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setVisibilityRules(List<RulePersist> visibilityRules) {
|
public List<String> getSchematics() {
|
||||||
this.visibilityRules = visibilityRules;
|
return schematics;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<FieldValidationType> getValidations() {
|
public void setSchematics(List<String> schematics) {
|
||||||
return validations;
|
this.schematics = schematics;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setValidations(List<FieldValidationType> validations) {
|
public String getDefaultValue() {
|
||||||
this.validations = validations;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean getIncludeInExport() {
|
public void setDefaultValue(String defaultValue) {
|
||||||
return includeInExport;
|
this.defaultValue = defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setIncludeInExport(Boolean includeInExport) {
|
public List<RulePersist> getVisibilityRules() {
|
||||||
this.includeInExport = includeInExport;
|
return visibilityRules;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BaseFieldDataPersist getData() {
|
public void setVisibilityRules(List<RulePersist> visibilityRules) {
|
||||||
return data;
|
this.visibilityRules = visibilityRules;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<FieldValidationType> getValidations() {
|
||||||
|
return validations;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValidations(List<FieldValidationType> validations) {
|
||||||
|
this.validations = validations;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean getIncludeInExport() {
|
||||||
|
return includeInExport;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIncludeInExport(Boolean includeInExport) {
|
||||||
|
this.includeInExport = includeInExport;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BaseFieldDataPersist getData() {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setData(BaseFieldDataPersist data) {
|
||||||
|
this.data = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Component(FieldPersistValidator.ValidatorName)
|
||||||
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public static class FieldPersistValidator extends BaseValidator<FieldPersist> {
|
||||||
|
|
||||||
|
public static final String ValidatorName = "DescriptionTemplate.FieldPersistValidator";
|
||||||
|
|
||||||
|
private final MessageSource messageSource;
|
||||||
|
|
||||||
|
private final ValidatorFactory validatorFactory;
|
||||||
|
|
||||||
|
protected FieldPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource, ValidatorFactory validatorFactory) {
|
||||||
|
super(conventionService, errors);
|
||||||
|
this.messageSource = messageSource;
|
||||||
|
this.validatorFactory = validatorFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<FieldPersist> modelClass() {
|
||||||
|
return FieldPersist.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<Specification> specifications(FieldPersist item) {
|
||||||
|
return Arrays.asList(
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isEmpty(item.getId()))
|
||||||
|
.failOn(FieldPersist._id).failWith(messageSource.getMessage("Validation_Required", new Object[]{FieldPersist._id}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isNull(item.getOrdinal()))
|
||||||
|
.failOn(FieldPersist._ordinal).failWith(messageSource.getMessage("Validation_Required", new Object[]{FieldPersist._ordinal}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isNull(item.getIncludeInExport()))
|
||||||
|
.failOn(FieldPersist._includeInExport).failWith(messageSource.getMessage("Validation_Required", new Object[]{FieldPersist._includeInExport}, LocaleContextHolder.getLocale())),
|
||||||
|
|
||||||
|
this.navSpec()
|
||||||
|
.iff(() -> !this.isNull(item.getVisibilityRules()))
|
||||||
|
.on(FieldPersist._visibilityRules)
|
||||||
|
.over(item.getVisibilityRules())
|
||||||
|
.using(() -> this.validatorFactory.validator(RulePersist.RulePersistValidator.class)),
|
||||||
|
this.refSpec()
|
||||||
|
.iff(() -> !this.isNull(item.getData()) && item.getData().getFieldType() == FieldType.AUTO_COMPLETE)
|
||||||
|
.on(FieldPersist._data)
|
||||||
|
.over(item.getData())
|
||||||
|
.using(() -> this.validatorFactory.validator(AutoCompleteDataPersist.AutoCompleteDataPersistValidator.class)),
|
||||||
|
this.refSpec()
|
||||||
|
.iff(() -> !this.isNull(item.getData()) && item.getData().getFieldType() == FieldType.BOOLEAN_DECISION)
|
||||||
|
.on(FieldPersist._data)
|
||||||
|
.over(item.getData())
|
||||||
|
.using(() -> this.validatorFactory.validator(BooleanDecisionDataPersist.BooleanDecisionPersistValidator.class)),
|
||||||
|
this.refSpec()
|
||||||
|
.iff(() -> !this.isNull(item.getData()) && item.getData().getFieldType() == FieldType.INTERNAL_DMP_ENTRIES_DATASETS)
|
||||||
|
.on(FieldPersist._data)
|
||||||
|
.over(item.getData())
|
||||||
|
.using(() -> this.validatorFactory.validator(DatasetAutoCompleteDataPersist.DatasetAutoCompleteDataPersistValidator.class)),
|
||||||
|
this.refSpec()
|
||||||
|
.iff(() -> !this.isNull(item.getData()) && item.getData().getFieldType() == FieldType.INTERNAL_DMP_ENTRIES_DMPS)
|
||||||
|
.on(FieldPersist._data)
|
||||||
|
.over(item.getData())
|
||||||
|
.using(() -> this.validatorFactory.validator(DmpAutoCompleteDataPersist.DmpAutoCompleteDataPersistValidator.class)),
|
||||||
|
this.refSpec()
|
||||||
|
.iff(() -> !this.isNull(item.getData()) && item.getData().getFieldType() == FieldType.CHECK_BOX)
|
||||||
|
.on(FieldPersist._data)
|
||||||
|
.over(item.getData())
|
||||||
|
.using(() -> this.validatorFactory.validator(CheckBoxDataPersist.CheckBoxDataPersistValidator.class)),
|
||||||
|
this.refSpec()
|
||||||
|
.iff(() -> !this.isNull(item.getData()) && item.getData().getFieldType() == FieldType.DATE_PICKER)
|
||||||
|
.on(FieldPersist._data)
|
||||||
|
.over(item.getData())
|
||||||
|
.using(() -> this.validatorFactory.validator(DatePickerDataPersist.DatePickerDataPersistValidator.class)),
|
||||||
|
this.refSpec()
|
||||||
|
.iff(() -> !this.isNull(item.getData()) && item.getData().getFieldType() == FieldType.EXTERNAL_DATASETS)
|
||||||
|
.on(FieldPersist._data)
|
||||||
|
.over(item.getData())
|
||||||
|
.using(() -> this.validatorFactory.validator(ExternalDatasetDataPersist.ExternalDatasetDataPersistValidator.class)),
|
||||||
|
this.refSpec()
|
||||||
|
.iff(() -> !this.isNull(item.getData()) && item.getData().getFieldType() == FieldType.FREE_TEXT)
|
||||||
|
.on(FieldPersist._data)
|
||||||
|
.over(item.getData())
|
||||||
|
.using(() -> this.validatorFactory.validator(FreeTextDataPersist.FreeTextDataPersistValidator.class)),
|
||||||
|
this.refSpec()
|
||||||
|
.iff(() -> !this.isNull(item.getData()) && item.getData().getFieldType() == FieldType.LICENSES)
|
||||||
|
.on(FieldPersist._data)
|
||||||
|
.over(item.getData())
|
||||||
|
.using(() -> this.validatorFactory.validator(LicenseDataPersist.LicenseDataPersistValidator.class)),
|
||||||
|
this.refSpec()
|
||||||
|
.iff(() -> !this.isNull(item.getData()) && item.getData().getFieldType() == FieldType.ORGANIZATIONS)
|
||||||
|
.on(FieldPersist._data)
|
||||||
|
.over(item.getData())
|
||||||
|
.using(() -> this.validatorFactory.validator(OrganizationDataPersist.OrganizationDataPersistValidator.class)),
|
||||||
|
this.refSpec()
|
||||||
|
.iff(() -> !this.isNull(item.getData()) && item.getData().getFieldType() == FieldType.PUBLICATIONS)
|
||||||
|
.on(FieldPersist._data)
|
||||||
|
.over(item.getData())
|
||||||
|
.using(() -> this.validatorFactory.validator(PublicationDataPersist.PublicationDataPersistValidator.class)),
|
||||||
|
this.refSpec()
|
||||||
|
.iff(() -> !this.isNull(item.getData()) && item.getData().getFieldType() == FieldType.RADIO_BOX)
|
||||||
|
.on(FieldPersist._data)
|
||||||
|
.over(item.getData())
|
||||||
|
.using(() -> this.validatorFactory.validator(RadioBoxDataPersist.RadioBoxDataPersistValidator.class))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void setData(BaseFieldDataPersist data) {
|
|
||||||
this.data = data;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,127 +1,187 @@
|
||||||
package eu.eudat.model.persist.descriptiontemplatedefinition;
|
package eu.eudat.model.persist.descriptiontemplatedefinition;
|
||||||
|
|
||||||
import jakarta.validation.Valid;
|
import eu.eudat.commons.validation.BaseValidator;
|
||||||
import jakarta.validation.constraints.NotEmpty;
|
import eu.eudat.commons.validation.ValidatorFactory;
|
||||||
import jakarta.validation.constraints.NotNull;
|
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.List;
|
||||||
|
|
||||||
public class FieldSetPersist {
|
public class FieldSetPersist {
|
||||||
|
|
||||||
@NotNull(message = "{validation.empty}")
|
private String id = null;
|
||||||
@NotEmpty(message = "{validation.empty}")
|
|
||||||
private String id = null;
|
|
||||||
|
|
||||||
@NotNull(message = "{validation.empty}")
|
public static final String _id = "id";
|
||||||
private Integer ordinal = null;
|
|
||||||
|
|
||||||
@NotNull(message = "{validation.empty}")
|
private Integer ordinal = null;
|
||||||
@NotEmpty(message = "{validation.empty}")
|
|
||||||
private String numbering = null;
|
|
||||||
|
|
||||||
@NotNull(message = "{validation.empty}")
|
public static final String _ordinal = "ordinal";
|
||||||
@NotEmpty(message = "{validation.empty}")
|
|
||||||
private String title = null;
|
|
||||||
|
|
||||||
@NotNull(message = "{validation.empty}")
|
private String numbering = null;
|
||||||
@NotEmpty(message = "{validation.empty}")
|
|
||||||
private String description = null;
|
|
||||||
|
|
||||||
// @NotNull(message = "{validation.empty}")
|
public static final String _numbering = "numbering";
|
||||||
// @NotEmpty(message = "{validation.empty}")
|
|
||||||
private String extendedDescription = null;
|
|
||||||
|
|
||||||
// @NotNull(message = "{validation.empty}")
|
|
||||||
// @NotEmpty(message = "{validation.empty}")
|
|
||||||
private String additionalInformation = null;
|
|
||||||
|
|
||||||
@Valid
|
private String title = null;
|
||||||
private MultiplicityPersist multiplicity= null;
|
|
||||||
|
|
||||||
|
public static final String _title = "title";
|
||||||
|
|
||||||
private Boolean hasCommentField = null;
|
private String description = null;
|
||||||
|
|
||||||
@NotNull(message = "{validation.empty}")
|
public static final String _description = "description";
|
||||||
@Valid
|
|
||||||
private List<FieldPersist> fields = null;
|
|
||||||
|
|
||||||
public String getId() {
|
private String extendedDescription = null;
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(String id) {
|
private String additionalInformation = null;
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getOrdinal() {
|
private MultiplicityPersist multiplicity = null;
|
||||||
return ordinal;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOrdinal(Integer ordinal) {
|
public static final String _multiplicity = "multiplicity";
|
||||||
this.ordinal = ordinal;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getNumbering() {
|
private Boolean hasCommentField = null;
|
||||||
return numbering;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNumbering(String numbering) {
|
private List<FieldPersist> fields = null;
|
||||||
this.numbering = numbering;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTitle() {
|
public static final String _fields = "fields";
|
||||||
return title;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTitle(String title) {
|
public String getId() {
|
||||||
this.title = title;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDescription() {
|
public void setId(String id) {
|
||||||
return description;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDescription(String description) {
|
public Integer getOrdinal() {
|
||||||
this.description = description;
|
return ordinal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getExtendedDescription() {
|
public void setOrdinal(Integer ordinal) {
|
||||||
return extendedDescription;
|
this.ordinal = ordinal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setExtendedDescription(String extendedDescription) {
|
public String getNumbering() {
|
||||||
this.extendedDescription = extendedDescription;
|
return numbering;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAdditionalInformation() {
|
public void setNumbering(String numbering) {
|
||||||
return additionalInformation;
|
this.numbering = numbering;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAdditionalInformation(String additionalInformation) {
|
public String getTitle() {
|
||||||
this.additionalInformation = additionalInformation;
|
return title;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MultiplicityPersist getMultiplicity() {
|
public void setTitle(String title) {
|
||||||
return multiplicity;
|
this.title = title;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMultiplicity(MultiplicityPersist multiplicity) {
|
public String getDescription() {
|
||||||
this.multiplicity = multiplicity;
|
return description;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean getHasCommentField() {
|
public void setDescription(String description) {
|
||||||
return hasCommentField;
|
this.description = description;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHasCommentField(Boolean hasCommentField) {
|
public String getExtendedDescription() {
|
||||||
this.hasCommentField = hasCommentField;
|
return extendedDescription;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<FieldPersist> getFields() {
|
public void setExtendedDescription(String extendedDescription) {
|
||||||
return fields;
|
this.extendedDescription = extendedDescription;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getAdditionalInformation() {
|
||||||
|
return additionalInformation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAdditionalInformation(String additionalInformation) {
|
||||||
|
this.additionalInformation = additionalInformation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MultiplicityPersist getMultiplicity() {
|
||||||
|
return multiplicity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMultiplicity(MultiplicityPersist multiplicity) {
|
||||||
|
this.multiplicity = multiplicity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean getHasCommentField() {
|
||||||
|
return hasCommentField;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHasCommentField(Boolean hasCommentField) {
|
||||||
|
this.hasCommentField = hasCommentField;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<FieldPersist> getFields() {
|
||||||
|
return fields;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFields(List<FieldPersist> fields) {
|
||||||
|
this.fields = fields;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Component(FieldSetPersistValidator.ValidatorName)
|
||||||
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public static class FieldSetPersistValidator extends BaseValidator<FieldSetPersist> {
|
||||||
|
|
||||||
|
public static final String ValidatorName = "DescriptionTemplate.FieldSetPersistValidator";
|
||||||
|
|
||||||
|
private final MessageSource messageSource;
|
||||||
|
|
||||||
|
private final ValidatorFactory validatorFactory;
|
||||||
|
|
||||||
|
protected FieldSetPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource, ValidatorFactory validatorFactory) {
|
||||||
|
super(conventionService, errors);
|
||||||
|
this.messageSource = messageSource;
|
||||||
|
this.validatorFactory = validatorFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<FieldSetPersist> modelClass() {
|
||||||
|
return FieldSetPersist.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<Specification> specifications(FieldSetPersist item) {
|
||||||
|
return Arrays.asList(
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isEmpty(item.getId()))
|
||||||
|
.failOn(FieldSetPersist._id).failWith(messageSource.getMessage("Validation_Required", new Object[]{FieldSetPersist._id}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isNull(item.getOrdinal()))
|
||||||
|
.failOn(FieldSetPersist._ordinal).failWith(messageSource.getMessage("Validation_Required", new Object[]{FieldSetPersist._ordinal}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isEmpty(item.getNumbering()))
|
||||||
|
.failOn(FieldSetPersist._numbering).failWith(messageSource.getMessage("Validation_Required", new Object[]{FieldSetPersist._numbering}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isEmpty(item.getTitle()))
|
||||||
|
.failOn(FieldSetPersist._title).failWith(messageSource.getMessage("Validation_Required", new Object[]{FieldSetPersist._title}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isEmpty(item.getDescription()))
|
||||||
|
.failOn(FieldSetPersist._description).failWith(messageSource.getMessage("Validation_Required", new Object[]{FieldSetPersist._description}, LocaleContextHolder.getLocale())),
|
||||||
|
|
||||||
|
this.refSpec()
|
||||||
|
.iff(() -> !this.isNull(item.getMultiplicity()))
|
||||||
|
.on(FieldSetPersist._multiplicity)
|
||||||
|
.over(item.getMultiplicity())
|
||||||
|
.using(() -> this.validatorFactory.validator(MultiplicityPersist.MultiplicityValidator.class)),
|
||||||
|
this.navSpec()
|
||||||
|
.iff(() -> !this.isNull(item.getFields()))
|
||||||
|
.on(FieldSetPersist._fields)
|
||||||
|
.over(item.getFields())
|
||||||
|
.using(() -> this.validatorFactory.validator(FieldPersist.FieldPersistValidator.class))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void setFields(List<FieldPersist> fields) {
|
|
||||||
this.fields = fields;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,47 +1,77 @@
|
||||||
package eu.eudat.model.persist.descriptiontemplatedefinition;
|
package eu.eudat.model.persist.descriptiontemplatedefinition;
|
||||||
|
|
||||||
import jakarta.validation.constraints.NotEmpty;
|
import eu.eudat.commons.validation.BaseValidator;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import eu.eudat.commons.validation.specification.Specification;
|
||||||
|
import eu.eudat.convention.ConventionService;
|
||||||
|
import eu.eudat.errorcode.ErrorThesaurusProperties;
|
||||||
|
import org.apache.commons.compress.utils.Lists;
|
||||||
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class MultiplicityPersist {
|
public class MultiplicityPersist {
|
||||||
|
|
||||||
private Integer min = null;
|
private Integer min = null;
|
||||||
|
|
||||||
private Integer max = null;
|
private Integer max = null;
|
||||||
|
|
||||||
private String placeholder = null;
|
private String placeholder = null;
|
||||||
|
|
||||||
private Boolean tableView = null;
|
private Boolean tableView = null;
|
||||||
|
|
||||||
public Integer getMin() {
|
public Integer getMin() {
|
||||||
return min;
|
return min;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMin(Integer min) {
|
public void setMin(Integer min) {
|
||||||
this.min = min;
|
this.min = min;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getMax() {
|
public Integer getMax() {
|
||||||
return max;
|
return max;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMax(Integer max) {
|
public void setMax(Integer max) {
|
||||||
this.max = max;
|
this.max = max;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPlaceholder() {
|
public String getPlaceholder() {
|
||||||
return placeholder;
|
return placeholder;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPlaceholder(String placeholder) {
|
public void setPlaceholder(String placeholder) {
|
||||||
this.placeholder = placeholder;
|
this.placeholder = placeholder;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean getTableView() {
|
public Boolean getTableView() {
|
||||||
return tableView;
|
return tableView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setTableView(Boolean tableView) {
|
||||||
|
this.tableView = tableView;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Component(MultiplicityValidator.ValidatorName)
|
||||||
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public static class MultiplicityValidator extends BaseValidator<MultiplicityPersist> {
|
||||||
|
|
||||||
|
public static final String ValidatorName = "DescriptionTemplate.MultiplicityValidator";
|
||||||
|
|
||||||
|
protected MultiplicityValidator(ConventionService conventionService, ErrorThesaurusProperties errors) {
|
||||||
|
super(conventionService, errors);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<MultiplicityPersist> modelClass() {
|
||||||
|
return MultiplicityPersist.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<Specification> specifications(MultiplicityPersist item) {
|
||||||
|
return Lists.newArrayList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void setTableView(Boolean tableView) {
|
|
||||||
this.tableView = tableView;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,44 +1,90 @@
|
||||||
package eu.eudat.model.persist.descriptiontemplatedefinition;
|
package eu.eudat.model.persist.descriptiontemplatedefinition;
|
||||||
|
|
||||||
|
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 jakarta.validation.constraints.NotEmpty;
|
import java.util.Arrays;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import java.util.List;
|
||||||
|
|
||||||
public class PagePersist {
|
public class PagePersist {
|
||||||
@NotNull(message = "{validation.empty}")
|
|
||||||
@NotEmpty(message = "{validation.empty}")
|
|
||||||
private String id = null;
|
|
||||||
|
|
||||||
@NotNull(message = "{validation.empty}")
|
private String id = null;
|
||||||
private Integer ordinal = null;
|
|
||||||
|
|
||||||
@NotNull(message = "{validation.empty}")
|
public static final String _id = "id";
|
||||||
@NotEmpty(message = "{validation.empty}")
|
|
||||||
private String title = null;
|
|
||||||
|
|
||||||
public String getId() {
|
private Integer ordinal = null;
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(String id) {
|
public static final String _ordinal = "ordinal";
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getOrdinal() {
|
private String title = null;
|
||||||
return ordinal;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOrdinal(int ordinal) {
|
public static final String _title = "title";
|
||||||
this.ordinal = ordinal;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTitle() {
|
public String getId() {
|
||||||
return title;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getOrdinal() {
|
||||||
|
return ordinal;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOrdinal(int ordinal) {
|
||||||
|
this.ordinal = ordinal;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTitle(String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Component(PagePersistValidator.ValidatorName)
|
||||||
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public static class PagePersistValidator extends BaseValidator<PagePersist> {
|
||||||
|
|
||||||
|
public static final String ValidatorName = "DescriptionTemplate.PagePersistValidator";
|
||||||
|
|
||||||
|
private final MessageSource messageSource;
|
||||||
|
|
||||||
|
protected PagePersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource) {
|
||||||
|
super(conventionService, errors);
|
||||||
|
this.messageSource = messageSource;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<PagePersist> modelClass() {
|
||||||
|
return PagePersist.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<Specification> specifications(PagePersist item) {
|
||||||
|
return Arrays.asList(
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isEmpty(item.getId()))
|
||||||
|
.failOn(PagePersist._id).failWith(messageSource.getMessage("Validation_Required", new Object[]{PagePersist._id}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isNull(item.getOrdinal()))
|
||||||
|
.failOn(PagePersist._ordinal).failWith(messageSource.getMessage("Validation_Required", new Object[]{PagePersist._ordinal}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isEmpty(item.getTitle()))
|
||||||
|
.failOn(PagePersist._title).failWith(messageSource.getMessage("Validation_Required", new Object[]{PagePersist._title}, LocaleContextHolder.getLocale()))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void setTitle(String title) {
|
|
||||||
this.title = title;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,33 +1,73 @@
|
||||||
package eu.eudat.model.persist.descriptiontemplatedefinition;
|
package eu.eudat.model.persist.descriptiontemplatedefinition;
|
||||||
|
|
||||||
import jakarta.validation.constraints.NotEmpty;
|
import eu.eudat.commons.validation.BaseValidator;
|
||||||
import jakarta.validation.constraints.NotNull;
|
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;
|
||||||
|
|
||||||
public class RulePersist {
|
public class RulePersist {
|
||||||
|
|
||||||
@NotNull(message = "{validation.empty}")
|
private String target = null;
|
||||||
@NotEmpty(message = "{validation.empty}")
|
|
||||||
private String target = null;
|
|
||||||
|
|
||||||
@NotNull(message = "{validation.empty}")
|
public static final String _target = "target";
|
||||||
@NotEmpty(message = "{validation.empty}")
|
|
||||||
private String value= null;
|
|
||||||
|
|
||||||
|
private String value = null;
|
||||||
|
|
||||||
public String getTarget() {
|
public static final String _value = "value";
|
||||||
return target;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTarget(String target) {
|
public String getTarget() {
|
||||||
this.target = target;
|
return target;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getValue() {
|
public void setTarget(String target) {
|
||||||
return value;
|
this.target = target;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setValue(String value) {
|
public String getValue() {
|
||||||
this.value = value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setValue(String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Component(RulePersistValidator.ValidatorName)
|
||||||
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public static class RulePersistValidator extends BaseValidator<RulePersist> {
|
||||||
|
|
||||||
|
public static final String ValidatorName = "DescriptionTemplate.RulePersistValidator";
|
||||||
|
|
||||||
|
private final MessageSource messageSource;
|
||||||
|
|
||||||
|
protected RulePersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource) {
|
||||||
|
super(conventionService, errors);
|
||||||
|
this.messageSource = messageSource;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<RulePersist> modelClass() {
|
||||||
|
return RulePersist.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<Specification> specifications(RulePersist item) {
|
||||||
|
return Arrays.asList(
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isEmpty(item.getTarget()))
|
||||||
|
.failOn(RulePersist._target).failWith(messageSource.getMessage("Validation_Required", new Object[]{RulePersist._target}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isEmpty(item.getValue()))
|
||||||
|
.failOn(RulePersist._value).failWith(messageSource.getMessage("Validation_Required", new Object[]{RulePersist._value}, LocaleContextHolder.getLocale()))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,118 +1,194 @@
|
||||||
package eu.eudat.model.persist.descriptiontemplatedefinition;
|
package eu.eudat.model.persist.descriptiontemplatedefinition;
|
||||||
|
|
||||||
|
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.ActionConfirmationPersist;
|
||||||
|
import eu.eudat.model.persist.actionconfirmation.DmpInvitationPersist;
|
||||||
|
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 jakarta.validation.Valid;
|
import java.util.Arrays;
|
||||||
import jakarta.validation.constraints.NotEmpty;
|
|
||||||
import jakarta.validation.constraints.NotNull;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class SectionPersist {
|
public class SectionPersist {
|
||||||
|
|
||||||
@NotNull(message = "{validation.empty}")
|
private String id = null;
|
||||||
@NotEmpty(message = "{validation.empty}")
|
|
||||||
private String id = null;
|
|
||||||
|
|
||||||
@NotNull(message = "{validation.empty}")
|
public static final String _id = "id";
|
||||||
private Integer ordinal = null;
|
|
||||||
|
|
||||||
@NotNull(message = "{validation.empty}")
|
private Integer ordinal = null;
|
||||||
private Boolean defaultVisibility = null;
|
|
||||||
|
|
||||||
@NotNull(message = "{validation.empty}")
|
public static final String _ordinal = "ordinal";
|
||||||
private Boolean multiplicity = null;
|
|
||||||
|
|
||||||
@NotNull(message = "{validation.empty}")
|
private Boolean defaultVisibility = null;
|
||||||
@NotEmpty(message = "{validation.empty}")
|
|
||||||
private String page = null;
|
|
||||||
|
|
||||||
@NotNull(message = "{validation.empty}")
|
public static final String _defaultVisibility = "defaultVisibility";
|
||||||
@NotEmpty(message = "{validation.empty}")
|
|
||||||
private String title = null;
|
|
||||||
|
|
||||||
@NotNull(message = "{validation.empty}")
|
private Boolean multiplicity = null;
|
||||||
@NotEmpty(message = "{validation.empty}")
|
|
||||||
private String description = null;
|
|
||||||
|
|
||||||
@NotNull(message = "{validation.empty}")
|
public static final String _multiplicity = "multiplicity";
|
||||||
@Valid
|
|
||||||
private List<SectionPersist> sections = null;
|
|
||||||
|
|
||||||
@NotNull(message = "{validation.empty}")
|
|
||||||
@Valid
|
|
||||||
private List<FieldSetPersist> fieldSets = null;
|
|
||||||
|
|
||||||
public String getId() {
|
private String page = null;
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(String id) {
|
public static final String _page = "page";
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getOrdinal() {
|
private String title = null;
|
||||||
return ordinal;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOrdinal(int ordinal) {
|
public static final String _title = "title";
|
||||||
this.ordinal = ordinal;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Boolean getDefaultVisibility() {
|
private String description = null;
|
||||||
return defaultVisibility;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDefaultVisibility(Boolean defaultVisibility) {
|
public static final String _description = "description";
|
||||||
this.defaultVisibility = defaultVisibility;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Boolean getMultiplicity() {
|
private List<SectionPersist> sections = null;
|
||||||
return multiplicity;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMultiplicity(Boolean multiplicity) {
|
public static final String _sections = "sections";
|
||||||
this.multiplicity = multiplicity;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPage() {
|
private List<FieldSetPersist> fieldSets = null;
|
||||||
return page;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPage(String page) {
|
public static final String _fieldSets = "fieldSets";
|
||||||
this.page = page;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTitle() {
|
public String getId() {
|
||||||
return title;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTitle(String title) {
|
public void setId(String id) {
|
||||||
this.title = title;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDescription() {
|
public int getOrdinal() {
|
||||||
return description;
|
return ordinal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDescription(String description) {
|
public void setOrdinal(int ordinal) {
|
||||||
this.description = description;
|
this.ordinal = ordinal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<SectionPersist> getSections() {
|
public Boolean getDefaultVisibility() {
|
||||||
return sections;
|
return defaultVisibility;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSections(List<SectionPersist> sections) {
|
public void setDefaultVisibility(Boolean defaultVisibility) {
|
||||||
this.sections = sections;
|
this.defaultVisibility = defaultVisibility;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<FieldSetPersist> getFieldSets() {
|
public Boolean getMultiplicity() {
|
||||||
return fieldSets;
|
return multiplicity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setMultiplicity(Boolean multiplicity) {
|
||||||
|
this.multiplicity = multiplicity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPage() {
|
||||||
|
return page;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPage(String page) {
|
||||||
|
this.page = page;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTitle(String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<SectionPersist> getSections() {
|
||||||
|
return sections;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSections(List<SectionPersist> sections) {
|
||||||
|
this.sections = sections;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<FieldSetPersist> getFieldSets() {
|
||||||
|
return fieldSets;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFieldSets(List<FieldSetPersist> fieldSets) {
|
||||||
|
this.fieldSets = fieldSets;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Component(SectionPersistValidator.ValidatorName)
|
||||||
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public static class SectionPersistValidator extends BaseValidator<SectionPersist> {
|
||||||
|
|
||||||
|
public static final String ValidatorName = "DescriptionTemplate.SectionPersistValidator";
|
||||||
|
|
||||||
|
private final MessageSource messageSource;
|
||||||
|
|
||||||
|
private final ValidatorFactory validatorFactory;
|
||||||
|
|
||||||
|
protected SectionPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource, ValidatorFactory validatorFactory) {
|
||||||
|
super(conventionService, errors);
|
||||||
|
this.messageSource = messageSource;
|
||||||
|
this.validatorFactory = validatorFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<SectionPersist> modelClass() {
|
||||||
|
return SectionPersist.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<Specification> specifications(SectionPersist item) {
|
||||||
|
return Arrays.asList(
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isEmpty(item.getId()))
|
||||||
|
.failOn(SectionPersist._id).failWith(messageSource.getMessage("Validation_Required", new Object[]{SectionPersist._id}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isNull(item.getOrdinal()))
|
||||||
|
.failOn(SectionPersist._ordinal).failWith(messageSource.getMessage("Validation_Required", new Object[]{SectionPersist._ordinal}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isNull(item.getDefaultVisibility()))
|
||||||
|
.failOn(SectionPersist._defaultVisibility).failWith(messageSource.getMessage("Validation_Required", new Object[]{SectionPersist._defaultVisibility}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isNull(item.getMultiplicity()))
|
||||||
|
.failOn(SectionPersist._multiplicity).failWith(messageSource.getMessage("Validation_Required", new Object[]{SectionPersist._multiplicity}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isEmpty(item.getPage()))
|
||||||
|
.failOn(SectionPersist._page).failWith(messageSource.getMessage("Validation_Required", new Object[]{SectionPersist._page}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isEmpty(item.getTitle()))
|
||||||
|
.failOn(SectionPersist._title).failWith(messageSource.getMessage("Validation_Required", new Object[]{SectionPersist._title}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isEmpty(item.getDescription()))
|
||||||
|
.failOn(SectionPersist._description).failWith(messageSource.getMessage("Validation_Required", new Object[]{SectionPersist._description}, LocaleContextHolder.getLocale())),
|
||||||
|
|
||||||
|
this.navSpec()
|
||||||
|
.iff(() -> !this.isNull(item.getSections()))
|
||||||
|
.on(SectionPersist._sections)
|
||||||
|
.over(item.getSections())
|
||||||
|
.using(() -> this.validatorFactory.validator(SectionPersistValidator.class)),
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isNull(item.getFieldSets()))
|
||||||
|
.failOn(SectionPersist._fieldSets).failWith(messageSource.getMessage("Validation_Required", new Object[]{SectionPersist._fieldSets}, LocaleContextHolder.getLocale())),
|
||||||
|
this.navSpec()
|
||||||
|
.iff(() -> !this.isNull(item.getFieldSets()))
|
||||||
|
.on(SectionPersist._fieldSets)
|
||||||
|
.over(item.getFieldSets())
|
||||||
|
.using(() -> this.validatorFactory.validator(FieldSetPersist.FieldSetPersistValidator.class))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void setFieldSets(List<FieldSetPersist> fieldSets) {
|
|
||||||
this.fieldSets = fieldSets;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,66 +1,113 @@
|
||||||
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
|
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
|
||||||
|
|
||||||
import jakarta.validation.constraints.NotEmpty;
|
import eu.eudat.commons.validation.BaseValidator;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import eu.eudat.commons.validation.specification.Specification;
|
||||||
|
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;
|
||||||
|
|
||||||
public class AuthAutoCompleteDataPersist {
|
public class AuthAutoCompleteDataPersist {
|
||||||
@NotNull(message = "{validation.empty}")
|
|
||||||
@NotEmpty(message = "{validation.empty}")
|
|
||||||
private String url = null;
|
|
||||||
|
|
||||||
@NotNull(message = "{validation.empty}")
|
private String url = null;
|
||||||
@NotEmpty(message = "{validation.empty}")
|
|
||||||
private String method = null;
|
|
||||||
|
|
||||||
@NotNull(message = "{validation.empty}")
|
public static final String _uri = "uri";
|
||||||
@NotEmpty(message = "{validation.empty}")
|
|
||||||
private String body = null;
|
|
||||||
|
|
||||||
@NotNull(message = "{validation.empty}")
|
private String method = null;
|
||||||
@NotEmpty(message = "{validation.empty}")
|
|
||||||
private String path = null;
|
|
||||||
|
|
||||||
@NotNull(message = "{validation.empty}")
|
public static final String _method = "method";
|
||||||
@NotEmpty(message = "{validation.empty}")
|
|
||||||
private String type = null;
|
|
||||||
|
|
||||||
public String getUrl() {
|
private String body = null;
|
||||||
return url;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUrl(String url) {
|
public static final String _body = "body";
|
||||||
this.url = url;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMethod() {
|
private String path = null;
|
||||||
return method;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMethod(String method) {
|
public static final String _path = "path";
|
||||||
this.method = method;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getBody() {
|
private String type = null;
|
||||||
return body;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBody(String body) {
|
public static final String _type = "type";
|
||||||
this.body = body;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPath() {
|
public String getUrl() {
|
||||||
return path;
|
return url;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPath(String path) {
|
public void setUrl(String url) {
|
||||||
this.path = path;
|
this.url = url;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getType() {
|
public String getMethod() {
|
||||||
return type;
|
return method;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setMethod(String method) {
|
||||||
|
this.method = method;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBody() {
|
||||||
|
return body;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBody(String body) {
|
||||||
|
this.body = body;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPath() {
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPath(String path) {
|
||||||
|
this.path = path;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(String type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class AuthAutoCompleteDataPersistValidator extends BaseValidator<AuthAutoCompleteDataPersist> {
|
||||||
|
|
||||||
|
public static final String ValidatorName = "DescriptionTemplate.AuthAutoCompleteDataPersistValidator";
|
||||||
|
|
||||||
|
private final MessageSource messageSource;
|
||||||
|
|
||||||
|
protected AuthAutoCompleteDataPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource) {
|
||||||
|
super(conventionService, errors);
|
||||||
|
this.messageSource = messageSource;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<AuthAutoCompleteDataPersist> modelClass() {
|
||||||
|
return AuthAutoCompleteDataPersist.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<Specification> specifications(AuthAutoCompleteDataPersist item) {
|
||||||
|
return Arrays.asList(
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isEmpty(item.getUrl()))
|
||||||
|
.failOn(AuthAutoCompleteDataPersist._uri).failWith(messageSource.getMessage("Validation_Required", new Object[]{AuthAutoCompleteDataPersist._uri}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isEmpty(item.getMethod()))
|
||||||
|
.failOn(AuthAutoCompleteDataPersist._method).failWith(messageSource.getMessage("Validation_Required", new Object[]{AuthAutoCompleteDataPersist._method}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isEmpty(item.getBody()))
|
||||||
|
.failOn(AuthAutoCompleteDataPersist._body).failWith(messageSource.getMessage("Validation_Required", new Object[]{AuthAutoCompleteDataPersist._body}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isEmpty(item.getPath()))
|
||||||
|
.failOn(AuthAutoCompleteDataPersist._path).failWith(messageSource.getMessage("Validation_Required", new Object[]{AuthAutoCompleteDataPersist._path}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isEmpty(item.getType()))
|
||||||
|
.failOn(AuthAutoCompleteDataPersist._type).failWith(messageSource.getMessage("Validation_Required", new Object[]{AuthAutoCompleteDataPersist._type}, LocaleContextHolder.getLocale()))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void setType(String type) {
|
|
||||||
this.type = type;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,20 +1,35 @@
|
||||||
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
|
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
|
||||||
|
|
||||||
import jakarta.validation.Valid;
|
import eu.eudat.commons.validation.ValidatorFactory;
|
||||||
import jakarta.validation.constraints.NotNull;
|
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.List;
|
||||||
|
|
||||||
public class AutoCompleteDataPersist extends BaseFieldDataPersist {
|
public class AutoCompleteDataPersist extends BaseFieldDataPersist {
|
||||||
@NotNull(message = "{validation.empty}")
|
|
||||||
private Boolean multiAutoComplete = null;
|
private Boolean multiAutoComplete = null;
|
||||||
|
|
||||||
@NotNull(message = "{validation.empty}")
|
public static final String _multiAutoComplete = "multiAutoComplete";
|
||||||
@Valid
|
|
||||||
private List<AutoCompleteSingleDataPersist> autoCompleteSingleDataList = null;
|
private List<AutoCompleteSingleDataPersist> autoCompleteSingleDataList = null;
|
||||||
|
|
||||||
public Boolean getMultiAutoComplete() { return multiAutoComplete; }
|
public static final String _autoCompleteSingleDataList = "autoCompleteSingleDataList";
|
||||||
public void setMultiAutoComplete(Boolean multiAutoComplete) { this.multiAutoComplete = multiAutoComplete; }
|
|
||||||
|
public Boolean getMultiAutoComplete() {
|
||||||
|
return multiAutoComplete;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMultiAutoComplete(Boolean multiAutoComplete) {
|
||||||
|
this.multiAutoComplete = multiAutoComplete;
|
||||||
|
}
|
||||||
|
|
||||||
public List<AutoCompleteSingleDataPersist> getAutoCompleteSingleDataList() {
|
public List<AutoCompleteSingleDataPersist> getAutoCompleteSingleDataList() {
|
||||||
return autoCompleteSingleDataList;
|
return autoCompleteSingleDataList;
|
||||||
|
@ -23,5 +38,40 @@ public class AutoCompleteDataPersist extends BaseFieldDataPersist {
|
||||||
public void setAutoCompleteSingleDataList(List<AutoCompleteSingleDataPersist> autoCompleteSingleDataList) {
|
public void setAutoCompleteSingleDataList(List<AutoCompleteSingleDataPersist> autoCompleteSingleDataList) {
|
||||||
this.autoCompleteSingleDataList = autoCompleteSingleDataList;
|
this.autoCompleteSingleDataList = autoCompleteSingleDataList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Component(AutoCompleteDataPersistValidator.ValidatorName)
|
||||||
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public static class AutoCompleteDataPersistValidator extends BaseFieldDataPersistValidator<AutoCompleteDataPersist> {
|
||||||
|
|
||||||
|
public static final String ValidatorName = "DescriptionTemplate.AutoCompleteDataPersistValidator";
|
||||||
|
|
||||||
|
private final ValidatorFactory validatorFactory;
|
||||||
|
|
||||||
|
protected AutoCompleteDataPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource, ValidatorFactory validatorFactory) {
|
||||||
|
super(conventionService, errors, messageSource);
|
||||||
|
this.validatorFactory = validatorFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<AutoCompleteDataPersist> modelClass() {
|
||||||
|
return AutoCompleteDataPersist.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<Specification> specifications(AutoCompleteDataPersist item) {
|
||||||
|
List<Specification> specifications = getBaseSpecifications(item);
|
||||||
|
specifications.addAll(Arrays.asList(
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isNull(item.getMultiAutoComplete()))
|
||||||
|
.failOn(AutoCompleteDataPersist._multiAutoComplete).failWith(messageSource.getMessage("Validation_Required", new Object[]{AutoCompleteDataPersist._multiAutoComplete}, LocaleContextHolder.getLocale())),
|
||||||
|
this.navSpec()
|
||||||
|
.iff(() -> !this.isNull(item.getAutoCompleteSingleDataList()))
|
||||||
|
.on(AutoCompleteDataPersist._autoCompleteSingleDataList)
|
||||||
|
.over(item.getAutoCompleteSingleDataList())
|
||||||
|
.using(() -> this.validatorFactory.validator(AutoCompleteSingleDataPersist.AutoCompleteSingleDataPersistValidator.class))
|
||||||
|
));
|
||||||
|
return specifications;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,88 +1,157 @@
|
||||||
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
|
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
|
||||||
|
|
||||||
import eu.eudat.commons.types.descriptiontemplate.fielddata.AutoCompleteDataEntity;
|
import eu.eudat.commons.types.descriptiontemplate.fielddata.AutoCompleteDataEntity;
|
||||||
import eu.eudat.commons.validation.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;
|
||||||
|
|
||||||
public class AutoCompleteSingleDataPersist {
|
public class AutoCompleteSingleDataPersist {
|
||||||
|
|
||||||
@ValidEnum(message = "{validation.empty}")
|
private AutoCompleteDataEntity.AutocompleteType autocompleteType;
|
||||||
private AutoCompleteDataEntity.AutocompleteType autocompleteType;
|
|
||||||
@NotNull(message = "{validation.empty}")
|
|
||||||
@NotEmpty(message = "{validation.empty}")
|
|
||||||
private String url = null;
|
|
||||||
|
|
||||||
@Valid
|
|
||||||
private ComboBoxOptionPersist autoCompleteOptions;
|
|
||||||
|
|
||||||
private String optionsRoot;
|
|
||||||
|
|
||||||
|
public static final String _autocompleteType = "autocompleteType";
|
||||||
|
|
||||||
@NotNull(message = "{validation.empty}")
|
private String url = null;
|
||||||
private Boolean hasAuth = null;
|
|
||||||
|
|
||||||
@Valid
|
public static final String _url = "url";
|
||||||
private AuthAutoCompleteDataPersist auth;
|
|
||||||
|
|
||||||
@NotNull(message = "{validation.empty}")
|
private ComboBoxOptionPersist autoCompleteOptions;
|
||||||
@NotEmpty(message = "{validation.empty}")
|
|
||||||
private String method = null;
|
|
||||||
|
|
||||||
public AutoCompleteDataEntity.AutocompleteType getAutocompleteType() {
|
public static final String _autoCompleteOptions = "autoCompleteOptions";
|
||||||
return autocompleteType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAutocompleteType(AutoCompleteDataEntity.AutocompleteType autocompleteType) {
|
private String optionsRoot;
|
||||||
this.autocompleteType = autocompleteType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getOptionsRoot() {
|
private Boolean hasAuth = null;
|
||||||
return optionsRoot;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOptionsRoot(String optionsRoot) {
|
public static final String _hasAuth = "hasAuth";
|
||||||
this.optionsRoot = optionsRoot;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUrl() {
|
private AuthAutoCompleteDataPersist auth;
|
||||||
return url;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUrl(String url) {
|
public static final String _auth = "auth";
|
||||||
this.url = url;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Boolean getHasAuth() {
|
private String method = null;
|
||||||
return hasAuth;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHasAuth(Boolean hasAuth) {
|
public static final String _method = "method";
|
||||||
this.hasAuth = hasAuth;
|
|
||||||
}
|
|
||||||
|
|
||||||
public AuthAutoCompleteDataPersist getAuth() {
|
public AutoCompleteDataEntity.AutocompleteType getAutocompleteType() {
|
||||||
return auth;
|
return autocompleteType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAuth(AuthAutoCompleteDataPersist auth) {
|
public void setAutocompleteType(AutoCompleteDataEntity.AutocompleteType autocompleteType) {
|
||||||
this.auth = auth;
|
this.autocompleteType = autocompleteType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ComboBoxOptionPersist getAutoCompleteOptions() {
|
public String getOptionsRoot() {
|
||||||
return autoCompleteOptions;
|
return optionsRoot;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAutoCompleteOptions(ComboBoxOptionPersist autoCompleteOptions) {
|
public void setOptionsRoot(String optionsRoot) {
|
||||||
this.autoCompleteOptions = autoCompleteOptions;
|
this.optionsRoot = optionsRoot;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getMethod() {
|
public String getUrl() {
|
||||||
return method;
|
return url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setUrl(String url) {
|
||||||
|
this.url = url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean getHasAuth() {
|
||||||
|
return hasAuth;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHasAuth(Boolean hasAuth) {
|
||||||
|
this.hasAuth = hasAuth;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AuthAutoCompleteDataPersist getAuth() {
|
||||||
|
return auth;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAuth(AuthAutoCompleteDataPersist auth) {
|
||||||
|
this.auth = auth;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ComboBoxOptionPersist getAutoCompleteOptions() {
|
||||||
|
return autoCompleteOptions;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAutoCompleteOptions(ComboBoxOptionPersist autoCompleteOptions) {
|
||||||
|
this.autoCompleteOptions = autoCompleteOptions;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMethod() {
|
||||||
|
return method;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMethod(String method) {
|
||||||
|
this.method = method;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Component(AutoCompleteSingleDataPersistValidator.ValidatorName)
|
||||||
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public static class AutoCompleteSingleDataPersistValidator extends BaseValidator<AutoCompleteSingleDataPersist> {
|
||||||
|
|
||||||
|
public static final String ValidatorName = "DescriptionTemplate.AutoCompleteSingleDataPersistValidator";
|
||||||
|
|
||||||
|
private final MessageSource messageSource;
|
||||||
|
|
||||||
|
private final ValidatorFactory validatorFactory;
|
||||||
|
|
||||||
|
protected AutoCompleteSingleDataPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource, ValidatorFactory validatorFactory) {
|
||||||
|
super(conventionService, errors);
|
||||||
|
this.messageSource = messageSource;
|
||||||
|
this.validatorFactory = validatorFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<AutoCompleteSingleDataPersist> modelClass() {
|
||||||
|
return AutoCompleteSingleDataPersist.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<Specification> specifications(AutoCompleteSingleDataPersist item) {
|
||||||
|
return Arrays.asList(
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isNull(item.getAutocompleteType()))
|
||||||
|
.failOn(AutoCompleteSingleDataPersist._autocompleteType).failWith(messageSource.getMessage("Validation_Required", new Object[]{AutoCompleteSingleDataPersist._autocompleteType}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isEmpty(item.getUrl()))
|
||||||
|
.failOn(AutoCompleteSingleDataPersist._url).failWith(messageSource.getMessage("Validation_Required", new Object[]{AutoCompleteSingleDataPersist._url}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isNull(item.getHasAuth()))
|
||||||
|
.failOn(AutoCompleteSingleDataPersist._hasAuth).failWith(messageSource.getMessage("Validation_Required", new Object[]{AutoCompleteSingleDataPersist._hasAuth}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isEmpty(item.getMethod()))
|
||||||
|
.failOn(AutoCompleteSingleDataPersist._method).failWith(messageSource.getMessage("Validation_Required", new Object[]{AutoCompleteSingleDataPersist._method}, LocaleContextHolder.getLocale())),
|
||||||
|
|
||||||
|
this.refSpec()
|
||||||
|
.iff(() -> !this.isNull(item.getAutoCompleteOptions()))
|
||||||
|
.on(AutoCompleteSingleDataPersist._autoCompleteOptions)
|
||||||
|
.over(item.getAutoCompleteOptions())
|
||||||
|
.using(() -> this.validatorFactory.validator(ComboBoxOptionPersist.ComboBoxOptionPersistValidator.class)),
|
||||||
|
this.spec()
|
||||||
|
.iff(() -> !this.isNull(item.getHasAuth()) && item.getHasAuth())
|
||||||
|
.must(() -> !this.isNull(item.getAuth()))
|
||||||
|
.failOn(AutoCompleteSingleDataPersist._auth).failWith(messageSource.getMessage("Validation_Required", new Object[]{AutoCompleteSingleDataPersist._auth}, LocaleContextHolder.getLocale())),
|
||||||
|
this.refSpec()
|
||||||
|
.iff(() -> !this.isNull(item.getAuth()))
|
||||||
|
.on(AutoCompleteSingleDataPersist._auth)
|
||||||
|
.over(item.getAuth())
|
||||||
|
.using(() -> this.validatorFactory.validator(AuthAutoCompleteDataPersist.AuthAutoCompleteDataPersistValidator.class))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void setMethod(String method) {
|
|
||||||
this.method = method;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,67 +3,97 @@ package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
|
||||||
import com.fasterxml.jackson.annotation.JsonSubTypes;
|
import com.fasterxml.jackson.annotation.JsonSubTypes;
|
||||||
import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
||||||
import eu.eudat.commons.enums.FieldType;
|
import eu.eudat.commons.enums.FieldType;
|
||||||
import eu.eudat.commons.validation.old.ValidEnum;
|
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 eu.eudat.errorcode.ErrorThesaurusProperties;
|
||||||
|
import org.springframework.context.MessageSource;
|
||||||
|
import org.springframework.context.i18n.LocaleContextHolder;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@JsonTypeInfo(
|
@JsonTypeInfo(
|
||||||
use = JsonTypeInfo.Id.NAME,
|
use = JsonTypeInfo.Id.NAME,
|
||||||
include = JsonTypeInfo.As.PROPERTY,
|
include = JsonTypeInfo.As.PROPERTY,
|
||||||
property = "fieldType",
|
property = "fieldType",
|
||||||
visible = true)
|
visible = true)
|
||||||
@JsonSubTypes({
|
@JsonSubTypes({
|
||||||
@JsonSubTypes.Type(value = AutoCompleteDataPersist.class, name = FieldType.Names.Autocomplete),
|
@JsonSubTypes.Type(value = AutoCompleteDataPersist.class, name = FieldType.Names.Autocomplete),
|
||||||
@JsonSubTypes.Type(value = BooleanDecisionDataPersist.class, name = FieldType.Names.BooleanDecision),
|
@JsonSubTypes.Type(value = BooleanDecisionDataPersist.class, name = FieldType.Names.BooleanDecision),
|
||||||
@JsonSubTypes.Type(value = DatasetAutoCompleteDataPersist.class, name = FieldType.Names.InternalDmpDatasets),
|
@JsonSubTypes.Type(value = DatasetAutoCompleteDataPersist.class, name = FieldType.Names.InternalDmpDatasets),
|
||||||
@JsonSubTypes.Type(value = DmpAutoCompleteDataPersist.class, name = FieldType.Names.InternalDmpDmps),
|
@JsonSubTypes.Type(value = DmpAutoCompleteDataPersist.class, name = FieldType.Names.InternalDmpDmps),
|
||||||
@JsonSubTypes.Type(value = CheckBoxDataPersist.class, name = FieldType.Names.CheckBox),
|
@JsonSubTypes.Type(value = CheckBoxDataPersist.class, name = FieldType.Names.CheckBox),
|
||||||
@JsonSubTypes.Type(value = DatePickerDataPersist.class, name = FieldType.Names.DatePicker),
|
@JsonSubTypes.Type(value = DatePickerDataPersist.class, name = FieldType.Names.DatePicker),
|
||||||
@JsonSubTypes.Type(value = ExternalDatasetDataPersist.class, name = FieldType.Names.ExternalDatasets),
|
@JsonSubTypes.Type(value = ExternalDatasetDataPersist.class, name = FieldType.Names.ExternalDatasets),
|
||||||
@JsonSubTypes.Type(value = FreeTextDataPersist.class, name = FieldType.Names.FreeText),
|
@JsonSubTypes.Type(value = FreeTextDataPersist.class, name = FieldType.Names.FreeText),
|
||||||
@JsonSubTypes.Type(value = LicenseDataPersist.class, name = FieldType.Names.Licenses),
|
@JsonSubTypes.Type(value = LicenseDataPersist.class, name = FieldType.Names.Licenses),
|
||||||
@JsonSubTypes.Type(value = OrganizationDataPersist.class, name = FieldType.Names.Organizations),
|
@JsonSubTypes.Type(value = OrganizationDataPersist.class, name = FieldType.Names.Organizations),
|
||||||
@JsonSubTypes.Type(value = PublicationDataPersist.class, name = FieldType.Names.Publications),
|
@JsonSubTypes.Type(value = PublicationDataPersist.class, name = FieldType.Names.Publications),
|
||||||
@JsonSubTypes.Type(value = RadioBoxDataPersist.class, name = FieldType.Names.RadioBox),
|
@JsonSubTypes.Type(value = RadioBoxDataPersist.class, name = FieldType.Names.RadioBox),
|
||||||
@JsonSubTypes.Type(value = RegistryDataPersist.class, name = FieldType.Names.Registries),
|
@JsonSubTypes.Type(value = RegistryDataPersist.class, name = FieldType.Names.Registries),
|
||||||
@JsonSubTypes.Type(value = ResearcherAutoCompleteDataPersist.class, name = FieldType.Names.InternalDmpResearchers),
|
@JsonSubTypes.Type(value = ResearcherAutoCompleteDataPersist.class, name = FieldType.Names.InternalDmpResearchers),
|
||||||
@JsonSubTypes.Type(value = ResearcherDataPersist.class, name = FieldType.Names.Researchers),
|
@JsonSubTypes.Type(value = ResearcherDataPersist.class, name = FieldType.Names.Researchers),
|
||||||
@JsonSubTypes.Type(value = RichTextAreaDataPersist.class, name = FieldType.Names.RichTextarea),
|
@JsonSubTypes.Type(value = RichTextAreaDataPersist.class, name = FieldType.Names.RichTextarea),
|
||||||
@JsonSubTypes.Type(value = ServiceDataPersist.class, name = FieldType.Names.Services),
|
@JsonSubTypes.Type(value = ServiceDataPersist.class, name = FieldType.Names.Services),
|
||||||
@JsonSubTypes.Type(value = TagDataPersist.class, name = FieldType.Names.Tags),
|
@JsonSubTypes.Type(value = TagDataPersist.class, name = FieldType.Names.Tags),
|
||||||
@JsonSubTypes.Type(value = TaxonomyDataPersist.class, name = FieldType.Names.Taxonomies),
|
@JsonSubTypes.Type(value = TaxonomyDataPersist.class, name = FieldType.Names.Taxonomies),
|
||||||
@JsonSubTypes.Type(value = TextAreaDataPersist.class, name = FieldType.Names.TextArea),
|
@JsonSubTypes.Type(value = TextAreaDataPersist.class, name = FieldType.Names.TextArea),
|
||||||
@JsonSubTypes.Type(value = UploadDataPersist.class, name = FieldType.Names.Upload),
|
@JsonSubTypes.Type(value = UploadDataPersist.class, name = FieldType.Names.Upload),
|
||||||
@JsonSubTypes.Type(value = ValidationDataPersist.class, name = FieldType.Names.Validation),
|
@JsonSubTypes.Type(value = ValidationDataPersist.class, name = FieldType.Names.Validation),
|
||||||
@JsonSubTypes.Type(value = DatasetIdentifierDataPersist.class, name = FieldType.Names.DatasetIdentifier),
|
@JsonSubTypes.Type(value = DatasetIdentifierDataPersist.class, name = FieldType.Names.DatasetIdentifier),
|
||||||
@JsonSubTypes.Type(value = CurrencyDataPersist.class, name = FieldType.Names.Currency),
|
@JsonSubTypes.Type(value = CurrencyDataPersist.class, name = FieldType.Names.Currency),
|
||||||
@JsonSubTypes.Type(value = WordListDataPersist.class, name = FieldType.Names.Wordlist),
|
@JsonSubTypes.Type(value = WordListDataPersist.class, name = FieldType.Names.Wordlist),
|
||||||
@JsonSubTypes.Type(value = DataRepositoryDataPersist.class, name = FieldType.Names.DataRepositories),
|
@JsonSubTypes.Type(value = DataRepositoryDataPersist.class, name = FieldType.Names.DataRepositories),
|
||||||
@JsonSubTypes.Type(value = JournalRepositoryDataPersist.class, name = FieldType.Names.JournalRepositories),
|
@JsonSubTypes.Type(value = JournalRepositoryDataPersist.class, name = FieldType.Names.JournalRepositories),
|
||||||
@JsonSubTypes.Type(value = PublicationRepositoryDataPersist.class, name = FieldType.Names.Publications),
|
@JsonSubTypes.Type(value = PublicationRepositoryDataPersist.class, name = FieldType.Names.Publications),
|
||||||
})
|
})
|
||||||
public abstract class BaseFieldDataPersist {
|
public abstract class BaseFieldDataPersist {
|
||||||
|
|
||||||
@NotNull(message = "{validation.empty}")
|
private String label = null;
|
||||||
@NotEmpty(message = "{validation.empty}")
|
|
||||||
private String label = null;
|
|
||||||
|
|
||||||
@ValidEnum(message = "{validation.empty}")
|
public static final String _label = "label";
|
||||||
private FieldType fieldType;
|
|
||||||
|
|
||||||
public String getLabel() {
|
private FieldType fieldType;
|
||||||
return label;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLabel(String label) {
|
public static final String _fieldType = "fieldType";
|
||||||
this.label = label;
|
|
||||||
}
|
|
||||||
|
|
||||||
public FieldType getFieldType() {
|
public String getLabel() {
|
||||||
return fieldType;
|
return label;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setLabel(String label) {
|
||||||
|
this.label = label;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FieldType getFieldType() {
|
||||||
|
return fieldType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFieldType(FieldType fieldType) {
|
||||||
|
this.fieldType = fieldType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract static class BaseFieldDataPersistValidator<T extends BaseFieldDataPersist> extends BaseValidator<T> {
|
||||||
|
|
||||||
|
protected final MessageSource messageSource;
|
||||||
|
|
||||||
|
protected BaseFieldDataPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource) {
|
||||||
|
super(conventionService, errors);
|
||||||
|
this.messageSource = messageSource;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected List<Specification> getBaseSpecifications(T item) {
|
||||||
|
return Arrays.asList(
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isEmpty(item.getLabel()))
|
||||||
|
.failOn(BaseFieldDataPersist._label).failWith(messageSource.getMessage("Validation_Required", new Object[]{BaseFieldDataPersist._label}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isNull(item.getFieldType()))
|
||||||
|
.failOn(BaseFieldDataPersist._fieldType).failWith(messageSource.getMessage("Validation_Required", new Object[]{BaseFieldDataPersist._fieldType}, LocaleContextHolder.getLocale()))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public void setFieldType(FieldType fieldType) {
|
|
||||||
this.fieldType = fieldType;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,40 @@
|
||||||
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
|
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
|
||||||
|
|
||||||
|
import eu.eudat.commons.validation.ValidatorFactory;
|
||||||
|
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.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class BooleanDecisionDataPersist extends BaseFieldDataPersist {
|
public class BooleanDecisionDataPersist extends BaseFieldDataPersist {
|
||||||
|
|
||||||
|
@Component(BooleanDecisionPersistValidator.ValidatorName)
|
||||||
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public static class BooleanDecisionPersistValidator extends BaseFieldDataPersistValidator<BooleanDecisionDataPersist> {
|
||||||
|
|
||||||
|
public static final String ValidatorName = "DescriptionTemplate.BooleanDecisionPersistValidator";
|
||||||
|
|
||||||
|
private final ValidatorFactory validatorFactory;
|
||||||
|
|
||||||
|
protected BooleanDecisionPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource, ValidatorFactory validatorFactory) {
|
||||||
|
super(conventionService, errors, messageSource);
|
||||||
|
this.validatorFactory = validatorFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<BooleanDecisionDataPersist> modelClass() {
|
||||||
|
return BooleanDecisionDataPersist.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<Specification> specifications(BooleanDecisionDataPersist item) {
|
||||||
|
return getBaseSpecifications(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,37 @@
|
||||||
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
|
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
|
||||||
|
|
||||||
|
import eu.eudat.commons.validation.ValidatorFactory;
|
||||||
|
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.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class CheckBoxDataPersist extends BaseFieldDataPersist {
|
public class CheckBoxDataPersist extends BaseFieldDataPersist {
|
||||||
|
|
||||||
|
@Component(CheckBoxDataPersist.CheckBoxDataPersistValidator.ValidatorName)
|
||||||
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public static class CheckBoxDataPersistValidator extends BaseFieldDataPersistValidator<CheckBoxDataPersist> {
|
||||||
|
|
||||||
|
public static final String ValidatorName = "DescriptionTemplate.CheckBoxDataPersistValidator";
|
||||||
|
|
||||||
|
protected CheckBoxDataPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource) {
|
||||||
|
super(conventionService, errors, messageSource);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<CheckBoxDataPersist> modelClass() {
|
||||||
|
return CheckBoxDataPersist.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<Specification> specifications(CheckBoxDataPersist item) {
|
||||||
|
return getBaseSpecifications(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,53 +1,103 @@
|
||||||
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
|
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
|
||||||
|
|
||||||
import jakarta.validation.constraints.NotEmpty;
|
import eu.eudat.commons.validation.BaseValidator;
|
||||||
import jakarta.validation.constraints.NotNull;
|
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;
|
||||||
|
|
||||||
public class ComboBoxOptionPersist {
|
public class ComboBoxOptionPersist {
|
||||||
@NotNull(message = "{validation.empty}")
|
|
||||||
@NotEmpty(message = "{validation.empty}")
|
|
||||||
private String label = null;
|
|
||||||
@NotNull(message = "{validation.empty}")
|
|
||||||
@NotEmpty(message = "{validation.empty}")
|
|
||||||
private String value = null;
|
|
||||||
@NotNull(message = "{validation.empty}")
|
|
||||||
@NotEmpty(message = "{validation.empty}")
|
|
||||||
private String source = null;
|
|
||||||
@NotNull(message = "{validation.empty}")
|
|
||||||
@NotEmpty(message = "{validation.empty}")
|
|
||||||
private String uri = null;
|
|
||||||
|
|
||||||
public String getLabel() {
|
private String label = null;
|
||||||
return label;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLabel(String label) {
|
public static final String _label = "label";
|
||||||
this.label = label;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getValue() {
|
private String value = null;
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setValue(String value) {
|
public static final String _value = "value";
|
||||||
this.value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSource() {
|
private String source = null;
|
||||||
return source;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSource(String source) {
|
public static final String _source = "source";
|
||||||
this.source = source;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUri() {
|
private String uri = null;
|
||||||
return uri;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUri(String uri) {
|
public static final String _uri = "uri";
|
||||||
this.uri = uri;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
public String getLabel() {
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLabel(String label) {
|
||||||
|
this.label = label;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValue(String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSource() {
|
||||||
|
return source;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSource(String source) {
|
||||||
|
this.source = source;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUri() {
|
||||||
|
return uri;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUri(String uri) {
|
||||||
|
this.uri = uri;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Component(ComboBoxOptionPersistValidator.ValidatorName)
|
||||||
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public static class ComboBoxOptionPersistValidator extends BaseValidator<ComboBoxOptionPersist> {
|
||||||
|
|
||||||
|
public static final String ValidatorName = "DescriptionTemplate.ComboBoxOptionPersistValidator";
|
||||||
|
|
||||||
|
private final MessageSource messageSource;
|
||||||
|
|
||||||
|
protected ComboBoxOptionPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource) {
|
||||||
|
super(conventionService, errors);
|
||||||
|
this.messageSource = messageSource;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<ComboBoxOptionPersist> modelClass() {
|
||||||
|
return ComboBoxOptionPersist.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<Specification> specifications(ComboBoxOptionPersist item) {
|
||||||
|
return Arrays.asList(
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isEmpty(item.getLabel()))
|
||||||
|
.failOn(ComboBoxOptionPersist._label).failWith(messageSource.getMessage("Validation_Required", new Object[]{ComboBoxOptionPersist._label}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isEmpty(item.getValue()))
|
||||||
|
.failOn(ComboBoxOptionPersist._value).failWith(messageSource.getMessage("Validation_Required", new Object[]{ComboBoxOptionPersist._value}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isEmpty(item.getSource()))
|
||||||
|
.failOn(ComboBoxOptionPersist._source).failWith(messageSource.getMessage("Validation_Required", new Object[]{ComboBoxOptionPersist._source}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isEmpty(item.getUri()))
|
||||||
|
.failOn(ComboBoxOptionPersist._uri).failWith(messageSource.getMessage("Validation_Required", new Object[]{ComboBoxOptionPersist._uri}, LocaleContextHolder.getLocale()))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,15 +1,55 @@
|
||||||
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
|
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
|
||||||
|
|
||||||
import jakarta.validation.constraints.NotNull;
|
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.List;
|
||||||
|
|
||||||
public class DatasetAutoCompleteDataPersist extends BaseFieldDataPersist {
|
public class DatasetAutoCompleteDataPersist extends BaseFieldDataPersist {
|
||||||
@NotNull(message = "{validation.empty}")
|
|
||||||
private Boolean multiAutoComplete = null;
|
|
||||||
|
|
||||||
public Boolean getMultiAutoComplete() {
|
private Boolean multiAutoComplete = null;
|
||||||
return multiAutoComplete;
|
|
||||||
}
|
public static final String _multiAutoComplete = "multiAutoComplete";
|
||||||
public void setMultiAutoComplete(Boolean multiAutoComplete) {
|
|
||||||
this.multiAutoComplete = multiAutoComplete;
|
public Boolean getMultiAutoComplete() {
|
||||||
}
|
return multiAutoComplete;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMultiAutoComplete(Boolean multiAutoComplete) {
|
||||||
|
this.multiAutoComplete = multiAutoComplete;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Component(DatasetAutoCompleteDataPersist.DatasetAutoCompleteDataPersistValidator.ValidatorName)
|
||||||
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public static class DatasetAutoCompleteDataPersistValidator extends BaseFieldDataPersistValidator<DatasetAutoCompleteDataPersist> {
|
||||||
|
|
||||||
|
public static final String ValidatorName = "DescriptionTemplate.DatasetAutoCompleteDataPersistValidator";
|
||||||
|
|
||||||
|
protected DatasetAutoCompleteDataPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource) {
|
||||||
|
super(conventionService, errors, messageSource);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<DatasetAutoCompleteDataPersist> modelClass() {
|
||||||
|
return DatasetAutoCompleteDataPersist.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<Specification> specifications(DatasetAutoCompleteDataPersist item) {
|
||||||
|
List<Specification> specifications = getBaseSpecifications(item);
|
||||||
|
specifications.add(
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isNull(item.getMultiAutoComplete()))
|
||||||
|
.failOn(DatasetAutoCompleteDataPersist._multiAutoComplete).failWith(messageSource.getMessage("Validation_Required", new Object[]{DatasetAutoCompleteDataPersist._multiAutoComplete}, LocaleContextHolder.getLocale()))
|
||||||
|
);
|
||||||
|
return specifications;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,40 @@
|
||||||
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
|
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
|
||||||
|
|
||||||
|
import eu.eudat.commons.validation.ValidatorFactory;
|
||||||
|
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.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class DatePickerDataPersist extends BaseFieldDataPersist {
|
public class DatePickerDataPersist extends BaseFieldDataPersist {
|
||||||
|
|
||||||
|
@Component(DatePickerDataPersist.DatePickerDataPersistValidator.ValidatorName)
|
||||||
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public static class DatePickerDataPersistValidator extends BaseFieldDataPersistValidator<DatePickerDataPersist> {
|
||||||
|
|
||||||
|
public static final String ValidatorName = "DescriptionTemplate.DatePickerDataPersistValidator";
|
||||||
|
|
||||||
|
private final ValidatorFactory validatorFactory;
|
||||||
|
|
||||||
|
protected DatePickerDataPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource, ValidatorFactory validatorFactory) {
|
||||||
|
super(conventionService, errors, messageSource);
|
||||||
|
this.validatorFactory = validatorFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<DatePickerDataPersist> modelClass() {
|
||||||
|
return DatePickerDataPersist.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<Specification> specifications(DatePickerDataPersist item) {
|
||||||
|
return getBaseSpecifications(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,16 +1,55 @@
|
||||||
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
|
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
|
||||||
|
|
||||||
import jakarta.validation.constraints.NotNull;
|
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.List;
|
||||||
|
|
||||||
public class DmpAutoCompleteDataPersist extends BaseFieldDataPersist {
|
public class DmpAutoCompleteDataPersist extends BaseFieldDataPersist {
|
||||||
|
|
||||||
@NotNull(message = "{validation.empty}")
|
private Boolean multiAutoComplete = null;
|
||||||
private Boolean multiAutoComplete = null;
|
|
||||||
|
public static final String _multiAutoComplete = "multiAutoComplete";
|
||||||
|
|
||||||
|
public Boolean getMultiAutoComplete() {
|
||||||
|
return multiAutoComplete;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMultiAutoComplete(Boolean multiAutoComplete) {
|
||||||
|
this.multiAutoComplete = multiAutoComplete;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Component(DmpAutoCompleteDataPersist.DmpAutoCompleteDataPersistValidator.ValidatorName)
|
||||||
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public static class DmpAutoCompleteDataPersistValidator extends BaseFieldDataPersistValidator<DmpAutoCompleteDataPersist> {
|
||||||
|
|
||||||
|
public static final String ValidatorName = "DescriptionTemplate.DmpAutoCompleteDataPersistValidator";
|
||||||
|
|
||||||
|
protected DmpAutoCompleteDataPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource) {
|
||||||
|
super(conventionService, errors, messageSource);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<DmpAutoCompleteDataPersist> modelClass() {
|
||||||
|
return DmpAutoCompleteDataPersist.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<Specification> specifications(DmpAutoCompleteDataPersist item) {
|
||||||
|
List<Specification> specifications = getBaseSpecifications(item);
|
||||||
|
specifications.add(
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isNull(item.getMultiAutoComplete()))
|
||||||
|
.failOn(DmpAutoCompleteDataPersist._multiAutoComplete).failWith(messageSource.getMessage("Validation_Required", new Object[]{DmpAutoCompleteDataPersist._multiAutoComplete}, LocaleContextHolder.getLocale()))
|
||||||
|
);
|
||||||
|
return specifications;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public Boolean getMultiAutoComplete() {
|
|
||||||
return multiAutoComplete;
|
|
||||||
}
|
|
||||||
public void setMultiAutoComplete(Boolean multiAutoComplete) {
|
|
||||||
this.multiAutoComplete = multiAutoComplete;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,16 +1,28 @@
|
||||||
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
|
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
|
||||||
|
|
||||||
|
|
||||||
import eu.eudat.commons.enums.FieldDataExternalDatasetType;
|
import eu.eudat.commons.enums.FieldDataExternalDatasetType;
|
||||||
import eu.eudat.commons.validation.old.ValidEnum;
|
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;
|
||||||
|
|
||||||
public class ExternalDatasetDataPersist extends BaseFieldDataPersist {
|
public class ExternalDatasetDataPersist extends BaseFieldDataPersist {
|
||||||
@NotNull(message = "{validation.empty}")
|
|
||||||
private Boolean multiAutoComplete = null;
|
private Boolean multiAutoComplete = null;
|
||||||
@ValidEnum(message = "{validation.empty}")
|
|
||||||
|
public static final String _multiAutoComplete = "multiAutoComplete";
|
||||||
|
|
||||||
private FieldDataExternalDatasetType type;
|
private FieldDataExternalDatasetType type;
|
||||||
|
|
||||||
|
public static final String _type = "type";
|
||||||
|
|
||||||
public Boolean getMultiAutoComplete() {
|
public Boolean getMultiAutoComplete() {
|
||||||
return multiAutoComplete;
|
return multiAutoComplete;
|
||||||
}
|
}
|
||||||
|
@ -26,4 +38,36 @@ public class ExternalDatasetDataPersist extends BaseFieldDataPersist {
|
||||||
public void setType(FieldDataExternalDatasetType type) {
|
public void setType(FieldDataExternalDatasetType type) {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Component(ExternalDatasetDataPersist.ExternalDatasetDataPersistValidator.ValidatorName)
|
||||||
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public static class ExternalDatasetDataPersistValidator extends BaseFieldDataPersistValidator<ExternalDatasetDataPersist> {
|
||||||
|
|
||||||
|
public static final String ValidatorName = "DescriptionTemplate.ExternalDatasetDataPersistValidator";
|
||||||
|
|
||||||
|
protected ExternalDatasetDataPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource) {
|
||||||
|
super(conventionService, errors, messageSource);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<ExternalDatasetDataPersist> modelClass() {
|
||||||
|
return ExternalDatasetDataPersist.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<Specification> specifications(ExternalDatasetDataPersist item) {
|
||||||
|
List<Specification> specifications = getBaseSpecifications(item);
|
||||||
|
specifications.addAll(Arrays.asList(
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isNull(item.getMultiAutoComplete()))
|
||||||
|
.failOn(ExternalDatasetDataPersist._multiAutoComplete).failWith(messageSource.getMessage("Validation_Required", new Object[]{ExternalDatasetDataPersist._multiAutoComplete}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isNull(item.getType()))
|
||||||
|
.failOn(ExternalDatasetDataPersist._type).failWith(messageSource.getMessage("Validation_Required", new Object[]{ExternalDatasetDataPersist._type}, LocaleContextHolder.getLocale()))
|
||||||
|
|
||||||
|
));
|
||||||
|
return specifications;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,36 @@
|
||||||
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
|
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
|
||||||
|
|
||||||
|
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.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class FreeTextDataPersist extends BaseFieldDataPersist {
|
public class FreeTextDataPersist extends BaseFieldDataPersist {
|
||||||
|
|
||||||
|
@Component(FreeTextDataPersist.FreeTextDataPersistValidator.ValidatorName)
|
||||||
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public static class FreeTextDataPersistValidator extends BaseFieldDataPersistValidator<FreeTextDataPersist> {
|
||||||
|
|
||||||
|
public static final String ValidatorName = "DescriptionTemplate.FreeTextDataPersistValidator";
|
||||||
|
|
||||||
|
protected FreeTextDataPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource) {
|
||||||
|
super(conventionService, errors, messageSource);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<FreeTextDataPersist> modelClass() {
|
||||||
|
return FreeTextDataPersist.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<Specification> specifications(FreeTextDataPersist item) {
|
||||||
|
return getBaseSpecifications(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,22 @@
|
||||||
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
|
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
|
||||||
|
|
||||||
import jakarta.validation.constraints.NotNull;
|
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.List;
|
||||||
|
|
||||||
public class LicenseDataPersist extends BaseFieldDataPersist {
|
public class LicenseDataPersist extends BaseFieldDataPersist {
|
||||||
@NotNull(message = "{validation.empty}")
|
|
||||||
private Boolean multiAutoComplete = null;
|
private Boolean multiAutoComplete = null;
|
||||||
|
|
||||||
|
public static final String _multiAutoComplete = "multiAutoComplete";
|
||||||
|
|
||||||
public Boolean getMultiAutoComplete() {
|
public Boolean getMultiAutoComplete() {
|
||||||
return multiAutoComplete;
|
return multiAutoComplete;
|
||||||
}
|
}
|
||||||
|
@ -14,4 +25,31 @@ public class LicenseDataPersist extends BaseFieldDataPersist {
|
||||||
this.multiAutoComplete = multiAutoComplete;
|
this.multiAutoComplete = multiAutoComplete;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Component(LicenseDataPersist.LicenseDataPersistValidator.ValidatorName)
|
||||||
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public static class LicenseDataPersistValidator extends BaseFieldDataPersistValidator<LicenseDataPersist> {
|
||||||
|
|
||||||
|
public static final String ValidatorName = "DescriptionTemplate.LicenseDataPersistValidator";
|
||||||
|
|
||||||
|
protected LicenseDataPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource) {
|
||||||
|
super(conventionService, errors, messageSource);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<LicenseDataPersist> modelClass() {
|
||||||
|
return LicenseDataPersist.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<Specification> specifications(LicenseDataPersist item) {
|
||||||
|
List<Specification> specifications = getBaseSpecifications(item);
|
||||||
|
specifications.add(
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isNull(item.getMultiAutoComplete()))
|
||||||
|
.failOn(LicenseDataPersist._multiAutoComplete).failWith(messageSource.getMessage("Validation_Required", new Object[]{LicenseDataPersist._multiAutoComplete}, LocaleContextHolder.getLocale()))
|
||||||
|
);
|
||||||
|
return specifications;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,22 @@
|
||||||
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
|
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
|
||||||
|
|
||||||
import jakarta.validation.constraints.NotNull;
|
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.List;
|
||||||
|
|
||||||
public class OrganizationDataPersist extends BaseFieldDataPersist {
|
public class OrganizationDataPersist extends BaseFieldDataPersist {
|
||||||
@NotNull(message = "{validation.empty}")
|
|
||||||
private Boolean multiAutoComplete = null;
|
private Boolean multiAutoComplete = null;
|
||||||
|
|
||||||
|
public static final String _multiAutoComplete = "multiAutoComplete";
|
||||||
|
|
||||||
public Boolean getMultiAutoComplete() {
|
public Boolean getMultiAutoComplete() {
|
||||||
return multiAutoComplete;
|
return multiAutoComplete;
|
||||||
}
|
}
|
||||||
|
@ -14,4 +25,31 @@ public class OrganizationDataPersist extends BaseFieldDataPersist {
|
||||||
this.multiAutoComplete = multiAutoComplete;
|
this.multiAutoComplete = multiAutoComplete;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Component(OrganizationDataPersist.OrganizationDataPersistValidator.ValidatorName)
|
||||||
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public static class OrganizationDataPersistValidator extends BaseFieldDataPersistValidator<OrganizationDataPersist> {
|
||||||
|
|
||||||
|
public static final String ValidatorName = "DescriptionTemplate.OrganizationDataPersistValidator";
|
||||||
|
|
||||||
|
protected OrganizationDataPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource) {
|
||||||
|
super(conventionService, errors, messageSource);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<OrganizationDataPersist> modelClass() {
|
||||||
|
return OrganizationDataPersist.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<Specification> specifications(OrganizationDataPersist item) {
|
||||||
|
List<Specification> specifications = getBaseSpecifications(item);
|
||||||
|
specifications.add(
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isNull(item.getMultiAutoComplete()))
|
||||||
|
.failOn(OrganizationDataPersist._multiAutoComplete).failWith(messageSource.getMessage("Validation_Required", new Object[]{OrganizationDataPersist._multiAutoComplete}, LocaleContextHolder.getLocale()))
|
||||||
|
);
|
||||||
|
return specifications;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,22 @@
|
||||||
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
|
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
|
||||||
|
|
||||||
|
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 jakarta.validation.constraints.NotNull;
|
import java.util.List;
|
||||||
|
|
||||||
public class PublicationDataPersist extends BaseFieldDataPersist {
|
public class PublicationDataPersist extends BaseFieldDataPersist {
|
||||||
@NotNull(message = "{validation.empty}")
|
|
||||||
private Boolean multiAutoComplete;
|
private Boolean multiAutoComplete;
|
||||||
|
|
||||||
|
public static final String _multiAutoComplete = "multiAutoComplete";
|
||||||
|
|
||||||
public Boolean getMultiAutoComplete() {
|
public Boolean getMultiAutoComplete() {
|
||||||
return multiAutoComplete;
|
return multiAutoComplete;
|
||||||
}
|
}
|
||||||
|
@ -15,4 +25,31 @@ public class PublicationDataPersist extends BaseFieldDataPersist {
|
||||||
this.multiAutoComplete = multiAutoComplete;
|
this.multiAutoComplete = multiAutoComplete;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Component(PublicationDataPersist.PublicationDataPersistValidator.ValidatorName)
|
||||||
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public static class PublicationDataPersistValidator extends BaseFieldDataPersistValidator<PublicationDataPersist> {
|
||||||
|
|
||||||
|
public static final String ValidatorName = "DescriptionTemplate.PublicationDataPersistValidator";
|
||||||
|
|
||||||
|
protected PublicationDataPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource) {
|
||||||
|
super(conventionService, errors, messageSource);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<PublicationDataPersist> modelClass() {
|
||||||
|
return PublicationDataPersist.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<Specification> specifications(PublicationDataPersist item) {
|
||||||
|
List<Specification> specifications = getBaseSpecifications(item);
|
||||||
|
specifications.add(
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isNull(item.getMultiAutoComplete()))
|
||||||
|
.failOn(PublicationDataPersist._multiAutoComplete).failWith(messageSource.getMessage("Validation_Required", new Object[]{PublicationDataPersist._multiAutoComplete}, LocaleContextHolder.getLocale()))
|
||||||
|
);
|
||||||
|
return specifications;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,16 +1,24 @@
|
||||||
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
|
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
|
||||||
|
|
||||||
|
import eu.eudat.commons.validation.ValidatorFactory;
|
||||||
|
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 jakarta.validation.Valid;
|
import java.util.Arrays;
|
||||||
import jakarta.validation.constraints.NotNull;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class RadioBoxDataPersist extends BaseFieldDataPersist {
|
public class RadioBoxDataPersist extends BaseFieldDataPersist {
|
||||||
@NotNull(message = "{validation.empty}")
|
|
||||||
@Valid
|
|
||||||
private List<RadioBoxOptionPersist> options = null;
|
private List<RadioBoxOptionPersist> options = null;
|
||||||
|
|
||||||
|
public static final String _options = "options";
|
||||||
|
|
||||||
public List<RadioBoxOptionPersist> getOptions() {
|
public List<RadioBoxOptionPersist> getOptions() {
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
|
@ -18,4 +26,38 @@ public class RadioBoxDataPersist extends BaseFieldDataPersist {
|
||||||
public void setOptions(List<RadioBoxOptionPersist> options) {
|
public void setOptions(List<RadioBoxOptionPersist> options) {
|
||||||
this.options = options;
|
this.options = options;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Component(RadioBoxDataPersistValidator.ValidatorName)
|
||||||
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public static class RadioBoxDataPersistValidator extends BaseFieldDataPersistValidator<RadioBoxDataPersist> {
|
||||||
|
|
||||||
|
public static final String ValidatorName = "DescriptionTemplate.RadioBoxDataPersistValidator";
|
||||||
|
|
||||||
|
private final ValidatorFactory validatorFactory;
|
||||||
|
|
||||||
|
protected RadioBoxDataPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource, ValidatorFactory validatorFactory) {
|
||||||
|
super(conventionService, errors, messageSource);
|
||||||
|
this.validatorFactory = validatorFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<RadioBoxDataPersist> modelClass() {
|
||||||
|
return RadioBoxDataPersist.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<Specification> specifications(RadioBoxDataPersist item) {
|
||||||
|
return Arrays.asList(
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isNull(item.getOptions()))
|
||||||
|
.failOn(RadioBoxDataPersist._options).failWith(messageSource.getMessage("Validation_Required", new Object[]{RadioBoxDataPersist._options}, LocaleContextHolder.getLocale())),
|
||||||
|
this.navSpec()
|
||||||
|
.iff(() -> !this.isNull(item.getOptions()))
|
||||||
|
.on(RadioBoxDataPersist._options)
|
||||||
|
.over(item.getOptions())
|
||||||
|
.using(() -> this.validatorFactory.validator(RadioBoxOptionPersist.RadioBoxOptionPersistValidator.class))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,29 +1,73 @@
|
||||||
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
|
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
|
||||||
|
|
||||||
import jakarta.validation.constraints.NotEmpty;
|
import eu.eudat.commons.validation.BaseValidator;
|
||||||
import jakarta.validation.constraints.NotNull;
|
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;
|
||||||
|
|
||||||
public class RadioBoxOptionPersist {
|
public class RadioBoxOptionPersist {
|
||||||
@NotNull(message = "{validation.empty}")
|
|
||||||
@NotEmpty(message = "{validation.empty}")
|
|
||||||
private String label = null;
|
|
||||||
@NotNull(message = "{validation.empty}")
|
|
||||||
@NotEmpty(message = "{validation.empty}")
|
|
||||||
private String value = null;
|
|
||||||
|
|
||||||
public String getLabel() {
|
private String label = null;
|
||||||
return label;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLabel(String label) {
|
public static final String _label = "label";
|
||||||
this.label = label;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getValue() {
|
private String value = null;
|
||||||
return value;
|
|
||||||
}
|
public static final String _value = "value";
|
||||||
|
|
||||||
|
public String getLabel() {
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLabel(String label) {
|
||||||
|
this.label = label;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValue(String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Component(RadioBoxOptionPersistValidator.ValidatorName)
|
||||||
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public static class RadioBoxOptionPersistValidator extends BaseValidator<RadioBoxOptionPersist> {
|
||||||
|
|
||||||
|
public static final String ValidatorName = "DescriptionTemplate.RadioBoxOptionPersistValidator";
|
||||||
|
|
||||||
|
private final MessageSource messageSource;
|
||||||
|
|
||||||
|
protected RadioBoxOptionPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource) {
|
||||||
|
super(conventionService, errors);
|
||||||
|
this.messageSource = messageSource;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<RadioBoxOptionPersist> modelClass() {
|
||||||
|
return RadioBoxOptionPersist.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<Specification> specifications(RadioBoxOptionPersist item) {
|
||||||
|
return Arrays.asList(
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isEmpty(item.getLabel()))
|
||||||
|
.failOn(RadioBoxOptionPersist._label).failWith(messageSource.getMessage("Validation_Required", new Object[]{RadioBoxOptionPersist._label}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isEmpty(item.getValue()))
|
||||||
|
.failOn(RadioBoxOptionPersist._value).failWith(messageSource.getMessage("Validation_Required", new Object[]{RadioBoxOptionPersist._value}, LocaleContextHolder.getLocale()))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void setValue(String value) {
|
|
||||||
this.value = value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@ 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.errorcode.ErrorThesaurusProperties;
|
import eu.eudat.errorcode.ErrorThesaurusProperties;
|
||||||
import eu.eudat.model.persist.descriptionproperties.PropertyDefinitionPersist;
|
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
|
@ -19,54 +18,54 @@ import java.util.List;
|
||||||
|
|
||||||
public class DefinitionPersist {
|
public class DefinitionPersist {
|
||||||
|
|
||||||
@NotNull(message = "{validation.empty}")
|
@NotNull(message = "{validation.empty}")
|
||||||
@Valid
|
@Valid
|
||||||
private List<FieldPersist> fields = null;
|
private List<FieldPersist> fields = null;
|
||||||
|
|
||||||
public static final String _fields = "fields";
|
public static final String _fields = "fields";
|
||||||
|
|
||||||
public List<FieldPersist> getFields() {
|
public List<FieldPersist> getFields() {
|
||||||
return fields;
|
return fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFields(List<FieldPersist> fields) {
|
public void setFields(List<FieldPersist> fields) {
|
||||||
this.fields = fields;
|
this.fields = fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Component(DefinitionPersistValidator.ValidatorName)
|
@Component(DefinitionPersistValidator.ValidatorName)
|
||||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
public static class DefinitionPersistValidator extends BaseValidator<DefinitionPersist> {
|
public static class DefinitionPersistValidator extends BaseValidator<DefinitionPersist> {
|
||||||
|
|
||||||
public static final String ValidatorName = "Reference.DefinitionPersistValidator";
|
public static final String ValidatorName = "Reference.DefinitionPersistValidator";
|
||||||
|
|
||||||
private final MessageSource messageSource;
|
private final MessageSource messageSource;
|
||||||
|
|
||||||
private final ValidatorFactory validatorFactory;
|
private final ValidatorFactory validatorFactory;
|
||||||
|
|
||||||
protected DefinitionPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource, ValidatorFactory validatorFactory) {
|
protected DefinitionPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource, ValidatorFactory validatorFactory) {
|
||||||
super(conventionService, errors);
|
super(conventionService, errors);
|
||||||
this.messageSource = messageSource;
|
this.messageSource = messageSource;
|
||||||
this.validatorFactory = validatorFactory;
|
this.validatorFactory = validatorFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Class<DefinitionPersist> modelClass() {
|
protected Class<DefinitionPersist> modelClass() {
|
||||||
return DefinitionPersist.class;
|
return DefinitionPersist.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected List<Specification> specifications(DefinitionPersist item) {
|
protected List<Specification> specifications(DefinitionPersist item) {
|
||||||
return Arrays.asList(
|
return Arrays.asList(
|
||||||
this.spec()
|
this.spec()
|
||||||
.must(() -> !this.isNull(item.getFields()))
|
.must(() -> !this.isNull(item.getFields()))
|
||||||
.failOn(DefinitionPersist._fields).failWith(messageSource.getMessage("Validation_Required", new Object[]{DefinitionPersist._fields}, LocaleContextHolder.getLocale())),
|
.failOn(DefinitionPersist._fields).failWith(messageSource.getMessage("Validation_Required", new Object[]{DefinitionPersist._fields}, LocaleContextHolder.getLocale())),
|
||||||
this.navSpec()
|
this.navSpec()
|
||||||
.iff(() -> !this.isNull(item.getFields()))
|
.iff(() -> !this.isNull(item.getFields()))
|
||||||
.on(DefinitionPersist._fields)
|
.on(DefinitionPersist._fields)
|
||||||
.over(item.getFields())
|
.over(item.getFields())
|
||||||
.using(() -> null) //TODO
|
.using(() -> this.validatorFactory.validator(FieldPersist.FieldPersistValidator.class))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,24 +1,38 @@
|
||||||
package eu.eudat.model.persist.referencedefinition;
|
package eu.eudat.model.persist.referencedefinition;
|
||||||
|
|
||||||
import eu.eudat.commons.enums.ReferenceFieldDataType;
|
import eu.eudat.commons.enums.ReferenceFieldDataType;
|
||||||
|
import eu.eudat.commons.validation.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 eu.eudat.model.persist.DescriptionTemplateTypePersist;
|
||||||
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.context.i18n.LocaleContextHolder;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class FieldPersist {
|
public class FieldPersist {
|
||||||
|
|
||||||
@NotNull(message = "{validation.empty}")
|
|
||||||
@NotEmpty(message = "{validation.empty}")
|
|
||||||
private String code = null;
|
private String code = null;
|
||||||
|
|
||||||
@ValidEnum(message = "{validation.empty}")
|
public static final String _code = "code";
|
||||||
|
|
||||||
private ReferenceFieldDataType dataType;
|
private ReferenceFieldDataType dataType;
|
||||||
|
|
||||||
@NotNull(message = "{validation.empty}")
|
public static final String _dataType = "dataType";
|
||||||
@NotEmpty(message = "{validation.empty}")
|
|
||||||
private String value = null;
|
private String value = null;
|
||||||
|
|
||||||
|
public static final String _value = "value";
|
||||||
|
|
||||||
public String getCode() {
|
public String getCode() {
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
@ -42,6 +56,41 @@ public class FieldPersist {
|
||||||
public void setValue(String value) {
|
public void setValue(String value) {
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Component(FieldPersistValidator.ValidatorName)
|
||||||
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public static class FieldPersistValidator extends BaseValidator<FieldPersist> {
|
||||||
|
|
||||||
|
public static final String ValidatorName = "Reference.FieldPersistValidator";
|
||||||
|
|
||||||
|
private final MessageSource messageSource;
|
||||||
|
|
||||||
|
protected FieldPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource) {
|
||||||
|
super(conventionService, errors);
|
||||||
|
this.messageSource = messageSource;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<FieldPersist> modelClass() {
|
||||||
|
return FieldPersist.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<Specification> specifications(FieldPersist item) {
|
||||||
|
return Arrays.asList(
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isEmpty(item.getCode()))
|
||||||
|
.failOn(FieldPersist._code).failWith(messageSource.getMessage("Validation_Required", new Object[]{FieldPersist._code}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isNull(item.getDataType()))
|
||||||
|
.failOn(FieldPersist._dataType).failWith(messageSource.getMessage("Validation_Required", new Object[]{FieldPersist._dataType}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isEmpty(item.getValue()))
|
||||||
|
.failOn(FieldPersist._value).failWith(messageSource.getMessage("Validation_Required", new Object[]{FieldPersist._value}, LocaleContextHolder.getLocale()))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
package eu.eudat.service.tag;
|
||||||
|
|
||||||
|
import eu.eudat.model.Tag;
|
||||||
|
import eu.eudat.model.persist.TagPersist;
|
||||||
|
import gr.cite.tools.exception.MyApplicationException;
|
||||||
|
import gr.cite.tools.exception.MyForbiddenException;
|
||||||
|
import gr.cite.tools.exception.MyNotFoundException;
|
||||||
|
import gr.cite.tools.exception.MyValidationException;
|
||||||
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
|
|
||||||
|
import javax.management.InvalidApplicationException;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public interface TagService {
|
||||||
|
|
||||||
|
Tag persist(TagPersist model, FieldSet fields) throws MyForbiddenException, MyValidationException, MyApplicationException, MyNotFoundException, InvalidApplicationException;
|
||||||
|
|
||||||
|
void deleteAndSave(UUID id) throws MyForbiddenException, InvalidApplicationException;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,127 @@
|
||||||
|
package eu.eudat.service.tag;
|
||||||
|
|
||||||
|
import eu.eudat.authorization.AuthorizationFlags;
|
||||||
|
import eu.eudat.authorization.Permission;
|
||||||
|
import eu.eudat.commons.enums.IsActive;
|
||||||
|
import eu.eudat.commons.scope.user.UserScope;
|
||||||
|
import eu.eudat.convention.ConventionService;
|
||||||
|
import eu.eudat.data.TagEntity;
|
||||||
|
import eu.eudat.errorcode.ErrorThesaurusProperties;
|
||||||
|
import eu.eudat.event.EventBroker;
|
||||||
|
import eu.eudat.event.TagTouchedEvent;
|
||||||
|
import eu.eudat.model.Tag;
|
||||||
|
import eu.eudat.model.builder.TagBuilder;
|
||||||
|
import eu.eudat.model.deleter.TagDeleter;
|
||||||
|
import eu.eudat.model.persist.TagPersist;
|
||||||
|
import gr.cite.commons.web.authz.service.AuthorizationService;
|
||||||
|
import gr.cite.tools.data.builder.BuilderFactory;
|
||||||
|
import gr.cite.tools.data.deleter.DeleterFactory;
|
||||||
|
import gr.cite.tools.exception.MyApplicationException;
|
||||||
|
import gr.cite.tools.exception.MyForbiddenException;
|
||||||
|
import gr.cite.tools.exception.MyNotFoundException;
|
||||||
|
import gr.cite.tools.exception.MyValidationException;
|
||||||
|
import gr.cite.tools.fieldset.BaseFieldSet;
|
||||||
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
|
import gr.cite.tools.logging.LoggerService;
|
||||||
|
import gr.cite.tools.logging.MapLogEntry;
|
||||||
|
import jakarta.persistence.EntityManager;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.MessageSource;
|
||||||
|
import org.springframework.context.i18n.LocaleContextHolder;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.management.InvalidApplicationException;
|
||||||
|
import java.time.Instant;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class TagServiceImpl implements TagService {
|
||||||
|
|
||||||
|
private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(TagServiceImpl.class));
|
||||||
|
|
||||||
|
private final EntityManager entityManager;
|
||||||
|
|
||||||
|
private final AuthorizationService authorizationService;
|
||||||
|
|
||||||
|
private final DeleterFactory deleterFactory;
|
||||||
|
|
||||||
|
private final BuilderFactory builderFactory;
|
||||||
|
|
||||||
|
private final ConventionService conventionService;
|
||||||
|
|
||||||
|
private final ErrorThesaurusProperties errors;
|
||||||
|
|
||||||
|
private final MessageSource messageSource;
|
||||||
|
|
||||||
|
private final EventBroker eventBroker;
|
||||||
|
|
||||||
|
private final UserScope userScope;
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public TagServiceImpl(
|
||||||
|
EntityManager entityManager,
|
||||||
|
AuthorizationService authorizationService,
|
||||||
|
DeleterFactory deleterFactory,
|
||||||
|
BuilderFactory builderFactory,
|
||||||
|
ConventionService conventionService,
|
||||||
|
ErrorThesaurusProperties errors,
|
||||||
|
MessageSource messageSource,
|
||||||
|
UserScope userScope,
|
||||||
|
EventBroker eventBroker) {
|
||||||
|
this.entityManager = entityManager;
|
||||||
|
this.authorizationService = authorizationService;
|
||||||
|
this.deleterFactory = deleterFactory;
|
||||||
|
this.builderFactory = builderFactory;
|
||||||
|
this.conventionService = conventionService;
|
||||||
|
this.errors = errors;
|
||||||
|
this.messageSource = messageSource;
|
||||||
|
this.eventBroker = eventBroker;
|
||||||
|
this.userScope = userScope;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Tag persist(TagPersist model, FieldSet fields) throws MyForbiddenException, MyValidationException, MyApplicationException, MyNotFoundException, InvalidApplicationException {
|
||||||
|
logger.debug(new MapLogEntry("persisting data tag").And("model", model).And("fields", fields));
|
||||||
|
|
||||||
|
this.authorizationService.authorizeForce(Permission.EditTag);
|
||||||
|
|
||||||
|
Boolean isUpdate = this.conventionService.isValidGuid(model.getId());
|
||||||
|
|
||||||
|
TagEntity data;
|
||||||
|
if (isUpdate) {
|
||||||
|
data = this.entityManager.find(TagEntity.class, model.getId());
|
||||||
|
if (data == null) throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{model.getId(), Tag.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||||
|
if (!this.conventionService.hashValue(data.getUpdatedAt()).equals(model.getHash())) throw new MyValidationException(this.errors.getHashConflict().getCode(), this.errors.getHashConflict().getMessage());
|
||||||
|
} else {
|
||||||
|
data = new TagEntity();
|
||||||
|
data.setId(UUID.randomUUID());
|
||||||
|
data.setIsActive(IsActive.Active);
|
||||||
|
data.setCreatedAt(Instant.now());
|
||||||
|
data.setCreatedById(userScope.getUserId());
|
||||||
|
}
|
||||||
|
|
||||||
|
data.setLabel(model.getLabel());
|
||||||
|
data.setUpdatedAt(Instant.now());
|
||||||
|
if (isUpdate)
|
||||||
|
this.entityManager.merge(data);
|
||||||
|
else
|
||||||
|
this.entityManager.persist(data);
|
||||||
|
|
||||||
|
this.entityManager.flush();
|
||||||
|
|
||||||
|
this.eventBroker.emit(new TagTouchedEvent(data.getId()));
|
||||||
|
return this.builderFactory.builder(TagBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(BaseFieldSet.build(fields, Tag._id), data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void deleteAndSave(UUID id) throws MyForbiddenException, InvalidApplicationException {
|
||||||
|
logger.debug("deleting tag: {}", id);
|
||||||
|
|
||||||
|
this.authorizationService.authorizeForce(Permission.DeleteTag);
|
||||||
|
|
||||||
|
this.deleterFactory.deleter(TagDeleter.class).deleteAndSaveByIds(List.of(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
artifactId=core
|
||||||
|
groupId=eu.eudat
|
||||||
|
version=1.0.0-SNAPSHOT
|
|
@ -169,6 +169,7 @@ public class DescriptionController {
|
||||||
|
|
||||||
@PostMapping("persist-status")
|
@PostMapping("persist-status")
|
||||||
@Transactional
|
@Transactional
|
||||||
|
@ValidationFilterAnnotation(validator = DescriptionStatusPersist.DescriptionStatusPersistValidator.ValidatorName, argumentName = "model")
|
||||||
public Description persistStatus(@MyValidate @RequestBody DescriptionStatusPersist model, FieldSet fieldSet) throws MyApplicationException, MyForbiddenException, MyNotFoundException {
|
public Description persistStatus(@MyValidate @RequestBody DescriptionStatusPersist model, FieldSet fieldSet) throws MyApplicationException, MyForbiddenException, MyNotFoundException {
|
||||||
logger.debug(new MapLogEntry("persisting" + Description.class.getSimpleName()).And("model", model).And("fieldSet", fieldSet));
|
logger.debug(new MapLogEntry("persisting" + Description.class.getSimpleName()).And("model", model).And("fieldSet", fieldSet));
|
||||||
Description persisted = this.descriptionService.persistStatus(model, fieldSet);
|
Description persisted = this.descriptionService.persistStatus(model, fieldSet);
|
||||||
|
@ -197,10 +198,4 @@ public class DescriptionController {
|
||||||
|
|
||||||
return this.descriptionService.export(id, exportType);
|
return this.descriptionService.export(id, exportType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/export/formats")
|
|
||||||
public List<FileFormat> getAvailableExportFormats() {
|
|
||||||
return this.fileTransformerService.getAvailableConfigurations();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -213,11 +213,6 @@ public class DmpController {
|
||||||
return this.dmpService.export(id, exportType);
|
return this.dmpService.export(id, exportType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/export/formats")
|
|
||||||
public List<FileFormat> getAvailableExportFormats() {
|
|
||||||
return this.fileTransformerService.getAvailableConfigurations();
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("{id}/invite-users")
|
@PostMapping("{id}/invite-users")
|
||||||
@Transactional
|
@Transactional
|
||||||
public ResponseEntity inviteUsers(@PathVariable("id") UUID id, @MyValidate @RequestBody DmpUserInvitePersist model) throws InvalidApplicationException, JAXBException {
|
public ResponseEntity inviteUsers(@PathVariable("id") UUID id, @MyValidate @RequestBody DmpUserInvitePersist model) throws InvalidApplicationException, JAXBException {
|
||||||
|
@ -234,7 +229,7 @@ public class DmpController {
|
||||||
|
|
||||||
@GetMapping("{id}/token/{token}/invite-accept")
|
@GetMapping("{id}/token/{token}/invite-accept")
|
||||||
@Transactional
|
@Transactional
|
||||||
public ResponseEntity inviteUsers(@PathVariable("id") UUID id, @PathVariable("token") String token) throws InvalidApplicationException, JAXBException {
|
public ResponseEntity 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);
|
||||||
|
|
|
@ -0,0 +1,50 @@
|
||||||
|
package eu.eudat.controllers.v2;
|
||||||
|
|
||||||
|
import eu.eudat.audit.AuditableAction;
|
||||||
|
import eu.eudat.controllers.BaseController;
|
||||||
|
import eu.eudat.file.transformer.model.file.FileFormat;
|
||||||
|
import eu.eudat.logic.services.ApiContext;
|
||||||
|
import eu.eudat.service.transformer.FileTransformerService;
|
||||||
|
import gr.cite.commons.web.authz.service.AuthorizationService;
|
||||||
|
import gr.cite.tools.auditing.AuditService;
|
||||||
|
import gr.cite.tools.data.censor.CensorFactory;
|
||||||
|
import gr.cite.tools.logging.LoggerService;
|
||||||
|
import gr.cite.tools.logging.MapLogEntry;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@CrossOrigin
|
||||||
|
@RequestMapping(value = {"/api/file-transformer/"})
|
||||||
|
public class FileTransformerController extends BaseController {
|
||||||
|
private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(FileTransformerController.class));
|
||||||
|
|
||||||
|
|
||||||
|
private final AuthorizationService authorizationService;
|
||||||
|
private final FileTransformerService depositService;
|
||||||
|
private final CensorFactory censorFactory;
|
||||||
|
private final AuditService auditService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public FileTransformerController(ApiContext apiContext, AuthorizationService authorizationService, FileTransformerService depositService, CensorFactory censorFactory, AuditService auditService){
|
||||||
|
super(apiContext);
|
||||||
|
this.authorizationService = authorizationService;
|
||||||
|
this.depositService = depositService;
|
||||||
|
this.censorFactory = censorFactory;
|
||||||
|
this.auditService = auditService;
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/available")
|
||||||
|
public List<FileFormat> getAvailableConfigurations() {
|
||||||
|
logger.debug(new MapLogEntry("getAvailableConfigurations"));
|
||||||
|
|
||||||
|
List<FileFormat> model = this.depositService.getAvailableConfigurations();
|
||||||
|
this.auditService.track(AuditableAction.FileTransformer_GetAvailableConfigurations);
|
||||||
|
//this.auditService.trackIdentity(AuditableAction.IdentityTracking_Action);
|
||||||
|
|
||||||
|
return model;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,133 @@
|
||||||
|
package eu.eudat.controllers.v2;
|
||||||
|
|
||||||
|
import eu.eudat.audit.AuditableAction;
|
||||||
|
import eu.eudat.authorization.AuthorizationFlags;
|
||||||
|
import eu.eudat.commons.validation.ValidationFilterAnnotation;
|
||||||
|
import eu.eudat.data.TagEntity;
|
||||||
|
import eu.eudat.logic.services.ApiContext;
|
||||||
|
import eu.eudat.model.Tag;
|
||||||
|
import eu.eudat.model.builder.TagBuilder;
|
||||||
|
import eu.eudat.model.censorship.TagCensor;
|
||||||
|
import eu.eudat.model.persist.TagPersist;
|
||||||
|
import eu.eudat.model.result.QueryResult;
|
||||||
|
import eu.eudat.query.TagQuery;
|
||||||
|
import eu.eudat.query.lookup.TagLookup;
|
||||||
|
import eu.eudat.service.tag.TagService;
|
||||||
|
import gr.cite.tools.auditing.AuditService;
|
||||||
|
import gr.cite.tools.data.builder.BuilderFactory;
|
||||||
|
import gr.cite.tools.data.censor.CensorFactory;
|
||||||
|
import gr.cite.tools.data.query.QueryFactory;
|
||||||
|
import gr.cite.tools.exception.MyApplicationException;
|
||||||
|
import gr.cite.tools.exception.MyForbiddenException;
|
||||||
|
import gr.cite.tools.exception.MyNotFoundException;
|
||||||
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
|
import gr.cite.tools.logging.LoggerService;
|
||||||
|
import gr.cite.tools.logging.MapLogEntry;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.MessageSource;
|
||||||
|
import org.springframework.context.i18n.LocaleContextHolder;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.management.InvalidApplicationException;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping(path = "api/tag")
|
||||||
|
public class TagController {
|
||||||
|
|
||||||
|
private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(TagController.class));
|
||||||
|
@Autowired
|
||||||
|
private ApiContext apiContext;
|
||||||
|
|
||||||
|
private final BuilderFactory builderFactory;
|
||||||
|
private final AuditService auditService;
|
||||||
|
|
||||||
|
private final TagService tagService;
|
||||||
|
|
||||||
|
private final CensorFactory censorFactory;
|
||||||
|
|
||||||
|
private final QueryFactory queryFactory;
|
||||||
|
|
||||||
|
private final MessageSource messageSource;
|
||||||
|
|
||||||
|
public TagController(
|
||||||
|
BuilderFactory builderFactory,
|
||||||
|
AuditService auditService,
|
||||||
|
TagService tagService,
|
||||||
|
CensorFactory censorFactory,
|
||||||
|
QueryFactory queryFactory,
|
||||||
|
MessageSource messageSource) {
|
||||||
|
this.builderFactory = builderFactory;
|
||||||
|
this.auditService = auditService;
|
||||||
|
this.tagService = tagService;
|
||||||
|
this.censorFactory = censorFactory;
|
||||||
|
this.queryFactory = queryFactory;
|
||||||
|
this.messageSource = messageSource;
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("query")
|
||||||
|
public QueryResult<Tag> Query(@RequestBody TagLookup lookup) throws MyApplicationException, MyForbiddenException {
|
||||||
|
logger.debug("querying {}", Tag.class.getSimpleName());
|
||||||
|
|
||||||
|
this.censorFactory.censor(TagCensor.class).censor(lookup.getProject(), null);
|
||||||
|
|
||||||
|
TagQuery query = lookup.enrich(this.queryFactory).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic);
|
||||||
|
|
||||||
|
List<TagEntity> data = query.collectAs(lookup.getProject());
|
||||||
|
List<Tag> models = this.builderFactory.builder(TagBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(lookup.getProject(), data);
|
||||||
|
long count = (lookup.getMetadata() != null && lookup.getMetadata().getCountAll()) ? query.count() : models.size();
|
||||||
|
|
||||||
|
this.auditService.track(AuditableAction.Tag_Query, "lookup", lookup);
|
||||||
|
//this.auditService.trackIdentity(AuditableAction.IdentityTracking_Action);
|
||||||
|
|
||||||
|
return new QueryResult<>(models, count);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("{id}")
|
||||||
|
public Tag Get(@PathVariable("id") UUID id, FieldSet fieldSet, Locale locale) throws MyApplicationException, MyForbiddenException, MyNotFoundException {
|
||||||
|
logger.debug(new MapLogEntry("retrieving" + Tag.class.getSimpleName()).And("id", id).And("fields", fieldSet));
|
||||||
|
|
||||||
|
this.censorFactory.censor(TagCensor.class).censor(fieldSet, null);
|
||||||
|
|
||||||
|
TagQuery query = this.queryFactory.query(TagQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).ids(id);
|
||||||
|
Tag model = this.builderFactory.builder(TagBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(fieldSet, query.firstAs(fieldSet));
|
||||||
|
if (model == null)
|
||||||
|
throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{id, Tag.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||||
|
|
||||||
|
this.auditService.track(AuditableAction.Tag_Lookup, Map.ofEntries(
|
||||||
|
new AbstractMap.SimpleEntry<String, Object>("id", id),
|
||||||
|
new AbstractMap.SimpleEntry<String, Object>("fields", fieldSet)
|
||||||
|
));
|
||||||
|
//this.auditService.trackIdentity(AuditableAction.IdentityTracking_Action);
|
||||||
|
|
||||||
|
return model;
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("persist")
|
||||||
|
@Transactional
|
||||||
|
@ValidationFilterAnnotation(validator = TagPersist.TagPersistValidator.ValidatorName, argumentName ="model")
|
||||||
|
public Tag Persist(@RequestBody TagPersist model, FieldSet fieldSet) throws MyApplicationException, MyForbiddenException, MyNotFoundException, InvalidApplicationException {
|
||||||
|
logger.debug(new MapLogEntry("persisting" + Tag.class.getSimpleName()).And("model", model).And("fieldSet", fieldSet));
|
||||||
|
Tag persisted = this.tagService.persist(model, fieldSet);
|
||||||
|
|
||||||
|
this.auditService.track(AuditableAction.Tag_Persist, Map.ofEntries(
|
||||||
|
new AbstractMap.SimpleEntry<String, Object>("model", model),
|
||||||
|
new AbstractMap.SimpleEntry<String, Object>("fields", fieldSet)
|
||||||
|
));
|
||||||
|
//this.auditService.trackIdentity(AuditableAction.IdentityTracking_Action);
|
||||||
|
return persisted;
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("{id}")
|
||||||
|
@Transactional
|
||||||
|
public void Delete(@PathVariable("id") UUID id) throws MyForbiddenException, InvalidApplicationException {
|
||||||
|
logger.debug(new MapLogEntry("retrieving" + Tag.class.getSimpleName()).And("id", id));
|
||||||
|
|
||||||
|
this.tagService.deleteAndSave(id);
|
||||||
|
|
||||||
|
this.auditService.track(AuditableAction.Tag_Delete, "id", id);
|
||||||
|
//this.auditService.trackIdentity(AuditableAction.IdentityTracking_Action);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
DO $$DECLARE
|
||||||
|
this_version CONSTANT varchar := '00.01.042';
|
||||||
|
BEGIN
|
||||||
|
PERFORM * FROM "DBVersion" WHERE version = this_version;
|
||||||
|
IF FOUND THEN RETURN; END IF;
|
||||||
|
|
||||||
|
ALTER TABLE IF EXISTS public."EntityDoi" DROP COLUMN IF EXISTS entity_type;
|
||||||
|
|
||||||
|
ALTER TABLE IF EXISTS public."EntityDoi"
|
||||||
|
ADD COLUMN entity_type smallint NOT NULL DEFAULT 0;
|
||||||
|
|
||||||
|
ALTER TABLE IF EXISTS public."EntityDoi"
|
||||||
|
ALTER COLUMN entity_type DROP DEFAULT;
|
||||||
|
|
||||||
|
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.042', '2023-12-27 12:00:00.000000+02', now(), 'Change Entity Type To Enum at Entity DOI table');
|
||||||
|
|
||||||
|
END$$;
|
|
@ -1,10 +1,10 @@
|
||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { RouterModule, Routes } from '@angular/router';
|
import { RouterModule, Routes } from '@angular/router';
|
||||||
import { ReloadHelperComponent } from '@app/ui/misc/reload-helper/reload-helper.component';
|
|
||||||
import { Oauth2DialogComponent } from './ui/misc/oauth2-dialog/oauth2-dialog.component';
|
import { Oauth2DialogComponent } from './ui/misc/oauth2-dialog/oauth2-dialog.component';
|
||||||
import { AppComponent } from './app.component';
|
import { AppComponent } from './app.component';
|
||||||
import { AppPermission } from './core/common/enum/permission.enum';
|
import { AppPermission } from './core/common/enum/permission.enum';
|
||||||
import { BreadcrumbService } from './ui/misc/breadcrumb/breadcrumb.service';
|
import { BreadcrumbService } from './ui/misc/breadcrumb/breadcrumb.service';
|
||||||
|
import { ReloadHelperComponent } from './ui/misc/reload-helper/reload-helper.component';
|
||||||
|
|
||||||
const appRoutes: Routes = [
|
const appRoutes: Routes = [
|
||||||
{
|
{
|
||||||
|
@ -71,16 +71,6 @@ const appRoutes: Routes = [
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{
|
|
||||||
path: 'datasetcreatewizard',
|
|
||||||
loadChildren: () => import('./ui/dataset-create-wizard/dataset-create-wizard.module').then(m => m.DatasetCreateWizardModule),
|
|
||||||
data: {
|
|
||||||
breadcrumb: true,
|
|
||||||
title: 'GENERAL.TITLES.DATASETCREATEWIZARD'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
{
|
||||||
path: 'about',
|
path: 'about',
|
||||||
|
@ -100,22 +90,7 @@ const appRoutes: Routes = [
|
||||||
// }
|
// }
|
||||||
// },
|
// },
|
||||||
|
|
||||||
{
|
|
||||||
path: 'quick-wizard',
|
|
||||||
loadChildren: () => import('./ui/quick-wizard/quick-wizard.module').then(m => m.OuickWizardModule),
|
|
||||||
data: {
|
|
||||||
breadcrumb: true,
|
|
||||||
title: "GENERAL.TITLES.QUICK-WIZARD"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: 'dataset-profiles',
|
|
||||||
loadChildren: () => import('./ui/admin/dataset-profile/dataset-profile.module').then(m => m.DatasetProfileModule),
|
|
||||||
data: {
|
|
||||||
breadcrumb: true,
|
|
||||||
title: 'GENERAL.TITLES.DATASET-PROFILES'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
path: 'description-templates',
|
path: 'description-templates',
|
||||||
loadChildren: () => import('./ui/admin/description-template/description-template.module').then(m => m.DescriptionTemplateModule),
|
loadChildren: () => import('./ui/admin/description-template/description-template.module').then(m => m.DescriptionTemplateModule),
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { OverlayModule } from '@angular/cdk/overlay';
|
import { OverlayModule } from '@angular/cdk/overlay';
|
||||||
import { HttpClient, HttpClientModule } from '@angular/common/http';
|
import { HttpClientModule } from '@angular/common/http';
|
||||||
import { APP_INITIALIZER, LOCALE_ID, NgModule } from '@angular/core';
|
import { APP_INITIALIZER, LOCALE_ID, NgModule } from '@angular/core';
|
||||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||||
import { MAT_MOMENT_DATE_FORMATS, MatMomentDateModule } from '@angular/material-moment-adapter';
|
import { MAT_MOMENT_DATE_FORMATS, MatMomentDateModule } from '@angular/material-moment-adapter';
|
||||||
|
@ -12,10 +12,7 @@ import { AppComponent } from '@app/app.component';
|
||||||
import { CoreServiceModule } from '@app/core/core-service.module';
|
import { CoreServiceModule } from '@app/core/core-service.module';
|
||||||
import { NotificationModule } from '@app/library/notification/notification.module';
|
import { NotificationModule } from '@app/library/notification/notification.module';
|
||||||
import { LoginModule } from '@app/ui/auth/login/login.module';
|
import { LoginModule } from '@app/ui/auth/login/login.module';
|
||||||
import { DatasetCreateWizardModule } from '@app/ui/dataset-create-wizard/dataset-create-wizard.module';
|
|
||||||
// import { BreadcrumbModule } from '@app/ui/misc/breadcrumb/breadcrumb.module';
|
// import { BreadcrumbModule } from '@app/ui/misc/breadcrumb/breadcrumb.module';
|
||||||
import { HelpContentModule } from '@app/ui/misc/help-content/help-content.module';
|
|
||||||
import { NavigationModule } from '@app/ui/misc/navigation/navigation.module';
|
|
||||||
import { ReloadHelperComponent } from '@app/ui/misc/reload-helper/reload-helper.component';
|
import { ReloadHelperComponent } from '@app/ui/misc/reload-helper/reload-helper.component';
|
||||||
import { NavbarModule } from '@app/ui/navbar/navbar.module';
|
import { NavbarModule } from '@app/ui/navbar/navbar.module';
|
||||||
import { SidebarModule } from '@app/ui/sidebar/sidebar.module';
|
import { SidebarModule } from '@app/ui/sidebar/sidebar.module';
|
||||||
|
@ -138,12 +135,9 @@ export function InstallationConfigurationFactory(appConfig: ConfigurationService
|
||||||
LoginModule,
|
LoginModule,
|
||||||
//Ui
|
//Ui
|
||||||
NotificationModule,
|
NotificationModule,
|
||||||
NavigationModule,
|
|
||||||
// BreadcrumbModule,
|
// BreadcrumbModule,
|
||||||
HelpContentModule,
|
|
||||||
ReactiveFormsModule,
|
ReactiveFormsModule,
|
||||||
FormsModule,
|
FormsModule,
|
||||||
DatasetCreateWizardModule,
|
|
||||||
NavbarModule,
|
NavbarModule,
|
||||||
SidebarModule,
|
SidebarModule,
|
||||||
NgcCookieConsentModule.forRoot(cookieConfig),
|
NgcCookieConsentModule.forRoot(cookieConfig),
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
export enum ApiMessageCode {
|
|
||||||
NO_MESSAGE = 0,
|
|
||||||
SUCCESS_MESSAGE = 200,
|
|
||||||
WARN_MESSAGE = 300,
|
|
||||||
ERROR_MESSAGE = 400,
|
|
||||||
DEFAULT_ERROR_MESSAGE = 444,
|
|
||||||
VALIDATION_MESSAGE = 445
|
|
||||||
}
|
|
|
@ -1,12 +0,0 @@
|
||||||
export enum AuthProvider {
|
|
||||||
Google = 1,
|
|
||||||
Facebook = 2,
|
|
||||||
Twitter = 3,
|
|
||||||
LinkedIn = 4,
|
|
||||||
//NativeLogin=5,
|
|
||||||
B2Access = 6,
|
|
||||||
ORCID = 7,
|
|
||||||
OpenAire = 8,
|
|
||||||
Configurable = 9,
|
|
||||||
Zenodo = 10
|
|
||||||
}
|
|
|
@ -1,4 +0,0 @@
|
||||||
export enum ConfigurableProviderType {
|
|
||||||
Oauth2 = "oauth2",
|
|
||||||
Saml2 = "saml2"
|
|
||||||
}
|
|
|
@ -1,4 +0,0 @@
|
||||||
export enum DatasetProfileComboBoxType {
|
|
||||||
Autocomplete = "autocomplete",
|
|
||||||
WordList = "wordlist"
|
|
||||||
}
|
|
|
@ -1,28 +0,0 @@
|
||||||
export enum DatasetProfileFieldViewStyle {
|
|
||||||
TextArea = "textarea",
|
|
||||||
RichTextArea = "richTextarea",
|
|
||||||
Table = "table",
|
|
||||||
Upload = "upload",
|
|
||||||
BooleanDecision = "booleanDecision",
|
|
||||||
ComboBox = "combobox",
|
|
||||||
CheckBox = "checkBox",
|
|
||||||
FreeText = "freetext",
|
|
||||||
RadioBox = "radiobox",
|
|
||||||
DatePicker = "datePicker",
|
|
||||||
InternalDmpEntities = "internalDmpEntities",
|
|
||||||
ExternalDatasets = "externalDatasets",
|
|
||||||
DataRepositories = "dataRepositories",
|
|
||||||
PubRepositories = "pubRepositories",
|
|
||||||
JournalRepositories = "journalRepositories",
|
|
||||||
Taxonomies = "taxonomies",
|
|
||||||
Licenses = "licenses",
|
|
||||||
Publications = "publications",
|
|
||||||
Registries = "registries",
|
|
||||||
Services = "services",
|
|
||||||
Tags = "tags",
|
|
||||||
Researchers = "researchers",
|
|
||||||
Organizations = "organizations",
|
|
||||||
DatasetIdentifier = "datasetIdentifier",
|
|
||||||
Currency = "currency",
|
|
||||||
Validation = 'validation'
|
|
||||||
}
|
|
|
@ -1,5 +0,0 @@
|
||||||
export enum DatasetProfileInternalDmpEntitiesType {
|
|
||||||
Researchers = "researchers",
|
|
||||||
Dmps = "dmps",
|
|
||||||
Datasets = "datasets"
|
|
||||||
}
|
|
|
@ -1,5 +0,0 @@
|
||||||
export enum DatasetProfileEnum {
|
|
||||||
SAVED = 0,
|
|
||||||
FINALIZED = 1,
|
|
||||||
DELETED = 99
|
|
||||||
}
|
|
|
@ -1,6 +0,0 @@
|
||||||
export enum DatasetStatus {
|
|
||||||
Draft = 0,
|
|
||||||
Finalized = 1,
|
|
||||||
Canceled = 2,
|
|
||||||
Deleted = 99
|
|
||||||
}
|
|
|
@ -1,5 +0,0 @@
|
||||||
export enum ExternalDatasetTypeEnum{
|
|
||||||
ReusedDataset = "reused_dataset",
|
|
||||||
ProducedDataset = "produced_dataset",
|
|
||||||
Other = "other"
|
|
||||||
}
|
|
|
@ -1,4 +0,0 @@
|
||||||
export enum ExternalDatasetType {
|
|
||||||
Source = 0,
|
|
||||||
Output = 1
|
|
||||||
}
|
|
|
@ -1,4 +0,0 @@
|
||||||
export enum GrantStateType {
|
|
||||||
OnGoing = 0,
|
|
||||||
Finished = 1
|
|
||||||
}
|
|
|
@ -1,4 +0,0 @@
|
||||||
export enum GrantType {
|
|
||||||
External = 0,
|
|
||||||
Internal = 1
|
|
||||||
}
|
|
|
@ -9,11 +9,16 @@ export enum AppPermission {
|
||||||
EditDmpBlueprint = "EditDmpBlueprint",
|
EditDmpBlueprint = "EditDmpBlueprint",
|
||||||
DeleteDmpBlueprint = "DeleteDmpBlueprint",
|
DeleteDmpBlueprint = "DeleteDmpBlueprint",
|
||||||
|
|
||||||
//DmpBlueprint
|
//Description
|
||||||
BrowseDescription = "BrowseDescription",
|
BrowseDescription = "BrowseDescription",
|
||||||
EditDescription = "EditDescription",
|
EditDescription = "EditDescription",
|
||||||
DeleteDescription= "DeleteDescription",
|
DeleteDescription= "DeleteDescription",
|
||||||
|
|
||||||
|
//Dmp
|
||||||
|
BrowseDmp = "BrowseDmp",
|
||||||
|
EditDmp = "EditDmp",
|
||||||
|
DeleteDmp= "DeleteDmp",
|
||||||
|
|
||||||
//DescriptionTemplateType
|
//DescriptionTemplateType
|
||||||
BrowseDescriptionTemplate = "BrowseDescriptionTemplate",
|
BrowseDescriptionTemplate = "BrowseDescriptionTemplate",
|
||||||
EditDescriptionTemplate = "EditDescriptionTemplate",
|
EditDescriptionTemplate = "EditDescriptionTemplate",
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
export enum ProjectType {
|
|
||||||
External = 0,
|
|
||||||
Internal = 1
|
|
||||||
}
|
|
|
@ -1,14 +1,5 @@
|
||||||
export enum RecentActivityOrder {
|
export enum RecentActivityOrder {
|
||||||
UpdatedAt = 0,
|
UpdatedAt = 0,
|
||||||
Label = 1,
|
Label = 1,
|
||||||
Status = 2,
|
Status = 2
|
||||||
|
|
||||||
//TODO: delete them since these are from the prerefactor model
|
|
||||||
LABEL = "label",
|
|
||||||
CREATED = "created",
|
|
||||||
MODIFIED = "modified",
|
|
||||||
FINALIZED = "finalizedAt",
|
|
||||||
PUBLISHED = "publishedAt",
|
|
||||||
DATASETPUBLISHED = "dmp:publishedAt|join|",
|
|
||||||
STATUS = "status"
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
export enum Role {
|
|
||||||
Owner = 0,
|
|
||||||
Member = 1
|
|
||||||
}
|
|
|
@ -1,5 +0,0 @@
|
||||||
export enum SaveType {
|
|
||||||
close = 0,
|
|
||||||
addNew = 1,
|
|
||||||
finalize = 2
|
|
||||||
}
|
|
|
@ -1,4 +0,0 @@
|
||||||
export enum Status {
|
|
||||||
Active = 0,
|
|
||||||
Inactive = 1
|
|
||||||
}
|
|
|
@ -6,6 +6,7 @@ export enum ValidationType {
|
||||||
URL = 2
|
URL = 2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//TODO: move this
|
||||||
export class ValidatorURL {
|
export class ValidatorURL {
|
||||||
|
|
||||||
public static regex = 'https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|www\.' +
|
public static regex = 'https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|www\.' +
|
||||||
|
|
|
@ -7,64 +7,43 @@ import { AuthService } from './services/auth/auth.service';
|
||||||
import { ContactSupportService } from './services/contact-support/contact-support.service';
|
import { ContactSupportService } from './services/contact-support/contact-support.service';
|
||||||
import { CultureService } from './services/culture/culture-service';
|
import { CultureService } from './services/culture/culture-service';
|
||||||
import { LanguageInfoService } from './services/culture/language-info-service';
|
import { LanguageInfoService } from './services/culture/language-info-service';
|
||||||
import { CurrencyService } from './services/currency/currency.service';
|
|
||||||
import { DashboardService } from './services/dashboard/dashboard.service';
|
import { DashboardService } from './services/dashboard/dashboard.service';
|
||||||
import { DatasetProfileService } from './services/dataset-profile/dataset-profile.service';
|
import { DepositService } from './services/deposit/deposit.service';
|
||||||
import { DatasetWizardService } from './services/dataset-wizard/dataset-wizard.service';
|
|
||||||
import { DatasetExternalAutocompleteService } from './services/dataset/dataset-external-autocomplete.service';
|
|
||||||
import { DatasetService } from './services/dataset/dataset.service';
|
|
||||||
import { DepositRepositoriesService } from './services/deposit-repositories/deposit-repositories.service';
|
|
||||||
import { DescriptionTemplateTypeService } from './services/description-template-type/description-template-type.service';
|
import { DescriptionTemplateTypeService } from './services/description-template-type/description-template-type.service';
|
||||||
import { DmpBlueprintService } from './services/dmp/dmp-blueprint.service';
|
import { DmpBlueprintService } from './services/dmp/dmp-blueprint.service';
|
||||||
import { DmpInvitationService } from './services/dmp/dmp-invitation.service';
|
import { DmpService } from './services/dmp/dmp.service';
|
||||||
import { DmpService, DmpServiceNew } from './services/dmp/dmp.service';
|
|
||||||
import { EmailConfirmationService } from './services/email-confirmation/email-confirmation.service';
|
|
||||||
import { ExternalDataRepositoryService } from './services/external-sources/data-repository/extternal-data-repository.service';
|
|
||||||
import { ExternalDatasetService } from './services/external-sources/dataset/external-dataset.service';
|
|
||||||
import { ExternalSourcesConfigurationService } from './services/external-sources/external-sources-configuration.service';
|
|
||||||
import { ExternalSourcesService } from './services/external-sources/external-sources.service';
|
|
||||||
import { ExternalRegistryService } from './services/external-sources/registry/external-registry.service';
|
|
||||||
import { ExternalResearcherService } from './services/external-sources/researcher/external-researcher.service';
|
|
||||||
import { ExternalServiceService } from './services/external-sources/service/external-service.service';
|
|
||||||
import { FunderService } from './services/funder/funder.service';
|
|
||||||
import { GrantFileUploadService } from './services/grant/grant-file-upload.service';
|
|
||||||
import { GrantService } from './services/grant/grant.service';
|
|
||||||
import { BaseHttpV2Service } from './services/http/base-http-v2.service';
|
import { BaseHttpV2Service } from './services/http/base-http-v2.service';
|
||||||
import { BaseHttpService } from './services/http/base-http.service';
|
|
||||||
import { LanguageService } from './services/language/language.service';
|
import { LanguageService } from './services/language/language.service';
|
||||||
import { LockService } from './services/lock/lock.service';
|
import { LockService } from './services/lock/lock.service';
|
||||||
import { LoggingService } from './services/logging/logging-service';
|
import { LoggingService } from './services/logging/logging-service';
|
||||||
import { MergeEmailConfirmationService } from './services/merge-email-confirmation/merge-email-confirmation.service';
|
|
||||||
import { UiNotificationService } from './services/notification/ui-notification-service';
|
import { UiNotificationService } from './services/notification/ui-notification-service';
|
||||||
import { OrganisationService } from './services/organisation/organisation.service';
|
|
||||||
import { ProgressIndicationService } from './services/progress-indication/progress-indication-service';
|
import { ProgressIndicationService } from './services/progress-indication/progress-indication-service';
|
||||||
import { ProjectService } from './services/project/project.service';
|
|
||||||
import { QuickWizardService } from './services/quick-wizard/quick-wizard.service';
|
|
||||||
import { SearchBarService } from './services/search-bar/search-bar.service';
|
|
||||||
import { TimezoneService } from './services/timezone/timezone-service';
|
import { TimezoneService } from './services/timezone/timezone-service';
|
||||||
import { UnlinkAccountEmailConfirmationService } from './services/unlink-account-email-confirmation/unlink-account-email-confirmation.service';
|
|
||||||
import { UserServiceOld } from './services/user/user.service-old';
|
|
||||||
import { CollectionUtils } from './services/utilities/collection-utils.service';
|
import { CollectionUtils } from './services/utilities/collection-utils.service';
|
||||||
import { TypeUtils } from './services/utilities/type-utils.service';
|
import { TypeUtils } from './services/utilities/type-utils.service';
|
||||||
import { SpecialAuthGuard } from './special-auth-guard.service';
|
import { SpecialAuthGuard } from './special-auth-guard.service';
|
||||||
//import { KeycloakService } from 'keycloak-angular';
|
//import { KeycloakService } from 'keycloak-angular';
|
||||||
|
import { CanDeactivateGuard } from '@app/library/deactivate/can-deactivate.guard';
|
||||||
import { HttpErrorHandlingService } from '@common/modules/errors/error-handling/http-error-handling.service';
|
import { HttpErrorHandlingService } from '@common/modules/errors/error-handling/http-error-handling.service';
|
||||||
import { FilterService } from '@common/modules/text-filter/filter-service';
|
import { FilterService } from '@common/modules/text-filter/filter-service';
|
||||||
import { DescriptionTemplateService } from './services/description-template/description-template.service';
|
import { DescriptionTemplateService } from './services/description-template/description-template.service';
|
||||||
|
import { DescriptionService } from './services/description/description.service';
|
||||||
|
import { FileTransformerService } from './services/file-transformer/file-transformer.service';
|
||||||
import { PrincipalService } from './services/http/principal.service';
|
import { PrincipalService } from './services/http/principal.service';
|
||||||
|
import { LanguageHttpService } from './services/language/language.http.service';
|
||||||
|
import { MaintenanceService } from './services/maintenance/maintenance.service';
|
||||||
|
import { NotificationTemplateService } from './services/notification-template/notification-template.service';
|
||||||
import { ReferenceTypeService } from './services/reference-type/reference-type.service';
|
import { ReferenceTypeService } from './services/reference-type/reference-type.service';
|
||||||
import { ReferenceService } from './services/reference/reference.service';
|
import { ReferenceService } from './services/reference/reference.service';
|
||||||
import { SupportiveMaterialService } from './services/supportive-material/supportive-material.service';
|
import { SupportiveMaterialService } from './services/supportive-material/supportive-material.service';
|
||||||
|
import { TagService } from './services/tag/tag.service';
|
||||||
import { TenantService } from './services/tenant/tenant.service';
|
import { TenantService } from './services/tenant/tenant.service';
|
||||||
import { UserSettingsHttpService } from './services/user-settings/user-settings-http.service';
|
import { UserSettingsHttpService } from './services/user-settings/user-settings-http.service';
|
||||||
import { UserSettingsService } from './services/user-settings/user-settings.service';
|
import { UserSettingsService } from './services/user-settings/user-settings.service';
|
||||||
import { UserService } from './services/user/user.service';
|
import { UserService } from './services/user/user.service';
|
||||||
import { FileUtils } from './services/utilities/file-utils.service';
|
import { FileUtils } from './services/utilities/file-utils.service';
|
||||||
import { QueryParamsService } from './services/utilities/query-params.service';
|
import { QueryParamsService } from './services/utilities/query-params.service';
|
||||||
import { LanguageHttpService } from './services/language/language.http.service';
|
import { FileTransformerHttpService } from './services/file-transformer/file-transformer.http.service';
|
||||||
import { DescriptionService } from './services/description/description.service';
|
|
||||||
import { MaintenanceService } from './services/maintenance/maintenance.service';
|
|
||||||
import { NotificationTemplateService } from './services/notification-template/notification-template.service';
|
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// This is shared module that provides all the services. Its imported only once on the AppModule.
|
// This is shared module that provides all the services. Its imported only once on the AppModule.
|
||||||
|
@ -86,7 +65,6 @@ export class CoreServiceModule {
|
||||||
providers: [
|
providers: [
|
||||||
AuthService,
|
AuthService,
|
||||||
CookieService,
|
CookieService,
|
||||||
BaseHttpService,
|
|
||||||
BaseHttpV2Service,
|
BaseHttpV2Service,
|
||||||
AdminAuthGuard,
|
AdminAuthGuard,
|
||||||
SpecialAuthGuard,
|
SpecialAuthGuard,
|
||||||
|
@ -98,39 +76,14 @@ export class CoreServiceModule {
|
||||||
UiNotificationService,
|
UiNotificationService,
|
||||||
ProgressIndicationService,
|
ProgressIndicationService,
|
||||||
LoggingService,
|
LoggingService,
|
||||||
SearchBarService,
|
|
||||||
DashboardService,
|
DashboardService,
|
||||||
GrantService,
|
DepositService,
|
||||||
ProjectService,
|
|
||||||
FunderService,
|
|
||||||
GrantFileUploadService,
|
|
||||||
DmpService,
|
|
||||||
DepositRepositoriesService,
|
|
||||||
DmpBlueprintService,
|
DmpBlueprintService,
|
||||||
ExternalSourcesService,
|
|
||||||
ExternalSourcesConfigurationService,
|
|
||||||
DatasetService,
|
|
||||||
DatasetWizardService,
|
|
||||||
ExternalDatasetService,
|
|
||||||
ExternalDataRepositoryService,
|
|
||||||
ExternalRegistryService,
|
|
||||||
ExternalResearcherService,
|
|
||||||
ExternalServiceService,
|
|
||||||
DatasetProfileService,
|
|
||||||
UserServiceOld,
|
|
||||||
DmpInvitationService,
|
|
||||||
DatasetExternalAutocompleteService,
|
|
||||||
QuickWizardService,
|
|
||||||
OrganisationService,
|
|
||||||
EmailConfirmationService,
|
|
||||||
ContactSupportService,
|
ContactSupportService,
|
||||||
LanguageService,
|
LanguageService,
|
||||||
LockService,
|
LockService,
|
||||||
PrincipalService,
|
PrincipalService,
|
||||||
SupportiveMaterialService,
|
SupportiveMaterialService,
|
||||||
CurrencyService,
|
|
||||||
MergeEmailConfirmationService,
|
|
||||||
UnlinkAccountEmailConfirmationService,
|
|
||||||
LanguageInfoService,
|
LanguageInfoService,
|
||||||
PrefillingService,
|
PrefillingService,
|
||||||
DescriptionTemplateTypeService,
|
DescriptionTemplateTypeService,
|
||||||
|
@ -146,10 +99,14 @@ export class CoreServiceModule {
|
||||||
TenantService,
|
TenantService,
|
||||||
UserService,
|
UserService,
|
||||||
LanguageHttpService,
|
LanguageHttpService,
|
||||||
DmpServiceNew,
|
DmpService,
|
||||||
DescriptionService,
|
DescriptionService,
|
||||||
MaintenanceService,
|
MaintenanceService,
|
||||||
NotificationTemplateService
|
NotificationTemplateService,
|
||||||
|
TagService,
|
||||||
|
CanDeactivateGuard,
|
||||||
|
FileTransformerService,
|
||||||
|
FileTransformerHttpService
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,6 @@ import { JsonParserPipe } from './pipes/json-parser.pipe';
|
||||||
import { DateTimeCultureFormatPipe } from './pipes/date-time-culture-format.pipe';
|
import { DateTimeCultureFormatPipe } from './pipes/date-time-culture-format.pipe';
|
||||||
import {FieldValuePipe} from "@app/core/pipes/field-value.pipe";
|
import {FieldValuePipe} from "@app/core/pipes/field-value.pipe";
|
||||||
import {ColumnClassPipe} from "@app/core/pipes/column-class.pipe";
|
import {ColumnClassPipe} from "@app/core/pipes/column-class.pipe";
|
||||||
import { DatasetInSectioPipe } from './pipes/dataset-in-section.pipe';
|
|
||||||
import { PipeService } from '@common/formatting/pipe.service';
|
import { PipeService } from '@common/formatting/pipe.service';
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -28,7 +27,6 @@ import { PipeService } from '@common/formatting/pipe.service';
|
||||||
JsonParserPipe,
|
JsonParserPipe,
|
||||||
FieldValuePipe,
|
FieldValuePipe,
|
||||||
ColumnClassPipe,
|
ColumnClassPipe,
|
||||||
DatasetInSectioPipe,
|
|
||||||
],
|
],
|
||||||
exports: [
|
exports: [
|
||||||
NgForLimitPipe,
|
NgForLimitPipe,
|
||||||
|
@ -39,7 +37,6 @@ import { PipeService } from '@common/formatting/pipe.service';
|
||||||
JsonParserPipe,
|
JsonParserPipe,
|
||||||
FieldValuePipe,
|
FieldValuePipe,
|
||||||
ColumnClassPipe,
|
ColumnClassPipe,
|
||||||
DatasetInSectioPipe
|
|
||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
EnumUtils,
|
EnumUtils,
|
||||||
|
@ -53,7 +50,6 @@ import { PipeService } from '@common/formatting/pipe.service';
|
||||||
JsonParserPipe,
|
JsonParserPipe,
|
||||||
FieldValuePipe,
|
FieldValuePipe,
|
||||||
ColumnClassPipe,
|
ColumnClassPipe,
|
||||||
DatasetInSectioPipe
|
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class FormattingModule { }
|
export class FormattingModule { }
|
||||||
|
|
|
@ -1,89 +0,0 @@
|
||||||
import { ValidationType } from "../../../common/enum/validation-type";
|
|
||||||
import { UserInfoListingModel } from "../../user/user-info-listing";
|
|
||||||
|
|
||||||
export interface DatasetProfile {
|
|
||||||
label: string;
|
|
||||||
type: string;
|
|
||||||
sections: Section[];
|
|
||||||
pages: Page[];
|
|
||||||
status: number;
|
|
||||||
version: number;
|
|
||||||
description: string;
|
|
||||||
language: string;
|
|
||||||
users: UserInfoListingModel[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Page {
|
|
||||||
id: string;
|
|
||||||
ordinal: number;
|
|
||||||
title: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Section {
|
|
||||||
sections: Section[];
|
|
||||||
fieldSets: FieldSet[];
|
|
||||||
defaultVisibility: boolean;
|
|
||||||
page: string;
|
|
||||||
ordinal: number;
|
|
||||||
id: string;
|
|
||||||
title: string;
|
|
||||||
description: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface FieldSet {
|
|
||||||
id: string;
|
|
||||||
ordinal: number;
|
|
||||||
multiplicity: Multiplicity;
|
|
||||||
title: string;
|
|
||||||
description: string;
|
|
||||||
extendedDescription: string;
|
|
||||||
additionalInformation:string;
|
|
||||||
hasCommentField: boolean;
|
|
||||||
fields: Field[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Multiplicity {
|
|
||||||
min: number;
|
|
||||||
max: number;
|
|
||||||
placeholder: string;
|
|
||||||
tableView: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Field {
|
|
||||||
id: string;
|
|
||||||
ordinal: number;
|
|
||||||
value: string;
|
|
||||||
viewStyle: ViewStyle;
|
|
||||||
datatype: string;
|
|
||||||
page: number;
|
|
||||||
defaultValue: DefaultValue;
|
|
||||||
data: any;
|
|
||||||
visible: Visibility;
|
|
||||||
validations: ValidationType[];
|
|
||||||
schematics: string[];
|
|
||||||
export: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ViewStyle {
|
|
||||||
renderStyle: string;
|
|
||||||
cssClass: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface DefaultValue {
|
|
||||||
type: string;
|
|
||||||
value: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export interface Visibility {
|
|
||||||
rules: Rule[];
|
|
||||||
style: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Rule {
|
|
||||||
ruleType: string;
|
|
||||||
target: string;
|
|
||||||
ruleStyle: string;
|
|
||||||
value: string;
|
|
||||||
valueType: string;
|
|
||||||
}
|
|
|
@ -4,14 +4,13 @@ import { Guid } from "@common/types/guid";
|
||||||
|
|
||||||
export interface AppAccount {
|
export interface AppAccount {
|
||||||
isAuthenticated: boolean;
|
isAuthenticated: boolean;
|
||||||
// permissions: AppPermission[];
|
|
||||||
roles: AppRole[];
|
roles: AppRole[];
|
||||||
permissions: AppPermission[];
|
permissions: AppPermission[];
|
||||||
principal: AppPrincipalInfo;
|
principal: AppPrincipalInfo;
|
||||||
profile: UserProfileInfo;
|
profile: UserProfileInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AppPrincipalInfo{
|
export interface AppPrincipalInfo {
|
||||||
subject: Guid;
|
subject: Guid;
|
||||||
name: string;
|
name: string;
|
||||||
scope: string[];
|
scope: string[];
|
||||||
|
@ -22,6 +21,7 @@ export interface AppPrincipalInfo{
|
||||||
userId: Guid;
|
userId: Guid;
|
||||||
more: Record<string, string[]>
|
more: Record<string, string[]>
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface UserProfileInfo {
|
export interface UserProfileInfo {
|
||||||
culture: string;
|
culture: string;
|
||||||
language: string;
|
language: string;
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
import { UntypedFormBuilder } from '@angular/forms';
|
|
||||||
export abstract class BaseFormModel {
|
|
||||||
public formBuilder: UntypedFormBuilder = new UntypedFormBuilder();
|
|
||||||
}
|
|
|
@ -1,8 +0,0 @@
|
||||||
import { SearchBarType } from "../../../ui/misc/navigation/navigation.component";
|
|
||||||
|
|
||||||
export interface SearchBarItem {
|
|
||||||
id: string;
|
|
||||||
label: string;
|
|
||||||
type: SearchBarType;
|
|
||||||
isPublished: boolean;
|
|
||||||
}
|
|
|
@ -1,9 +0,0 @@
|
||||||
export interface DataRepositoryModel {
|
|
||||||
id: string;
|
|
||||||
name: string;
|
|
||||||
abbreviation: string;
|
|
||||||
uri: string;
|
|
||||||
pid: string;
|
|
||||||
info: string;
|
|
||||||
source: string;
|
|
||||||
}
|
|
|
@ -1,3 +0,0 @@
|
||||||
export class ColumnOrdering {
|
|
||||||
public fields: Array<string> = new Array();
|
|
||||||
}
|
|
|
@ -1,4 +0,0 @@
|
||||||
export class DataTableData<T> {
|
|
||||||
data = new Array<T>();
|
|
||||||
totalCount = 0;
|
|
||||||
}
|
|
|
@ -1,28 +0,0 @@
|
||||||
import { RequestItem } from '../../query/request-item';
|
|
||||||
import { ColumnOrdering } from './column-ordering';
|
|
||||||
|
|
||||||
export class DataTableRequest<T> extends RequestItem<T> {
|
|
||||||
offset = 0;
|
|
||||||
length = 0;
|
|
||||||
public orderings: ColumnOrdering;
|
|
||||||
constructor(offset: number, length: number, orderings: ColumnOrdering) {
|
|
||||||
super();
|
|
||||||
this.length = length;
|
|
||||||
this.offset = offset;
|
|
||||||
this.orderings = orderings;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class DataTableMultiTypeRequest<T> extends RequestItem<T> {
|
|
||||||
dmpOffset = 0;
|
|
||||||
datasetOffset = 0;
|
|
||||||
length = 0;
|
|
||||||
public orderings: ColumnOrdering;
|
|
||||||
constructor(dmpOffset: number, datasetOffset: number, length: number, orderings: ColumnOrdering) {
|
|
||||||
super();
|
|
||||||
this.length = length;
|
|
||||||
this.dmpOffset = dmpOffset;
|
|
||||||
this.datasetOffset = datasetOffset;
|
|
||||||
this.orderings = orderings;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,3 +0,0 @@
|
||||||
export enum AuthType {
|
|
||||||
BEARER = 'Bearer'
|
|
||||||
}
|
|
|
@ -1,17 +0,0 @@
|
||||||
import { Field } from './field';
|
|
||||||
import { Multiplicity } from './multiplicity';
|
|
||||||
|
|
||||||
export interface CompositeField {
|
|
||||||
fields: Array<Field>;
|
|
||||||
ordinal: number;
|
|
||||||
id: string;
|
|
||||||
numbering: string;
|
|
||||||
multiplicity: Multiplicity;
|
|
||||||
multiplicityItems: Array<CompositeField>;
|
|
||||||
title: string;
|
|
||||||
description: string;
|
|
||||||
extendedDescription: string;
|
|
||||||
additionalInformation:string;
|
|
||||||
hasCommentField: boolean;
|
|
||||||
commentFieldValue: string;
|
|
||||||
}
|
|
|
@ -1,8 +0,0 @@
|
||||||
import { Page } from "./page";
|
|
||||||
import { Rule } from "./rule";
|
|
||||||
|
|
||||||
export interface DatasetProfileDefinitionModel {
|
|
||||||
status: number;
|
|
||||||
pages: Page[];
|
|
||||||
rules: Rule[];
|
|
||||||
}
|
|
|
@ -1,4 +0,0 @@
|
||||||
export interface DefaultValue {
|
|
||||||
type: string;
|
|
||||||
value: string;
|
|
||||||
}
|
|
|
@ -1,150 +0,0 @@
|
||||||
import { ExternalDatasetTypeEnum } from "@app/core/common/enum/external-dataset-type-enum";
|
|
||||||
import { DatasetProfileComboBoxType } from "../../../common/enum/dataset-profile-combo-box-type";
|
|
||||||
import { DatasetProfileInternalDmpEntitiesType } from "../../../common/enum/dataset-profile-internal-dmp-entities-type";
|
|
||||||
|
|
||||||
export interface FieldData {
|
|
||||||
label: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface AutoCompleteFieldData extends FieldData {
|
|
||||||
type: DatasetProfileComboBoxType;
|
|
||||||
autoCompleteSingleDataList: AutoCompleteSingleData[];
|
|
||||||
multiAutoComplete: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface AuthAutoCompleteData extends FieldData {
|
|
||||||
url: string;
|
|
||||||
method: string;
|
|
||||||
body: string;
|
|
||||||
path: string;
|
|
||||||
type: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface AutoCompleteSingleData extends FieldData {
|
|
||||||
url: string;
|
|
||||||
optionsRoot: string;
|
|
||||||
autoCompleteOptions: FieldDataOption;
|
|
||||||
autocompleteType: number;
|
|
||||||
hasAuth: boolean;
|
|
||||||
method: string;
|
|
||||||
auth: AuthAutoCompleteData;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface CheckBoxFieldData extends FieldData {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface BooleanDecisionFieldData extends FieldData {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface FreeTextFieldData extends FieldData {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface RadioBoxFieldData extends FieldData {
|
|
||||||
options: Array<FieldDataOption>;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface TextAreaFieldData extends FieldData {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface RichTextAreaFieldData extends FieldData {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// export interface TableFieldData extends FieldData {
|
|
||||||
// headers: string[];
|
|
||||||
// rows: Array<string[]>;
|
|
||||||
// }
|
|
||||||
|
|
||||||
export interface UploadFieldData extends FieldData {
|
|
||||||
types: Array<FieldDataOption>;
|
|
||||||
maxFileSizeInMB: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface WordListFieldData extends FieldData {
|
|
||||||
type: DatasetProfileComboBoxType;
|
|
||||||
options: Array<FieldDataOption>;
|
|
||||||
multiList: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface FieldDataOption extends FieldData {
|
|
||||||
label: string;
|
|
||||||
value: string;
|
|
||||||
source: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface DatePickerFieldData extends FieldData {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ResearchersAutoCompleteFieldData extends FieldData {
|
|
||||||
type: DatasetProfileInternalDmpEntitiesType;
|
|
||||||
multiAutoComplete: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface DatasetsAutoCompleteFieldData extends FieldData {
|
|
||||||
type: DatasetProfileInternalDmpEntitiesType;
|
|
||||||
multiAutoComplete: boolean;
|
|
||||||
autoCompleteType: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface DmpsAutoCompleteFieldData extends FieldData {
|
|
||||||
type: DatasetProfileInternalDmpEntitiesType;
|
|
||||||
multiAutoComplete: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ExternalDatasetsFieldData extends FieldData {
|
|
||||||
multiAutoComplete: boolean;
|
|
||||||
type?: ExternalDatasetTypeEnum;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface DataRepositoriesFieldData extends FieldData {
|
|
||||||
multiAutoComplete: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface TaxonomiesFieldData extends FieldData {
|
|
||||||
multiAutoComplete: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface LicensesFieldData extends FieldData {
|
|
||||||
multiAutoComplete: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface PublicationsFieldData extends FieldData {
|
|
||||||
multiAutoComplete: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface RegistriesFieldData extends FieldData {
|
|
||||||
multiAutoComplete: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ServicesFieldData extends FieldData {
|
|
||||||
multiAutoComplete: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface TagsFieldData extends FieldData {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ResearchersFieldData extends FieldData {
|
|
||||||
multiAutoComplete: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface OrganizationsFieldData extends AutoCompleteFieldData {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface DatasetIdentifierFieldData extends FieldData {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface CurrencyFieldData extends FieldData {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ValidationFieldData extends FieldData {
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,51 +0,0 @@
|
||||||
// import { FormGroup } from "@angular/forms";
|
|
||||||
// import { JsonSerializer } from "../../../common/types/json/json-serializer";
|
|
||||||
// import { Serializable } from "../../../common/types/json/serializable";
|
|
||||||
// import { BaseModel } from "../../../models/BaseModel";
|
|
||||||
// import { CompositeField } from "./composite-field";
|
|
||||||
|
|
||||||
// export class FieldGroup extends BaseModel implements Serializable<FieldGroup> {
|
|
||||||
// public id: string;
|
|
||||||
// public title: string;
|
|
||||||
// public section: string;
|
|
||||||
// public value: string;
|
|
||||||
// public description: string;
|
|
||||||
// public extendedDescription: string;
|
|
||||||
// public defaultVisibility: boolean;
|
|
||||||
// public page: number;
|
|
||||||
// public compositeFields: Array<CompositeField> = new Array<CompositeField>();
|
|
||||||
|
|
||||||
// fromJSONObject(item: any): FieldGroup {
|
|
||||||
// this.id = item.id;
|
|
||||||
// this.title = item.title;
|
|
||||||
// this.value = item.value;
|
|
||||||
// this.description = item.description;
|
|
||||||
// this.extendedDescription = item.extendedDescription;
|
|
||||||
// this.defaultVisibility = item.defaultVisibility;
|
|
||||||
// this.page = item.page;
|
|
||||||
// this.compositeFields = new JsonSerializer<CompositeField>(CompositeField).fromJSONArray(item.compositeFields);
|
|
||||||
// return this;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// buildForm(): FormGroup {
|
|
||||||
// const formGroup: FormGroup = this.formBuilder.group({
|
|
||||||
// /* id: [this.id],
|
|
||||||
// title: [this.title],
|
|
||||||
// value: [this.value],
|
|
||||||
// description: [this.description],
|
|
||||||
// extendedDescription: [this.extendedDescription],
|
|
||||||
// defaultVisibility: [this.defaultVisibility],
|
|
||||||
// page: [this.page] */
|
|
||||||
// });
|
|
||||||
// const compositeFieldsFormArray = new Array<FormGroup>();
|
|
||||||
// if (this.compositeFields) {
|
|
||||||
// this.compositeFields.forEach(item => {
|
|
||||||
// const form: FormGroup = item.buildForm();
|
|
||||||
// compositeFieldsFormArray.push(form);
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
// formGroup.addControl('compositeFields', this.formBuilder.array(compositeFieldsFormArray));
|
|
||||||
|
|
||||||
// return formGroup;
|
|
||||||
// }
|
|
||||||
// }
|
|
|
@ -1,26 +0,0 @@
|
||||||
import { ValidationType } from "../../common/enum/validation-type";
|
|
||||||
import { DefaultValue } from "./default-value";
|
|
||||||
import { Multiplicity } from "./multiplicity";
|
|
||||||
import { ViewStyle } from "./view-style";
|
|
||||||
|
|
||||||
export interface Field {
|
|
||||||
|
|
||||||
id: string;
|
|
||||||
title: string;
|
|
||||||
value: any;
|
|
||||||
defaultValue: DefaultValue;
|
|
||||||
description: string;
|
|
||||||
numbering: string;
|
|
||||||
extendedDescription: string;
|
|
||||||
additionalInformation: string;
|
|
||||||
viewStyle: ViewStyle;
|
|
||||||
defaultVisibility: boolean;
|
|
||||||
page: number;
|
|
||||||
multiplicity: Multiplicity;
|
|
||||||
multiplicityItems: Array<Field>;
|
|
||||||
data: any;
|
|
||||||
validations: Array<ValidationType>;
|
|
||||||
validationRequired;
|
|
||||||
validationURL;
|
|
||||||
ordinal: number;
|
|
||||||
}
|
|
|
@ -1,6 +0,0 @@
|
||||||
export enum HtmlMethod {
|
|
||||||
GET = 'GET',
|
|
||||||
POST = 'POST',
|
|
||||||
PUT = 'PUT',
|
|
||||||
PATCH = 'PATCH'
|
|
||||||
}
|
|
|
@ -1,9 +0,0 @@
|
||||||
|
|
||||||
|
|
||||||
export interface Multiplicity {
|
|
||||||
min: number;
|
|
||||||
max: number;
|
|
||||||
placeholder: string;
|
|
||||||
tableView: boolean;
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
import { Section } from "./section";
|
|
||||||
|
|
||||||
export interface Page {
|
|
||||||
ordinal: number;
|
|
||||||
title: string;
|
|
||||||
sections: Array<Section>;
|
|
||||||
}
|
|
|
@ -1,13 +0,0 @@
|
||||||
import { CompositeField } from "./composite-field";
|
|
||||||
|
|
||||||
export interface Section {
|
|
||||||
sections: Array<Section>;
|
|
||||||
defaultVisibility: boolean;
|
|
||||||
page: number;
|
|
||||||
numbering: string;
|
|
||||||
ordinal: number;
|
|
||||||
id: string;
|
|
||||||
title: string;
|
|
||||||
description: string;
|
|
||||||
compositeFields: Array<CompositeField>;
|
|
||||||
}
|
|
|
@ -1,4 +0,0 @@
|
||||||
export interface ViewStyle {
|
|
||||||
cssClass: string;
|
|
||||||
renderStyle: string;
|
|
||||||
}
|
|
|
@ -1,34 +0,0 @@
|
||||||
import { UntypedFormGroup, UntypedFormBuilder } from '@angular/forms';
|
|
||||||
import { isNullOrUndefined } from '@app/utilities/enhancers/utils';
|
|
||||||
|
|
||||||
export class DatasetIdModel {
|
|
||||||
identifier: string;
|
|
||||||
type: string;
|
|
||||||
|
|
||||||
constructor(data: any) {
|
|
||||||
try{
|
|
||||||
const parsed = JSON.parse(data);
|
|
||||||
if (!isNullOrUndefined(parsed)) {
|
|
||||||
if(typeof parsed !== 'string'){
|
|
||||||
this.identifier = parsed.identifier;
|
|
||||||
this.type = parsed.type;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
const parsedObjectFromString = JSON.parse(parsed);
|
|
||||||
this.identifier = parsedObjectFromString.identifier;
|
|
||||||
this.type = parsedObjectFromString.type;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch(error){
|
|
||||||
console.warn('Could not parse DatasetIdModel');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
buildForm(): UntypedFormGroup {
|
|
||||||
return new UntypedFormBuilder().group({
|
|
||||||
identifier: [this.identifier],
|
|
||||||
type: [this.type]
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,25 +0,0 @@
|
||||||
import { DatasetProfileModel } from './dataset-profile';
|
|
||||||
|
|
||||||
export interface DatasetListingModel {
|
|
||||||
id: string;
|
|
||||||
label: string;
|
|
||||||
dmp: String;
|
|
||||||
dmpId: String;
|
|
||||||
grant: String;
|
|
||||||
grantId: String;
|
|
||||||
grantAbbreviation: String;
|
|
||||||
profile: DatasetProfileModel;
|
|
||||||
dataRepositories: String;
|
|
||||||
registries: String;
|
|
||||||
services: String;
|
|
||||||
description: String;
|
|
||||||
status: number;
|
|
||||||
created: Date;
|
|
||||||
modified: Date;
|
|
||||||
finalizedAt: Date;
|
|
||||||
dmpPublishedAt?: Date;
|
|
||||||
version: number;
|
|
||||||
users: any[];
|
|
||||||
public: boolean;
|
|
||||||
isProfileLatestVersion: boolean;
|
|
||||||
}
|
|
|
@ -1,17 +0,0 @@
|
||||||
import { DatasetProfileModel } from "./dataset-profile";
|
|
||||||
import { GrantOverviewModel } from '../grant/grant-overview';
|
|
||||||
import { DmpOverviewModel } from '../dmp/dmp-overview';
|
|
||||||
|
|
||||||
export interface DatasetOverviewModel {
|
|
||||||
id: string;
|
|
||||||
label: string;
|
|
||||||
status: number;
|
|
||||||
datasetTemplate: DatasetProfileModel;
|
|
||||||
|
|
||||||
users: any[];
|
|
||||||
dmp: DmpOverviewModel;
|
|
||||||
grant: GrantOverviewModel;
|
|
||||||
description: String;
|
|
||||||
public: boolean;
|
|
||||||
modified: Date;
|
|
||||||
}
|
|
|
@ -1,34 +0,0 @@
|
||||||
|
|
||||||
export interface DatasetProfileModel {
|
|
||||||
id: string;
|
|
||||||
label: string;
|
|
||||||
description: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
// export class DatasetProfileModel implements Serializable<DatasetProfileModel> {
|
|
||||||
// public id: String;
|
|
||||||
// public label: String;
|
|
||||||
|
|
||||||
// fromJSONObject(item: any): DatasetProfileModel {
|
|
||||||
// this.id = item.id;
|
|
||||||
// this.label = item.label;
|
|
||||||
|
|
||||||
// return this;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// buildForm(context: ValidationContext = null, disabled: boolean = false): FormGroup {
|
|
||||||
// if (context == null) { context = this.createValidationContext(); }
|
|
||||||
|
|
||||||
// const formGroup = new FormBuilder().group({
|
|
||||||
// id: [{ value: this.id, disabled: disabled }],
|
|
||||||
// });
|
|
||||||
|
|
||||||
// return formGroup;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// createValidationContext(): ValidationContext {
|
|
||||||
// const baseContext: ValidationContext = new ValidationContext();
|
|
||||||
// //baseContext.validation.push({ key: 'id', validators: [Validators.required, BackendErrorValidator(this.validationErrorModel, 'id')] });
|
|
||||||
// return baseContext;
|
|
||||||
// }
|
|
||||||
// }
|
|
|
@ -1,4 +0,0 @@
|
||||||
export interface DatasetUrlListing {
|
|
||||||
label: String;
|
|
||||||
url: String;
|
|
||||||
}
|
|
|
@ -1,27 +0,0 @@
|
||||||
import { DataRepositoryModel } from "../data-repository/data-repository";
|
|
||||||
import { DatasetProfileDefinitionModel } from "../dataset-profile-definition/dataset-profile-definition";
|
|
||||||
import { DmpModel } from "../dmp/dmp";
|
|
||||||
import { ExternalDatasetModel } from "../external-dataset/external-dataset";
|
|
||||||
import { RegistryModel } from "../registry/registry";
|
|
||||||
import { ServiceModel } from "../service/service";
|
|
||||||
import { TagModel } from "../tag/tag";
|
|
||||||
import { DatasetProfileModel } from "./dataset-profile";
|
|
||||||
|
|
||||||
export interface DatasetWizardModel {
|
|
||||||
id?: string;
|
|
||||||
label?: string;
|
|
||||||
uri?: String;
|
|
||||||
description?: String;
|
|
||||||
status?: number;
|
|
||||||
dmp?: DmpModel;
|
|
||||||
dmpSectionIndex?: number;
|
|
||||||
datasetProfileDefinition?: DatasetProfileDefinitionModel;
|
|
||||||
registries?: RegistryModel[];
|
|
||||||
services?: ServiceModel[];
|
|
||||||
dataRepositories?: DataRepositoryModel[];
|
|
||||||
tags?: TagModel[];
|
|
||||||
externalDatasets?: ExternalDatasetModel[];
|
|
||||||
profile?: DatasetProfileModel;
|
|
||||||
isProfileLatestVersion?: Boolean;
|
|
||||||
modified?: Date;
|
|
||||||
}
|
|
|
@ -1,73 +0,0 @@
|
||||||
import { DataRepositoryModel } from '../data-repository/data-repository';
|
|
||||||
import { RegistryModel } from '../registry/registry';
|
|
||||||
import { ServiceModel } from '../service/service';
|
|
||||||
|
|
||||||
export interface DatasetModel {
|
|
||||||
id: String;
|
|
||||||
label: String;
|
|
||||||
profile: String;
|
|
||||||
uri: String;
|
|
||||||
status: String;
|
|
||||||
description: String;
|
|
||||||
services: ServiceModel[];
|
|
||||||
registries: RegistryModel[];
|
|
||||||
dataRepositories: DataRepositoryModel[];
|
|
||||||
}
|
|
||||||
// export class DatasetModel implements Serializable<DatasetModel> {
|
|
||||||
// public id: String;
|
|
||||||
// public label: String;
|
|
||||||
// public profile: String;
|
|
||||||
// public uri: String;
|
|
||||||
// public status: String;
|
|
||||||
// public description: String;
|
|
||||||
// public services: ServiceModel[] = [];
|
|
||||||
// public registries: RegistryModel[] = [];
|
|
||||||
// public dataRepositories: DataRepositoryModel[] = [];
|
|
||||||
|
|
||||||
// public validationErrorModel: ValidationErrorModel = new ValidationErrorModel();
|
|
||||||
|
|
||||||
// fromJSONObject(item: any): DatasetModel {
|
|
||||||
// this.id = item.id;
|
|
||||||
// this.label = item.label;
|
|
||||||
// this.profile = item.profile;
|
|
||||||
// this.uri = item.uri;
|
|
||||||
// this.status = item.status;
|
|
||||||
// this.description = item.description;
|
|
||||||
// this.services = new JsonSerializer<ServiceModel>(ServiceModel).fromJSONArray(item.services);
|
|
||||||
// this.registries = new JsonSerializer<RegistryModel>(RegistryModel).fromJSONArray(item.registries);
|
|
||||||
// this.dataRepositories = new JsonSerializer<DataRepositoryModel>(DataRepositoryModel).fromJSONArray(item.dataRepositories);
|
|
||||||
|
|
||||||
// return this;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// buildForm(context: ValidationContext = null, disabled: boolean = false): FormGroup {
|
|
||||||
// if (context == null) { context = this.createValidationContext(); }
|
|
||||||
|
|
||||||
// const formGroup = new FormBuilder().group({
|
|
||||||
// label: [{ value: this.label, disabled: disabled }, context.getValidation('label').validators],
|
|
||||||
// profile: [{ value: this.profile, disabled: disabled }, context.getValidation('profile').validators],
|
|
||||||
// uri: [{ value: this.uri, disabled: disabled }, context.getValidation('uri').validators],
|
|
||||||
// status: [{ value: this.status, disabled: disabled }, context.getValidation('status').validators],
|
|
||||||
// description: [{ value: this.description, disabled: disabled }, context.getValidation('description').validators],
|
|
||||||
// services: [{ value: this.services, disabled: disabled }, context.getValidation('services').validators],
|
|
||||||
// registries: [{ value: this.registries, disabled: disabled }, context.getValidation('registries').validators],
|
|
||||||
// dataRepositories: [{ value: this.dataRepositories, disabled: disabled }, context.getValidation('dataRepositories').validators]
|
|
||||||
// });
|
|
||||||
|
|
||||||
// return formGroup;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// createValidationContext(): ValidationContext {
|
|
||||||
// const baseContext: ValidationContext = new ValidationContext();
|
|
||||||
// baseContext.validation.push({ key: 'label', validators: [Validators.required, BackendErrorValidator(this.validationErrorModel, 'label')] });
|
|
||||||
// baseContext.validation.push({ key: 'profile', validators: [Validators.required, BackendErrorValidator(this.validationErrorModel, 'profile')] });
|
|
||||||
// baseContext.validation.push({ key: 'uri', validators: [BackendErrorValidator(this.validationErrorModel, 'uri')] });
|
|
||||||
// baseContext.validation.push({ key: 'status', validators: [Validators.required, BackendErrorValidator(this.validationErrorModel, 'status')] });
|
|
||||||
// baseContext.validation.push({ key: 'description', validators: [BackendErrorValidator(this.validationErrorModel, 'description')] });
|
|
||||||
// baseContext.validation.push({ key: 'services', validators: [Validators.required, BackendErrorValidator(this.validationErrorModel, 'services')] });
|
|
||||||
// baseContext.validation.push({ key: 'registries', validators: [Validators.required, BackendErrorValidator(this.validationErrorModel, 'registries')] });
|
|
||||||
// baseContext.validation.push({ key: 'dataRepositories', validators: [Validators.required, BackendErrorValidator(this.validationErrorModel, 'dataRepositories')] });
|
|
||||||
|
|
||||||
// return baseContext;
|
|
||||||
// }
|
|
||||||
// }
|
|
|
@ -1,3 +0,0 @@
|
||||||
export interface DatasetsToBeFinalized {
|
|
||||||
uuids: string[];
|
|
||||||
}
|
|
|
@ -1,7 +0,0 @@
|
||||||
export interface Prefilling {
|
|
||||||
pid: string;
|
|
||||||
name: string;
|
|
||||||
data: any;
|
|
||||||
key: string;
|
|
||||||
tag: string;
|
|
||||||
}
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { DepositConfigurationStatus } from "@app/core/common/enum/deposit-configuration-status";
|
import { DepositConfigurationStatus } from "@app/core/common/enum/deposit-configuration-status";
|
||||||
|
|
||||||
export class DepositConfigurationModel {
|
export class DepositConfiguration {
|
||||||
depositType: DepositConfigurationStatus;
|
depositType: DepositConfigurationStatus;
|
||||||
repositoryId: string;
|
repositoryId: string;
|
||||||
repositoryAuthorizationUrl: string;
|
repositoryAuthorizationUrl: string;
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
|
import { Guid } from "@common/types/guid";
|
||||||
|
|
||||||
export class DepositRequest {
|
export class DepositRequest {
|
||||||
repositoryId: string;
|
repositoryId: string;
|
||||||
dmpId: string;
|
dmpId: Guid;
|
||||||
accessToken: string;
|
accessToken: String;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class DepositCode {
|
export class DepositAuthenticateRequest {
|
||||||
repositoryId: string;
|
repositoryId: string;
|
||||||
code: string;
|
code: string;
|
||||||
}
|
}
|
|
@ -30,13 +30,13 @@ export interface DescriptionTemplateDefinitionPersist {
|
||||||
|
|
||||||
|
|
||||||
export interface DescriptionTemplatePagePersist {
|
export interface DescriptionTemplatePagePersist {
|
||||||
id: Guid;
|
id: string;
|
||||||
ordinal: number;
|
ordinal: number;
|
||||||
title: string;
|
title: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DescriptionTemplateSectionPersist {
|
export interface DescriptionTemplateSectionPersist {
|
||||||
id: Guid;
|
id: string;
|
||||||
ordinal: number;
|
ordinal: number;
|
||||||
defaultVisibility: boolean;
|
defaultVisibility: boolean;
|
||||||
multiplicity: boolean;
|
multiplicity: boolean;
|
||||||
|
@ -49,7 +49,7 @@ export interface DescriptionTemplateSectionPersist {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DescriptionTemplateFieldSetPersist {
|
export interface DescriptionTemplateFieldSetPersist {
|
||||||
id: Guid;
|
id: string;
|
||||||
ordinal: number;
|
ordinal: number;
|
||||||
numbering: string;
|
numbering: string;
|
||||||
title: string;
|
title: string;
|
||||||
|
@ -62,7 +62,7 @@ export interface DescriptionTemplateFieldSetPersist {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DescriptionTemplateFieldPersist {
|
export interface DescriptionTemplateFieldPersist {
|
||||||
id: Guid;
|
id: string;
|
||||||
ordinal: number;
|
ordinal: number;
|
||||||
schematics: string[];
|
schematics: string[];
|
||||||
defaultValue: string;
|
defaultValue: string;
|
||||||
|
|
|
@ -34,13 +34,13 @@ export interface DescriptionTemplateDefinition {
|
||||||
|
|
||||||
|
|
||||||
export interface DescriptionTemplatePage {
|
export interface DescriptionTemplatePage {
|
||||||
id: Guid;
|
id: string;
|
||||||
ordinal: number;
|
ordinal: number;
|
||||||
title: string;
|
title: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DescriptionTemplateSection {
|
export interface DescriptionTemplateSection {
|
||||||
id: Guid;
|
id: string;
|
||||||
ordinal: number;
|
ordinal: number;
|
||||||
defaultVisibility: boolean;
|
defaultVisibility: boolean;
|
||||||
multiplicity: boolean;
|
multiplicity: boolean;
|
||||||
|
@ -55,7 +55,7 @@ export interface DescriptionTemplateSection {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DescriptionTemplateFieldSet {
|
export interface DescriptionTemplateFieldSet {
|
||||||
id: Guid;
|
id: string;
|
||||||
ordinal: number;
|
ordinal: number;
|
||||||
numbering: string;
|
numbering: string;
|
||||||
title: string;
|
title: string;
|
||||||
|
@ -68,7 +68,7 @@ export interface DescriptionTemplateFieldSet {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DescriptionTemplateField {
|
export interface DescriptionTemplateField {
|
||||||
id: Guid;
|
id: string;
|
||||||
ordinal: number;
|
ordinal: number;
|
||||||
numbering?: string;
|
numbering?: string;
|
||||||
schematics?: string[];
|
schematics?: string[];
|
||||||
|
|
|
@ -2,13 +2,11 @@ import { DescriptionStatus } from "@app/core/common/enum/description-status";
|
||||||
import { BaseEntity, BaseEntityPersist } from "@common/base/base-entity.model";
|
import { BaseEntity, BaseEntityPersist } from "@common/base/base-entity.model";
|
||||||
import { Guid } from "@common/types/guid";
|
import { Guid } from "@common/types/guid";
|
||||||
import { DescriptionTemplate } from "../description-template/description-template";
|
import { DescriptionTemplate } from "../description-template/description-template";
|
||||||
import { Dmp, DmpDescriptionTemplatePersist } from "../dmp/dmp";
|
import { Dmp, DmpDescriptionTemplate } from "../dmp/dmp";
|
||||||
import { Reference, ReferencePersist } from "../reference/reference";
|
import { Reference, ReferencePersist } from "../reference/reference";
|
||||||
import { Tag } from "../tag/tag";
|
import { Tag } from "../tag/tag";
|
||||||
import { User } from "../user/user";
|
import { User } from "../user/user";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export interface Description extends BaseEntity {
|
export interface Description extends BaseEntity {
|
||||||
label: string;
|
label: string;
|
||||||
properties: PropertyDefinition;
|
properties: PropertyDefinition;
|
||||||
|
@ -19,7 +17,7 @@ export interface Description extends BaseEntity {
|
||||||
descriptionReferences: DescriptionReference[];
|
descriptionReferences: DescriptionReference[];
|
||||||
descriptionTags: DescriptionTag[];
|
descriptionTags: DescriptionTag[];
|
||||||
descriptionTemplate: DescriptionTemplate;
|
descriptionTemplate: DescriptionTemplate;
|
||||||
dmpDescriptionTemplate: DmpDescriptionTemplatePersist;
|
dmpDescriptionTemplate: DmpDescriptionTemplate;
|
||||||
dmp: Dmp;
|
dmp: Dmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue