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 cfb10e4fa..3dda56cbe 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 @@ -7,7 +7,7 @@ import java.util.Map; public enum FieldType implements DatabaseEnum { AUTO_COMPLETE(Names.Autocomplete), - WORD_LIST(Names.Wordlist), + SELECT(Names.Select), BOOLEAN_DECISION(Names.BooleanDecision), RADIO_BOX(Names.RadioBox), INTERNAL_DMP_ENTRIES_RESEARCHERS(Names.InternalDmpResearchers), @@ -39,7 +39,7 @@ public enum FieldType implements DatabaseEnum { public static class Names { public static final String ComboBox = "combobox"; public static final String Autocomplete = "autocomplete"; - public static final String Wordlist = "wordlist"; + public static final String Select = "wordlist"; public static final String BooleanDecision = "booleanDecision"; public static final String RadioBox = "radiobox"; public static final String InternalDmpEntities = "internalDmpEntities"; 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 0daa35c1b..9f5f65558 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 @@ -1,7 +1,6 @@ package eu.eudat.commons.types.descriptiontemplate; import eu.eudat.commons.enums.FieldValidationType; -import eu.eudat.commons.enums.FieldType; import eu.eudat.commons.types.common.DatabaseViewStyleDefinition; import eu.eudat.commons.types.descriptiontemplate.fielddata.*; import jakarta.xml.bind.annotation.*; @@ -31,8 +30,8 @@ public class FieldEntity implements DatabaseViewStyleDefinition { @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), + @XmlElement(name = "wordListData", type = SelectDataEntity.class), + @XmlElement(name = "autocompleteData", type = ExternalSelectDataEntity.class), }) private BaseFieldDataEntity data; @XmlElementWrapper(name = "validations") diff --git a/dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/BaseFieldDataEntity.java b/dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/BaseFieldDataEntity.java index bb4239c0e..84b696c15 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/BaseFieldDataEntity.java +++ b/dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/BaseFieldDataEntity.java @@ -7,7 +7,7 @@ import jakarta.xml.bind.annotation.XmlAttribute; @XmlAccessorType(XmlAccessType.FIELD) -public abstract class BaseFieldDataEntity { +public abstract class BaseFieldDataEntity { @XmlAttribute(name = "label") private String label; diff --git a/dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/ComboBoxDataEntity.java b/dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/ComboBoxDataEntity.java deleted file mode 100644 index 7714d3b97..000000000 --- a/dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/ComboBoxDataEntity.java +++ /dev/null @@ -1,51 +0,0 @@ -package eu.eudat.commons.types.descriptiontemplate.fielddata; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; -import jakarta.xml.bind.annotation.XmlAttribute; - -@XmlAccessorType(XmlAccessType.FIELD) -public abstract class ComboBoxDataEntity extends BaseFieldDataEntity { - - @XmlAccessorType(XmlAccessType.FIELD) - public static class Option { - @XmlAttribute(name="label") - private String label; - @XmlAttribute(name="value") - private String value; - @XmlAttribute(name="source") - private String source; - @XmlAttribute(name="uri") - private String 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; - } - } - -} 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 index 3f23cb51b..d9d218a52 100644 --- 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 @@ -12,20 +12,10 @@ import java.util.HashMap; import java.util.Map; @XmlAccessorType(XmlAccessType.FIELD) -public class ExternalDatasetDataEntity extends BaseFieldDataEntity { - @XmlAttribute(name="multiAutoComplete") - private Boolean multiAutoComplete; +public class ExternalDatasetDataEntity extends LabelAndMultiplicityDataEntity { @XmlAttribute(name="type") private FieldDataExternalDatasetType type; - public Boolean getMultiAutoComplete() { - return multiAutoComplete; - } - - public void setMultiAutoComplete(Boolean multiAutoComplete) { - this.multiAutoComplete = multiAutoComplete; - } - public FieldDataExternalDatasetType getType() { return type; } diff --git a/dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/AutoCompleteDataEntity.java b/dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/ExternalSelectDataEntity.java similarity index 58% rename from dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/AutoCompleteDataEntity.java rename to dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/ExternalSelectDataEntity.java index 472a026aa..178b513a7 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/AutoCompleteDataEntity.java +++ b/dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/ExternalSelectDataEntity.java @@ -10,11 +10,11 @@ import java.util.Map; @XmlAccessorType(XmlAccessType.FIELD) -public class AutoCompleteDataEntity extends ComboBoxDataEntity { +public class ExternalSelectDataEntity extends LabelAndMultiplicityDataEntity { @XmlAccessorType(XmlAccessType.FIELD) - public static class AuthAutoCompleteData { + public static class ExternalSelectAuthDataEntity { @XmlAttribute(name="url") private String url; @XmlAttribute(name="method") @@ -68,29 +68,50 @@ public class AutoCompleteDataEntity extends ComboBoxDataEntity autoCompleteSingleDataList; + private List sources; - public Boolean getMultiAutoComplete() { - return multiAutoComplete; + public List getAutoCompleteSingleDataList() { + return sources; } - public void setMultiAutoComplete(Boolean multiAutoComplete) { - this.multiAutoComplete = multiAutoComplete; - } - - public List getAutoCompleteSingleDataList() { - return autoCompleteSingleDataList; - } - - public void setAutoCompleteSingleDataList(List autoCompleteSingleDataList) { - this.autoCompleteSingleDataList = autoCompleteSingleDataList; - } - - public enum AutocompleteType implements DatabaseEnum { - UNCACHED(0), - CACHED(1); - - private final int value; - - AutocompleteType(int value) { - this.value = value; - } - - @JsonValue - public Integer getValue() { - return value; - } - - private static final Map map = EnumUtils.getEnumValueMap(AutocompleteType.class); - - public static AutocompleteType of(int i) { - return map.get(i); - } + public void setAutoCompleteSingleDataList(List externalSelectSourceEntityList) { + this.sources = externalSelectSourceEntityList; } } diff --git a/dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/LabelAndMultiplicityDataEntity.java b/dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/LabelAndMultiplicityDataEntity.java index cd13249b9..14edbd378 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/LabelAndMultiplicityDataEntity.java +++ b/dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/LabelAndMultiplicityDataEntity.java @@ -1,23 +1,20 @@ package eu.eudat.commons.types.descriptiontemplate.fielddata; -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; @XmlAccessorType(XmlAccessType.FIELD) -public class LabelAndMultiplicityDataEntity extends BaseFieldDataEntity { +public class LabelAndMultiplicityDataEntity extends BaseFieldDataEntity { - @XmlAttribute(name = "multiAutoComplete") - private Boolean multiAutoComplete; + @XmlAttribute(name = "multipleSelect") + private Boolean multipleSelect; - public Boolean getMultiAutoComplete() { - return multiAutoComplete; + public Boolean getMultipleSelect() { + return multipleSelect; } - public void setMultiAutoComplete(Boolean multiAutoComplete) { - this.multiAutoComplete = multiAutoComplete; + public void setMultipleSelect(Boolean multipleSelect) { + this.multipleSelect = multipleSelect; } } diff --git a/dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/LabelDataEntity.java b/dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/LabelDataEntity.java index 8be934145..3008e7282 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/LabelDataEntity.java +++ b/dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/LabelDataEntity.java @@ -5,5 +5,5 @@ import jakarta.xml.bind.annotation.XmlAccessorType; @XmlAccessorType(XmlAccessType.FIELD) -public class LabelDataEntity extends BaseFieldDataEntity { +public class LabelDataEntity extends BaseFieldDataEntity { } diff --git a/dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/RadioBoxDataEntity.java b/dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/RadioBoxDataEntity.java index 72c879b01..8ae36d6e4 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/RadioBoxDataEntity.java +++ b/dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/RadioBoxDataEntity.java @@ -5,7 +5,7 @@ import jakarta.xml.bind.annotation.*; import java.util.List; @XmlAccessorType(XmlAccessType.FIELD) -public class RadioBoxDataEntity extends BaseFieldDataEntity { +public class RadioBoxDataEntity extends BaseFieldDataEntity { @XmlAccessorType(XmlAccessType.FIELD) public static class RadioBoxDataOptionEntity { @XmlAttribute(name="label") diff --git a/dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/SelectDataEntity.java b/dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/SelectDataEntity.java new file mode 100644 index 000000000..dc706436d --- /dev/null +++ b/dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/SelectDataEntity.java @@ -0,0 +1,43 @@ +package eu.eudat.commons.types.descriptiontemplate.fielddata; + +import jakarta.xml.bind.annotation.*; + +import java.util.List; + +@XmlAccessorType(XmlAccessType.FIELD) +public class SelectDataEntity extends LabelAndMultiplicityDataEntity { + @XmlElementWrapper(name = "options") + @XmlElement(name = "options") + private List options; + + public List getOptions() { + return options; + } + + public void setOptions(List optionEntities) { + this.options = optionEntities; + } + + @XmlAccessorType(XmlAccessType.FIELD) + public static class OptionEntity { + @XmlAttribute(name="label") + private String label; + @XmlAttribute(name="value") + private String 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; + } + } +} + diff --git a/dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/UploadDataEntity.java b/dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/UploadDataEntity.java index 4b1c6454a..8e3a9bb3b 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/UploadDataEntity.java +++ b/dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/UploadDataEntity.java @@ -6,7 +6,7 @@ import java.util.List; @XmlAccessorType(XmlAccessType.FIELD) -public class UploadDataEntity extends BaseFieldDataEntity { +public class UploadDataEntity extends BaseFieldDataEntity { @XmlAccessorType(XmlAccessType.FIELD) public static class UploadDataOptionEntity { diff --git a/dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/WordListDataEntity.java b/dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/WordListDataEntity.java deleted file mode 100644 index ca0efaefc..000000000 --- a/dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/WordListDataEntity.java +++ /dev/null @@ -1,31 +0,0 @@ -package eu.eudat.commons.types.descriptiontemplate.fielddata; - -import jakarta.xml.bind.annotation.*; - -import java.util.List; - -@XmlAccessorType(XmlAccessType.FIELD) -public class WordListDataEntity extends ComboBoxDataEntity { - @XmlElementWrapper(name = "options") - @XmlElement(name = "options") - private List