diff --git a/dmp-backend/core/src/main/java/eu/eudat/commons/enums/DmpBlueprintSystemFieldType.java b/dmp-backend/core/src/main/java/eu/eudat/commons/enums/DmpBlueprintSystemFieldType.java index 283ead523..73a371059 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/commons/enums/DmpBlueprintSystemFieldType.java +++ b/dmp-backend/core/src/main/java/eu/eudat/commons/enums/DmpBlueprintSystemFieldType.java @@ -7,16 +7,16 @@ import java.util.Map; public enum DmpBlueprintSystemFieldType implements DatabaseEnum { - Text((short)0), - HtmlText((short)1), - Researchers((short)2), - Organizations((short)3), + Text((short)0), //TODO: Rename to "Title" + HtmlText((short)1), //TODO: Rename to "Description" + Researchers((short)2), //TODO: replace by reference type + Organizations((short)3), //TODO: replace by reference type Language((short)4), Contact((short)5), - Funder((short)6), - Grant((short)7), - Project((short)8), - License((short)9), + Funder((short)6), //TODO: replace by reference type + Grant((short)7), //TODO: replace by reference type + Project((short)8), //TODO: replace by reference type + License((short)9), //TODO: replace by reference type AccessRights((short)10); private final Short value; diff --git a/dmp-backend/core/src/main/java/eu/eudat/commons/enums/FieldType.java b/dmp-backend/core/src/main/java/eu/eudat/commons/enums/FieldType.java index 186442ad2..97324ed53 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/commons/enums/FieldType.java +++ b/dmp-backend/core/src/main/java/eu/eudat/commons/enums/FieldType.java @@ -6,31 +6,31 @@ import eu.eudat.data.converters.enums.DatabaseEnum; import java.util.Map; public enum FieldType implements DatabaseEnum { - EXTERNAL_SELECT(Names.ExternalSelect), + EXTERNAL_SELECT(Names.ExternalSelect), //TODO: remove SELECT(Names.Select), BOOLEAN_DECISION(Names.BooleanDecision), RADIO_BOX(Names.RadioBox), - INTERNAL_DMP_ENTRIES_RESEARCHERS(Names.InternalDmpResearchers), - INTERNAL_DMP_ENTRIES_DMPS(Names.InternalDmpDmps), - INTERNAL_ENTRIES_DESCRIPTIONS(Names.InternalDmpDescriptions), + INTERNAL_DMP_ENTRIES_RESEARCHERS(Names.InternalDmpResearchers), //TODO: remove + INTERNAL_DMP_ENTRIES_DMPS(Names.InternalDmpDmps), //TODO: rename InternalEntitiesDmps + INTERNAL_DMP_ENTRIES_DATASETS(Names.InternalDmpDescriptions), CHECK_BOX(Names.CheckBox), FREE_TEXT(Names.FreeText), TEXT_AREA(Names.TextArea), RICH_TEXT_AREA(Names.RichTextarea), UPLOAD(Names.Upload), DATE_PICKER(Names.DatePicker), - EXTERNAL_DATASETS(Names.ExternalDatasets), - DATA_REPOSITORIES(Names.DataRepositories), - JOURNAL_REPOSITORIES(Names.JournalRepositories), - PUB_REPOSITORIES(Names.PubRepositories), - LICENSES(Names.Licenses), - TAXONOMIES(Names.Taxonomies), - PUBLICATIONS(Names.Publications), - REGISTRIES(Names.Registries), - SERVICES(Names.Services), + EXTERNAL_DATASETS(Names.ExternalDatasets), //TODO: replace with reference type + DATA_REPOSITORIES(Names.DataRepositories), //TODO: replace with reference type + JOURNAL_REPOSITORIES(Names.JournalRepositories), //TODO: replace with reference type + PUB_REPOSITORIES(Names.PubRepositories), //TODO: replace with reference type + LICENSES(Names.Licenses), //TODO: replace with reference type + TAXONOMIES(Names.Taxonomies), //TODO: replace with reference type + PUBLICATIONS(Names.Publications), //TODO: replace with reference type + REGISTRIES(Names.Registries), //TODO: replace with reference type + SERVICES(Names.Services), //TODO: replace with reference type TAGS(Names.Tags), - RESEARCHERS(Names.Researchers), - ORGANIZATIONS(Names.Organizations), + RESEARCHERS(Names.Researchers), //TODO: replace with reference type + ORGANIZATIONS(Names.Organizations), //TODO: replace with reference type DATASET_IDENTIFIER(Names.DatasetIdentifier), CURRENCY(Names.Currency), VALIDATION(Names.Validation); @@ -43,7 +43,7 @@ public enum FieldType implements DatabaseEnum { public static final String RadioBox = "radiobox"; public static final String InternalDmpResearchers = "internalDmpResearchers"; public static final String InternalDmpDmps = "internalDmpDmps"; - public static final String InternalDmpDescriptions = "internalDmpDescriptions"; + public static final String InternalDmpDescriptions = "internalDmpDatasets"; public static final String CheckBox = "checkBox"; public static final String FreeText = "freetext"; public static final String TextArea = "textarea"; @@ -101,7 +101,7 @@ public enum FieldType implements DatabaseEnum { public static boolean isTextListType(FieldType fieldType){ return fieldType.equals(FieldType.SELECT) || fieldType.equals(FieldType.TAGS) || fieldType.equals(FieldType.INTERNAL_DMP_ENTRIES_RESEARCHERS) || fieldType.equals(FieldType.INTERNAL_DMP_ENTRIES_DMPS) || - fieldType.equals(FieldType.INTERNAL_ENTRIES_DESCRIPTIONS); + fieldType.equals(FieldType.INTERNAL_DMP_ENTRIES_DATASETS); } public static boolean isDateType(FieldType fieldType){ diff --git a/dmp-backend/core/src/main/java/eu/eudat/model/builder/deposit/DescriptionFieldDepositBuilder.java b/dmp-backend/core/src/main/java/eu/eudat/model/builder/deposit/DescriptionFieldDepositBuilder.java index 59c548e0c..ba146f952 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/model/builder/deposit/DescriptionFieldDepositBuilder.java +++ b/dmp-backend/core/src/main/java/eu/eudat/model/builder/deposit/DescriptionFieldDepositBuilder.java @@ -86,7 +86,7 @@ public class DescriptionFieldDepositBuilder extends BaseDepositBuilder m.setFieldType(FieldType.RADIO_BOX); case INTERNAL_DMP_ENTRIES_RESEARCHERS -> m.setFieldType(FieldType.INTERNAL_DMP_ENTRIES_RESEARCHERS); case INTERNAL_DMP_ENTRIES_DMPS -> m.setFieldType(FieldType.INTERNAL_DMP_ENTRIES_DMPS); - case INTERNAL_ENTRIES_DESCRIPTIONS -> m.setFieldType(FieldType.INTERNAL_DMP_ENTRIES_DATASETS); + case INTERNAL_DMP_ENTRIES_DATASETS -> m.setFieldType(FieldType.INTERNAL_DMP_ENTRIES_DATASETS); case CHECK_BOX -> m.setFieldType(FieldType.CHECK_BOX); case FREE_TEXT -> m.setFieldType(FieldType.FREE_TEXT); case TEXT_AREA -> m.setFieldType(FieldType.TEXT_AREA); diff --git a/dmp-backend/core/src/main/java/eu/eudat/model/persist/DescriptionPersist.java b/dmp-backend/core/src/main/java/eu/eudat/model/persist/DescriptionPersist.java index 255e251fe..245287eaf 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/model/persist/DescriptionPersist.java +++ b/dmp-backend/core/src/main/java/eu/eudat/model/persist/DescriptionPersist.java @@ -173,49 +173,49 @@ public class DescriptionPersist { DescriptionTemplateEntity descriptionTemplate = this.isValidGuid(item.getDescriptionTemplateId()) ? this.entityManager.find(DescriptionTemplateEntity.class, item.getDescriptionTemplateId()) : null; DefinitionEntity definition = descriptionTemplate == null ? null : this.xmlHandlingService.fromXmlSafe(DefinitionEntity.class, descriptionTemplate.getDefinition()); return Arrays.asList( - this.spec() - .iff(() -> this.isValidGuid(item.getId())) - .must(() -> this.isValidHash(item.getHash())) - .failOn(DescriptionPersist._hash).failWith(messageSource.getMessage("Validation_Required", new Object[]{DescriptionPersist._hash}, LocaleContextHolder.getLocale())), - this.spec() - .iff(() -> !this.isValidGuid(item.getId())) - .must(() -> !this.isValidHash(item.getHash())) - .failOn(DescriptionPersist._hash).failWith(messageSource.getMessage("Validation_OverPosting", new Object[]{}, LocaleContextHolder.getLocale())), - this.spec() - .must(() -> !this.isEmpty(item.getLabel())) - .failOn(DescriptionPersist._label).failWith(messageSource.getMessage("Validation_Required", new Object[]{DescriptionPersist._label}, LocaleContextHolder.getLocale())), - this.spec() - .iff(() -> !this.isEmpty(item.getLabel())) - .must(() -> this.lessEqualLength(item.getLabel(), DescriptionEntity._labelLength)) - .failOn(DescriptionPersist._label).failWith(messageSource.getMessage("Validation_MaxLength", new Object[]{DescriptionPersist._label}, LocaleContextHolder.getLocale())), - this.spec() - .must(() -> this.isValidGuid(item.getDmpId())) - .failOn(DescriptionPersist._dmpId).failWith(messageSource.getMessage("Validation_Required", new Object[]{DescriptionPersist._dmpId}, LocaleContextHolder.getLocale())), - this.spec() - .iff(() -> item.getStatus() == DescriptionStatus.Finalized) - .must(() -> this.isValidGuid(item.getDescriptionTemplateId())) - .failOn(DescriptionPersist._descriptionTemplateId).failWith(messageSource.getMessage("Validation_Required", new Object[]{DescriptionPersist._descriptionTemplateId}, LocaleContextHolder.getLocale())), - this.spec() - .iff(() -> item.getStatus() == DescriptionStatus.Finalized) - .must(() -> this.isValidGuid(item.getDmpDescriptionTemplateId())) - .failOn(DescriptionPersist._dmpDescriptionTemplateId).failWith(messageSource.getMessage("Validation_Required", new Object[]{DescriptionPersist._dmpDescriptionTemplateId}, LocaleContextHolder.getLocale())), - this.spec() - .must(() -> !this.isNull(item.getStatus())) - .failOn(DescriptionPersist._status).failWith(messageSource.getMessage("Validation_Required", new Object[]{DescriptionPersist._status}, LocaleContextHolder.getLocale())), - this.spec() - .iff(() -> item.getStatus() == DescriptionStatus.Finalized) - .must(() -> !this.isListNullOrEmpty(item.getTags())) - .failOn(DescriptionPersist._tags).failWith(messageSource.getMessage("Validation_Required", new Object[]{DescriptionPersist._tags}, LocaleContextHolder.getLocale())), - - this.spec() - .iff(() -> item.getStatus() == DescriptionStatus.Finalized) - .must(() -> !this.isNull(item.getProperties())) - .failOn(DescriptionPersist._properties).failWith(messageSource.getMessage("Validation_Required", new Object[]{DescriptionPersist._properties}, LocaleContextHolder.getLocale())), - this.refSpec() - .iff(() -> !this.isNull(item.getProperties())) - .on(DescriptionPersist._properties) - .over(item.getProperties()) - .using(() -> this.validatorFactory.validator(PropertyDefinitionPersist.PropertyDefinitionPersistValidator.class).setStatus(item.getStatus()).withDefinition(definition)) +// this.spec() +// .iff(() -> this.isValidGuid(item.getId())) +// .must(() -> this.isValidHash(item.getHash())) +// .failOn(DescriptionPersist._hash).failWith(messageSource.getMessage("Validation_Required", new Object[]{DescriptionPersist._hash}, LocaleContextHolder.getLocale())), +// this.spec() +// .iff(() -> !this.isValidGuid(item.getId())) +// .must(() -> !this.isValidHash(item.getHash())) +// .failOn(DescriptionPersist._hash).failWith(messageSource.getMessage("Validation_OverPosting", new Object[]{}, LocaleContextHolder.getLocale())), +// this.spec() +// .must(() -> !this.isEmpty(item.getLabel())) +// .failOn(DescriptionPersist._label).failWith(messageSource.getMessage("Validation_Required", new Object[]{DescriptionPersist._label}, LocaleContextHolder.getLocale())), +// this.spec() +// .iff(() -> !this.isEmpty(item.getLabel())) +// .must(() -> this.lessEqualLength(item.getLabel(), DescriptionEntity._labelLength)) +// .failOn(DescriptionPersist._label).failWith(messageSource.getMessage("Validation_MaxLength", new Object[]{DescriptionPersist._label}, LocaleContextHolder.getLocale())), +// this.spec() +// .must(() -> this.isValidGuid(item.getDmpId())) +// .failOn(DescriptionPersist._dmpId).failWith(messageSource.getMessage("Validation_Required", new Object[]{DescriptionPersist._dmpId}, LocaleContextHolder.getLocale())), +// this.spec() +// .iff(() -> item.getStatus() == DescriptionStatus.Finalized) +// .must(() -> this.isValidGuid(item.getDescriptionTemplateId())) +// .failOn(DescriptionPersist._descriptionTemplateId).failWith(messageSource.getMessage("Validation_Required", new Object[]{DescriptionPersist._descriptionTemplateId}, LocaleContextHolder.getLocale())), +// this.spec() +// .iff(() -> item.getStatus() == DescriptionStatus.Finalized) +// .must(() -> this.isValidGuid(item.getDmpDescriptionTemplateId())) +// .failOn(DescriptionPersist._dmpDescriptionTemplateId).failWith(messageSource.getMessage("Validation_Required", new Object[]{DescriptionPersist._dmpDescriptionTemplateId}, LocaleContextHolder.getLocale())), +// this.spec() +// .must(() -> !this.isNull(item.getStatus())) +// .failOn(DescriptionPersist._status).failWith(messageSource.getMessage("Validation_Required", new Object[]{DescriptionPersist._status}, LocaleContextHolder.getLocale())), +// this.spec() +// .iff(() -> item.getStatus() == DescriptionStatus.Finalized) +// .must(() -> !this.isListNullOrEmpty(item.getTags())) +// .failOn(DescriptionPersist._tags).failWith(messageSource.getMessage("Validation_Required", new Object[]{DescriptionPersist._tags}, LocaleContextHolder.getLocale())), +// +// this.spec() +// .iff(() -> item.getStatus() == DescriptionStatus.Finalized) +// .must(() -> !this.isNull(item.getProperties())) +// .failOn(DescriptionPersist._properties).failWith(messageSource.getMessage("Validation_Required", new Object[]{DescriptionPersist._properties}, LocaleContextHolder.getLocale())), +// this.refSpec() +// .iff(() -> !this.isNull(item.getProperties())) +// .on(DescriptionPersist._properties) +// .over(item.getProperties()) +// .using(() -> this.validatorFactory.validator(PropertyDefinitionPersist.PropertyDefinitionPersistValidator.class).setStatus(item.getStatus()).withDefinition(definition)) ); } } diff --git a/dmp-backend/core/src/main/java/eu/eudat/model/persist/descriptionproperties/FieldPersist.java b/dmp-backend/core/src/main/java/eu/eudat/model/persist/descriptionproperties/FieldPersist.java index f3bc32ab8..b4937bb3a 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/model/persist/descriptionproperties/FieldPersist.java +++ b/dmp-backend/core/src/main/java/eu/eudat/model/persist/descriptionproperties/FieldPersist.java @@ -130,7 +130,7 @@ public class FieldPersist { .must(() -> this.isUUID(item.getTextValue())) .failOn(FieldPersist._textValue).failWith(messageSource.getMessage("Validation_UnexpectedValue", new Object[]{FieldPersist._textValue}, LocaleContextHolder.getLocale())), this.spec() - .iff(()-> !this.isNull(item.getTextListValue()) && (fieldType.equals(FieldType.INTERNAL_DMP_ENTRIES_DMPS) || fieldType.equals(FieldType.INTERNAL_DMP_ENTRIES_RESEARCHERS) || fieldType.equals(FieldType.INTERNAL_ENTRIES_DESCRIPTIONS))) + .iff(()-> !this.isNull(item.getTextListValue()) && (fieldType.equals(FieldType.INTERNAL_DMP_ENTRIES_DMPS) || fieldType.equals(FieldType.INTERNAL_DMP_ENTRIES_RESEARCHERS) || fieldType.equals(FieldType.INTERNAL_DMP_ENTRIES_DATASETS))) .must(() -> item.getTextListValue().stream().allMatch(this::isUUID)) .failOn(FieldPersist._textListValue).failWith(messageSource.getMessage("Validation_UnexpectedValue", new Object[]{FieldPersist._textListValue}, LocaleContextHolder.getLocale())), this.navSpec() diff --git a/dmp-backend/core/src/main/java/eu/eudat/model/persist/descriptiontemplatedefinition/FieldPersist.java b/dmp-backend/core/src/main/java/eu/eudat/model/persist/descriptiontemplatedefinition/FieldPersist.java index ec02d1b10..e93482197 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/model/persist/descriptiontemplatedefinition/FieldPersist.java +++ b/dmp-backend/core/src/main/java/eu/eudat/model/persist/descriptiontemplatedefinition/FieldPersist.java @@ -154,8 +154,12 @@ public class FieldPersist { .iff(() -> !this.isNull(item.getData()) && item.getData().getFieldType() != null) .on(FieldPersist._data) .over(item.getData()) - .using(() -> this.fieldDataHelperServiceProvider.get(item.getData().getFieldType()).getPersistModelValidator()) - ); + .using(() -> this.fieldDataHelperServiceProvider.get(item.getData().getFieldType()).getPersistModelValidator()), + this.spec() + .iff(() -> !this.isNull(item.getData())) + .must(() -> !this.isNull(item.getData().getFieldType())) + .failOn(FieldPersist._data + '.' + BaseFieldDataPersist._fieldType).failWith(messageSource.getMessage("Validation_Required", new Object[]{BaseFieldDataPersist._fieldType}, LocaleContextHolder.getLocale())) + ); } } diff --git a/dmp-backend/core/src/main/java/eu/eudat/model/persist/descriptiontemplatedefinition/fielddata/BaseFieldDataPersist.java b/dmp-backend/core/src/main/java/eu/eudat/model/persist/descriptiontemplatedefinition/fielddata/BaseFieldDataPersist.java index b09df07c5..d6ec01609 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/model/persist/descriptiontemplatedefinition/fielddata/BaseFieldDataPersist.java +++ b/dmp-backend/core/src/main/java/eu/eudat/model/persist/descriptiontemplatedefinition/fielddata/BaseFieldDataPersist.java @@ -18,7 +18,8 @@ import java.util.List; use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "fieldType", - visible = true) + visible = true, + defaultImpl = LabelDataPersist.class) @JsonSubTypes({ @JsonSubTypes.Type(value = ExternalSelectDataPersist.class, name = FieldType.Names.ExternalSelect), @JsonSubTypes.Type(value = LabelDataPersist.class, name = FieldType.Names.BooleanDecision), diff --git a/dmp-backend/core/src/main/java/eu/eudat/service/description/DescriptionServiceImpl.java b/dmp-backend/core/src/main/java/eu/eudat/service/description/DescriptionServiceImpl.java index 72c5c03bd..2d416db90 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/service/description/DescriptionServiceImpl.java +++ b/dmp-backend/core/src/main/java/eu/eudat/service/description/DescriptionServiceImpl.java @@ -155,12 +155,13 @@ public class DescriptionServiceImpl implements DescriptionService { data.setId(UUID.randomUUID()); data.setIsActive(IsActive.Active); data.setCreatedAt(Instant.now()); + data.setCreatedById(this.userScope.getUserId()); data.setDmpId(model.getDmpId()); data.setDmpDescriptionTemplateId(model.getDmpDescriptionTemplateId()); } - DmpDescriptionTemplateEntity dmpDescriptionTemplate = this.entityManager.find(DmpDescriptionTemplateEntity.class, data.getDescriptionTemplateId()); - if (dmpDescriptionTemplate == null) throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{data.getDescriptionTemplateId(), DmpDescriptionTemplate.class.getSimpleName()}, LocaleContextHolder.getLocale())); + DmpDescriptionTemplateEntity dmpDescriptionTemplate = this.entityManager.find(DmpDescriptionTemplateEntity.class, data.getDmpDescriptionTemplateId()); + if (dmpDescriptionTemplate == null) throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{data.getDmpDescriptionTemplateId(), DmpDescriptionTemplate.class.getSimpleName()}, LocaleContextHolder.getLocale())); DescriptionTemplateEntity descriptionTemplateEntity = this.entityManager.find(DescriptionTemplateEntity.class, model.getDescriptionTemplateId()); if (descriptionTemplateEntity == null) throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{model.getDescriptionTemplateId(), DescriptionTemplate.class.getSimpleName()}, LocaleContextHolder.getLocale())); @@ -385,6 +386,8 @@ public class DescriptionServiceImpl implements DescriptionService { PropertyDefinitionFieldSetItemEntity data = new PropertyDefinitionFieldSetItemEntity(); if (persist == null) return data; if (persist.getFields() != null && !persist.getFields().isEmpty()){ + data.setOrdinal(persist.getOrdinal()); + data.setComment(persist.getComment()); data.setFields(new HashMap<>()); for (String key: persist.getFields().keySet()) { eu.eudat.commons.types.descriptiontemplate.FieldEntity fieldEntity = fieldSetEntity != null ? fieldSetEntity.getAllField().stream().findFirst().orElse(null) : null; @@ -400,7 +403,7 @@ public class DescriptionServiceImpl implements DescriptionService { if (persist == null) return data; if (FieldType.isTextType(fieldType)) { - if (FieldType.UPLOAD.equals(fieldType)){ + if (FieldType.UPLOAD.equals(fieldType) && !this.conventionService.isNullOrEmpty(persist.getTextValue())){ StorageFile storageFile = this.storageFileService.copyToStorage(UUID.fromString(persist.getTextValue()), StorageType.Main, true, new BaseFieldSet().ensure(StorageFile._id)); this.storageFileService.updatePurgeAt(storageFile.getId(), null); data.setTextValue(storageFile.getId().toString()); @@ -415,7 +418,7 @@ public class DescriptionServiceImpl implements DescriptionService { for (UUID id : ids){ if (!existingIds.contains(id)) throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{id, Dmp.class.getSimpleName()}, LocaleContextHolder.getLocale())); } - } if (FieldType.INTERNAL_ENTRIES_DESCRIPTIONS.equals(fieldType) && !this.conventionService.isListNullOrEmpty(persist.getTextListValue())){ + } if (FieldType.INTERNAL_DMP_ENTRIES_DATASETS.equals(fieldType) && !this.conventionService.isListNullOrEmpty(persist.getTextListValue())){ List ids = persist.getTextListValue().stream().map(UUID::fromString).toList(); Set existingIds = this.queryFactory.query(DescriptionQuery.class).ids(ids).isActive(IsActive.Active).collectAs(new BaseFieldSet().ensure(Description._id)).stream().map(DescriptionEntity::getId).collect(Collectors.toSet()); for (UUID id : ids){ diff --git a/dmp-backend/core/src/main/java/eu/eudat/service/fielddatahelper/FieldDataHelperServiceProvider.java b/dmp-backend/core/src/main/java/eu/eudat/service/fielddatahelper/FieldDataHelperServiceProvider.java index 4c4db3cae..570b9c7f3 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/service/fielddatahelper/FieldDataHelperServiceProvider.java +++ b/dmp-backend/core/src/main/java/eu/eudat/service/fielddatahelper/FieldDataHelperServiceProvider.java @@ -24,7 +24,7 @@ public class FieldDataHelperServiceProvider { case REGISTRIES: case SERVICES: case RESEARCHERS: - case INTERNAL_ENTRIES_DESCRIPTIONS: + case INTERNAL_DMP_ENTRIES_DATASETS: case INTERNAL_DMP_ENTRIES_DMPS: case INTERNAL_DMP_ENTRIES_RESEARCHERS: case ORGANIZATIONS: { diff --git a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/radio-box/description-template-editor-radio-box-field.component.html b/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/radio-box/description-template-editor-radio-box-field.component.html index 255585aef..0b64347ff 100644 --- a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/radio-box/description-template-editor-radio-box-field.component.html +++ b/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/radio-box/description-template-editor-radio-box-field.component.html @@ -1,15 +1,17 @@
-
{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-RADIO-BOX-TITLE' +
{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-RADIO-BOX-TITLE' | translate}}
warning_amber - {{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.ERROR-MESSAGES.FIELD-RADIO-AT-LEAST-ONE-REQUIRED'| translate}} + {{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.ERROR-MESSAGES.FIELD-RADIO-AT-LEAST-ONE-REQUIRED'| translate}} + {{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.ERROR-MESSAGES.FIELD-RADIO-AT-LEAST-ONE-REQUIRED' | translate}} + {{form.get('data').get('options').getError('backendError').message}}
@@ -17,14 +19,16 @@
- {{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-RADIO-BOX-LABEL' | translate}} - + {{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-RADIO-BOX-LABEL' | translate}} + {{option.get('label').getError('backendError').message}} + {{'GENERAL.VALIDATION.REQUIRED' | translate}} - {{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-RADIO-BOX-VALUE' | translate}} - + {{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-RADIO-BOX-VALUE' | translate}} + {{option.get('value').getError('backendError').message}} + {{'GENERAL.VALIDATION.REQUIRED' | translate}}
- {{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-MULTIPLE-SELECT' | translate}} + {{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-MULTIPLE-WORDLIST' | translate}} {{form.get('data').get('multipleSelect').getError('backendError').message}} @@ -36,6 +36,8 @@
+ {{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.ERROR-MESSAGES.FIELD-RADIO-AT-LEAST-ONE-REQUIRED' | translate}} + {{form.get('data').get('options').getError('backendError').message}}
diff --git a/dmp-frontend/src/app/ui/admin/description-template/editor/components/section-fieldset/description-template-editor-section-fieldset.component.html b/dmp-frontend/src/app/ui/admin/description-template/editor/components/section-fieldset/description-template-editor-section-fieldset.component.html index 8e97fb165..dc1f89400 100644 --- a/dmp-frontend/src/app/ui/admin/description-template/editor/components/section-fieldset/description-template-editor-section-fieldset.component.html +++ b/dmp-frontend/src/app/ui/admin/description-template/editor/components/section-fieldset/description-template-editor-section-fieldset.component.html @@ -65,7 +65,7 @@ [hasFocus]="fieldset.get('id').value === selectedFieldSetId" [datasetProfileId]="datasetProfileId" [validationErrorModel]="validationErrorModel" - [rootPath]="rootPath"> + [rootPath]="rootPath + 'fieldSets[' + i + '].'"> diff --git a/dmp-frontend/src/app/ui/admin/description-template/editor/description-template-editor.component.ts b/dmp-frontend/src/app/ui/admin/description-template/editor/description-template-editor.component.ts index 027bc2fd4..e6064e396 100644 --- a/dmp-frontend/src/app/ui/admin/description-template/editor/description-template-editor.component.ts +++ b/dmp-frontend/src/app/ui/admin/description-template/editor/description-template-editor.component.ts @@ -616,6 +616,10 @@ export class DescriptionTemplateEditorComponent extends BaseEditor { parentSectionRootPath = parentSectionRootPath + 'sections[' + index +'].' }); + + sectionsArray = parent.form.get('sections') as UntypedFormArray; + + //adding page parent MAYBE NOT NEEDED + try { + const maxOrdinal = sectionsArray.controls.map(control => control.get('ordinal').value).reduce((a, b) => Math.max(a, b)); + section.ordinal = maxOrdinal + 1; + } catch { + section.ordinal = sectionsArray.length; + } + + //store rootPath for next levels/components + this.rootPath = 'definition.pages['+ pageIndex +'].'+ parentSectionRootPath; + + sectionsArray.push(section.buildForm({ rootPath: 'definition.pages['+ pageIndex +'].' + parentSectionRootPath + 'sections[' + sectionsArray.length + '].' })); + // (child.form.parent as FormArray).push(section.buildForm()); + } - - sectionsArray = parent.form.get('sections') as UntypedFormArray; - - //adding page parent MAYBE NOT NEEDED - try { - const maxOrdinal = sectionsArray.controls.map(control => control.get('ordinal').value).reduce((a, b) => Math.max(a, b)); - section.ordinal = maxOrdinal + 1; - } catch { - section.ordinal = sectionsArray.length; - } - - sectionsArray.push(section.buildForm({ rootPath: 'definition.pages['+ pageIndex +'].' + parentSectionRootPath + 'sections[' + sectionsArray.length + '].' })); - // (child.form.parent as FormArray).push(section.buildForm()); - } else { console.error('Section can only be child of a page or another section'); } @@ -687,8 +694,6 @@ export class DescriptionTemplateEditorComponent extends BaseEditor item.buildForm({ rootPath: `${rootPath}sources[${index}].` - }), context.getValidation('sources') - ))); + }) + ), context.getValidation('sources').validators + )); return formGroup; } @@ -1583,8 +1584,9 @@ export class DescriptionTemplateRadioBoxDataEditorModel extends DescriptionTempl this.validationErrorModel ).fromModel(item).buildForm({ rootPath: `${rootPath}options[${index}].` - }), context.getValidation('options') - ))); + }) + ), context.getValidation('options').validators + )); return formGroup; } @@ -1729,8 +1731,9 @@ export class DescriptionTemplateSelectDataEditorModel extends DescriptionTemplat this.validationErrorModel ).fromModel(item).buildForm({ rootPath: `${rootPath}options[${index}].` - }), context.getValidation('options') - ))); + }) + ), context.getValidation('options').validators + )); return formGroup; } diff --git a/dmp-frontend/src/app/ui/admin/dmp-blueprint/editor/dmp-blueprint-editor.component.ts b/dmp-frontend/src/app/ui/admin/dmp-blueprint/editor/dmp-blueprint-editor.component.ts index ab7c183ed..18de7bda0 100644 --- a/dmp-frontend/src/app/ui/admin/dmp-blueprint/editor/dmp-blueprint-editor.component.ts +++ b/dmp-frontend/src/app/ui/admin/dmp-blueprint/editor/dmp-blueprint-editor.component.ts @@ -128,7 +128,9 @@ export class DmpBlueprintEditorComponent extends BaseEditor this.initModelFlags(d['action'])); + this.route.data.subscribe(d => { + this.initModelFlags(d['action']); + }); } private initModelFlags(action: string): void { diff --git a/dmp-frontend/src/app/ui/admin/dmp-blueprint/listing/dmp-blueprint-listing.component.html b/dmp-frontend/src/app/ui/admin/dmp-blueprint/listing/dmp-blueprint-listing.component.html index a8807adfe..a6b6ac261 100644 --- a/dmp-frontend/src/app/ui/admin/dmp-blueprint/listing/dmp-blueprint-listing.component.html +++ b/dmp-frontend/src/app/ui/admin/dmp-blueprint/listing/dmp-blueprint-listing.component.html @@ -90,20 +90,20 @@ more_horiz - - - - -