no message

This commit is contained in:
Diamantis Tziotzios 2024-01-31 10:44:48 +02:00
parent 5377b1db18
commit 59c425a240
40 changed files with 293 additions and 364 deletions

View File

@ -7,7 +7,7 @@ import java.util.Map;
public enum FieldType implements DatabaseEnum<String> { public enum FieldType implements DatabaseEnum<String> {
AUTO_COMPLETE(Names.Autocomplete), AUTO_COMPLETE(Names.Autocomplete),
WORD_LIST(Names.Wordlist), SELECT(Names.Select),
BOOLEAN_DECISION(Names.BooleanDecision), BOOLEAN_DECISION(Names.BooleanDecision),
RADIO_BOX(Names.RadioBox), RADIO_BOX(Names.RadioBox),
INTERNAL_DMP_ENTRIES_RESEARCHERS(Names.InternalDmpResearchers), INTERNAL_DMP_ENTRIES_RESEARCHERS(Names.InternalDmpResearchers),
@ -39,7 +39,7 @@ public enum FieldType implements DatabaseEnum<String> {
public static class Names { public static class Names {
public static final String ComboBox = "combobox"; public static final String ComboBox = "combobox";
public static final String Autocomplete = "autocomplete"; 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 BooleanDecision = "booleanDecision";
public static final String RadioBox = "radiobox"; public static final String RadioBox = "radiobox";
public static final String InternalDmpEntities = "internalDmpEntities"; public static final String InternalDmpEntities = "internalDmpEntities";

View File

@ -1,7 +1,6 @@
package eu.eudat.commons.types.descriptiontemplate; package eu.eudat.commons.types.descriptiontemplate;
import eu.eudat.commons.enums.FieldValidationType; import eu.eudat.commons.enums.FieldValidationType;
import eu.eudat.commons.enums.FieldType;
import eu.eudat.commons.types.common.DatabaseViewStyleDefinition; import eu.eudat.commons.types.common.DatabaseViewStyleDefinition;
import eu.eudat.commons.types.descriptiontemplate.fielddata.*; import eu.eudat.commons.types.descriptiontemplate.fielddata.*;
import jakarta.xml.bind.annotation.*; import jakarta.xml.bind.annotation.*;
@ -31,8 +30,8 @@ public class FieldEntity implements DatabaseViewStyleDefinition {
@XmlElement(name = "externalDatasetsData", type = ExternalDatasetDataEntity.class), @XmlElement(name = "externalDatasetsData", type = ExternalDatasetDataEntity.class),
@XmlElement(name = "uploadData", type = UploadDataEntity.class), @XmlElement(name = "uploadData", type = UploadDataEntity.class),
@XmlElement(name = "radioBoxData", type = RadioBoxDataEntity.class), @XmlElement(name = "radioBoxData", type = RadioBoxDataEntity.class),
@XmlElement(name = "wordListData", type = WordListDataEntity.class), @XmlElement(name = "wordListData", type = SelectDataEntity.class),
@XmlElement(name = "autocompleteData", type = AutoCompleteDataEntity.class), @XmlElement(name = "autocompleteData", type = ExternalSelectDataEntity.class),
}) })
private BaseFieldDataEntity<?> data; private BaseFieldDataEntity<?> data;
@XmlElementWrapper(name = "validations") @XmlElementWrapper(name = "validations")

View File

@ -7,7 +7,7 @@ import jakarta.xml.bind.annotation.XmlAttribute;
@XmlAccessorType(XmlAccessType.FIELD) @XmlAccessorType(XmlAccessType.FIELD)
public abstract class BaseFieldDataEntity<T> { public abstract class BaseFieldDataEntity {
@XmlAttribute(name = "label") @XmlAttribute(name = "label")
private String label; private String label;

View File

@ -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<T> extends BaseFieldDataEntity<T> {
@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;
}
}
}

View File

@ -12,20 +12,10 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
@XmlAccessorType(XmlAccessType.FIELD) @XmlAccessorType(XmlAccessType.FIELD)
public class ExternalDatasetDataEntity extends BaseFieldDataEntity<ExternalDatasetDataEntity> { public class ExternalDatasetDataEntity extends LabelAndMultiplicityDataEntity {
@XmlAttribute(name="multiAutoComplete")
private Boolean multiAutoComplete;
@XmlAttribute(name="type") @XmlAttribute(name="type")
private FieldDataExternalDatasetType type; private FieldDataExternalDatasetType type;
public Boolean getMultiAutoComplete() {
return multiAutoComplete;
}
public void setMultiAutoComplete(Boolean multiAutoComplete) {
this.multiAutoComplete = multiAutoComplete;
}
public FieldDataExternalDatasetType getType() { public FieldDataExternalDatasetType getType() {
return type; return type;
} }

View File

@ -10,11 +10,11 @@ import java.util.Map;
@XmlAccessorType(XmlAccessType.FIELD) @XmlAccessorType(XmlAccessType.FIELD)
public class AutoCompleteDataEntity extends ComboBoxDataEntity<AutoCompleteDataEntity> { public class ExternalSelectDataEntity extends LabelAndMultiplicityDataEntity {
@XmlAccessorType(XmlAccessType.FIELD) @XmlAccessorType(XmlAccessType.FIELD)
public static class AuthAutoCompleteData { public static class ExternalSelectAuthDataEntity {
@XmlAttribute(name="url") @XmlAttribute(name="url")
private String url; private String url;
@XmlAttribute(name="method") @XmlAttribute(name="method")
@ -68,29 +68,50 @@ public class AutoCompleteDataEntity extends ComboBoxDataEntity<AutoCompleteDataE
} }
@XmlAccessorType(XmlAccessType.FIELD) @XmlAccessorType(XmlAccessType.FIELD)
public static class AutoCompleteSingleData { public static class ExternalSelectSourceBindingEntity {
@XmlAttribute(name="autocompleteType") @XmlAttribute(name="label")
private AutocompleteType autocompleteType; private String label;
@XmlAttribute(name="value")
private String value;
@XmlAttribute(name="source")
private String source;
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;
}
}
@XmlAccessorType(XmlAccessType.FIELD)
public static class ExternalSelectSourceEntity {
@XmlAttribute(name="url") @XmlAttribute(name="url")
private String url; private String url;
@XmlElement(name="option") @XmlAttribute(name="method")
private ComboBoxDataEntity.Option autoCompleteOptions; private String method;
@XmlAttribute(name="optionsRoot") @XmlAttribute(name="optionsRoot")
private String optionsRoot; private String optionsRoot;
@XmlElement(name="option")
private ExternalSelectSourceBindingEntity externalSelectSourceBindingEntity;
@XmlAttribute(name="hasAuth") @XmlAttribute(name="hasAuth")
private Boolean hasAuth; private Boolean hasAuth;
@XmlElement(name="auth") @XmlElement(name="auth")
private AuthAutoCompleteData auth; private ExternalSelectAuthDataEntity auth;
@XmlAttribute(name="method")
private String method;
public AutocompleteType getAutocompleteType() {
return autocompleteType;
}
public void setAutocompleteType(AutocompleteType autocompleteType) {
this.autocompleteType = autocompleteType;
}
public String getOptionsRoot() { public String getOptionsRoot() {
return optionsRoot; return optionsRoot;
@ -114,19 +135,19 @@ public class AutoCompleteDataEntity extends ComboBoxDataEntity<AutoCompleteDataE
this.hasAuth = hasAuth; this.hasAuth = hasAuth;
} }
public AuthAutoCompleteData getAuth() { public ExternalSelectAuthDataEntity getAuth() {
return auth; return auth;
} }
public void setAuth(AuthAutoCompleteData auth) { public void setAuth(ExternalSelectAuthDataEntity auth) {
this.auth = auth; this.auth = auth;
} }
public ComboBoxDataEntity.Option getAutoCompleteOptions() { public ExternalSelectSourceBindingEntity getExternalSelectSourceBindingEntity() {
return autoCompleteOptions; return externalSelectSourceBindingEntity;
} }
public void setAutoCompleteOptions(ComboBoxDataEntity.Option autoCompleteOptions) { public void setExternalSelectSourceBindingEntity(ExternalSelectSourceBindingEntity externalSelectSourceBindingEntity) {
this.autoCompleteOptions = autoCompleteOptions; this.externalSelectSourceBindingEntity = externalSelectSourceBindingEntity;
} }
public String getMethod() { public String getMethod() {
@ -138,48 +159,16 @@ public class AutoCompleteDataEntity extends ComboBoxDataEntity<AutoCompleteDataE
} }
} }
@XmlAttribute(name="multiAutoComplete")
private Boolean multiAutoComplete;
@XmlElementWrapper(name = "autoCompleteSingleDataList") @XmlElementWrapper(name = "autoCompleteSingleDataList")
@XmlElement(name = "autoCompleteSingleData") @XmlElement(name = "autoCompleteSingleData")
private List<AutoCompleteSingleData> autoCompleteSingleDataList; private List<ExternalSelectSourceEntity> sources;
public Boolean getMultiAutoComplete() { public List<ExternalSelectSourceEntity> getAutoCompleteSingleDataList() {
return multiAutoComplete; return sources;
} }
public void setMultiAutoComplete(Boolean multiAutoComplete) { public void setAutoCompleteSingleDataList(List<ExternalSelectSourceEntity> externalSelectSourceEntityList) {
this.multiAutoComplete = multiAutoComplete; this.sources = externalSelectSourceEntityList;
}
public List<AutoCompleteSingleData> getAutoCompleteSingleDataList() {
return autoCompleteSingleDataList;
}
public void setAutoCompleteSingleDataList(List<AutoCompleteSingleData> autoCompleteSingleDataList) {
this.autoCompleteSingleDataList = autoCompleteSingleDataList;
}
public enum AutocompleteType implements DatabaseEnum<Integer> {
UNCACHED(0),
CACHED(1);
private final int value;
AutocompleteType(int value) {
this.value = value;
}
@JsonValue
public Integer getValue() {
return value;
}
private static final Map<Integer, AutocompleteType> map = EnumUtils.getEnumValueMap(AutocompleteType.class);
public static AutocompleteType of(int i) {
return map.get(i);
}
} }
} }

View File

@ -1,23 +1,20 @@
package eu.eudat.commons.types.descriptiontemplate.fielddata; package eu.eudat.commons.types.descriptiontemplate.fielddata;
import eu.eudat.commons.enums.FieldType;
import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType; import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlAttribute; import jakarta.xml.bind.annotation.XmlAttribute;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@XmlAccessorType(XmlAccessType.FIELD) @XmlAccessorType(XmlAccessType.FIELD)
public class LabelAndMultiplicityDataEntity extends BaseFieldDataEntity<LabelAndMultiplicityDataEntity> { public class LabelAndMultiplicityDataEntity extends BaseFieldDataEntity {
@XmlAttribute(name = "multiAutoComplete") @XmlAttribute(name = "multipleSelect")
private Boolean multiAutoComplete; private Boolean multipleSelect;
public Boolean getMultiAutoComplete() { public Boolean getMultipleSelect() {
return multiAutoComplete; return multipleSelect;
} }
public void setMultiAutoComplete(Boolean multiAutoComplete) { public void setMultipleSelect(Boolean multipleSelect) {
this.multiAutoComplete = multiAutoComplete; this.multipleSelect = multipleSelect;
} }
} }

View File

@ -5,5 +5,5 @@ import jakarta.xml.bind.annotation.XmlAccessorType;
@XmlAccessorType(XmlAccessType.FIELD) @XmlAccessorType(XmlAccessType.FIELD)
public class LabelDataEntity extends BaseFieldDataEntity<LabelDataEntity> { public class LabelDataEntity extends BaseFieldDataEntity {
} }

View File

@ -5,7 +5,7 @@ import jakarta.xml.bind.annotation.*;
import java.util.List; import java.util.List;
@XmlAccessorType(XmlAccessType.FIELD) @XmlAccessorType(XmlAccessType.FIELD)
public class RadioBoxDataEntity extends BaseFieldDataEntity<RadioBoxDataEntity> { public class RadioBoxDataEntity extends BaseFieldDataEntity {
@XmlAccessorType(XmlAccessType.FIELD) @XmlAccessorType(XmlAccessType.FIELD)
public static class RadioBoxDataOptionEntity { public static class RadioBoxDataOptionEntity {
@XmlAttribute(name="label") @XmlAttribute(name="label")

View File

@ -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<OptionEntity> options;
public List<OptionEntity> getOptions() {
return options;
}
public void setOptions(List<OptionEntity> 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;
}
}
}

View File

@ -6,7 +6,7 @@ import java.util.List;
@XmlAccessorType(XmlAccessType.FIELD) @XmlAccessorType(XmlAccessType.FIELD)
public class UploadDataEntity extends BaseFieldDataEntity<UploadDataEntity> { public class UploadDataEntity extends BaseFieldDataEntity {
@XmlAccessorType(XmlAccessType.FIELD) @XmlAccessorType(XmlAccessType.FIELD)
public static class UploadDataOptionEntity { public static class UploadDataOptionEntity {

View File

@ -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<WordListDataEntity> {
@XmlElementWrapper(name = "options")
@XmlElement(name = "options")
private List<Option> options;
@XmlAttribute(name="multiList")
private Boolean multiList;
public List<Option> getOptions() {
return options;
}
public void setOptions(List<Option> options) {
this.options = options;
}
public Boolean getMultiList() {
return multiList;
}
public void setMultiList(Boolean multiList) {
this.multiList = multiList;
}
}

View File

@ -2,7 +2,6 @@ package eu.eudat.commons.types.descriptiontemplate.importexport;
import eu.eudat.commons.enums.FieldType; import eu.eudat.commons.enums.FieldType;
import eu.eudat.commons.enums.FieldValidationType; import eu.eudat.commons.enums.FieldValidationType;
import eu.eudat.commons.types.descriptiontemplate.fielddata.*;
import eu.eudat.commons.types.descriptiontemplate.importexport.fielddata.*; import eu.eudat.commons.types.descriptiontemplate.importexport.fielddata.*;
import jakarta.xml.bind.annotation.*; import jakarta.xml.bind.annotation.*;
@ -40,7 +39,7 @@ public class FieldImportExport {
@XmlElement(name = "externalDatasetsData", type = ExternalDatasetDataImportExport.class), @XmlElement(name = "externalDatasetsData", type = ExternalDatasetDataImportExport.class),
@XmlElement(name = "uploadData", type = UploadDataImportExport.class), @XmlElement(name = "uploadData", type = UploadDataImportExport.class),
@XmlElement(name = "radioBoxData", type = RadioBoxDataImportExport.class), @XmlElement(name = "radioBoxData", type = RadioBoxDataImportExport.class),
@XmlElement(name = "wordListData", type = WordListDataImportExport.class), @XmlElement(name = "wordListData", type = SelectDataImportExport.class),
@XmlElement(name = "autocompleteData", type = AutoCompleteDataImportExport.class), @XmlElement(name = "autocompleteData", type = AutoCompleteDataImportExport.class),
}) })
private BaseFieldDataImportExport data; private BaseFieldDataImportExport data;

View File

@ -1,5 +1,6 @@
package eu.eudat.commons.types.descriptiontemplate.importexport.fielddata; package eu.eudat.commons.types.descriptiontemplate.importexport.fielddata;
import eu.eudat.commons.types.descriptiontemplate.fielddata.ExternalSelectDataEntity;
import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType; import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlAttribute; import jakarta.xml.bind.annotation.XmlAttribute;
@ -8,7 +9,7 @@ import jakarta.xml.bind.annotation.XmlElement;
@XmlAccessorType(XmlAccessType.FIELD) @XmlAccessorType(XmlAccessType.FIELD)
public class AutoCompleteSingleData { public class AutoCompleteSingleData {
@XmlAttribute(name = "autocompleteType") @XmlAttribute(name = "autocompleteType")
private eu.eudat.commons.types.descriptiontemplate.fielddata.AutoCompleteDataEntity.AutocompleteType autocompleteType; private ExternalSelectDataEntity.AutocompleteType autocompleteType;
@XmlAttribute(name = "url") @XmlAttribute(name = "url")
private String url; private String url;
@XmlElement(name = "autoCompleteOptions") @XmlElement(name = "autoCompleteOptions")
@ -22,11 +23,11 @@ public class AutoCompleteSingleData {
@XmlAttribute(name = "method") @XmlAttribute(name = "method")
private String method; private String method;
public eu.eudat.commons.types.descriptiontemplate.fielddata.AutoCompleteDataEntity.AutocompleteType getAutocompleteType() { public ExternalSelectDataEntity.AutocompleteType getAutocompleteType() {
return autocompleteType; return autocompleteType;
} }
public void setAutocompleteType(eu.eudat.commons.types.descriptiontemplate.fielddata.AutoCompleteDataEntity.AutocompleteType autocompleteType) { public void setAutocompleteType(ExternalSelectDataEntity.AutocompleteType autocompleteType) {
this.autocompleteType = autocompleteType; this.autocompleteType = autocompleteType;
} }

View File

@ -5,7 +5,7 @@ import jakarta.xml.bind.annotation.*;
import java.util.List; import java.util.List;
@XmlAccessorType(XmlAccessType.FIELD) @XmlAccessorType(XmlAccessType.FIELD)
public class WordListDataImportExport extends BaseFieldDataImportExport { public class SelectDataImportExport extends BaseFieldDataImportExport {
@XmlElementWrapper(name = "options") @XmlElementWrapper(name = "options")
@XmlElement(name = "options") @XmlElement(name = "options")
private List<ComboBoxDataOptionEntity> options; private List<ComboBoxDataOptionEntity> options;

View File

@ -78,7 +78,7 @@ public class DescriptionFieldDepositBuilder extends BaseDepositBuilder<Descripti
switch (field.getData().getFieldType()) { switch (field.getData().getFieldType()) {
case AUTO_COMPLETE -> m.setFieldType(FieldType.AUTO_COMPLETE); case AUTO_COMPLETE -> m.setFieldType(FieldType.AUTO_COMPLETE);
case WORD_LIST -> m.setFieldType(FieldType.WORD_LIST); case SELECT -> m.setFieldType(FieldType.WORD_LIST);
case BOOLEAN_DECISION -> m.setFieldType(FieldType.BOOLEAN_DECISION); case BOOLEAN_DECISION -> m.setFieldType(FieldType.BOOLEAN_DECISION);
case RADIO_BOX -> m.setFieldType(FieldType.RADIO_BOX); case RADIO_BOX -> m.setFieldType(FieldType.RADIO_BOX);
case INTERNAL_DMP_ENTRIES_RESEARCHERS -> m.setFieldType(FieldType.INTERNAL_DMP_ENTRIES_RESEARCHERS); case INTERNAL_DMP_ENTRIES_RESEARCHERS -> m.setFieldType(FieldType.INTERNAL_DMP_ENTRIES_RESEARCHERS);

View File

@ -1,7 +1,7 @@
package eu.eudat.model.builder.descriptiontemplatedefinition.fielddata; package eu.eudat.model.builder.descriptiontemplatedefinition.fielddata;
import eu.eudat.authorization.AuthorizationFlags; import eu.eudat.authorization.AuthorizationFlags;
import eu.eudat.commons.types.descriptiontemplate.fielddata.AutoCompleteDataEntity; import eu.eudat.commons.types.descriptiontemplate.fielddata.ExternalSelectDataEntity;
import eu.eudat.convention.ConventionService; import eu.eudat.convention.ConventionService;
import eu.eudat.model.builder.BaseBuilder; import eu.eudat.model.builder.BaseBuilder;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.AuthAutoCompleteData; import eu.eudat.model.descriptiontemplatedefinition.fielddata.AuthAutoCompleteData;
@ -19,7 +19,7 @@ import java.util.*;
@Component @Component
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class AuthAutoCompleteDataBuilder extends BaseBuilder<AuthAutoCompleteData, AutoCompleteDataEntity.AuthAutoCompleteData> { public class AuthAutoCompleteDataBuilder extends BaseBuilder<AuthAutoCompleteData, ExternalSelectDataEntity.ExternalSelectAuthDataEntity> {
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None); private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
@ -35,14 +35,14 @@ public class AuthAutoCompleteDataBuilder extends BaseBuilder<AuthAutoCompleteDat
} }
@Override @Override
public List<AuthAutoCompleteData> build(FieldSet fields, List<AutoCompleteDataEntity.AuthAutoCompleteData> data) throws MyApplicationException { public List<AuthAutoCompleteData> build(FieldSet fields, List<ExternalSelectDataEntity.ExternalSelectAuthDataEntity> data) throws MyApplicationException {
this.logger.debug("building for {} items requesting {} fields", Optional.ofNullable(data).map(List::size).orElse(0), Optional.ofNullable(fields).map(FieldSet::getFields).map(Set::size).orElse(0)); this.logger.debug("building for {} items requesting {} fields", Optional.ofNullable(data).map(List::size).orElse(0), Optional.ofNullable(fields).map(FieldSet::getFields).map(Set::size).orElse(0));
this.logger.trace(new DataLogEntry("requested fields", fields)); this.logger.trace(new DataLogEntry("requested fields", fields));
if (fields == null || data == null || fields.isEmpty()) if (fields == null || data == null || fields.isEmpty())
return new ArrayList<>(); return new ArrayList<>();
List<AuthAutoCompleteData> models = new ArrayList<>(); List<AuthAutoCompleteData> models = new ArrayList<>();
for (AutoCompleteDataEntity.AuthAutoCompleteData d : data) { for (ExternalSelectDataEntity.ExternalSelectAuthDataEntity d : data) {
AuthAutoCompleteData m = new AuthAutoCompleteData(); AuthAutoCompleteData m = new AuthAutoCompleteData();
if (fields.hasField(this.asIndexer(AuthAutoCompleteData._url))) m.setUrl(d.getUrl()); if (fields.hasField(this.asIndexer(AuthAutoCompleteData._url))) m.setUrl(d.getUrl());
if (fields.hasField(this.asIndexer(AuthAutoCompleteData._method))) m.setMethod(d.getMethod()); if (fields.hasField(this.asIndexer(AuthAutoCompleteData._method))) m.setMethod(d.getMethod());

View File

@ -1,6 +1,6 @@
package eu.eudat.model.builder.descriptiontemplatedefinition.fielddata; package eu.eudat.model.builder.descriptiontemplatedefinition.fielddata;
import eu.eudat.commons.types.descriptiontemplate.fielddata.AutoCompleteDataEntity; import eu.eudat.commons.types.descriptiontemplate.fielddata.ExternalSelectDataEntity;
import eu.eudat.convention.ConventionService; import eu.eudat.convention.ConventionService;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.AutoCompleteData; import eu.eudat.model.descriptiontemplatedefinition.fielddata.AutoCompleteData;
import gr.cite.tools.data.builder.BuilderFactory; import gr.cite.tools.data.builder.BuilderFactory;
@ -14,7 +14,7 @@ import org.springframework.stereotype.Component;
@Component @Component
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class AutoCompleteDataBuilder extends BaseFieldDataBuilder<AutoCompleteData, AutoCompleteDataEntity> { public class AutoCompleteDataBuilder extends BaseFieldDataBuilder<AutoCompleteData, ExternalSelectDataEntity> {
private final BuilderFactory builderFactory; private final BuilderFactory builderFactory;
@Autowired @Autowired
public AutoCompleteDataBuilder(ConventionService conventionService, BuilderFactory builderFactory) { public AutoCompleteDataBuilder(ConventionService conventionService, BuilderFactory builderFactory) {
@ -28,9 +28,9 @@ public class AutoCompleteDataBuilder extends BaseFieldDataBuilder<AutoCompleteDa
} }
@Override @Override
protected void buildChild(FieldSet fields, AutoCompleteDataEntity d, AutoCompleteData m) { protected void buildChild(FieldSet fields, ExternalSelectDataEntity d, AutoCompleteData m) {
FieldSet autoCompleteSingleDataListFields = fields.extractPrefixed(this.asPrefix(AutoCompleteData._autoCompleteSingleDataList)); FieldSet autoCompleteSingleDataListFields = fields.extractPrefixed(this.asPrefix(AutoCompleteData._autoCompleteSingleDataList));
if (fields.hasField(this.asIndexer(AutoCompleteData._multiAutoComplete))) m.setMultiAutoComplete(d.getMultiAutoComplete()); if (fields.hasField(this.asIndexer(AutoCompleteData._multiAutoComplete))) m.setMultiAutoComplete(d.getMultipleSelect());
if (!autoCompleteSingleDataListFields.isEmpty() && d.getAutoCompleteSingleDataList() != null) m.setAutoCompleteSingleDataList(this.builderFactory.builder(AutoCompleteSingleDataBuilder.class).authorize(this.authorize).build(autoCompleteSingleDataListFields, d.getAutoCompleteSingleDataList())); if (!autoCompleteSingleDataListFields.isEmpty() && d.getAutoCompleteSingleDataList() != null) m.setAutoCompleteSingleDataList(this.builderFactory.builder(AutoCompleteSingleDataBuilder.class).authorize(this.authorize).build(autoCompleteSingleDataListFields, d.getAutoCompleteSingleDataList()));
} }

View File

@ -1,7 +1,7 @@
package eu.eudat.model.builder.descriptiontemplatedefinition.fielddata; package eu.eudat.model.builder.descriptiontemplatedefinition.fielddata;
import eu.eudat.authorization.AuthorizationFlags; import eu.eudat.authorization.AuthorizationFlags;
import eu.eudat.commons.types.descriptiontemplate.fielddata.AutoCompleteDataEntity; import eu.eudat.commons.types.descriptiontemplate.fielddata.ExternalSelectDataEntity;
import eu.eudat.convention.ConventionService; import eu.eudat.convention.ConventionService;
import eu.eudat.model.builder.BaseBuilder; import eu.eudat.model.builder.BaseBuilder;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.AutoCompleteSingleData; import eu.eudat.model.descriptiontemplatedefinition.fielddata.AutoCompleteSingleData;
@ -20,7 +20,7 @@ import java.util.*;
@Component @Component
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class AutoCompleteSingleDataBuilder extends BaseBuilder<AutoCompleteSingleData, AutoCompleteDataEntity.AutoCompleteSingleData> { public class AutoCompleteSingleDataBuilder extends BaseBuilder<AutoCompleteSingleData, ExternalSelectDataEntity.ExternalSelectSourceEntity> {
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None); private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
private final BuilderFactory builderFactory; private final BuilderFactory builderFactory;
@ -38,7 +38,7 @@ public class AutoCompleteSingleDataBuilder extends BaseBuilder<AutoCompleteSingl
} }
@Override @Override
public List<AutoCompleteSingleData> build(FieldSet fields, List<AutoCompleteDataEntity.AutoCompleteSingleData> data) throws MyApplicationException { public List<AutoCompleteSingleData> build(FieldSet fields, List<ExternalSelectDataEntity.ExternalSelectSourceEntity> data) throws MyApplicationException {
this.logger.debug("building for {} items requesting {} fields", Optional.ofNullable(data).map(List::size).orElse(0), Optional.ofNullable(fields).map(FieldSet::getFields).map(Set::size).orElse(0)); this.logger.debug("building for {} items requesting {} fields", Optional.ofNullable(data).map(List::size).orElse(0), Optional.ofNullable(fields).map(FieldSet::getFields).map(Set::size).orElse(0));
this.logger.trace(new DataLogEntry("requested fields", fields)); this.logger.trace(new DataLogEntry("requested fields", fields));
if (fields == null || data == null || fields.isEmpty()) if (fields == null || data == null || fields.isEmpty())
@ -47,14 +47,14 @@ public class AutoCompleteSingleDataBuilder extends BaseBuilder<AutoCompleteSingl
FieldSet autoCompleteOptionsFields = fields.extractPrefixed(this.asPrefix(AutoCompleteSingleData._autoCompleteOptions)); FieldSet autoCompleteOptionsFields = fields.extractPrefixed(this.asPrefix(AutoCompleteSingleData._autoCompleteOptions));
FieldSet authFields = fields.extractPrefixed(this.asPrefix(AutoCompleteSingleData._auth)); FieldSet authFields = fields.extractPrefixed(this.asPrefix(AutoCompleteSingleData._auth));
List<AutoCompleteSingleData> models = new ArrayList<>(); List<AutoCompleteSingleData> models = new ArrayList<>();
for (AutoCompleteDataEntity.AutoCompleteSingleData d : data) { for (ExternalSelectDataEntity.ExternalSelectSourceEntity d : data) {
AutoCompleteSingleData m = new AutoCompleteSingleData(); AutoCompleteSingleData m = new AutoCompleteSingleData();
if (fields.hasField(this.asIndexer(AutoCompleteSingleData._autocompleteType))) m.setAutocompleteType(d.getAutocompleteType()); if (fields.hasField(this.asIndexer(AutoCompleteSingleData._autocompleteType))) m.setAutocompleteType(d.getAutocompleteType());
if (fields.hasField(this.asIndexer(AutoCompleteSingleData._url))) m.setUrl(d.getUrl()); if (fields.hasField(this.asIndexer(AutoCompleteSingleData._url))) m.setUrl(d.getUrl());
if (fields.hasField(this.asIndexer(AutoCompleteSingleData._optionsRoot))) m.setOptionsRoot(d.getOptionsRoot()); if (fields.hasField(this.asIndexer(AutoCompleteSingleData._optionsRoot))) m.setOptionsRoot(d.getOptionsRoot());
if (fields.hasField(this.asIndexer(AutoCompleteSingleData._hasAuth))) m.setHasAuth(d.getHasAuth()); if (fields.hasField(this.asIndexer(AutoCompleteSingleData._hasAuth))) m.setHasAuth(d.getHasAuth());
if (fields.hasField(this.asIndexer(AutoCompleteSingleData._method))) m.setMethod(d.getMethod()); if (fields.hasField(this.asIndexer(AutoCompleteSingleData._method))) m.setMethod(d.getMethod());
if (!autoCompleteOptionsFields.isEmpty() && d.getAutoCompleteOptions() != null) m.setAutoCompleteOptions(this.builderFactory.builder(ComboBoxOptionBuilder.class).authorize(this.authorize).build(autoCompleteOptionsFields, d.getAutoCompleteOptions())); if (!autoCompleteOptionsFields.isEmpty() && d.getExternalSelectSourceBindingEntity() != null) m.setAutoCompleteOptions(this.builderFactory.builder(ComboBoxOptionBuilder.class).authorize(this.authorize).build(autoCompleteOptionsFields, d.getExternalSelectSourceBindingEntity()));
if (!authFields.isEmpty() && d.getAuth() != null) m.setAuth(this.builderFactory.builder(AuthAutoCompleteDataBuilder.class).authorize(this.authorize).build(authFields, d.getAuth())); if (!authFields.isEmpty() && d.getAuth() != null) m.setAuth(this.builderFactory.builder(AuthAutoCompleteDataBuilder.class).authorize(this.authorize).build(authFields, d.getAuth()));
models.add(m); models.add(m);
} }

View File

@ -1,7 +1,6 @@
package eu.eudat.model.builder.descriptiontemplatedefinition.fielddata; package eu.eudat.model.builder.descriptiontemplatedefinition.fielddata;
import eu.eudat.authorization.AuthorizationFlags; import eu.eudat.authorization.AuthorizationFlags;
import eu.eudat.commons.types.descriptiontemplate.fielddata.ComboBoxDataEntity;
import eu.eudat.convention.ConventionService; import eu.eudat.convention.ConventionService;
import eu.eudat.model.builder.BaseBuilder; import eu.eudat.model.builder.BaseBuilder;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.ComboBoxOption; import eu.eudat.model.descriptiontemplatedefinition.fielddata.ComboBoxOption;

View File

@ -25,7 +25,7 @@ public class ExternalDatasetDataBuilder extends BaseFieldDataBuilder<ExternalDat
} }
@Override @Override
protected void buildChild(FieldSet fields, ExternalDatasetDataEntity d, ExternalDatasetData m) { protected void buildChild(FieldSet fields, ExternalDatasetDataEntity d, ExternalDatasetData m) {
if (fields.hasField(this.asIndexer(ExternalDatasetData._multiAutoComplete))) m.setMultiAutoComplete(d.getMultiAutoComplete()); if (fields.hasField(this.asIndexer(ExternalDatasetData._multiAutoComplete))) m.setMultiAutoComplete(d.getMultipleSelect());
if (fields.hasField(this.asIndexer(ExternalDatasetData._type))) m.setType(d.getType()); if (fields.hasField(this.asIndexer(ExternalDatasetData._type))) m.setType(d.getType());
} }
} }

View File

@ -25,6 +25,6 @@ public class LabelAndMultiplicityDataBuilder extends BaseFieldDataBuilder<LabelA
} }
@Override @Override
protected void buildChild(FieldSet fields, LabelAndMultiplicityDataEntity d, LabelAndMultiplicityData m) { protected void buildChild(FieldSet fields, LabelAndMultiplicityDataEntity d, LabelAndMultiplicityData m) {
if (fields.hasField(this.asIndexer(LabelAndMultiplicityData._multiAutoComplete))) m.setMultiAutoComplete(d.getMultiAutoComplete()); if (fields.hasField(this.asIndexer(LabelAndMultiplicityData._multiAutoComplete))) m.setMultiAutoComplete(d.getMultipleSelect());
} }
} }

View File

@ -1,8 +1,8 @@
package eu.eudat.model.builder.descriptiontemplatedefinition.fielddata; package eu.eudat.model.builder.descriptiontemplatedefinition.fielddata;
import eu.eudat.commons.types.descriptiontemplate.fielddata.WordListDataEntity; import eu.eudat.commons.types.descriptiontemplate.fielddata.SelectDataEntity;
import eu.eudat.convention.ConventionService; import eu.eudat.convention.ConventionService;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.WordListData; import eu.eudat.model.descriptiontemplatedefinition.fielddata.SelectData;
import gr.cite.tools.data.builder.BuilderFactory; import gr.cite.tools.data.builder.BuilderFactory;
import gr.cite.tools.fieldset.FieldSet; import gr.cite.tools.fieldset.FieldSet;
import gr.cite.tools.logging.LoggerService; import gr.cite.tools.logging.LoggerService;
@ -14,23 +14,23 @@ import org.springframework.stereotype.Component;
@Component @Component
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class WordListDataBuilder extends BaseFieldDataBuilder<WordListData, WordListDataEntity> { public class SelectDataBuilder extends BaseFieldDataBuilder<SelectData, SelectDataEntity> {
private final BuilderFactory builderFactory; private final BuilderFactory builderFactory;
@Autowired @Autowired
public WordListDataBuilder(ConventionService conventionService, BuilderFactory builderFactory) { public SelectDataBuilder(ConventionService conventionService, BuilderFactory builderFactory) {
super(conventionService, new LoggerService(LoggerFactory.getLogger(WordListDataBuilder.class))); super(conventionService, new LoggerService(LoggerFactory.getLogger(SelectDataBuilder.class)));
this.builderFactory = builderFactory; this.builderFactory = builderFactory;
} }
@Override @Override
protected WordListData getInstance() { protected SelectData getInstance() {
return new WordListData(); return new SelectData();
} }
@Override @Override
protected void buildChild(FieldSet fields, WordListDataEntity d, WordListData m) { protected void buildChild(FieldSet fields, SelectDataEntity d, SelectData m) {
FieldSet optionsFields = fields.extractPrefixed(this.asPrefix(WordListData._options)); FieldSet optionsFields = fields.extractPrefixed(this.asPrefix(SelectData._options));
if (fields.hasField(this.asIndexer(WordListData._multiList))) m.setMultiList(d.getMultiList()); if (fields.hasField(this.asIndexer(SelectData._multiList))) m.setMultiList(d.getMultiList());
if (!optionsFields.isEmpty() && d.getOptions() != null) m.setOptions(this.builderFactory.builder(ComboBoxOptionBuilder.class).authorize(this.authorize).build(optionsFields, d.getOptions())); if (!optionsFields.isEmpty() && d.getOptions() != null) m.setOptions(this.builderFactory.builder(ComboBoxOptionBuilder.class).authorize(this.authorize).build(optionsFields, d.getOptions()));
} }

View File

@ -156,11 +156,11 @@ public class DescriptionTemplateDefinitionFileTransformerBuilder extends BaseFil
public BaseFieldDataFileTransformerModel convertData (BaseFieldDataEntity data) { public BaseFieldDataFileTransformerModel convertData (BaseFieldDataEntity data) {
BaseFieldDataFileTransformerModel m; BaseFieldDataFileTransformerModel m;
switch (data) { switch (data) {
case AutoCompleteDataEntity d -> { case ExternalSelectDataEntity d -> {
m = new AutoCompleteDataFileTransformerModel(); m = new AutoCompleteDataFileTransformerModel();
m.setLabel(d.getLabel()); m.setLabel(d.getLabel());
m.setFieldType(FieldType.of(d.getFieldType().getValue())); m.setFieldType(FieldType.of(d.getFieldType().getValue()));
((AutoCompleteDataFileTransformerModel)m).setMultiAutoComplete(d.getMultiAutoComplete()); ((AutoCompleteDataFileTransformerModel)m).setMultiAutoComplete(d.getMultipleSelect());
((AutoCompleteDataFileTransformerModel) m).setAutoCompleteSingleDataList(convertAutoCompleteSingleData(d.getAutoCompleteSingleDataList())); ((AutoCompleteDataFileTransformerModel) m).setAutoCompleteSingleDataList(convertAutoCompleteSingleData(d.getAutoCompleteSingleDataList()));
} }
case ExternalDatasetDataEntity d -> { case ExternalDatasetDataEntity d -> {
@ -182,7 +182,7 @@ public class DescriptionTemplateDefinitionFileTransformerBuilder extends BaseFil
((UploadDataFileTransformerModel) m).setMaxFileSizeInMB(d.getMaxFileSizeInMB()); ((UploadDataFileTransformerModel) m).setMaxFileSizeInMB(d.getMaxFileSizeInMB());
((UploadDataFileTransformerModel) m).setTypes(convertUploadDataOptions(d.getTypes())); ((UploadDataFileTransformerModel) m).setTypes(convertUploadDataOptions(d.getTypes()));
} }
case WordListDataEntity d -> { case SelectDataEntity d -> {
m = new WordListDataFileTransformerModel(); m = new WordListDataFileTransformerModel();
m.setLabel(d.getLabel()); m.setLabel(d.getLabel());
m.setFieldType(FieldType.of(d.getFieldType().getValue())); m.setFieldType(FieldType.of(d.getFieldType().getValue()));
@ -205,12 +205,12 @@ public class DescriptionTemplateDefinitionFileTransformerBuilder extends BaseFil
return result; return result;
} }
private List<AutoCompleteSingleDataFileTransformerModel> convertAutoCompleteSingleData(List<AutoCompleteDataEntity.AutoCompleteSingleData> data) { private List<AutoCompleteSingleDataFileTransformerModel> convertAutoCompleteSingleData(List<ExternalSelectDataEntity.ExternalSelectSourceEntity> data) {
List<AutoCompleteSingleDataFileTransformerModel> result = new ArrayList<>(); List<AutoCompleteSingleDataFileTransformerModel> result = new ArrayList<>();
for (AutoCompleteDataEntity.AutoCompleteSingleData d : data) { for (ExternalSelectDataEntity.ExternalSelectSourceEntity d : data) {
AutoCompleteSingleDataFileTransformerModel m = new AutoCompleteSingleDataFileTransformerModel(); AutoCompleteSingleDataFileTransformerModel m = new AutoCompleteSingleDataFileTransformerModel();
m.setUrl(d.getUrl()); m.setUrl(d.getUrl());
m.setAutoCompleteOptions(convertComboBoxOption(d.getAutoCompleteOptions())); m.setAutoCompleteOptions(convertComboBoxOption(d.getExternalSelectSourceBindingEntity()));
result.add(m); result.add(m);
} }
return result; return result;

View File

@ -1,10 +1,10 @@
package eu.eudat.model.descriptiontemplatedefinition.fielddata; package eu.eudat.model.descriptiontemplatedefinition.fielddata;
import eu.eudat.commons.types.descriptiontemplate.fielddata.AutoCompleteDataEntity; import eu.eudat.commons.types.descriptiontemplate.fielddata.ExternalSelectDataEntity;
public class AutoCompleteSingleData { public class AutoCompleteSingleData {
public final static String _autocompleteType = "autocompleteType"; public final static String _autocompleteType = "autocompleteType";
private AutoCompleteDataEntity.AutocompleteType autocompleteType; private ExternalSelectDataEntity.AutocompleteType autocompleteType;
public final static String _url = "url"; public final static String _url = "url";
private String url; private String url;
public final static String _autoCompleteOptions = "autoCompleteOptions"; public final static String _autoCompleteOptions = "autoCompleteOptions";
@ -18,11 +18,11 @@ public class AutoCompleteSingleData {
public final static String _method = "method"; public final static String _method = "method";
private String method; private String method;
public AutoCompleteDataEntity.AutocompleteType getAutocompleteType() { public ExternalSelectDataEntity.AutocompleteType getAutocompleteType() {
return autocompleteType; return autocompleteType;
} }
public void setAutocompleteType(AutoCompleteDataEntity.AutocompleteType autocompleteType) { public void setAutocompleteType(ExternalSelectDataEntity.AutocompleteType autocompleteType) {
this.autocompleteType = autocompleteType; this.autocompleteType = autocompleteType;
} }

View File

@ -2,7 +2,7 @@ package eu.eudat.model.descriptiontemplatedefinition.fielddata;
import java.util.List; import java.util.List;
public class WordListData extends BaseFieldData { public class SelectData extends BaseFieldData {
public final static String _options = "options"; public final static String _options = "options";
private List<ComboBoxOption> options; private List<ComboBoxOption> options;
public final static String _multiList = "multiList"; public final static String _multiList = "multiList";

View File

@ -1,6 +1,6 @@
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata; package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
import eu.eudat.commons.types.descriptiontemplate.fielddata.AutoCompleteDataEntity; import eu.eudat.commons.types.descriptiontemplate.fielddata.ExternalSelectDataEntity;
import eu.eudat.commons.validation.BaseValidator; import eu.eudat.commons.validation.BaseValidator;
import gr.cite.tools.validation.ValidatorFactory; import gr.cite.tools.validation.ValidatorFactory;
import gr.cite.tools.validation.specification.Specification; import gr.cite.tools.validation.specification.Specification;
@ -17,7 +17,7 @@ import java.util.List;
public class AutoCompleteSingleDataPersist { public class AutoCompleteSingleDataPersist {
private AutoCompleteDataEntity.AutocompleteType autocompleteType; private ExternalSelectDataEntity.AutocompleteType autocompleteType;
public static final String _autocompleteType = "autocompleteType"; public static final String _autocompleteType = "autocompleteType";
@ -43,11 +43,11 @@ public class AutoCompleteSingleDataPersist {
public static final String _method = "method"; public static final String _method = "method";
public AutoCompleteDataEntity.AutocompleteType getAutocompleteType() { public ExternalSelectDataEntity.AutocompleteType getAutocompleteType() {
return autocompleteType; return autocompleteType;
} }
public void setAutocompleteType(AutoCompleteDataEntity.AutocompleteType autocompleteType) { public void setAutocompleteType(ExternalSelectDataEntity.AutocompleteType autocompleteType) {
this.autocompleteType = autocompleteType; this.autocompleteType = autocompleteType;
} }

View File

@ -44,7 +44,7 @@ import java.util.List;
@JsonSubTypes.Type(value = LabelDataPersist.class, name = FieldType.Names.Validation), @JsonSubTypes.Type(value = LabelDataPersist.class, name = FieldType.Names.Validation),
@JsonSubTypes.Type(value = LabelDataPersist.class, name = FieldType.Names.DatasetIdentifier), @JsonSubTypes.Type(value = LabelDataPersist.class, name = FieldType.Names.DatasetIdentifier),
@JsonSubTypes.Type(value = LabelDataPersist.class, name = FieldType.Names.Currency), @JsonSubTypes.Type(value = LabelDataPersist.class, name = FieldType.Names.Currency),
@JsonSubTypes.Type(value = WordListDataPersist.class, name = FieldType.Names.Wordlist), @JsonSubTypes.Type(value = SelectDataPersist.class, name = FieldType.Names.Select),
@JsonSubTypes.Type(value = LabelAndMultiplicityDataPersist.class, name = FieldType.Names.DataRepositories), @JsonSubTypes.Type(value = LabelAndMultiplicityDataPersist.class, name = FieldType.Names.DataRepositories),
@JsonSubTypes.Type(value = LabelAndMultiplicityDataPersist.class, name = FieldType.Names.JournalRepositories), @JsonSubTypes.Type(value = LabelAndMultiplicityDataPersist.class, name = FieldType.Names.JournalRepositories),
@JsonSubTypes.Type(value = LabelAndMultiplicityDataPersist.class, name = FieldType.Names.Publications), @JsonSubTypes.Type(value = LabelAndMultiplicityDataPersist.class, name = FieldType.Names.Publications),

View File

@ -13,7 +13,7 @@ import org.springframework.stereotype.Component;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
public class WordListDataPersist extends BaseFieldDataPersist { public class SelectDataPersist extends BaseFieldDataPersist {
private List<ComboBoxOptionPersist> options = null; private List<ComboBoxOptionPersist> options = null;
@ -39,38 +39,38 @@ public class WordListDataPersist extends BaseFieldDataPersist {
this.multiList = multiList; this.multiList = multiList;
} }
@Component(WordListDataPersistValidator.ValidatorName) @Component(SelectDataPersistValidator.ValidatorName)
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public static class WordListDataPersistValidator extends BaseFieldDataPersistValidator<WordListDataPersist> { public static class SelectDataPersistValidator extends BaseFieldDataPersistValidator<SelectDataPersist> {
public static final String ValidatorName = "DescriptionTemplate.WordListDataPersistValidator"; public static final String ValidatorName = "DescriptionTemplate.SelectDataPersistValidator";
private final ValidatorFactory validatorFactory; private final ValidatorFactory validatorFactory;
protected WordListDataPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource, ValidatorFactory validatorFactory) { protected SelectDataPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource, ValidatorFactory validatorFactory) {
super(conventionService, errors, messageSource); super(conventionService, errors, messageSource);
this.validatorFactory = validatorFactory; this.validatorFactory = validatorFactory;
} }
@Override @Override
protected Class<WordListDataPersist> modelClass() { protected Class<SelectDataPersist> modelClass() {
return WordListDataPersist.class; return SelectDataPersist.class;
} }
@Override @Override
protected List<Specification> specifications(WordListDataPersist item) { protected List<Specification> specifications(SelectDataPersist item) {
List<Specification> specifications = getBaseSpecifications(item); List<Specification> specifications = getBaseSpecifications(item);
specifications.addAll(Arrays.asList( specifications.addAll(Arrays.asList(
this.spec() this.spec()
.must(() -> !this.isNull(item.getMultiList())) .must(() -> !this.isNull(item.getMultiList()))
.failOn(WordListDataPersist._multiList).failWith(messageSource.getMessage("Validation_Required", new Object[]{WordListDataPersist._multiList}, LocaleContextHolder.getLocale())), .failOn(SelectDataPersist._multiList).failWith(messageSource.getMessage("Validation_Required", new Object[]{SelectDataPersist._multiList}, LocaleContextHolder.getLocale())),
this.spec() this.spec()
.must(() -> !this.isNull(item.getOptions())) .must(() -> !this.isNull(item.getOptions()))
.failOn(WordListDataPersist._options).failWith(messageSource.getMessage("Validation_Required", new Object[]{WordListDataPersist._options}, LocaleContextHolder.getLocale())), .failOn(SelectDataPersist._options).failWith(messageSource.getMessage("Validation_Required", new Object[]{SelectDataPersist._options}, LocaleContextHolder.getLocale())),
this.navSpec() this.navSpec()
.iff(() -> !this.isNull(item.getOptions())) .iff(() -> !this.isNull(item.getOptions()))
.on(WordListDataPersist._options) .on(SelectDataPersist._options)
.over(item.getOptions()) .over(item.getOptions())
.using((itm) -> this.validatorFactory.validator(ComboBoxOptionPersist.ComboBoxOptionPersistValidator.class)) .using((itm) -> this.validatorFactory.validator(ComboBoxOptionPersist.ComboBoxOptionPersistValidator.class))
)); ));

View File

@ -1,8 +1,7 @@
package eu.eudat.service.fielddatahelper; package eu.eudat.service.fielddatahelper;
import eu.eudat.authorization.AuthorizationFlags; import eu.eudat.authorization.AuthorizationFlags;
import eu.eudat.commons.types.descriptiontemplate.fielddata.AutoCompleteDataEntity; import eu.eudat.commons.types.descriptiontemplate.fielddata.ExternalSelectDataEntity;
import eu.eudat.commons.types.descriptiontemplate.fielddata.ComboBoxDataEntity;
import eu.eudat.commons.types.descriptiontemplate.importexport.fielddata.*; import eu.eudat.commons.types.descriptiontemplate.importexport.fielddata.*;
import eu.eudat.convention.ConventionService; import eu.eudat.convention.ConventionService;
import eu.eudat.model.builder.descriptiontemplatedefinition.fielddata.AutoCompleteDataBuilder; import eu.eudat.model.builder.descriptiontemplatedefinition.fielddata.AutoCompleteDataBuilder;
@ -20,7 +19,7 @@ import java.util.EnumSet;
import java.util.List; import java.util.List;
@Component @Component
public class AutoCompleteFieldDataHelperService extends BaseFieldDataHelperService<AutoCompleteData, AutoCompleteDataPersist, AutoCompleteDataEntity, AutoCompleteDataImportExport> { public class AutoCompleteFieldDataHelperService extends BaseFieldDataHelperService<AutoCompleteData, AutoCompleteDataPersist, ExternalSelectDataEntity, AutoCompleteDataImportExport> {
private final ConventionService conventionService; private final ConventionService conventionService;
private final BuilderFactory builderFactory; private final BuilderFactory builderFactory;
private final ValidatorFactory validatorFactory; private final ValidatorFactory validatorFactory;
@ -33,8 +32,8 @@ public class AutoCompleteFieldDataHelperService extends BaseFieldDataHelperServi
@Override @Override
public AutoCompleteDataEntity newDataInstanceInternal() { public ExternalSelectDataEntity newDataInstanceInternal() {
return new AutoCompleteDataEntity(); return new ExternalSelectDataEntity();
} }
@Override @Override
@ -54,7 +53,7 @@ public class AutoCompleteFieldDataHelperService extends BaseFieldDataHelperServi
@Override @Override
public Class<?> getDataClass() { public Class<?> getDataClass() {
return AutoCompleteDataEntity.class; return ExternalSelectDataEntity.class;
} }
@Override @Override
public Class<?> getModelClass() { public Class<?> getModelClass() {
@ -76,13 +75,13 @@ public class AutoCompleteFieldDataHelperService extends BaseFieldDataHelperServi
} }
@Override @Override
public List<AutoCompleteData> buildInternal(FieldSet fieldSet, List<AutoCompleteDataEntity> data, EnumSet<AuthorizationFlags> authorizationFlags){ public List<AutoCompleteData> buildInternal(FieldSet fieldSet, List<ExternalSelectDataEntity> data, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(AutoCompleteDataBuilder.class).authorize(authorizationFlags).build(fieldSet, data); return this.builderFactory.builder(AutoCompleteDataBuilder.class).authorize(authorizationFlags).build(fieldSet, data);
} }
@Override @Override
protected AutoCompleteDataEntity applyPersistInternal(AutoCompleteDataPersist persist, AutoCompleteDataEntity data) { protected ExternalSelectDataEntity applyPersistInternal(AutoCompleteDataPersist persist, ExternalSelectDataEntity data) {
data.setMultiAutoComplete(persist.getMultiAutoComplete()); data.setMultipleSelect(persist.getMultiAutoComplete());
if (!this.conventionService.isListNullOrEmpty(persist.getAutoCompleteSingleDataList())){ if (!this.conventionService.isListNullOrEmpty(persist.getAutoCompleteSingleDataList())){
data.setAutoCompleteSingleDataList(new ArrayList<>()); data.setAutoCompleteSingleDataList(new ArrayList<>());
for (AutoCompleteSingleDataPersist autoCompleteSingleDataPersist: persist.getAutoCompleteSingleDataList()) { for (AutoCompleteSingleDataPersist autoCompleteSingleDataPersist: persist.getAutoCompleteSingleDataList()) {
@ -92,15 +91,15 @@ public class AutoCompleteFieldDataHelperService extends BaseFieldDataHelperServi
return data; return data;
} }
private @NotNull AutoCompleteDataEntity.AutoCompleteSingleData buildAutoCompleteSingleData(AutoCompleteSingleDataPersist persist){ private @NotNull ExternalSelectDataEntity.ExternalSelectSourceEntity buildAutoCompleteSingleData(AutoCompleteSingleDataPersist persist){
AutoCompleteDataEntity.AutoCompleteSingleData data = new AutoCompleteDataEntity.AutoCompleteSingleData(); ExternalSelectDataEntity.ExternalSelectSourceEntity data = new ExternalSelectDataEntity.ExternalSelectSourceEntity();
if (persist == null) return data; if (persist == null) return data;
data.setUrl(persist.getUrl()); data.setUrl(persist.getUrl());
data.setAutocompleteType(persist.getAutocompleteType()); data.setAutocompleteType(persist.getAutocompleteType());
data.setOptionsRoot(persist.getOptionsRoot()); data.setOptionsRoot(persist.getOptionsRoot());
data.setHasAuth(persist.getHasAuth()); data.setHasAuth(persist.getHasAuth());
if(persist.getAutoCompleteOptions() != null) data.setAutoCompleteOptions(this.buildOption(persist.getAutoCompleteOptions())); if(persist.getAutoCompleteOptions() != null) data.setExternalSelectSourceBindingEntity(this.buildOption(persist.getAutoCompleteOptions()));
if(persist.getAuth() != null) data.setAuth(this.buildAuthAutoCompleteData(persist.getAuth())); if(persist.getAuth() != null) data.setAuth(this.buildAuthAutoCompleteData(persist.getAuth()));
data.setMethod(persist.getMethod()); data.setMethod(persist.getMethod());
@ -119,8 +118,8 @@ public class AutoCompleteFieldDataHelperService extends BaseFieldDataHelperServi
return data; return data;
} }
private @NotNull AutoCompleteDataEntity.AuthAutoCompleteData buildAuthAutoCompleteData(AuthAutoCompleteDataPersist persist){ private @NotNull ExternalSelectDataEntity.ExternalSelectAuthDataEntity buildAuthAutoCompleteData(AuthAutoCompleteDataPersist persist){
AutoCompleteDataEntity.AuthAutoCompleteData data = new AutoCompleteDataEntity.AuthAutoCompleteData(); ExternalSelectDataEntity.ExternalSelectAuthDataEntity data = new ExternalSelectDataEntity.ExternalSelectAuthDataEntity();
if (persist == null) return data; if (persist == null) return data;
data.setBody(persist.getBody()); data.setBody(persist.getBody());
@ -185,23 +184,23 @@ public class AutoCompleteFieldDataHelperService extends BaseFieldDataHelperServi
} }
@Override @Override
protected AutoCompleteDataImportExport dataToImportExportXmlInternal(AutoCompleteDataEntity data, AutoCompleteDataImportExport xml) { protected AutoCompleteDataImportExport dataToImportExportXmlInternal(ExternalSelectDataEntity data, AutoCompleteDataImportExport xml) {
xml.setMultiAutoComplete(data.getMultiAutoComplete()); xml.setMultiAutoComplete(data.getMultipleSelect());
if (!this.conventionService.isListNullOrEmpty(data.getAutoCompleteSingleDataList())){ if (!this.conventionService.isListNullOrEmpty(data.getAutoCompleteSingleDataList())){
xml.setAutoCompleteSingleDataList(new ArrayList<>()); xml.setAutoCompleteSingleDataList(new ArrayList<>());
for (AutoCompleteDataEntity.AutoCompleteSingleData autoCompleteSingleData: data.getAutoCompleteSingleDataList()) { for (ExternalSelectDataEntity.ExternalSelectSourceEntity externalSelectSourceEntity : data.getAutoCompleteSingleDataList()) {
xml.getAutoCompleteSingleDataList().add(this.buildAutoCompleteSingleData(autoCompleteSingleData)); xml.getAutoCompleteSingleDataList().add(this.buildAutoCompleteSingleData(externalSelectSourceEntity));
} }
} }
return xml; return xml;
} }
@Override @Override
protected boolean isMultiValueInternal(AutoCompleteDataEntity data) { protected boolean isMultiValueInternal(ExternalSelectDataEntity data) {
return data.getMultiAutoComplete(); return data.getMultipleSelect();
} }
private @NotNull AutoCompleteSingleData buildAutoCompleteSingleData(AutoCompleteDataEntity.AutoCompleteSingleData data){ private @NotNull AutoCompleteSingleData buildAutoCompleteSingleData(ExternalSelectDataEntity.ExternalSelectSourceEntity data){
AutoCompleteSingleData xml = new AutoCompleteSingleData(); AutoCompleteSingleData xml = new AutoCompleteSingleData();
if (data == null) return xml; if (data == null) return xml;
@ -209,7 +208,7 @@ public class AutoCompleteFieldDataHelperService extends BaseFieldDataHelperServi
xml.setAutocompleteType(data.getAutocompleteType()); xml.setAutocompleteType(data.getAutocompleteType());
xml.setOptionsRoot(data.getOptionsRoot()); xml.setOptionsRoot(data.getOptionsRoot());
xml.setHasAuth(data.getHasAuth()); xml.setHasAuth(data.getHasAuth());
if(data.getAutoCompleteOptions() != null) xml.setAutoCompleteOptions(this.buildOption(data.getAutoCompleteOptions())); if(data.getExternalSelectSourceBindingEntity() != null) xml.setAutoCompleteOptions(this.buildOption(data.getExternalSelectSourceBindingEntity()));
if(data.getAuth() != null) xml.setAuth(this.buildAuthAutoCompleteData(data.getAuth())); if(data.getAuth() != null) xml.setAuth(this.buildAuthAutoCompleteData(data.getAuth()));
xml.setMethod(data.getMethod()); xml.setMethod(data.getMethod());
@ -228,7 +227,7 @@ public class AutoCompleteFieldDataHelperService extends BaseFieldDataHelperServi
return xml; return xml;
} }
private @NotNull AuthAutoCompleteData buildAuthAutoCompleteData(AutoCompleteDataEntity.AuthAutoCompleteData data){ private @NotNull AuthAutoCompleteData buildAuthAutoCompleteData(ExternalSelectDataEntity.ExternalSelectAuthDataEntity data){
AuthAutoCompleteData xml = new AuthAutoCompleteData(); AuthAutoCompleteData xml = new AuthAutoCompleteData();
if (data == null) return xml; if (data == null) return xml;

View File

@ -75,7 +75,7 @@ public class ExternalDatasetFieldDataHelperService extends BaseFieldDataHelperSe
@Override @Override
protected ExternalDatasetDataEntity applyPersistInternal(ExternalDatasetDataPersist persist, ExternalDatasetDataEntity data) { protected ExternalDatasetDataEntity applyPersistInternal(ExternalDatasetDataPersist persist, ExternalDatasetDataEntity data) {
data.setMultiAutoComplete(persist.getMultiAutoComplete()); data.setMultipleSelect(persist.getMultiAutoComplete());
data.setType(persist.getType()); data.setType(persist.getType());
return data; return data;
} }
@ -89,13 +89,13 @@ public class ExternalDatasetFieldDataHelperService extends BaseFieldDataHelperSe
@Override @Override
protected ExternalDatasetDataImportExport dataToImportExportXmlInternal(ExternalDatasetDataEntity data, ExternalDatasetDataImportExport xml) { protected ExternalDatasetDataImportExport dataToImportExportXmlInternal(ExternalDatasetDataEntity data, ExternalDatasetDataImportExport xml) {
xml.setMultiAutoComplete(data.getMultiAutoComplete()); xml.setMultiAutoComplete(data.getMultipleSelect());
xml.setType(data.getType()); xml.setType(data.getType());
return xml; return xml;
} }
@Override @Override
protected boolean isMultiValueInternal(ExternalDatasetDataEntity data) { protected boolean isMultiValueInternal(ExternalDatasetDataEntity data) {
return data.getMultiAutoComplete(); return data.getMultipleSelect();
} }
} }

View File

@ -1,12 +1,8 @@
package eu.eudat.service.fielddatahelper; package eu.eudat.service.fielddatahelper;
import eu.eudat.commons.enums.FieldType; import eu.eudat.commons.enums.FieldType;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.LabelDataPersist;
import gr.cite.tools.data.builder.Builder;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@Component @Component
@ -60,8 +56,8 @@ public class FieldDataHelperServiceProvider {
item = this.applicationContext.getBean(ExternalDatasetFieldDataHelperService.class); item = this.applicationContext.getBean(ExternalDatasetFieldDataHelperService.class);
break; break;
} }
case WORD_LIST: { case SELECT: {
item = this.applicationContext.getBean(WordListFieldDataHelperService.class); item = this.applicationContext.getBean(SelectFieldDataHelperService.class);
break; break;
} }
case AUTO_COMPLETE: { case AUTO_COMPLETE: {

View File

@ -76,7 +76,7 @@ public class LabelAndMultiplicityFieldDataHelperService extends BaseFieldDataHel
@Override @Override
protected LabelAndMultiplicityDataEntity applyPersistInternal(LabelAndMultiplicityDataPersist persist, LabelAndMultiplicityDataEntity data) { protected LabelAndMultiplicityDataEntity applyPersistInternal(LabelAndMultiplicityDataPersist persist, LabelAndMultiplicityDataEntity data) {
data.setMultiAutoComplete(persist.getMultiAutoComplete()); data.setMultipleSelect(persist.getMultiAutoComplete());
return data; return data;
} }
@ -88,12 +88,12 @@ public class LabelAndMultiplicityFieldDataHelperService extends BaseFieldDataHel
@Override @Override
protected LabelAndMultiplicityDataImportExport dataToImportExportXmlInternal(LabelAndMultiplicityDataEntity data, LabelAndMultiplicityDataImportExport xml) { protected LabelAndMultiplicityDataImportExport dataToImportExportXmlInternal(LabelAndMultiplicityDataEntity data, LabelAndMultiplicityDataImportExport xml) {
xml.setMultiAutoComplete(data.getMultiAutoComplete()); xml.setMultiAutoComplete(data.getMultipleSelect());
return xml; return xml;
} }
@Override @Override
protected boolean isMultiValueInternal(LabelAndMultiplicityDataEntity data) { protected boolean isMultiValueInternal(LabelAndMultiplicityDataEntity data) {
return data.getMultiAutoComplete(); return data.getMultipleSelect();
} }
} }

View File

@ -2,12 +2,12 @@ package eu.eudat.service.fielddatahelper;
import eu.eudat.authorization.AuthorizationFlags; import eu.eudat.authorization.AuthorizationFlags;
import eu.eudat.commons.types.descriptiontemplate.fielddata.*; import eu.eudat.commons.types.descriptiontemplate.fielddata.*;
import eu.eudat.commons.types.descriptiontemplate.fielddata.WordListDataEntity; import eu.eudat.commons.types.descriptiontemplate.fielddata.SelectDataEntity;
import eu.eudat.commons.types.descriptiontemplate.importexport.fielddata.ComboBoxDataOptionEntity; import eu.eudat.commons.types.descriptiontemplate.importexport.fielddata.ComboBoxDataOptionEntity;
import eu.eudat.commons.types.descriptiontemplate.importexport.fielddata.WordListDataImportExport; import eu.eudat.commons.types.descriptiontemplate.importexport.fielddata.SelectDataImportExport;
import eu.eudat.convention.ConventionService; import eu.eudat.convention.ConventionService;
import eu.eudat.model.builder.descriptiontemplatedefinition.fielddata.WordListDataBuilder; import eu.eudat.model.builder.descriptiontemplatedefinition.fielddata.SelectDataBuilder;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.WordListData; import eu.eudat.model.descriptiontemplatedefinition.fielddata.SelectData;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.*; import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.*;
import gr.cite.tools.data.builder.BuilderFactory; import gr.cite.tools.data.builder.BuilderFactory;
import gr.cite.tools.fieldset.FieldSet; import gr.cite.tools.fieldset.FieldSet;
@ -21,13 +21,13 @@ import java.util.EnumSet;
import java.util.List; import java.util.List;
@Component @Component
public class WordListFieldDataHelperService extends BaseFieldDataHelperService<WordListData, WordListDataPersist, WordListDataEntity, WordListDataImportExport> { public class SelectFieldDataHelperService extends BaseFieldDataHelperService<SelectData, SelectDataPersist, SelectDataEntity, SelectDataImportExport> {
private final ConventionService conventionService; private final ConventionService conventionService;
private final BuilderFactory builderFactory; private final BuilderFactory builderFactory;
private final ValidatorFactory validatorFactory; private final ValidatorFactory validatorFactory;
public WordListFieldDataHelperService(ConventionService conventionService, BuilderFactory builderFactory, ValidatorFactory validatorFactory) { public SelectFieldDataHelperService(ConventionService conventionService, BuilderFactory builderFactory, ValidatorFactory validatorFactory) {
this.conventionService = conventionService; this.conventionService = conventionService;
this.builderFactory = builderFactory; this.builderFactory = builderFactory;
this.validatorFactory = validatorFactory; this.validatorFactory = validatorFactory;
@ -35,55 +35,55 @@ public class WordListFieldDataHelperService extends BaseFieldDataHelperService<W
@Override @Override
public WordListDataEntity newDataInstanceInternal() { public SelectDataEntity newDataInstanceInternal() {
return new WordListDataEntity(); return new SelectDataEntity();
} }
@Override @Override
public WordListData newModelInstanceInternal() { public SelectData newModelInstanceInternal() {
return new WordListData(); return new SelectData();
} }
@Override @Override
public WordListDataPersist newPersistModelInstanceInternal() { public SelectDataPersist newPersistModelInstanceInternal() {
return new WordListDataPersist(); return new SelectDataPersist();
} }
@Override @Override
protected WordListDataImportExport newImportExportInstanceInternal() { protected SelectDataImportExport newImportExportInstanceInternal() {
return new WordListDataImportExport(); return new SelectDataImportExport();
} }
@Override @Override
public Class<?> getDataClass() { public Class<?> getDataClass() {
return WordListDataEntity.class; return SelectDataEntity.class;
} }
@Override @Override
public Class<?> getModelClass() { public Class<?> getModelClass() {
return WordListData.class; return SelectData.class;
} }
@Override @Override
public Class<?> getPersistModelClass() { public Class<?> getPersistModelClass() {
return WordListDataPersist.class; return SelectDataPersist.class;
} }
@Override @Override
public Class<?> getImportExportClass() { public Class<?> getImportExportClass() {
return WordListDataImportExport.class; return SelectDataImportExport.class;
} }
@Override @Override
public Validator getPersistModelValidator() { public Validator getPersistModelValidator() {
return this.validatorFactory.validator(WordListDataPersist.WordListDataPersistValidator.class); return this.validatorFactory.validator(SelectDataPersist.SelectDataPersistValidator.class);
} }
@Override @Override
public List<WordListData> buildInternal(FieldSet fieldSet, List<WordListDataEntity> data, EnumSet<AuthorizationFlags> authorizationFlags){ public List<SelectData> buildInternal(FieldSet fieldSet, List<SelectDataEntity> data, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(WordListDataBuilder.class).authorize(authorizationFlags).build(fieldSet, data); return this.builderFactory.builder(SelectDataBuilder.class).authorize(authorizationFlags).build(fieldSet, data);
} }
@Override @Override
protected WordListDataEntity applyPersistInternal(WordListDataPersist persist, WordListDataEntity data) { protected SelectDataEntity applyPersistInternal(SelectDataPersist persist, SelectDataEntity data) {
data.setMultiList(persist.getMultiList()); data.setMultiList(persist.getMultiList());
if (!this.conventionService.isListNullOrEmpty(persist.getOptions())){ if (!this.conventionService.isListNullOrEmpty(persist.getOptions())){
data.setOptions(new ArrayList<>()); data.setOptions(new ArrayList<>());
@ -108,7 +108,7 @@ public class WordListFieldDataHelperService extends BaseFieldDataHelperService<W
} }
@Override @Override
protected WordListDataPersist importExportMapDataToPersistInternal(WordListDataImportExport data, WordListDataPersist persist) { protected SelectDataPersist importExportMapDataToPersistInternal(SelectDataImportExport data, SelectDataPersist persist) {
persist.setMultiList(data.getMultiList()); persist.setMultiList(data.getMultiList());
if (!this.conventionService.isListNullOrEmpty(data.getOptions())){ if (!this.conventionService.isListNullOrEmpty(data.getOptions())){
persist.setOptions(new ArrayList<>()); persist.setOptions(new ArrayList<>());
@ -132,7 +132,7 @@ public class WordListFieldDataHelperService extends BaseFieldDataHelperService<W
} }
@Override @Override
protected WordListDataImportExport dataToImportExportXmlInternal(WordListDataEntity data, WordListDataImportExport xml) { protected SelectDataImportExport dataToImportExportXmlInternal(SelectDataEntity data, SelectDataImportExport xml) {
xml.setMultiList(data.getMultiList()); xml.setMultiList(data.getMultiList());
if (!this.conventionService.isListNullOrEmpty(data.getOptions())){ if (!this.conventionService.isListNullOrEmpty(data.getOptions())){
xml.setOptions(new ArrayList<>()); xml.setOptions(new ArrayList<>());
@ -144,7 +144,7 @@ public class WordListFieldDataHelperService extends BaseFieldDataHelperService<W
} }
@Override @Override
protected boolean isMultiValueInternal(WordListDataEntity data) { protected boolean isMultiValueInternal(SelectDataEntity data) {
return data.getMultiList(); return data.getMultiList();
} }

View File

@ -7,10 +7,9 @@ import eu.eudat.commons.JsonHandlingService;
import eu.eudat.commons.XmlHandlingService; import eu.eudat.commons.XmlHandlingService;
import eu.eudat.commons.enums.FieldType; import eu.eudat.commons.enums.FieldType;
import eu.eudat.commons.types.descriptiontemplate.FieldEntity; import eu.eudat.commons.types.descriptiontemplate.FieldEntity;
import eu.eudat.commons.types.descriptiontemplate.fielddata.AutoCompleteDataEntity; import eu.eudat.commons.types.descriptiontemplate.fielddata.ExternalSelectDataEntity;
import eu.eudat.commons.types.descriptiontemplate.fielddata.ComboBoxDataEntity;
import eu.eudat.commons.types.descriptiontemplate.fielddata.LabelAndMultiplicityDataEntity; import eu.eudat.commons.types.descriptiontemplate.fielddata.LabelAndMultiplicityDataEntity;
import eu.eudat.commons.types.descriptiontemplate.fielddata.WordListDataEntity; import eu.eudat.commons.types.descriptiontemplate.fielddata.SelectDataEntity;
import eu.eudat.commons.types.prefilling.PrefillingEntity; import eu.eudat.commons.types.prefilling.PrefillingEntity;
import eu.eudat.convention.ConventionService; import eu.eudat.convention.ConventionService;
import eu.eudat.data.DescriptionTemplateEntity; import eu.eudat.data.DescriptionTemplateEntity;
@ -284,7 +283,7 @@ public class PrefillingServiceImpl implements PrefillingService {
field.setKey(id); field.setKey(id);
switch (fieldEntity.getData().getFieldType()) { switch (fieldEntity.getData().getFieldType()) {
case AUTO_COMPLETE: case AUTO_COMPLETE:
case WORD_LIST: { case SELECT: {
if (!parsedValues.stream().allMatch(Objects::isNull)) { if (!parsedValues.stream().allMatch(Objects::isNull)) {
field.setValue(this.jsonHandlingService.toJsonSafe(parseComboBoxValues(fieldEntity, parsedValues))); field.setValue(this.jsonHandlingService.toJsonSafe(parseComboBoxValues(fieldEntity, parsedValues)));
} }
@ -307,9 +306,9 @@ public class PrefillingServiceImpl implements PrefillingService {
} }
case LICENSES: { case LICENSES: {
List<ReferenceEntity> licenses = this.queryFactory.query(ReferenceQuery.class).references(parsedValues).collect(); List<ReferenceEntity> licenses = this.queryFactory.query(ReferenceQuery.class).references(parsedValues).collect();
LabelAndMultiplicityDataEntity wordListDataEntity = (LabelAndMultiplicityDataEntity) fieldEntity.getData(); LabelAndMultiplicityDataEntity licenseDataEntity = (LabelAndMultiplicityDataEntity) fieldEntity.getData();
if (licenses != null && !licenses.isEmpty() && wordListDataEntity != null) { if (licenses != null && !licenses.isEmpty() && licenseDataEntity != null) {
boolean isMultiAutocomplete = wordListDataEntity.getMultiAutoComplete(); boolean isMultiAutocomplete = licenseDataEntity.getMultipleSelect();
List<Reference> licenseModels = this.builderFactory.builder(ReferenceBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(new BaseFieldSet(), licenses); List<Reference> licenseModels = this.builderFactory.builder(ReferenceBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(new BaseFieldSet(), licenses);
if (isMultiAutocomplete) { if (isMultiAutocomplete) {
field.setValue(jsonHandlingService.toJsonSafe(licenseModels)); field.setValue(jsonHandlingService.toJsonSafe(licenseModels));
@ -366,8 +365,8 @@ public class PrefillingServiceImpl implements PrefillingService {
List<String> normalizedValues = new ArrayList<>(); List<String> normalizedValues = new ArrayList<>();
boolean isMultiSelect; boolean isMultiSelect;
if(fieldEntity.getData().getFieldType().equals(FieldType.AUTO_COMPLETE)) { if(fieldEntity.getData().getFieldType().equals(FieldType.AUTO_COMPLETE)) {
AutoCompleteDataEntity autoCompleteData = (AutoCompleteDataEntity)fieldEntity.getData(); ExternalSelectDataEntity autoCompleteData = (ExternalSelectDataEntity)fieldEntity.getData();
isMultiSelect = autoCompleteData.getMultiAutoComplete(); isMultiSelect = autoCompleteData.getMultipleSelect();
for (String format : parsedValues) { for (String format : parsedValues) {
List<ExternalAutocompleteFieldResult> result = new ArrayList<>(); List<ExternalAutocompleteFieldResult> result = new ArrayList<>();
try { try {
@ -391,10 +390,10 @@ public class PrefillingServiceImpl implements PrefillingService {
} }
return !normalizedValues.isEmpty() ? (isMultiSelect ? normalizedValues : normalizedValues.getFirst()) : null; return !normalizedValues.isEmpty() ? (isMultiSelect ? normalizedValues : normalizedValues.getFirst()) : null;
} else { } else {
WordListDataEntity wordListDataEntity = (WordListDataEntity)fieldEntity.getData(); SelectDataEntity selectDataEntity = (SelectDataEntity)fieldEntity.getData();
isMultiSelect = wordListDataEntity.getMultiList(); isMultiSelect = selectDataEntity.getMultiList();
if (wordListDataEntity.getOptions() != null) { if (selectDataEntity.getOptions() != null) {
for (ComboBoxDataEntity.Option option : wordListDataEntity.getOptions()) { for (ComboBoxDataEntity.Option option : selectDataEntity.getOptions()) {
if (parsedValues.contains(option.getValue())) { if (parsedValues.contains(option.getValue())) {
normalizedValues.add(option.getValue()); normalizedValues.add(option.getValue());
} }
@ -419,7 +418,7 @@ public class PrefillingServiceImpl implements PrefillingService {
return parsedTags; return parsedTags;
} }
public List<ExternalAutocompleteFieldResult> getAutocomplete(AutoCompleteDataEntity data, String like) throws URISyntaxException { public List<ExternalAutocompleteFieldResult> getAutocomplete(ExternalSelectDataEntity data, String like) throws URISyntaxException {
List<ExternalAutocompleteFieldResult> result = new LinkedList<>(); List<ExternalAutocompleteFieldResult> result = new LinkedList<>();
ExternalReferenceCriteria urlCriteria = new ExternalReferenceCriteria(); ExternalReferenceCriteria urlCriteria = new ExternalReferenceCriteria();
@ -428,7 +427,7 @@ public class PrefillingServiceImpl implements PrefillingService {
List<Map<String, String>> rawResults = new ArrayList<>(); List<Map<String, String>> rawResults = new ArrayList<>();
genericUrls.setFetchMode(FetchStrategy.FIRST); genericUrls.setFetchMode(FetchStrategy.FIRST);
urlCriteria.setLike(like); urlCriteria.setLike(like);
for (AutoCompleteDataEntity.AutoCompleteSingleData singleData : data.getAutoCompleteSingleDataList()) { for (ExternalSelectDataEntity.ExternalSelectSourceEntity singleData : data.getAutoCompleteSingleDataList()) {
UrlConfiguration urlConfiguration = new UrlConfiguration(); UrlConfiguration urlConfiguration = new UrlConfiguration();
try { try {
URI uri; URI uri;
@ -437,9 +436,9 @@ public class PrefillingServiceImpl implements PrefillingService {
} else { } else {
uri = new URI(singleData.getUrl()); uri = new URI(singleData.getUrl());
} }
String source = singleData.getAutoCompleteOptions().getSource(); String source = singleData.getExternalSelectSourceBindingEntity().getSource();
source = source != null && !source.isEmpty() ? source : uri.getHost(); source = source != null && !source.isEmpty() ? source : uri.getHost();
String uriString = singleData.getAutoCompleteOptions().getUri(); String uriString = singleData.getExternalSelectSourceBindingEntity().getUri();
uriString = uriString != null && !uriString.isEmpty() ? uriString : "uri"; uriString = uriString != null && !uriString.isEmpty() ? uriString : "uri";
String parsedUrl = singleData.getUrl(); String parsedUrl = singleData.getUrl();
parsedUrl = parsedUrl.replace("%20", " "); parsedUrl = parsedUrl.replace("%20", " ");
@ -456,9 +455,9 @@ public class PrefillingServiceImpl implements PrefillingService {
DataUrlConfiguration dataUrlConfiguration = new DataUrlConfiguration(); DataUrlConfiguration dataUrlConfiguration = new DataUrlConfiguration();
dataUrlConfiguration.setPath(singleData.getOptionsRoot()); dataUrlConfiguration.setPath(singleData.getOptionsRoot());
DataFieldsUrlConfiguration fieldsUrlConfiguration = new DataFieldsUrlConfiguration(); DataFieldsUrlConfiguration fieldsUrlConfiguration = new DataFieldsUrlConfiguration();
fieldsUrlConfiguration.setId(singleData.getAutoCompleteOptions().getValue()); fieldsUrlConfiguration.setId(singleData.getExternalSelectSourceBindingEntity().getValue());
fieldsUrlConfiguration.setName(singleData.getAutoCompleteOptions().getLabel()); fieldsUrlConfiguration.setName(singleData.getExternalSelectSourceBindingEntity().getLabel());
fieldsUrlConfiguration.setSource(singleData.getAutoCompleteOptions().getSource().isEmpty()? null : singleData.getAutoCompleteOptions().getSource()); fieldsUrlConfiguration.setSource(singleData.getExternalSelectSourceBindingEntity().getSource().isEmpty()? null : singleData.getExternalSelectSourceBindingEntity().getSource());
fieldsUrlConfiguration.setUri(uriString); fieldsUrlConfiguration.setUri(uriString);
dataUrlConfiguration.setFieldsUrlConfiguration(fieldsUrlConfiguration); dataUrlConfiguration.setFieldsUrlConfiguration(fieldsUrlConfiguration);
urlConfiguration.setKey(source); urlConfiguration.setKey(source);
@ -475,8 +474,8 @@ public class PrefillingServiceImpl implements PrefillingService {
} }
genericUrls.getUrls().add(urlConfiguration); genericUrls.getUrls().add(urlConfiguration);
List<Map<String, String>> singleResults = this.remoteFetcherService.getExternalGeneric(urlCriteria, genericUrls); List<Map<String, String>> singleResults = this.remoteFetcherService.getExternalGeneric(urlCriteria, genericUrls);
if (!singleResults.isEmpty() && !singleResults.get(0).containsKey("source") && !singleData.getAutoCompleteOptions().getSource().isEmpty()) { if (!singleResults.isEmpty() && !singleResults.get(0).containsKey("source") && !singleData.getExternalSelectSourceBindingEntity().getSource().isEmpty()) {
singleResults.forEach(singleResult -> singleResult.put("source", singleData.getAutoCompleteOptions().getSource())); singleResults.forEach(singleResult -> singleResult.put("source", singleData.getExternalSelectSourceBindingEntity().getSource()));
} }
rawResults.addAll(singleResults); rawResults.addAll(singleResults);
genericUrls.getUrls().clear(); genericUrls.getUrls().clear();

View File

@ -1,7 +1,7 @@
package eu.eudat.logic.managers; package eu.eudat.logic.managers;
import eu.eudat.commons.types.descriptiontemplate.FieldEntity; import eu.eudat.commons.types.descriptiontemplate.FieldEntity;
import eu.eudat.commons.types.descriptiontemplate.fielddata.AutoCompleteDataEntity; import eu.eudat.commons.types.descriptiontemplate.fielddata.ExternalSelectDataEntity;
import eu.eudat.logic.xml.XmlBuilder; import eu.eudat.logic.xml.XmlBuilder;
import eu.eudat.data.DescriptionTemplateEntity; import eu.eudat.data.DescriptionTemplateEntity;
import eu.eudat.logic.proxy.config.configloaders.ConfigLoader; import eu.eudat.logic.proxy.config.configloaders.ConfigLoader;
@ -62,7 +62,7 @@ public class DatasetProfileManager {
return fieldEntity; return fieldEntity;
} }
public List<ExternalAutocompleteFieldResult> getAutocomplete(AutoCompleteDataEntity data, String like) { public List<ExternalAutocompleteFieldResult> getAutocomplete(ExternalSelectDataEntity data, String like) {
/*List<ExternalAutocompleteFieldModel> result = new LinkedList<>(); /*List<ExternalAutocompleteFieldModel> result = new LinkedList<>();
SimpleClientHttpRequestFactory simpleFactory = new SimpleClientHttpRequestFactory(); SimpleClientHttpRequestFactory simpleFactory = new SimpleClientHttpRequestFactory();
@ -134,7 +134,7 @@ public class DatasetProfileManager {
List<Map<String, String>> rawResults = new ArrayList<>(); List<Map<String, String>> rawResults = new ArrayList<>();
genericUrls.setFetchMode(FetchStrategy.FIRST); genericUrls.setFetchMode(FetchStrategy.FIRST);
urlCriteria.setLike(like); urlCriteria.setLike(like);
for (AutoCompleteDataEntity.AutoCompleteSingleData singleData : data.getAutoCompleteSingleDataList()) { for (ExternalSelectDataEntity.ExternalSelectSourceEntity singleData : data.getAutoCompleteSingleDataList()) {
UrlConfiguration urlConfiguration = new UrlConfiguration(); UrlConfiguration urlConfiguration = new UrlConfiguration();
try { try {
URI uri; URI uri;
@ -143,9 +143,9 @@ public class DatasetProfileManager {
} else { } else {
uri = new URI(singleData.getUrl()); uri = new URI(singleData.getUrl());
} }
String source = singleData.getAutoCompleteOptions().getSource(); String source = singleData.getExternalSelectSourceBindingEntity().getSource();
source = source != null && !source.isEmpty() ? source : uri.getHost(); source = source != null && !source.isEmpty() ? source : uri.getHost();
String uriString = singleData.getAutoCompleteOptions().getUri(); String uriString = singleData.getExternalSelectSourceBindingEntity().getUri();
uriString = uriString != null && !uriString.isEmpty() ? uriString : "uri"; uriString = uriString != null && !uriString.isEmpty() ? uriString : "uri";
String parsedUrl = singleData.getUrl(); String parsedUrl = singleData.getUrl();
parsedUrl = parsedUrl.replace("%20", " "); parsedUrl = parsedUrl.replace("%20", " ");
@ -162,9 +162,9 @@ public class DatasetProfileManager {
DataUrlConfiguration dataUrlConfiguration = new DataUrlConfiguration(); DataUrlConfiguration dataUrlConfiguration = new DataUrlConfiguration();
dataUrlConfiguration.setPath(singleData.getOptionsRoot()); dataUrlConfiguration.setPath(singleData.getOptionsRoot());
DataFieldsUrlConfiguration fieldsUrlConfiguration = new DataFieldsUrlConfiguration(); DataFieldsUrlConfiguration fieldsUrlConfiguration = new DataFieldsUrlConfiguration();
fieldsUrlConfiguration.setId(singleData.getAutoCompleteOptions().getValue()); fieldsUrlConfiguration.setId(singleData.getExternalSelectSourceBindingEntity().getValue());
fieldsUrlConfiguration.setName(singleData.getAutoCompleteOptions().getLabel()); fieldsUrlConfiguration.setName(singleData.getExternalSelectSourceBindingEntity().getLabel());
fieldsUrlConfiguration.setSource(singleData.getAutoCompleteOptions().getSource().isEmpty()? null : singleData.getAutoCompleteOptions().getSource()); fieldsUrlConfiguration.setSource(singleData.getExternalSelectSourceBindingEntity().getSource().isEmpty()? null : singleData.getExternalSelectSourceBindingEntity().getSource());
fieldsUrlConfiguration.setUri(uriString); fieldsUrlConfiguration.setUri(uriString);
dataUrlConfiguration.setFieldsUrlConfiguration(fieldsUrlConfiguration); dataUrlConfiguration.setFieldsUrlConfiguration(fieldsUrlConfiguration);
urlConfiguration.setKey(source); urlConfiguration.setKey(source);
@ -181,8 +181,8 @@ public class DatasetProfileManager {
} }
genericUrls.getUrls().add(urlConfiguration); genericUrls.getUrls().add(urlConfiguration);
List<Map<String, String>> singleResults = this.remoteFetcherService.getExternalGeneric(urlCriteria, genericUrls); List<Map<String, String>> singleResults = this.remoteFetcherService.getExternalGeneric(urlCriteria, genericUrls);
if (!singleResults.isEmpty() && !singleResults.get(0).containsKey("source") && !singleData.getAutoCompleteOptions().getSource().isEmpty()) { if (!singleResults.isEmpty() && !singleResults.get(0).containsKey("source") && !singleData.getExternalSelectSourceBindingEntity().getSource().isEmpty()) {
singleResults.forEach(singleResult -> singleResult.put("source", singleData.getAutoCompleteOptions().getSource())); singleResults.forEach(singleResult -> singleResult.put("source", singleData.getExternalSelectSourceBindingEntity().getSource()));
} }
rawResults.addAll(singleResults); rawResults.addAll(singleResults);
genericUrls.getUrls().clear(); genericUrls.getUrls().clear();

View File

@ -15,7 +15,7 @@ import eu.eudat.service.remotefetcher.config.entities.PrefillingGet;
import eu.eudat.service.remotefetcher.config.entities.PrefillingMapping; import eu.eudat.service.remotefetcher.config.entities.PrefillingMapping;
import eu.eudat.utilities.helpers.StreamDistinctBy; import eu.eudat.utilities.helpers.StreamDistinctBy;
import eu.eudat.logic.utilities.json.JsonSearcher; import eu.eudat.logic.utilities.json.JsonSearcher;
import eu.eudat.commons.types.descriptiontemplate.fielddata.AutoCompleteDataEntity; import eu.eudat.commons.types.descriptiontemplate.fielddata.ExternalSelectDataEntity;
import eu.eudat.models.data.datasetwizard.DatasetWizardModel; import eu.eudat.models.data.datasetwizard.DatasetWizardModel;
import eu.eudat.service.remotefetcher.models.ExternalAutocompleteFieldResult; import eu.eudat.service.remotefetcher.models.ExternalAutocompleteFieldResult;
import org.json.JSONObject; import org.json.JSONObject;
@ -166,7 +166,7 @@ public class PrefillingMapper {
switch (FieldType.of(renderStyle)) { switch (FieldType.of(renderStyle)) {
case AUTO_COMPLETE: case AUTO_COMPLETE:
case WORD_LIST: case SELECT:
if (parsedValues.isEmpty()) if (parsedValues.isEmpty())
parsedValues.add(parsedValue); parsedValues.add(parsedValue);
if (!parsedValues.stream().allMatch(Objects::isNull)) { if (!parsedValues.stream().allMatch(Objects::isNull)) {
@ -227,12 +227,12 @@ public class PrefillingMapper {
String type = node.isArray() ? node.get(0).get("data").get("type").asText() : node.get("data").get("type").asText(); String type = node.isArray() ? node.get(0).get("data").get("type").asText() : node.get("data").get("type").asText();
if(type.equals("autocomplete")) { if(type.equals("autocomplete")) {
JsonNode dataNode = node.isArray() ? node.get(0).get("data") : node.get("data"); JsonNode dataNode = node.isArray() ? node.get(0).get("data") : node.get("data");
AutoCompleteDataEntity autoCompleteDataEntity = mapper.treeToValue(dataNode, AutoCompleteDataEntity.class); ExternalSelectDataEntity externalSelectDataEntity = mapper.treeToValue(dataNode, ExternalSelectDataEntity.class);
isMultiSelect = autoCompleteDataEntity.getMultiAutoComplete(); isMultiSelect = externalSelectDataEntity.getMultipleSelect();
for (String format : parsedValues) { for (String format : parsedValues) {
List<ExternalAutocompleteFieldResult> result = new ArrayList<>(); List<ExternalAutocompleteFieldResult> result = new ArrayList<>();
try { try {
result = datasetProfileManager.getAutocomplete(autoCompleteDataEntity, format); result = datasetProfileManager.getAutocomplete(externalSelectDataEntity, format);
} }
catch (Exception e) { catch (Exception e) {
logger.error(e.getMessage(), e); logger.error(e.getMessage(), e);

View File

@ -491,7 +491,7 @@ public class WordBuilder {
String format = this.formatter(field); String format = this.formatter(field);
if (field.getViewStyle().getFieldType().equals("tags")) { if (field.getViewStyle().getFieldType().equals("tags")) {
format = getCommaSeparatedFormatsFromJson(format, "name"); format = getCommaSeparatedFormatsFromJson(format, "name");
} else if (field.getViewStyle().getFieldType().equals("combobox") && field.getData() instanceof AutoCompleteDataEntity) { } else if (field.getViewStyle().getFieldType().equals("combobox") && field.getData() instanceof ExternalSelectDataEntity) {
format = getCommaSeparatedFormatsFromJson(format, "label"); format = getCommaSeparatedFormatsFromJson(format, "label");
} }
boolean isResearcher = field.getViewStyle().getFieldType().equals("researchers"); boolean isResearcher = field.getViewStyle().getFieldType().equals("researchers");
@ -637,7 +637,7 @@ public class WordBuilder {
String format = this.formatter(field); String format = this.formatter(field);
if (field.getViewStyle().getFieldType().equals("tags")) { if (field.getViewStyle().getFieldType().equals("tags")) {
format = getCommaSeparatedFormatsFromJson(format, "name"); format = getCommaSeparatedFormatsFromJson(format, "name");
} else if (field.getViewStyle().getFieldType().equals("combobox") && field.getData() instanceof AutoCompleteDataEntity) { } else if (field.getViewStyle().getFieldType().equals("combobox") && field.getData() instanceof ExternalSelectDataEntity) {
format = getCommaSeparatedFormatsFromJson(format, "label"); format = getCommaSeparatedFormatsFromJson(format, "label");
} }
switch (field.getViewStyle().getFieldType().getValue()) { switch (field.getViewStyle().getFieldType().getValue()) {

View File

@ -212,16 +212,16 @@ public class ExportXmlBuilderDatasetProfile {
if (field.getData() != null) { if (field.getData() != null) {
Element dataOut = element.createElement("data"); Element dataOut = element.createElement("data");
switch (field.getViewStyle().getFieldType()) { switch (field.getViewStyle().getFieldType()) {
case WORD_LIST: case SELECT:
case AUTO_COMPLETE: case AUTO_COMPLETE:
ComboBoxDataEntity comboBoxDataEntityObject = (ComboBoxDataEntity) field.getData(); ComboBoxDataEntity comboBoxDataEntityObject = (ComboBoxDataEntity) field.getData();
if (comboBoxDataEntityObject.getFieldType().equals("wordlist")) { if (comboBoxDataEntityObject.getFieldType().equals("wordlist")) {
WordListDataEntity wordListDataEntityObject = (WordListDataEntity) field.getData(); SelectDataEntity selectDataEntityObject = (SelectDataEntity) field.getData();
dataOut.setAttribute("label", wordListDataEntityObject.getLabel()); dataOut.setAttribute("label", selectDataEntityObject.getLabel());
dataOut.setAttribute("type", wordListDataEntityObject.getFieldType().getValue()); dataOut.setAttribute("type", selectDataEntityObject.getFieldType().getValue());
dataOut.setAttribute("multiList", wordListDataEntityObject.getMultiList().toString()); dataOut.setAttribute("multiList", selectDataEntityObject.getMultiList().toString());
Element options = element.createElement("options"); Element options = element.createElement("options");
wordListDataEntityObject.getOptions().forEach(optionChildFor -> { selectDataEntityObject.getOptions().forEach(optionChildFor -> {
Element optionChild = element.createElement("option"); Element optionChild = element.createElement("option");
optionChild.setAttribute("label", optionChildFor.getLabel()); optionChild.setAttribute("label", optionChildFor.getLabel());
optionChild.setAttribute("value", optionChildFor.getValue()); optionChild.setAttribute("value", optionChildFor.getValue());
@ -229,19 +229,19 @@ public class ExportXmlBuilderDatasetProfile {
}); });
dataOut.appendChild(options); dataOut.appendChild(options);
} else if (comboBoxDataEntityObject.getFieldType().equals("autocomplete")) { } else if (comboBoxDataEntityObject.getFieldType().equals("autocomplete")) {
AutoCompleteDataEntity autoCompleteDataEntityObject = (AutoCompleteDataEntity) field.getData(); ExternalSelectDataEntity externalSelectDataEntityObject = (ExternalSelectDataEntity) field.getData();
dataOut.setAttribute("label", autoCompleteDataEntityObject.getLabel()); dataOut.setAttribute("label", externalSelectDataEntityObject.getLabel());
dataOut.setAttribute("type", autoCompleteDataEntityObject.getFieldType().getValue()); dataOut.setAttribute("type", externalSelectDataEntityObject.getFieldType().getValue());
dataOut.setAttribute("multiAutoComplete", autoCompleteDataEntityObject.getMultiAutoComplete().toString()); dataOut.setAttribute("multiAutoComplete", externalSelectDataEntityObject.getMultipleSelect().toString());
for (AutoCompleteDataEntity.AutoCompleteSingleData singleData: autoCompleteDataEntityObject.getAutoCompleteSingleDataList()) { for (ExternalSelectDataEntity.ExternalSelectSourceEntity singleData: externalSelectDataEntityObject.getAutoCompleteSingleDataList()) {
Element singleItem = element.createElement("autocompleteSingle"); Element singleItem = element.createElement("autocompleteSingle");
singleItem.setAttribute("optionsRoot", singleData.getOptionsRoot()); singleItem.setAttribute("optionsRoot", singleData.getOptionsRoot());
singleItem.setAttribute("url", singleData.getUrl()); singleItem.setAttribute("url", singleData.getUrl());
singleItem.setAttribute("autoCompleteType", Integer.toString(singleData.getAutocompleteType().getValue())); singleItem.setAttribute("autoCompleteType", Integer.toString(singleData.getAutocompleteType().getValue()));
if (singleData.getAutoCompleteOptions() != null) { if (singleData.getExternalSelectSourceBindingEntity() != null) {
Element optionChild = element.createElement("option"); Element optionChild = element.createElement("option");
optionChild.setAttribute("label", singleData.getAutoCompleteOptions().getLabel()); optionChild.setAttribute("label", singleData.getExternalSelectSourceBindingEntity().getLabel());
optionChild.setAttribute("value", singleData.getAutoCompleteOptions().getValue()); optionChild.setAttribute("value", singleData.getExternalSelectSourceBindingEntity().getValue());
singleItem.appendChild(optionChild); singleItem.appendChild(optionChild);
} }
dataOut.appendChild(singleItem); dataOut.appendChild(singleItem);
@ -298,22 +298,22 @@ public class ExportXmlBuilderDatasetProfile {
switch (internalDmpEntitiesData.getFieldType()) { switch (internalDmpEntitiesData.getFieldType()) {
case INTERNAL_DMP_ENTRIES_RESEARCHERS: case INTERNAL_DMP_ENTRIES_RESEARCHERS:
InternalDmpBaseDataEntity researchersAutoCompleteData = (InternalDmpBaseDataEntity) internalDmpEntitiesData; InternalDmpBaseDataEntity researchersAutoCompleteData = (InternalDmpBaseDataEntity) internalDmpEntitiesData;
dataOut.setAttribute("multiAutocomplete", researchersAutoCompleteData.getMultiAutoComplete().toString()); dataOut.setAttribute("multiAutocomplete", researchersAutoCompleteData.getMultipleSelect().toString());
break; break;
case INTERNAL_DMP_ENTRIES_DATASETS: case INTERNAL_DMP_ENTRIES_DATASETS:
InternalDmpBaseDataEntity datasetAutoCompleteDataEntity = (InternalDmpBaseDataEntity) internalDmpEntitiesData; InternalDmpBaseDataEntity datasetAutoCompleteDataEntity = (InternalDmpBaseDataEntity) internalDmpEntitiesData;
dataOut.setAttribute("multiAutocomplete", datasetAutoCompleteDataEntity.getMultiAutoComplete().toString()); dataOut.setAttribute("multiAutocomplete", datasetAutoCompleteDataEntity.getMultipleSelect().toString());
break; break;
case INTERNAL_DMP_ENTRIES_DMPS: case INTERNAL_DMP_ENTRIES_DMPS:
InternalDmpBaseDataEntity dmpAutoCompleteDataEntity = (InternalDmpBaseDataEntity) internalDmpEntitiesData; InternalDmpBaseDataEntity dmpAutoCompleteDataEntity = (InternalDmpBaseDataEntity) internalDmpEntitiesData;
dataOut.setAttribute("multiAutocomplete", dmpAutoCompleteDataEntity.getMultiAutoComplete().toString()); dataOut.setAttribute("multiAutocomplete", dmpAutoCompleteDataEntity.getMultipleSelect().toString());
break; break;
} }
break; break;
case EXTERNAL_DATASETS: case EXTERNAL_DATASETS:
ExternalDatasetDataEntity externalDatasetDataEntity = (ExternalDatasetDataEntity) field.getData(); ExternalDatasetDataEntity externalDatasetDataEntity = (ExternalDatasetDataEntity) field.getData();
dataOut.setAttribute("label", externalDatasetDataEntity.getLabel()); dataOut.setAttribute("label", externalDatasetDataEntity.getLabel());
dataOut.setAttribute("multiAutocomplete", externalDatasetDataEntity.getMultiAutoComplete().toString()); dataOut.setAttribute("multiAutocomplete", externalDatasetDataEntity.getMultipleSelect().toString());
dataOut.setAttribute("type", externalDatasetDataEntity.getType().getValue()); dataOut.setAttribute("type", externalDatasetDataEntity.getType().getValue());
break; break;
case DATA_REPOSITORIES: case DATA_REPOSITORIES:
@ -321,42 +321,42 @@ public class ExportXmlBuilderDatasetProfile {
case PUB_REPOSITORIES: case PUB_REPOSITORIES:
InternalDmpBaseDataEntity dataRepositoryDataEntity = (InternalDmpBaseDataEntity) field.getData(); InternalDmpBaseDataEntity dataRepositoryDataEntity = (InternalDmpBaseDataEntity) field.getData();
dataOut.setAttribute("label", dataRepositoryDataEntity.getLabel()); dataOut.setAttribute("label", dataRepositoryDataEntity.getLabel());
dataOut.setAttribute("multiAutocomplete", dataRepositoryDataEntity.getMultiAutoComplete().toString()); dataOut.setAttribute("multiAutocomplete", dataRepositoryDataEntity.getMultipleSelect().toString());
break; break;
case TAXONOMIES: case TAXONOMIES:
InternalDmpBaseDataEntity taxonomyDataEntity = (InternalDmpBaseDataEntity) field.getData(); InternalDmpBaseDataEntity taxonomyDataEntity = (InternalDmpBaseDataEntity) field.getData();
dataOut.setAttribute("label", taxonomyDataEntity.getLabel()); dataOut.setAttribute("label", taxonomyDataEntity.getLabel());
dataOut.setAttribute("multiAutocomplete", taxonomyDataEntity.getMultiAutoComplete().toString()); dataOut.setAttribute("multiAutocomplete", taxonomyDataEntity.getMultipleSelect().toString());
break; break;
case LICENSES: case LICENSES:
InternalDmpBaseDataEntity licensesData = (InternalDmpBaseDataEntity) field.getData(); InternalDmpBaseDataEntity licensesData = (InternalDmpBaseDataEntity) field.getData();
dataOut.setAttribute("label", licensesData.getLabel()); dataOut.setAttribute("label", licensesData.getLabel());
dataOut.setAttribute("multiAutocomplete", licensesData.getMultiAutoComplete().toString()); dataOut.setAttribute("multiAutocomplete", licensesData.getMultipleSelect().toString());
break; break;
case PUBLICATIONS: case PUBLICATIONS:
InternalDmpBaseDataEntity publicationDataEntity = (InternalDmpBaseDataEntity) field.getData(); InternalDmpBaseDataEntity publicationDataEntity = (InternalDmpBaseDataEntity) field.getData();
dataOut.setAttribute("label", publicationDataEntity.getLabel()); dataOut.setAttribute("label", publicationDataEntity.getLabel());
dataOut.setAttribute("multiAutocomplete", publicationDataEntity.getMultiAutoComplete().toString()); dataOut.setAttribute("multiAutocomplete", publicationDataEntity.getMultipleSelect().toString());
break; break;
case ORGANIZATIONS: case ORGANIZATIONS:
InternalDmpBaseDataEntity organizationDataEntity = (InternalDmpBaseDataEntity) field.getData(); InternalDmpBaseDataEntity organizationDataEntity = (InternalDmpBaseDataEntity) field.getData();
dataOut.setAttribute("label", organizationDataEntity.getLabel()); dataOut.setAttribute("label", organizationDataEntity.getLabel());
dataOut.setAttribute("multiAutocomplete", organizationDataEntity.getMultiAutoComplete().toString()); dataOut.setAttribute("multiAutocomplete", organizationDataEntity.getMultipleSelect().toString());
break; break;
case RESEARCHERS: case RESEARCHERS:
InternalDmpBaseDataEntity researcherDataEntity = (InternalDmpBaseDataEntity) field.getData(); InternalDmpBaseDataEntity researcherDataEntity = (InternalDmpBaseDataEntity) field.getData();
dataOut.setAttribute("label", researcherDataEntity.getLabel()); dataOut.setAttribute("label", researcherDataEntity.getLabel());
dataOut.setAttribute("multiAutocomplete", researcherDataEntity.getMultiAutoComplete().toString()); dataOut.setAttribute("multiAutocomplete", researcherDataEntity.getMultipleSelect().toString());
break; break;
case REGISTRIES: case REGISTRIES:
InternalDmpBaseDataEntity registriesEntity = (InternalDmpBaseDataEntity) field.getData(); InternalDmpBaseDataEntity registriesEntity = (InternalDmpBaseDataEntity) field.getData();
dataOut.setAttribute("label", registriesEntity.getLabel()); dataOut.setAttribute("label", registriesEntity.getLabel());
dataOut.setAttribute("multiAutocomplete", registriesEntity.getMultiAutoComplete().toString()); dataOut.setAttribute("multiAutocomplete", registriesEntity.getMultipleSelect().toString());
break; break;
case SERVICES: case SERVICES:
InternalDmpBaseDataEntity serviceDataEntity = (InternalDmpBaseDataEntity) field.getData(); InternalDmpBaseDataEntity serviceDataEntity = (InternalDmpBaseDataEntity) field.getData();
dataOut.setAttribute("label", serviceDataEntity.getLabel()); dataOut.setAttribute("label", serviceDataEntity.getLabel());
dataOut.setAttribute("multiAutocomplete", serviceDataEntity.getMultiAutoComplete().toString()); dataOut.setAttribute("multiAutocomplete", serviceDataEntity.getMultipleSelect().toString());
break; break;
} }

View File

@ -1,19 +1,19 @@
package eu.eudat.models.data.helpers.common; package eu.eudat.models.data.helpers.common;
import eu.eudat.data.dao.criteria.Criteria; import eu.eudat.data.dao.criteria.Criteria;
import eu.eudat.commons.types.descriptiontemplate.fielddata.AutoCompleteDataEntity; import eu.eudat.commons.types.descriptiontemplate.fielddata.ExternalSelectDataEntity;
import java.util.List; import java.util.List;
public class AutoCompleteOptionsLookupItem extends Criteria<AutoCompleteOptionsLookupItem> { public class AutoCompleteOptionsLookupItem extends Criteria<AutoCompleteOptionsLookupItem> {
private List<AutoCompleteDataEntity.AutoCompleteSingleData> autoCompleteSingleDataList; private List<ExternalSelectDataEntity.ExternalSelectSourceEntity> externalSelectSourceEntityList;
public List<AutoCompleteDataEntity.AutoCompleteSingleData> getAutoCompleteSingleDataList() { public List<ExternalSelectDataEntity.ExternalSelectSourceEntity> getAutoCompleteSingleDataList() {
return autoCompleteSingleDataList; return externalSelectSourceEntityList;
} }
public void setAutoCompleteSingleDataList(List<AutoCompleteDataEntity.AutoCompleteSingleData> autoCompleteSingleDataList) { public void setAutoCompleteSingleDataList(List<ExternalSelectDataEntity.ExternalSelectSourceEntity> externalSelectSourceEntityList) {
this.autoCompleteSingleDataList = autoCompleteSingleDataList; this.externalSelectSourceEntityList = externalSelectSourceEntityList;
} }
} }