diff --git a/dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/FieldEntity.java b/dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/FieldEntity.java index 1c66feca9..0daa35c1b 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/FieldEntity.java +++ b/dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/FieldEntity.java @@ -26,34 +26,13 @@ public class FieldEntity implements DatabaseViewStyleDefinition { private List visibilityRules; @XmlElements({ - @XmlElement(name = FieldType.Names.CheckBox, type = LabelDataEntity.class), - @XmlElement(name = FieldType.Names.Validation, type = LabelDataEntity.class), - @XmlElement(name = FieldType.Names.TextArea, type = LabelDataEntity.class), - @XmlElement(name = FieldType.Names.Taxonomies, type = LabelAndMultiplicityDataEntity.class), - @XmlElement(name = FieldType.Names.Tags, type = LabelDataEntity.class), - @XmlElement(name = FieldType.Names.Services, type = LabelAndMultiplicityDataEntity.class), - @XmlElement(name = FieldType.Names.RichTextarea, type = LabelDataEntity.class), - @XmlElement(name = FieldType.Names.Researchers, type = LabelAndMultiplicityDataEntity.class), - @XmlElement(name = FieldType.Names.Registries, type = LabelAndMultiplicityDataEntity.class), - @XmlElement(name = FieldType.Names.PubRepositories, type = LabelAndMultiplicityDataEntity.class), - @XmlElement(name = FieldType.Names.Publications, type = LabelAndMultiplicityDataEntity.class), - @XmlElement(name = FieldType.Names.Organizations, type = LabelAndMultiplicityDataEntity.class), - @XmlElement(name = FieldType.Names.Licenses, type = LabelAndMultiplicityDataEntity.class), - @XmlElement(name = FieldType.Names.JournalRepositories, type = LabelAndMultiplicityDataEntity.class), - @XmlElement(name = FieldType.Names.FreeText, type = LabelDataEntity.class), - @XmlElement(name = FieldType.Names.ExternalDatasets, type = ExternalDatasetDataEntity.class), - @XmlElement(name = FieldType.Names.DatePicker, type = LabelDataEntity.class), - @XmlElement(name = FieldType.Names.DatasetIdentifier, type = LabelDataEntity.class), - @XmlElement(name = FieldType.Names.DataRepositories, type = LabelAndMultiplicityDataEntity.class), - @XmlElement(name = FieldType.Names.Currency, type = LabelDataEntity.class), - @XmlElement(name = FieldType.Names.BooleanDecision, type = LabelDataEntity.class), - @XmlElement(name = FieldType.Names.Upload, type = UploadDataEntity.class), - @XmlElement(name = FieldType.Names.RadioBox, type = RadioBoxDataEntity.class), - @XmlElement(name = FieldType.Names.Wordlist, type = WordListDataEntity.class), - @XmlElement(name = FieldType.Names.Autocomplete, type = AutoCompleteDataEntity.class), - @XmlElement(name = FieldType.Names.InternalDmpDatasets, type = LabelAndMultiplicityDataEntity.class), - @XmlElement(name = FieldType.Names.InternalDmpDmps, type = LabelAndMultiplicityDataEntity.class), - @XmlElement(name = FieldType.Names.InternalDmpResearchers, type = LabelAndMultiplicityDataEntity.class), + @XmlElement(name = "labelData", type = LabelDataEntity.class), + @XmlElement(name = "labelAndMultiplicityData", type = LabelAndMultiplicityDataEntity.class), + @XmlElement(name = "externalDatasetsData", type = ExternalDatasetDataEntity.class), + @XmlElement(name = "uploadData", type = UploadDataEntity.class), + @XmlElement(name = "radioBoxData", type = RadioBoxDataEntity.class), + @XmlElement(name = "wordListData", type = WordListDataEntity.class), + @XmlElement(name = "autocompleteData", type = AutoCompleteDataEntity.class), }) private BaseFieldDataEntity data; @XmlElementWrapper(name = "validations") diff --git a/dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/importexport/FieldImportExport.java b/dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/importexport/FieldImportExport.java index fdac5ff93..cdf7f9b36 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/importexport/FieldImportExport.java +++ b/dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/importexport/FieldImportExport.java @@ -2,6 +2,7 @@ package eu.eudat.commons.types.descriptiontemplate.importexport; import eu.eudat.commons.enums.FieldType; import eu.eudat.commons.enums.FieldValidationType; +import eu.eudat.commons.types.descriptiontemplate.fielddata.*; import eu.eudat.commons.types.descriptiontemplate.importexport.fielddata.*; import jakarta.xml.bind.annotation.*; @@ -34,34 +35,13 @@ public class FieldImportExport { private FieldType fieldType; @XmlElements({ - @XmlElement(name = FieldType.Names.CheckBox, type = LabelDataImportExport.class), - @XmlElement(name = FieldType.Names.Validation, type = LabelDataImportExport.class), - @XmlElement(name = FieldType.Names.TextArea, type = LabelDataImportExport.class), - @XmlElement(name = FieldType.Names.Taxonomies, type = LabelAndMultiplicityDataImportExport.class), - @XmlElement(name = FieldType.Names.Tags, type = LabelDataImportExport.class), - @XmlElement(name = FieldType.Names.Services, type = LabelAndMultiplicityDataImportExport.class), - @XmlElement(name = FieldType.Names.RichTextarea, type = LabelDataImportExport.class), - @XmlElement(name = FieldType.Names.Researchers, type = LabelAndMultiplicityDataImportExport.class), - @XmlElement(name = FieldType.Names.Registries, type = LabelAndMultiplicityDataImportExport.class), - @XmlElement(name = FieldType.Names.PubRepositories, type = LabelAndMultiplicityDataImportExport.class), - @XmlElement(name = FieldType.Names.Publications, type = LabelAndMultiplicityDataImportExport.class), - @XmlElement(name = FieldType.Names.Organizations, type = LabelAndMultiplicityDataImportExport.class), - @XmlElement(name = FieldType.Names.Licenses, type = LabelAndMultiplicityDataImportExport.class), - @XmlElement(name = FieldType.Names.JournalRepositories, type = LabelAndMultiplicityDataImportExport.class), - @XmlElement(name = FieldType.Names.FreeText, type = LabelDataImportExport.class), - @XmlElement(name = FieldType.Names.ExternalDatasets, type = ExternalDatasetDataImportExport.class), - @XmlElement(name = FieldType.Names.DatePicker, type = LabelDataImportExport.class), - @XmlElement(name = FieldType.Names.DatasetIdentifier, type = LabelDataImportExport.class), - @XmlElement(name = FieldType.Names.DataRepositories, type = LabelAndMultiplicityDataImportExport.class), - @XmlElement(name = FieldType.Names.Currency, type = LabelDataImportExport.class), - @XmlElement(name = FieldType.Names.BooleanDecision, type = LabelDataImportExport.class), - @XmlElement(name = FieldType.Names.Upload, type = UploadDataImportExport.class), - @XmlElement(name = FieldType.Names.RadioBox, type = RadioBoxDataImportExport.class), - @XmlElement(name = FieldType.Names.Wordlist, type = WordListDataImportExport.class), - @XmlElement(name = FieldType.Names.Autocomplete, type = AutoCompleteDataImportExport.class), - @XmlElement(name = FieldType.Names.InternalDmpDatasets, type = LabelAndMultiplicityDataImportExport.class), - @XmlElement(name = FieldType.Names.InternalDmpDmps, type = LabelAndMultiplicityDataImportExport.class), - @XmlElement(name = FieldType.Names.InternalDmpResearchers, type = LabelAndMultiplicityDataImportExport.class), + @XmlElement(name = "labelData", type = LabelDataImportExport.class), + @XmlElement(name = "labelAndMultiplicityData", type = LabelAndMultiplicityDataImportExport.class), + @XmlElement(name = "externalDatasetsData", type = ExternalDatasetDataImportExport.class), + @XmlElement(name = "uploadData", type = UploadDataImportExport.class), + @XmlElement(name = "radioBoxData", type = RadioBoxDataImportExport.class), + @XmlElement(name = "wordListData", type = WordListDataImportExport.class), + @XmlElement(name = "autocompleteData", type = AutoCompleteDataImportExport.class), }) private BaseFieldDataImportExport data; diff --git a/dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/importexport/fielddata/BaseFieldDataImportExport.java b/dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/importexport/fielddata/BaseFieldDataImportExport.java index a2053d32d..7f52b5c00 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/importexport/fielddata/BaseFieldDataImportExport.java +++ b/dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/importexport/fielddata/BaseFieldDataImportExport.java @@ -11,6 +11,8 @@ import java.util.Map; public abstract class BaseFieldDataImportExport { @XmlAttribute(name = "label") private String label; + @XmlAttribute(name = "fieldType") + private FieldType fieldType; public String getLabel() { return label; @@ -19,4 +21,12 @@ public abstract class BaseFieldDataImportExport { public void setLabel(String label) { this.label = label; } + + public FieldType getFieldType() { + return fieldType; + } + + public void setFieldType(FieldType fieldType) { + this.fieldType = fieldType; + } } diff --git a/dmp-backend/core/src/main/java/eu/eudat/model/builder/descriptiontemplatedefinition/FieldBuilder.java b/dmp-backend/core/src/main/java/eu/eudat/model/builder/descriptiontemplatedefinition/FieldBuilder.java index e4da9b38e..a5eda1d26 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/model/builder/descriptiontemplatedefinition/FieldBuilder.java +++ b/dmp-backend/core/src/main/java/eu/eudat/model/builder/descriptiontemplatedefinition/FieldBuilder.java @@ -65,8 +65,13 @@ public class FieldBuilder extends BaseBuilder { if (fields.hasField(this.asIndexer(Field._numbering))) m.setNumbering(d.getNumbering()); if (!visibilityRulesFields.isEmpty() && d.getVisibilityRules() != null) m.setVisibilityRules(this.builderFactory.builder(RuleBuilder.class).authorize(this.authorize).build(visibilityRulesFields, d.getVisibilityRules())); if (!dataFields.isEmpty() && d.getData() != null){ - FieldDataHelperService fieldDataHelperService = this.fieldDataHelperServiceProvider.get(d.getData().getFieldType()); - m.setData(fieldDataHelperService.buildOne(dataFields, d.getData(), this.authorize)); + try { + FieldDataHelperService fieldDataHelperService = this.fieldDataHelperServiceProvider.get(d.getData().getFieldType()); + m.setData(fieldDataHelperService.buildOne(dataFields, d.getData(), this.authorize)); + + } catch (Exception e){ + throw e; + } } models.add(m); diff --git a/dmp-backend/core/src/main/java/eu/eudat/service/fielddatahelper/BaseFieldDataHelperService.java b/dmp-backend/core/src/main/java/eu/eudat/service/fielddatahelper/BaseFieldDataHelperService.java index 9cbbcf60f..be30c7e1a 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/service/fielddatahelper/BaseFieldDataHelperService.java +++ b/dmp-backend/core/src/main/java/eu/eudat/service/fielddatahelper/BaseFieldDataHelperService.java @@ -67,6 +67,7 @@ public abstract class BaseFieldDataHelperService data){ IE xml = this.newImportExportInstanceInternal(); xml.setLabel(data.getLabel()); + xml.setFieldType(data.getFieldType()); return this.dataToImportExportXmlInternal((D)data, xml); } diff --git a/dmp-migration-tool/web/src/main/java/eu/old/eudat/migration/DescriptionTemplateXmlMigrationService.java b/dmp-migration-tool/web/src/main/java/eu/old/eudat/migration/DescriptionTemplateXmlMigrationService.java index 5b8840b58..3d07f3f9c 100644 --- a/dmp-migration-tool/web/src/main/java/eu/old/eudat/migration/DescriptionTemplateXmlMigrationService.java +++ b/dmp-migration-tool/web/src/main/java/eu/old/eudat/migration/DescriptionTemplateXmlMigrationService.java @@ -265,7 +265,7 @@ public class DescriptionTemplateXmlMigrationService { return this.buildLabelAndMultiplicityDataEntity(persist.getLabel(), ((DataRepositoriesData)persist).getMultiAutoComplete(),FieldType.DATA_REPOSITORIES); } if (renderStyle.equals("booleanDecision")){ - return this.buildLabelDataEntity(persist.getLabel(), FieldType.DATA_REPOSITORIES); + return this.buildLabelDataEntity(persist.getLabel(), FieldType.BOOLEAN_DECISION); } if (renderStyle.equals("internalDmpEntities")){ switch (((InternalDmpEntitiesData)persist).getType()){