diff --git a/dmp-backend/core/src/main/java/eu/eudat/model/persist/ReferencePersist.java b/dmp-backend/core/src/main/java/eu/eudat/model/persist/ReferencePersist.java index f4cb7d973..fa81ef4aa 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/model/persist/ReferencePersist.java +++ b/dmp-backend/core/src/main/java/eu/eudat/model/persist/ReferencePersist.java @@ -201,10 +201,7 @@ public class ReferencePersist { .must(() -> !this.isNull(item.getSourceType())) .failOn(ReferencePersist._sourceType).failWith(messageSource.getMessage("Validation_Required", new Object[]{ReferencePersist._sourceType}, LocaleContextHolder.getLocale())), - this.spec() - .must(() -> !this.isNull(item.getDefinition())) - .failOn(ReferencePersist._definition).failWith(messageSource.getMessage("Validation_Required", new Object[]{ReferencePersist._definition}, LocaleContextHolder.getLocale())), - this.refSpec() + this.refSpec() .iff(() -> !this.isNull(item.getDefinition())) .on(ReferencePersist._definition) .over(item.getDefinition()) diff --git a/dmp-backend/core/src/main/java/eu/eudat/model/persist/dmpproperties/DmpBlueprintValuePersist.java b/dmp-backend/core/src/main/java/eu/eudat/model/persist/dmpproperties/DmpBlueprintValuePersist.java index 89b8e043d..734dcd426 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/model/persist/dmpproperties/DmpBlueprintValuePersist.java +++ b/dmp-backend/core/src/main/java/eu/eudat/model/persist/dmpproperties/DmpBlueprintValuePersist.java @@ -1,6 +1,7 @@ package eu.eudat.model.persist.dmpproperties; import eu.eudat.commons.validation.BaseValidator; +import gr.cite.tools.validation.ValidatorFactory; import gr.cite.tools.validation.specification.Specification; import eu.eudat.convention.ConventionService; import eu.eudat.errorcode.ErrorThesaurusProperties; @@ -53,12 +54,14 @@ public class DmpBlueprintValuePersist { @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) public static class DmpBlueprintValuePersistValidator extends BaseValidator { + private final ValidatorFactory validatorFactory; private final MessageSource messageSource; public static final String ValidatorName = "DmpBlueprintValuePersistValidator"; - protected DmpBlueprintValuePersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource) { + protected DmpBlueprintValuePersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, ValidatorFactory validatorFactory, MessageSource messageSource) { super(conventionService, errors); + this.validatorFactory = validatorFactory; this.messageSource = messageSource; } @@ -70,17 +73,18 @@ public class DmpBlueprintValuePersist { @Override protected List specifications(DmpBlueprintValuePersist item) { return Arrays.asList( - this.spec() - .must(() -> !this.isValidGuid(item.getFieldId())) - .failOn(DmpBlueprintValuePersist._fieldId).failWith(messageSource.getMessage("Validation_Required", new Object[]{DmpBlueprintValuePersist._fieldId}, LocaleContextHolder.getLocale())), - this.spec() - .iff(() -> this.isNull(item.getReferences()) || item.getReferences().isEmpty()) - .must(() -> !this.isEmpty(item.getFieldValue())) - .failOn(DmpBlueprintValuePersist._fieldValue).failWith(messageSource.getMessage("Validation_Required", new Object[]{DmpBlueprintValuePersist._fieldValue}, LocaleContextHolder.getLocale())), - this.spec() - .iff(() -> !this.isNull(item.getReferences()) && !item.getReferences().isEmpty()) - .must(() -> this.isEmpty(item.getFieldValue())) - .failOn(DmpBlueprintValuePersist._fieldValue).failWith(messageSource.getMessage("Validation_UnexpectedValue", new Object[]{DmpBlueprintValuePersist._fieldValue}, LocaleContextHolder.getLocale())) +// this.spec() +// .must(() -> !this.isValidGuid(item.getFieldId())) +// .failOn(DmpBlueprintValuePersist._fieldId).failWith(messageSource.getMessage("Validation_Required", new Object[]{DmpBlueprintValuePersist._fieldId}, LocaleContextHolder.getLocale())), +// this.spec() +// .iff(() -> this.isNull(item.getReferences()) || item.getReferences().isEmpty()) +// .must(() -> !this.isEmpty(item.getFieldValue())) +// .failOn(DmpBlueprintValuePersist._fieldValue).failWith(messageSource.getMessage("Validation_Required", new Object[]{DmpBlueprintValuePersist._fieldValue}, LocaleContextHolder.getLocale())), + this.navSpec() + .iff(() -> !this.isListNullOrEmpty(item.getReferences())) + .on(DmpBlueprintValuePersist._references) + .over(item.getReferences()) + .using((itm) -> this.validatorFactory.validator(ReferencePersist.ReferencePersistValidator.class)) ); } } diff --git a/dmp-backend/core/src/main/java/eu/eudat/model/persist/referencedefinition/FieldPersist.java b/dmp-backend/core/src/main/java/eu/eudat/model/persist/referencedefinition/FieldPersist.java index 95ceaaefc..e4536f3b2 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/model/persist/referencedefinition/FieldPersist.java +++ b/dmp-backend/core/src/main/java/eu/eudat/model/persist/referencedefinition/FieldPersist.java @@ -79,10 +79,7 @@ public class FieldPersist { .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())) + .failOn(FieldPersist._dataType).failWith(messageSource.getMessage("Validation_Required", new Object[]{FieldPersist._dataType}, LocaleContextHolder.getLocale())) ); } } diff --git a/dmp-frontend/src/app/core/services/reference/reference.service.ts b/dmp-frontend/src/app/core/services/reference/reference.service.ts index 6999bf189..8f1012b9a 100644 --- a/dmp-frontend/src/app/core/services/reference/reference.service.ts +++ b/dmp-frontend/src/app/core/services/reference/reference.service.ts @@ -148,6 +148,7 @@ export class ReferenceService { lookup.project = { fields: [ nameof(x => x.id), + nameof(x => x.hash), nameof(x => x.label), nameof(x => x.type), nameof(x => x.description), diff --git a/dmp-frontend/src/app/ui/dmp/dmp-editor-blueprint/dmp-editor.component.html b/dmp-frontend/src/app/ui/dmp/dmp-editor-blueprint/dmp-editor.component.html index ca2aefe83..c34847d02 100644 --- a/dmp-frontend/src/app/ui/dmp/dmp-editor-blueprint/dmp-editor.component.html +++ b/dmp-frontend/src/app/ui/dmp/dmp-editor-blueprint/dmp-editor.component.html @@ -179,13 +179,6 @@
-
-
- -
-
@@ -193,53 +186,66 @@
drag_indicator
- +
{{enumUtils.toDmpContactTypeString(contactType)}}
-
- - {{'DMP-EDITOR.FIELDS1.USER' | translate}} - - {{contact.get('userId').getError('backendError').message}} - {{'GENERAL.VALIDATION.REQUIRED' | translate}} - -
-
-
- - {{'DMP-EDITOR.FIELDS1.FIRST-NAME' | translate}} - - {{contact.get('firstName').getError('backendError').message}} - {{'GENERAL.VALIDATION.REQUIRED' | translate}} - -
-
- - {{'DMP-EDITOR.FIELDS1.LAST-NAME' | translate}} - - {{contact.get('lastName').getError('backendError').message}} - {{'GENERAL.VALIDATION.REQUIRED' | translate}} - -
-
- - {{'DMP-EDITOR.FIELDS1.EMAIL' | translate}} - - {{contact.get('email').getError('backendError').message}} - {{'GENERAL.VALIDATION.REQUIRED' | translate}} - +
+
+
+ + {{'DMP-EDITOR.FIELDS1.USER' | translate}} + + {{contact.get('userId').getError('backendError').message}} + {{'GENERAL.VALIDATION.REQUIRED' | translate}} + +
+ +
+ + {{'DMP-EDITOR.FIELDS1.FIRST-NAME' | translate}} + + {{contact.get('firstName').getError('backendError').message}} + {{'GENERAL.VALIDATION.REQUIRED' | translate}} + +
+
+ + {{'DMP-EDITOR.FIELDS1.LAST-NAME' | translate}} + + {{contact.get('lastName').getError('backendError').message}} + {{'GENERAL.VALIDATION.REQUIRED' | translate}} + +
+
+ + {{'DMP-EDITOR.FIELDS1.EMAIL' | translate}} + + {{contact.get('email').getError('backendError').message}} + {{'GENERAL.VALIDATION.REQUIRED' | translate}} + +
+
- +
+ +
{{formGroup.get('properties').get('contacts').getError('backendError').message}} {{'GENERAL.VALIDATION.REQUIRED' | translate}}
+
+
+ +
+
@@ -252,55 +258,56 @@ {{'GENERAL.VALIDATION.REQUIRED' | translate}}
-
-
- - - -
-
- - - - - - +
+
+ + + +
+
+ + + + + + + - -
-
- - - -
-
- - - +
+
+ + + +
+
+ + + +
- -
- {{formGroup.get('descriptionTemplates').get(section.id).value | json}} -
-
-
-
{{'DMP-EDITOR.FIELDS.DESCRIPTION-TEMPLATES' | translate}}
- - {{'DMP-EDITOR.FIELDS.DESCRIPTION-TEMPLATES-HINT' | translate}} - - - {{formGroup.get('descriptionTemplates').get(section.id).getError('backendError').message}} - {{'GENERAL.VALIDATION.REQUIRED' | translate}} - -
- {{'DMP-EDITOR.NO-TEMPLATE-MESSAGE' | translate}} +
+ {{formGroup.get('descriptionTemplates').get(section.id).value | json}} +
+
+
+
{{'DMP-EDITOR.FIELDS.DESCRIPTION-TEMPLATES' | translate}}
+ + {{'DMP-EDITOR.FIELDS.DESCRIPTION-TEMPLATES-HINT' | translate}} + + + {{formGroup.get('descriptionTemplates').get(section.id).getError('backendError').message}} + {{'GENERAL.VALIDATION.REQUIRED' | translate}} + +
+ {{'DMP-EDITOR.NO-TEMPLATE-MESSAGE' | translate}} +
@@ -312,5 +319,4 @@
-
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dmp-frontend/src/app/ui/reference/reference-field/reference-field.component.html b/dmp-frontend/src/app/ui/reference/reference-field/reference-field.component.html index e7cfc285f..9b0380701 100644 --- a/dmp-frontend/src/app/ui/reference/reference-field/reference-field.component.html +++ b/dmp-frontend/src/app/ui/reference/reference-field/reference-field.component.html @@ -5,6 +5,7 @@ {{form.getError('backendError').message}} {{'GENERAL.VALIDATION.REQUIRED' | translate}} +{{form.errors | json}}
{{'REFERENCE-FIELD.COULD-NOT-FIND-MESSAGE' | translate}} {{'REFERENCE-FIELD.ACTIONS.INSERT-MANUALLY' | translate}}