diff --git a/dmp-backend/core/src/main/java/eu/eudat/commons/enums/FieldDataExternalDatasetType.java b/dmp-backend/core/src/main/java/eu/eudat/commons/enums/FieldDataExternalDatasetType.java deleted file mode 100644 index d2b75a913..000000000 --- a/dmp-backend/core/src/main/java/eu/eudat/commons/enums/FieldDataExternalDatasetType.java +++ /dev/null @@ -1,28 +0,0 @@ -package eu.eudat.commons.enums; - -import com.fasterxml.jackson.annotation.JsonValue; -import eu.eudat.data.converters.enums.DatabaseEnum; - -import java.util.Map; - -public enum FieldDataExternalDatasetType implements DatabaseEnum { - ReusedDataset("reused_dataset"), - ProducedDataset("produced_dataset"), - Other("other"); - private final String value; - - FieldDataExternalDatasetType(String value) { - this.value = value; - } - - @JsonValue - public String getValue() { - return value; - } - - private static final Map map = EnumUtils.getEnumValueMap(FieldDataExternalDatasetType.class); - - public static FieldDataExternalDatasetType of(String i) { - return map.get(i); - } -} 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 0cbac7bad..d803cb38e 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 @@ -18,7 +18,6 @@ public enum FieldType implements DatabaseEnum { UPLOAD(Names.Upload), DATE_PICKER(Names.DatePicker), TAGS(Names.Tags), - EXTERNAL_DATASETS(Names.ExternalDatasets), REFERENCE_TYPES(Names.ReferenceTypes), DATASET_IDENTIFIER(Names.DatasetIdentifier), CURRENCY(Names.Currency), @@ -42,7 +41,6 @@ public enum FieldType implements DatabaseEnum { public static final String Currency = "currency"; public static final String Validation = "validation"; public static final String ReferenceTypes = "referenceTypes"; - public static final String ExternalDatasets = "externalDatasets"; } FieldType(String value) { 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 af80d187d..a3c399d51 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,7 +26,6 @@ public class FieldEntity { @XmlElements({ @XmlElement(name = LabelDataEntity.XmlElementName, type = LabelDataEntity.class), @XmlElement(name = LabelAndMultiplicityDataEntity.XmlElementName, type = LabelAndMultiplicityDataEntity.class), - @XmlElement(name = ExternalDatasetDataEntity.XmlElementName, type = ExternalDatasetDataEntity.class), @XmlElement(name = UploadDataEntity.XmlElementName, type = UploadDataEntity.class), @XmlElement(name = RadioBoxDataEntity.XmlElementName, type = RadioBoxDataEntity.class), @XmlElement(name = SelectDataEntity.XmlElementName, type = SelectDataEntity.class), diff --git a/dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/ExternalDatasetDataEntity.java b/dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/ExternalDatasetDataEntity.java deleted file mode 100644 index 076fbd667..000000000 --- a/dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/ExternalDatasetDataEntity.java +++ /dev/null @@ -1,27 +0,0 @@ -package eu.eudat.commons.types.descriptiontemplate.fielddata; - -import eu.eudat.commons.enums.FieldDataExternalDatasetType; -import eu.eudat.commons.enums.FieldType; -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; -import jakarta.xml.bind.annotation.XmlAttribute; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -import java.util.HashMap; -import java.util.Map; - -@XmlAccessorType(XmlAccessType.FIELD) -public class ExternalDatasetDataEntity extends LabelAndMultiplicityDataEntity { - public static final String XmlElementName = "externalDatasetsData"; - @XmlAttribute(name="type") - private FieldDataExternalDatasetType type; - - public FieldDataExternalDatasetType getType() { - return type; - } - - public void setType(FieldDataExternalDatasetType type) { - this.type = type; - } -} 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 3064ac7aa..0fbaaaf4b 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 @@ -36,7 +36,6 @@ public class FieldImportExport { @XmlElements({ @XmlElement(name = LabelDataImportExport.XmlElementName, type = LabelDataImportExport.class), @XmlElement(name = LabelAndMultiplicityDataImportExport.XmlElementName, type = LabelAndMultiplicityDataImportExport.class), - @XmlElement(name = ExternalDatasetDataImportExport.XmlElementName, type = ExternalDatasetDataImportExport.class), @XmlElement(name = UploadDataImportExport.XmlElementName, type = UploadDataImportExport.class), @XmlElement(name = RadioBoxDataImportExport.XmlElementName, type = RadioBoxDataImportExport.class), @XmlElement(name = SelectDataImportExport.XmlElementName, type = SelectDataImportExport.class), diff --git a/dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/importexport/fielddata/ExternalDatasetDataImportExport.java b/dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/importexport/fielddata/ExternalDatasetDataImportExport.java deleted file mode 100644 index 65c44e9c6..000000000 --- a/dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/importexport/fielddata/ExternalDatasetDataImportExport.java +++ /dev/null @@ -1,21 +0,0 @@ -package eu.eudat.commons.types.descriptiontemplate.importexport.fielddata; - -import eu.eudat.commons.enums.FieldDataExternalDatasetType; -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; -import jakarta.xml.bind.annotation.XmlAttribute; - -@XmlAccessorType(XmlAccessType.FIELD) -public class ExternalDatasetDataImportExport extends LabelAndMultiplicityDataImportExport { - public static final String XmlElementName = "externalDatasetsData"; - @XmlAttribute(name = "type") - private FieldDataExternalDatasetType type; - - public FieldDataExternalDatasetType getType() { - return type; - } - - public void setType(FieldDataExternalDatasetType type) { - this.type = type; - } -} 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 824509e87..209c4935a 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 @@ -91,7 +91,6 @@ public class DescriptionFieldDepositBuilder extends BaseDepositBuilder m.setFieldType(FieldType.RICH_TEXT_AREA); case UPLOAD -> m.setFieldType(FieldType.UPLOAD); case DATE_PICKER -> m.setFieldType(FieldType.DATE_PICKER); - case EXTERNAL_DATASETS -> m.setFieldType(FieldType.EXTERNAL_DATASETS); // case REFERENCE_TYPES -> m.setFieldType(FieldType.REFERENCE_TYPES); //TODO new reference logic case TAGS -> m.setFieldType(FieldType.TAGS); case DATASET_IDENTIFIER -> m.setFieldType(FieldType.DATASET_IDENTIFIER); diff --git a/dmp-backend/core/src/main/java/eu/eudat/model/builder/descriptiontemplatedefinition/fielddata/ExternalDatasetDataBuilder.java b/dmp-backend/core/src/main/java/eu/eudat/model/builder/descriptiontemplatedefinition/fielddata/ExternalDatasetDataBuilder.java deleted file mode 100644 index 31822aef3..000000000 --- a/dmp-backend/core/src/main/java/eu/eudat/model/builder/descriptiontemplatedefinition/fielddata/ExternalDatasetDataBuilder.java +++ /dev/null @@ -1,31 +0,0 @@ -package eu.eudat.model.builder.descriptiontemplatedefinition.fielddata; - -import eu.eudat.commons.types.descriptiontemplate.fielddata.ExternalDatasetDataEntity; -import eu.eudat.convention.ConventionService; -import eu.eudat.model.descriptiontemplatedefinition.fielddata.ExternalDatasetData; -import gr.cite.tools.fieldset.FieldSet; -import gr.cite.tools.logging.LoggerService; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.config.ConfigurableBeanFactory; -import org.springframework.context.annotation.Scope; -import org.springframework.stereotype.Component; - -@Component -@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) -public class ExternalDatasetDataBuilder extends BaseFieldDataBuilder { - - @Autowired - public ExternalDatasetDataBuilder(ConventionService conventionService) { - super(conventionService, new LoggerService(LoggerFactory.getLogger(ExternalDatasetDataBuilder.class))); - } - - protected ExternalDatasetData getInstance() { - return new ExternalDatasetData(); - } - @Override - protected void buildChild(FieldSet fields, ExternalDatasetDataEntity d, ExternalDatasetData m) { - if (fields.hasField(this.asIndexer(ExternalDatasetData._multipleSelect))) m.setMultipleSelect(d.getMultipleSelect()); - if (fields.hasField(this.asIndexer(ExternalDatasetData._type))) m.setType(d.getType()); - } -} diff --git a/dmp-backend/core/src/main/java/eu/eudat/model/builder/filetransformer/DescriptionTemplateDefinitionFileTransformerBuilder.java b/dmp-backend/core/src/main/java/eu/eudat/model/builder/filetransformer/DescriptionTemplateDefinitionFileTransformerBuilder.java index e5b07ea17..6a53778b6 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/model/builder/filetransformer/DescriptionTemplateDefinitionFileTransformerBuilder.java +++ b/dmp-backend/core/src/main/java/eu/eudat/model/builder/filetransformer/DescriptionTemplateDefinitionFileTransformerBuilder.java @@ -169,12 +169,12 @@ public class DescriptionTemplateDefinitionFileTransformerBuilder extends BaseFil // ((ExternalSelectDataFileTransformerModel)m).setMultipleSelect(d.getMultipleSelect()); // ((ExternalSelectDataFileTransformerModel) m).setSources(convertAutoCompleteSingleData(d.getSources())); // } - case ExternalDatasetDataEntity d -> { - m = new ExternalDatasetDataFileTransformerModel(); - m.setLabel(d.getLabel()); - m.setFieldType(FieldType.of(d.getFieldType().getValue())); - ((ExternalDatasetDataFileTransformerModel)m).setType(FieldDataExternalDatasetType.of(d.getType().getValue())); - } +// case ExternalDatasetDataEntity d -> { +// m = new ExternalDatasetDataFileTransformerModel(); +// m.setLabel(d.getLabel()); +// m.setFieldType(FieldType.of(d.getFieldType().getValue())); +// ((ExternalDatasetDataFileTransformerModel)m).setType(FieldDataExternalDatasetType.of(d.getType().getValue())); +// } case RadioBoxDataEntity d -> { m = new RadioBoxDataFileTransformerModel(); m.setLabel(d.getLabel()); diff --git a/dmp-backend/core/src/main/java/eu/eudat/model/descriptiontemplatedefinition/fielddata/ExternalDatasetData.java b/dmp-backend/core/src/main/java/eu/eudat/model/descriptiontemplatedefinition/fielddata/ExternalDatasetData.java deleted file mode 100644 index f7078cdc8..000000000 --- a/dmp-backend/core/src/main/java/eu/eudat/model/descriptiontemplatedefinition/fielddata/ExternalDatasetData.java +++ /dev/null @@ -1,17 +0,0 @@ -package eu.eudat.model.descriptiontemplatedefinition.fielddata; - - -import eu.eudat.commons.enums.FieldDataExternalDatasetType; - -public class ExternalDatasetData extends LabelAndMultiplicityData { - public final static String _type = "type"; - private FieldDataExternalDatasetType type; - - public FieldDataExternalDatasetType getType() { - return type; - } - - public void setType(FieldDataExternalDatasetType type) { - this.type = type; - } -} 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 4c1e3903e..a5731592e 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 @@ -26,7 +26,6 @@ import java.util.List; @JsonSubTypes.Type(value = LabelAndMultiplicityDataPersist.class, name = FieldType.Names.InternalEntitiesDmps), @JsonSubTypes.Type(value = LabelDataPersist.class, name = FieldType.Names.CheckBox), @JsonSubTypes.Type(value = LabelDataPersist.class, name = FieldType.Names.DatePicker), - @JsonSubTypes.Type(value = ExternalDatasetDataPersist.class, name = FieldType.Names.ExternalDatasets), @JsonSubTypes.Type(value = LabelDataPersist.class, name = FieldType.Names.FreeText), @JsonSubTypes.Type(value = ReferenceTypeDataPersist.class, name = FieldType.Names.ReferenceTypes), @JsonSubTypes.Type(value = RadioBoxDataPersist.class, name = FieldType.Names.RadioBox), diff --git a/dmp-backend/core/src/main/java/eu/eudat/model/persist/descriptiontemplatedefinition/fielddata/ExternalDatasetDataPersist.java b/dmp-backend/core/src/main/java/eu/eudat/model/persist/descriptiontemplatedefinition/fielddata/ExternalDatasetDataPersist.java deleted file mode 100644 index 4bbf1edae..000000000 --- a/dmp-backend/core/src/main/java/eu/eudat/model/persist/descriptiontemplatedefinition/fielddata/ExternalDatasetDataPersist.java +++ /dev/null @@ -1,69 +0,0 @@ -package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata; - -import eu.eudat.commons.enums.FieldDataExternalDatasetType; -import gr.cite.tools.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 ExternalDatasetDataPersist extends BaseFieldDataPersist { - - private Boolean multipleSelect = null; - - public static final String _multipleSelect = "multipleSelect"; - - private FieldDataExternalDatasetType type; - - public static final String _type = "type"; - - public Boolean getMultipleSelect() { - return multipleSelect; - } - - public void setMultipleSelect(Boolean multipleSelect) { - this.multipleSelect = multipleSelect; - } - - public FieldDataExternalDatasetType getType() { - return type; - } - - public void setType(FieldDataExternalDatasetType type) { - this.type = type; - } - - @Component(ExternalDatasetDataPersist.ExternalDatasetDataPersistValidator.ValidatorName) - @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) - public static class ExternalDatasetDataPersistValidator extends BaseFieldDataPersistValidator { - - public static final String ValidatorName = "DescriptionTemplate.ExternalDatasetDataPersistValidator"; - - protected ExternalDatasetDataPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource) { - super(conventionService, errors, messageSource); - } - - @Override - protected Class modelClass() { - return ExternalDatasetDataPersist.class; - } - - @Override - protected List specifications(ExternalDatasetDataPersist item) { - List specifications = getBaseSpecifications(item); - specifications.addAll(Arrays.asList( - this.spec() - .must(() -> !this.isNull(item.getMultipleSelect())) - .failOn(ExternalDatasetDataPersist._multipleSelect).failWith(messageSource.getMessage("Validation_Required", new Object[]{ExternalDatasetDataPersist._multipleSelect}, LocaleContextHolder.getLocale())) - )); - return specifications; - } - } - -} diff --git a/dmp-backend/core/src/main/java/eu/eudat/service/fielddatahelper/ExternalDatasetFieldDataHelperService.java b/dmp-backend/core/src/main/java/eu/eudat/service/fielddatahelper/ExternalDatasetFieldDataHelperService.java deleted file mode 100644 index 9fc2ddcb1..000000000 --- a/dmp-backend/core/src/main/java/eu/eudat/service/fielddatahelper/ExternalDatasetFieldDataHelperService.java +++ /dev/null @@ -1,101 +0,0 @@ -package eu.eudat.service.fielddatahelper; - -import eu.eudat.authorization.AuthorizationFlags; -import eu.eudat.commons.types.descriptiontemplate.fielddata.ExternalDatasetDataEntity; -import eu.eudat.commons.types.descriptiontemplate.importexport.fielddata.ExternalDatasetDataImportExport; -import eu.eudat.model.builder.descriptiontemplatedefinition.fielddata.ExternalDatasetDataBuilder; -import eu.eudat.model.descriptiontemplatedefinition.fielddata.ExternalDatasetData; -import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.ExternalDatasetDataPersist; -import gr.cite.tools.data.builder.BuilderFactory; -import gr.cite.tools.fieldset.FieldSet; -import gr.cite.tools.validation.Validator; -import gr.cite.tools.validation.ValidatorFactory; -import org.springframework.stereotype.Component; - -import java.util.EnumSet; -import java.util.List; - -@Component -public class ExternalDatasetFieldDataHelperService extends BaseFieldDataHelperService { - - private final BuilderFactory builderFactory; - private final ValidatorFactory validatorFactory; - - public ExternalDatasetFieldDataHelperService(BuilderFactory builderFactory, ValidatorFactory validatorFactory) { - this.builderFactory = builderFactory; - this.validatorFactory = validatorFactory; - } - - @Override - public ExternalDatasetDataEntity newDataInstanceInternal() { - return new ExternalDatasetDataEntity(); - } - - @Override - public ExternalDatasetData newModelInstanceInternal() { - return new ExternalDatasetData(); - } - - @Override - public ExternalDatasetDataPersist newPersistModelInstanceInternal() { - return new ExternalDatasetDataPersist(); - } - - @Override - protected ExternalDatasetDataImportExport newImportExportInstanceInternal() { - return new ExternalDatasetDataImportExport(); - } - - @Override - public Class getDataClass() { - return ExternalDatasetDataEntity.class; - } - @Override - public Class getModelClass() { - return ExternalDatasetData.class; - } - @Override - public Class getPersistModelClass() { - return ExternalDatasetDataPersist.class; - } - - @Override - public Class getImportExportClass() { - return ExternalDatasetDataImportExport.class; - } - - @Override - public Validator getPersistModelValidator() { - return this.validatorFactory.validator(ExternalDatasetDataPersist.ExternalDatasetDataPersistValidator.class); - } - @Override - public List buildInternal(FieldSet fieldSet, List data, EnumSet authorizationFlags){ - return this.builderFactory.builder(ExternalDatasetDataBuilder.class).authorize(authorizationFlags).build(fieldSet, data); - } - - @Override - protected ExternalDatasetDataEntity applyPersistInternal(ExternalDatasetDataPersist persist, ExternalDatasetDataEntity data) { - data.setMultipleSelect(persist.getMultipleSelect()); - data.setType(persist.getType()); - return data; - } - - @Override - protected ExternalDatasetDataPersist importExportMapDataToPersistInternal(ExternalDatasetDataImportExport data, ExternalDatasetDataPersist persist) { - persist.setMultipleSelect(data.getMultipleSelect()); - persist.setType(data.getType()); - return persist; - } - - @Override - protected ExternalDatasetDataImportExport dataToImportExportXmlInternal(ExternalDatasetDataEntity data, ExternalDatasetDataImportExport xml) { - xml.setMultipleSelect(data.getMultipleSelect()); - xml.setType(data.getType()); - return xml; - } - - @Override - protected boolean isMultiValueInternal(ExternalDatasetDataEntity data) { - return data.getMultipleSelect(); - } -} 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 1ecd6affc..969435922 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 @@ -41,10 +41,6 @@ public class FieldDataHelperServiceProvider { item = this.applicationContext.getBean(UploadFieldDataHelperService.class); break; } - case EXTERNAL_DATASETS: { - item = this.applicationContext.getBean(ExternalDatasetFieldDataHelperService.class); - break; - } case SELECT: { item = this.applicationContext.getBean(SelectFieldDataHelperService.class); break;