Merge branch 'dmp-refactor-desc-templates' into dmp-refactoring
This commit is contained in:
commit
b4f55a721c
|
@ -6,8 +6,8 @@ import eu.eudat.data.converters.enums.DatabaseEnum;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public enum FieldType implements DatabaseEnum<String> {
|
public enum FieldType implements DatabaseEnum<String> {
|
||||||
AUTO_COMPLETE(Names.Autocomplete),
|
EXTERNAL_SELECT(Names.ExternalSelect),
|
||||||
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),
|
||||||
|
@ -37,12 +37,10 @@ public enum FieldType implements DatabaseEnum<String> {
|
||||||
private final String value;
|
private final String value;
|
||||||
|
|
||||||
public static class Names {
|
public static class Names {
|
||||||
public static final String ComboBox = "combobox";
|
public static final String ExternalSelect = "externalSelect";
|
||||||
public static final String Autocomplete = "autocomplete";
|
public static final String Select = "select";
|
||||||
public static final String Wordlist = "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 InternalDmpResearchers = "internalDmpResearchers";
|
public static final String InternalDmpResearchers = "internalDmpResearchers";
|
||||||
public static final String InternalDmpDmps = "internalDmpDmps";
|
public static final String InternalDmpDmps = "internalDmpDmps";
|
||||||
public static final String InternalDmpDatasets = "internalDmpDatasets";
|
public static final String InternalDmpDatasets = "internalDmpDatasets";
|
||||||
|
|
|
@ -8,21 +8,10 @@ import java.util.List;
|
||||||
@XmlRootElement(name = "root")
|
@XmlRootElement(name = "root")
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
public class DefinitionEntity {
|
public class DefinitionEntity {
|
||||||
@XmlElementWrapper(name = "sections")
|
|
||||||
@XmlElement(name = "section")
|
|
||||||
private List<SectionEntity> sections;
|
|
||||||
@XmlElementWrapper(name = "pages")
|
@XmlElementWrapper(name = "pages")
|
||||||
@XmlElement(name = "page")
|
@XmlElement(name = "page")
|
||||||
private List<PageEntity> pages;
|
private List<PageEntity> pages;
|
||||||
|
|
||||||
public List<SectionEntity> getSections() {
|
|
||||||
return sections;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSections(List<SectionEntity> sections) {
|
|
||||||
this.sections = sections;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<PageEntity> getPages() {
|
public List<PageEntity> getPages() {
|
||||||
return pages;
|
return pages;
|
||||||
}
|
}
|
||||||
|
@ -33,8 +22,8 @@ public class DefinitionEntity {
|
||||||
|
|
||||||
public List<FieldEntity> getAllField(){
|
public List<FieldEntity> getAllField(){
|
||||||
List<FieldEntity> fieldEntities = new ArrayList<>();
|
List<FieldEntity> fieldEntities = new ArrayList<>();
|
||||||
if (this.getSections() != null){
|
if (this.getPages() != null){
|
||||||
for (SectionEntity sectionEntity: this.getSections()) {
|
for (PageEntity sectionEntity: this.getPages()) {
|
||||||
fieldEntities.addAll(sectionEntity.getAllField());
|
fieldEntities.addAll(sectionEntity.getAllField());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.*;
|
||||||
|
@ -26,15 +25,15 @@ public class FieldEntity implements DatabaseViewStyleDefinition {
|
||||||
private List<RuleEntity> visibilityRules;
|
private List<RuleEntity> visibilityRules;
|
||||||
|
|
||||||
@XmlElements({
|
@XmlElements({
|
||||||
@XmlElement(name = "labelData", type = LabelDataEntity.class),
|
@XmlElement(name = LabelDataEntity.XmlElementName, type = LabelDataEntity.class),
|
||||||
@XmlElement(name = "labelAndMultiplicityData", type = LabelAndMultiplicityDataEntity.class),
|
@XmlElement(name = LabelAndMultiplicityDataEntity.XmlElementName, type = LabelAndMultiplicityDataEntity.class),
|
||||||
@XmlElement(name = "externalDatasetsData", type = ExternalDatasetDataEntity.class),
|
@XmlElement(name = ExternalDatasetDataEntity.XmlElementName, type = ExternalDatasetDataEntity.class),
|
||||||
@XmlElement(name = "uploadData", type = UploadDataEntity.class),
|
@XmlElement(name = UploadDataEntity.XmlElementName, type = UploadDataEntity.class),
|
||||||
@XmlElement(name = "radioBoxData", type = RadioBoxDataEntity.class),
|
@XmlElement(name = RadioBoxDataEntity.XmlElementName, type = RadioBoxDataEntity.class),
|
||||||
@XmlElement(name = "wordListData", type = WordListDataEntity.class),
|
@XmlElement(name = SelectDataEntity.XmlElementName, type = SelectDataEntity.class),
|
||||||
@XmlElement(name = "autocompleteData", type = AutoCompleteDataEntity.class),
|
@XmlElement(name = ExternalSelectDataEntity.XmlElementName, type = ExternalSelectDataEntity.class),
|
||||||
})
|
})
|
||||||
private BaseFieldDataEntity<?> data;
|
private BaseFieldDataEntity data;
|
||||||
@XmlElementWrapper(name = "validations")
|
@XmlElementWrapper(name = "validations")
|
||||||
@XmlElement(name = "validation")
|
@XmlElement(name = "validation")
|
||||||
private List<FieldValidationType> validations;
|
private List<FieldValidationType> validations;
|
||||||
|
@ -62,10 +61,10 @@ public class FieldEntity implements DatabaseViewStyleDefinition {
|
||||||
this.schematics = schematics;
|
this.schematics = schematics;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BaseFieldDataEntity<?> getData() {
|
public BaseFieldDataEntity getData() {
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
public void setData(BaseFieldDataEntity<?> data) {
|
public void setData(BaseFieldDataEntity data) {
|
||||||
this.data = data;
|
this.data = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
package eu.eudat.commons.types.descriptiontemplate;
|
package eu.eudat.commons.types.descriptiontemplate;
|
||||||
|
|
||||||
import eu.eudat.commons.types.common.DatabaseViewStyleDefinition;
|
import eu.eudat.commons.types.common.DatabaseViewStyleDefinition;
|
||||||
import jakarta.xml.bind.annotation.XmlAccessType;
|
import jakarta.xml.bind.annotation.*;
|
||||||
import jakarta.xml.bind.annotation.XmlAccessorType;
|
|
||||||
import jakarta.xml.bind.annotation.XmlAttribute;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
|
@ -15,6 +16,18 @@ public class PageEntity implements DatabaseViewStyleDefinition {
|
||||||
@XmlAttribute(name="title")
|
@XmlAttribute(name="title")
|
||||||
private String title;
|
private String title;
|
||||||
|
|
||||||
|
@XmlElementWrapper(name = "sections")
|
||||||
|
@XmlElement(name = "section")
|
||||||
|
private List<SectionEntity> sections;
|
||||||
|
|
||||||
|
public List<SectionEntity> getSections() {
|
||||||
|
return sections;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSections(List<SectionEntity> sections) {
|
||||||
|
this.sections = sections;
|
||||||
|
}
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
@ -39,4 +52,14 @@ public class PageEntity implements DatabaseViewStyleDefinition {
|
||||||
this.title = title;
|
this.title = title;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public List<FieldEntity> getAllField(){
|
||||||
|
List<FieldEntity> fieldEntities = new ArrayList<>();
|
||||||
|
if (this.getSections() != null){
|
||||||
|
for (SectionEntity sectionEntity: this.getSections()) {
|
||||||
|
fieldEntities.addAll(sectionEntity.getAllField());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return fieldEntities;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,8 +16,6 @@ public class SectionEntity implements DatabaseViewStyleDefinition{
|
||||||
private boolean defaultVisibility;
|
private boolean defaultVisibility;
|
||||||
@XmlAttribute(name="numbering")
|
@XmlAttribute(name="numbering")
|
||||||
private String numbering;
|
private String numbering;
|
||||||
@XmlAttribute(name="page")
|
|
||||||
private String page;
|
|
||||||
@XmlAttribute(name="title")
|
@XmlAttribute(name="title")
|
||||||
private String title;
|
private String title;
|
||||||
@XmlAttribute(name="description")
|
@XmlAttribute(name="description")
|
||||||
|
@ -58,14 +56,6 @@ public class SectionEntity implements DatabaseViewStyleDefinition{
|
||||||
this.defaultVisibility = defaultVisibility;
|
this.defaultVisibility = defaultVisibility;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPage() {
|
|
||||||
return page;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPage(String page) {
|
|
||||||
this.page = page;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTitle() {
|
public String getTitle() {
|
||||||
return title;
|
return title;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -12,20 +12,11 @@ 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")
|
public static final String XmlElementName = "externalDatasetsData";
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,20 +1,16 @@
|
||||||
package eu.eudat.commons.types.descriptiontemplate.fielddata;
|
package eu.eudat.commons.types.descriptiontemplate.fielddata;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonValue;
|
|
||||||
import eu.eudat.commons.enums.EnumUtils;
|
|
||||||
import eu.eudat.data.converters.enums.DatabaseEnum;
|
|
||||||
import jakarta.xml.bind.annotation.*;
|
import jakarta.xml.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
|
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
public class AutoCompleteDataEntity extends ComboBoxDataEntity<AutoCompleteDataEntity> {
|
public class ExternalSelectDataEntity extends LabelAndMultiplicityDataEntity {
|
||||||
|
public static final String XmlElementName = "externalSelectData";
|
||||||
|
|
||||||
@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 +64,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="sourceBinding")
|
||||||
|
private ExternalSelectSourceBindingEntity sourceBinding;
|
||||||
@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 +131,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 getSourceBinding() {
|
||||||
return autoCompleteOptions;
|
return sourceBinding;
|
||||||
}
|
}
|
||||||
public void setAutoCompleteOptions(ComboBoxDataEntity.Option autoCompleteOptions) {
|
public void setSourceBinding(ExternalSelectSourceBindingEntity sourceBinding) {
|
||||||
this.autoCompleteOptions = autoCompleteOptions;
|
this.sourceBinding = sourceBinding;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getMethod() {
|
public String getMethod() {
|
||||||
|
@ -138,48 +155,16 @@ public class AutoCompleteDataEntity extends ComboBoxDataEntity<AutoCompleteDataE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@XmlAttribute(name="multiAutoComplete")
|
@XmlElementWrapper(name = "sources")
|
||||||
private Boolean multiAutoComplete;
|
@XmlElement(name = "source")
|
||||||
@XmlElementWrapper(name = "autoCompleteSingleDataList")
|
private List<ExternalSelectSourceEntity> sources;
|
||||||
@XmlElement(name = "autoCompleteSingleData")
|
|
||||||
private List<AutoCompleteSingleData> autoCompleteSingleDataList;
|
|
||||||
|
|
||||||
public Boolean getMultiAutoComplete() {
|
public List<ExternalSelectSourceEntity> getSources() {
|
||||||
return multiAutoComplete;
|
return sources;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMultiAutoComplete(Boolean multiAutoComplete) {
|
public void setSources(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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +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 class InternalDmpBaseDataEntity extends LabelAndMultiplicityDataEntity {
|
|
||||||
}
|
|
|
@ -1,23 +1,21 @@
|
||||||
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 {
|
||||||
|
public static final String XmlElementName = "labelAndMultiplicityData";
|
||||||
|
|
||||||
@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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,5 +5,6 @@ import jakarta.xml.bind.annotation.XmlAccessorType;
|
||||||
|
|
||||||
|
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
public class LabelDataEntity extends BaseFieldDataEntity<LabelDataEntity> {
|
public class LabelDataEntity extends BaseFieldDataEntity {
|
||||||
|
public static final String XmlElementName = "labelData";
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,8 @@ 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 {
|
||||||
|
public static final String XmlElementName = "radioBoxData";
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
public static class RadioBoxDataOptionEntity {
|
public static class RadioBoxDataOptionEntity {
|
||||||
@XmlAttribute(name="label")
|
@XmlAttribute(name="label")
|
||||||
|
|
|
@ -0,0 +1,44 @@
|
||||||
|
package eu.eudat.commons.types.descriptiontemplate.fielddata;
|
||||||
|
|
||||||
|
import jakarta.xml.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
|
public class SelectDataEntity extends LabelAndMultiplicityDataEntity {
|
||||||
|
public static final String XmlElementName = "selectData";
|
||||||
|
@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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -6,7 +6,8 @@ import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
public class UploadDataEntity extends BaseFieldDataEntity<UploadDataEntity> {
|
public class UploadDataEntity extends BaseFieldDataEntity {
|
||||||
|
public static final String XmlElementName = "uploadData";
|
||||||
|
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
public static class UploadDataOptionEntity {
|
public static class UploadDataOptionEntity {
|
||||||
|
|
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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.*;
|
||||||
|
|
||||||
|
@ -35,13 +34,13 @@ public class FieldImportExport {
|
||||||
private FieldType fieldType;
|
private FieldType fieldType;
|
||||||
|
|
||||||
@XmlElements({
|
@XmlElements({
|
||||||
@XmlElement(name = "labelData", type = LabelDataImportExport.class),
|
@XmlElement(name = LabelDataImportExport.XmlElementName, type = LabelDataImportExport.class),
|
||||||
@XmlElement(name = "labelAndMultiplicityData", type = LabelAndMultiplicityDataImportExport.class),
|
@XmlElement(name = LabelAndMultiplicityDataImportExport.XmlElementName, type = LabelAndMultiplicityDataImportExport.class),
|
||||||
@XmlElement(name = "externalDatasetsData", type = ExternalDatasetDataImportExport.class),
|
@XmlElement(name = ExternalDatasetDataImportExport.XmlElementName, type = ExternalDatasetDataImportExport.class),
|
||||||
@XmlElement(name = "uploadData", type = UploadDataImportExport.class),
|
@XmlElement(name = UploadDataImportExport.XmlElementName, type = UploadDataImportExport.class),
|
||||||
@XmlElement(name = "radioBoxData", type = RadioBoxDataImportExport.class),
|
@XmlElement(name = RadioBoxDataImportExport.XmlElementName, type = RadioBoxDataImportExport.class),
|
||||||
@XmlElement(name = "wordListData", type = WordListDataImportExport.class),
|
@XmlElement(name = SelectDataImportExport.XmlElementName, type = SelectDataImportExport.class),
|
||||||
@XmlElement(name = "autocompleteData", type = AutoCompleteDataImportExport.class),
|
@XmlElement(name = ExternalSelectImportExport.XmlElementName, type = ExternalSelectImportExport.class),
|
||||||
})
|
})
|
||||||
private BaseFieldDataImportExport data;
|
private BaseFieldDataImportExport data;
|
||||||
|
|
||||||
|
|
|
@ -1,37 +1,34 @@
|
||||||
package eu.eudat.commons.types.descriptiontemplate.importexport;
|
package eu.eudat.commons.types.descriptiontemplate.importexport;
|
||||||
|
|
||||||
import eu.eudat.model.persist.descriptiontemplatedefinition.FieldPersist;
|
|
||||||
import eu.eudat.model.persist.descriptiontemplatedefinition.FieldSetPersist;
|
|
||||||
import eu.eudat.service.fielddatahelper.FieldDataHelperServiceProvider;
|
|
||||||
import jakarta.xml.bind.annotation.*;
|
import jakarta.xml.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
public class FieldSetImportExport {
|
public class FieldSetImportExport {
|
||||||
|
|
||||||
@XmlAttribute(name = "id")
|
@XmlAttribute(name="id")
|
||||||
private String id;
|
private String id;
|
||||||
@XmlAttribute(name = "ordinal")
|
@XmlAttribute(name="ordinal")
|
||||||
private int ordinal;
|
private int ordinal;
|
||||||
|
|
||||||
@XmlElementWrapper(name = "fields")
|
@XmlElementWrapper(name = "fields")
|
||||||
@XmlElement(name = "field")
|
@XmlElement(name = "field")
|
||||||
private List<FieldImportExport> fields;
|
private List<FieldImportExport> fields;
|
||||||
@XmlElement(name = "numbering")
|
@XmlAttribute(name="numbering")
|
||||||
private String numbering;
|
private String numbering;
|
||||||
@XmlElement(name = "commentField")
|
@XmlAttribute(name="title")
|
||||||
private Boolean commentField;
|
|
||||||
@XmlElement(name = "multiplicity")
|
|
||||||
private MultiplicityImportXml multiplicity;
|
|
||||||
@XmlElement(name = "description")
|
|
||||||
private String description;
|
|
||||||
@XmlElement(name = "extendedDescription")
|
|
||||||
private String extendedDescription;
|
|
||||||
@XmlElement(name = "additionalInformation")
|
|
||||||
private String additionalInformation;
|
|
||||||
@XmlElement(name = "title")
|
|
||||||
private String title;
|
private String title;
|
||||||
|
@XmlAttribute(name="description")
|
||||||
|
private String description;
|
||||||
|
@XmlAttribute(name="extendedDescription")
|
||||||
|
private String extendedDescription;
|
||||||
|
@XmlAttribute(name="additionalInformation")
|
||||||
|
private String additionalInformation;
|
||||||
|
@XmlElement(name="multiplicity")
|
||||||
|
private MultiplicityImportExport multiplicity;
|
||||||
|
@XmlAttribute(name="hasCommentField")
|
||||||
|
private Boolean hasCommentField;
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return id;
|
return id;
|
||||||
|
@ -65,19 +62,18 @@ public class FieldSetImportExport {
|
||||||
this.numbering = numbering;
|
this.numbering = numbering;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean getCommentField() {
|
public Boolean getHasCommentField() {
|
||||||
return commentField;
|
return hasCommentField;
|
||||||
|
}
|
||||||
|
public void setHasCommentField(Boolean hasCommentField) {
|
||||||
|
this.hasCommentField = hasCommentField;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCommentField(Boolean commentField) {
|
public MultiplicityImportExport getMultiplicity() {
|
||||||
this.commentField = commentField;
|
|
||||||
}
|
|
||||||
|
|
||||||
public MultiplicityImportXml getMultiplicity() {
|
|
||||||
return multiplicity;
|
return multiplicity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMultiplicity(MultiplicityImportXml multiplicity) {
|
public void setMultiplicity(MultiplicityImportExport multiplicity) {
|
||||||
this.multiplicity = multiplicity;
|
this.multiplicity = multiplicity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,27 +1,21 @@
|
||||||
package eu.eudat.commons.types.descriptiontemplate.importexport;
|
package eu.eudat.commons.types.descriptiontemplate.importexport;
|
||||||
|
|
||||||
import eu.eudat.model.persist.descriptiontemplatedefinition.MultiplicityPersist;
|
import jakarta.xml.bind.annotation.XmlAccessType;
|
||||||
|
import jakarta.xml.bind.annotation.XmlAccessorType;
|
||||||
import jakarta.xml.bind.annotation.XmlAttribute;
|
import jakarta.xml.bind.annotation.XmlAttribute;
|
||||||
import jakarta.xml.bind.annotation.XmlRootElement;
|
|
||||||
|
|
||||||
|
|
||||||
@XmlRootElement(name = "multiplicity")
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
public class MultiplicityImportXml {
|
public class MultiplicityImportExport {
|
||||||
private int max;
|
@XmlAttribute(name="min")
|
||||||
private int min;
|
private int min;
|
||||||
|
@XmlAttribute(name="max")
|
||||||
|
private int max;
|
||||||
|
@XmlAttribute(name="placeholder")
|
||||||
private String placeholder;
|
private String placeholder;
|
||||||
|
@XmlAttribute(name="tableView")
|
||||||
private boolean tableView;
|
private boolean tableView;
|
||||||
|
|
||||||
@XmlAttribute(name = "max")
|
|
||||||
public int getMax() {
|
|
||||||
return max;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMax(int max) {
|
|
||||||
this.max = max;
|
|
||||||
}
|
|
||||||
|
|
||||||
@XmlAttribute(name = "min")
|
|
||||||
public int getMin() {
|
public int getMin() {
|
||||||
return min;
|
return min;
|
||||||
}
|
}
|
||||||
|
@ -30,7 +24,14 @@ public class MultiplicityImportXml {
|
||||||
this.min = min;
|
this.min = min;
|
||||||
}
|
}
|
||||||
|
|
||||||
@XmlAttribute(name = "placeholder")
|
public int getMax() {
|
||||||
|
return max;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMax(int max) {
|
||||||
|
this.max = max;
|
||||||
|
}
|
||||||
|
|
||||||
public String getPlaceholder() {
|
public String getPlaceholder() {
|
||||||
return placeholder;
|
return placeholder;
|
||||||
}
|
}
|
||||||
|
@ -39,7 +40,6 @@ public class MultiplicityImportXml {
|
||||||
this.placeholder = placeholder;
|
this.placeholder = placeholder;
|
||||||
}
|
}
|
||||||
|
|
||||||
@XmlAttribute(name = "tableView")
|
|
||||||
public boolean getTableView() {
|
public boolean getTableView() {
|
||||||
return tableView;
|
return tableView;
|
||||||
}
|
}
|
|
@ -6,12 +6,11 @@ import jakarta.xml.bind.annotation.*;
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
public class RuleImportExport {
|
public class RuleImportExport {
|
||||||
|
|
||||||
@XmlAttribute(name = "target")
|
@XmlAttribute(name="target")
|
||||||
private String target;
|
private String target;
|
||||||
@XmlAttribute(name = "value")
|
@XmlAttribute(name="value")
|
||||||
private String value;
|
private String value;
|
||||||
|
|
||||||
@XmlAttribute(name = "target")
|
|
||||||
public String getTarget() {
|
public String getTarget() {
|
||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,8 +10,6 @@ public class SectionImportExport {
|
||||||
private String id;
|
private String id;
|
||||||
@XmlAttribute(name = "ordinal")
|
@XmlAttribute(name = "ordinal")
|
||||||
private int ordinal;
|
private int ordinal;
|
||||||
@XmlAttribute(name = "page")
|
|
||||||
private String page;
|
|
||||||
@XmlAttribute(name = "defaultVisibility")
|
@XmlAttribute(name = "defaultVisibility")
|
||||||
private Boolean defaultVisibility;
|
private Boolean defaultVisibility;
|
||||||
@XmlElementWrapper(name = "fieldSets")
|
@XmlElementWrapper(name = "fieldSets")
|
||||||
|
@ -45,14 +43,6 @@ public class SectionImportExport {
|
||||||
this.ordinal = ordinal;
|
this.ordinal = ordinal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPage() {
|
|
||||||
return page;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPage(String page) {
|
|
||||||
this.page = page;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Boolean getDefaultVisibility() {
|
public Boolean getDefaultVisibility() {
|
||||||
return defaultVisibility;
|
return defaultVisibility;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,59 +0,0 @@
|
||||||
package eu.eudat.commons.types.descriptiontemplate.importexport.fielddata;
|
|
||||||
|
|
||||||
import jakarta.xml.bind.annotation.XmlAccessType;
|
|
||||||
import jakarta.xml.bind.annotation.XmlAccessorType;
|
|
||||||
import jakarta.xml.bind.annotation.XmlAttribute;
|
|
||||||
|
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
|
||||||
public class AuthAutoCompleteData {
|
|
||||||
@XmlAttribute(name = "url")
|
|
||||||
private String url;
|
|
||||||
@XmlAttribute(name = "method")
|
|
||||||
private String method;
|
|
||||||
@XmlAttribute(name = "body")
|
|
||||||
private String body;
|
|
||||||
@XmlAttribute(name = "path")
|
|
||||||
private String path;
|
|
||||||
@XmlAttribute(name = "type")
|
|
||||||
private String type;
|
|
||||||
|
|
||||||
public String getUrl() {
|
|
||||||
return url;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUrl(String url) {
|
|
||||||
this.url = url;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMethod() {
|
|
||||||
return method;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMethod(String method) {
|
|
||||||
this.method = method;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getBody() {
|
|
||||||
return body;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBody(String body) {
|
|
||||||
this.body = body;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPath() {
|
|
||||||
return path;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPath(String path) {
|
|
||||||
this.path = path;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getType() {
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setType(String type) {
|
|
||||||
this.type = type;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,30 +0,0 @@
|
||||||
package eu.eudat.commons.types.descriptiontemplate.importexport.fielddata;
|
|
||||||
|
|
||||||
import jakarta.xml.bind.annotation.*;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
|
||||||
public class AutoCompleteDataImportExport extends BaseFieldDataImportExport {
|
|
||||||
|
|
||||||
@XmlAttribute(name = "multiAutoComplete")
|
|
||||||
private Boolean multiAutoComplete;
|
|
||||||
|
|
||||||
@XmlElementWrapper(name = "autoCompleteSingleDataList")
|
|
||||||
@XmlElement(name = "autoCompleteSingleData")
|
|
||||||
private List<AutoCompleteSingleData> autoCompleteSingleDataList;
|
|
||||||
|
|
||||||
public Boolean getMultiAutoComplete() { return multiAutoComplete; }
|
|
||||||
public void setMultiAutoComplete(Boolean multiAutoComplete) { this.multiAutoComplete = multiAutoComplete; }
|
|
||||||
|
|
||||||
public List<AutoCompleteSingleData> getAutoCompleteSingleDataList() {
|
|
||||||
return autoCompleteSingleDataList;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAutoCompleteSingleDataList(List<AutoCompleteSingleData> autoCompleteSingleDataList) {
|
|
||||||
this.autoCompleteSingleDataList = autoCompleteSingleDataList;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -1,80 +0,0 @@
|
||||||
package eu.eudat.commons.types.descriptiontemplate.importexport.fielddata;
|
|
||||||
|
|
||||||
import jakarta.xml.bind.annotation.XmlAccessType;
|
|
||||||
import jakarta.xml.bind.annotation.XmlAccessorType;
|
|
||||||
import jakarta.xml.bind.annotation.XmlAttribute;
|
|
||||||
import jakarta.xml.bind.annotation.XmlElement;
|
|
||||||
|
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
|
||||||
public class AutoCompleteSingleData {
|
|
||||||
@XmlAttribute(name = "autocompleteType")
|
|
||||||
private eu.eudat.commons.types.descriptiontemplate.fielddata.AutoCompleteDataEntity.AutocompleteType autocompleteType;
|
|
||||||
@XmlAttribute(name = "url")
|
|
||||||
private String url;
|
|
||||||
@XmlElement(name = "autoCompleteOptions")
|
|
||||||
private ComboBoxDataOptionEntity autoCompleteOptions;
|
|
||||||
@XmlAttribute(name = "optionsRoot")
|
|
||||||
private String optionsRoot;
|
|
||||||
@XmlAttribute(name = "hasAuth")
|
|
||||||
private Boolean hasAuth;
|
|
||||||
@XmlElement(name = "auth")
|
|
||||||
private AuthAutoCompleteData auth;
|
|
||||||
@XmlAttribute(name = "method")
|
|
||||||
private String method;
|
|
||||||
|
|
||||||
public eu.eudat.commons.types.descriptiontemplate.fielddata.AutoCompleteDataEntity.AutocompleteType getAutocompleteType() {
|
|
||||||
return autocompleteType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAutocompleteType(eu.eudat.commons.types.descriptiontemplate.fielddata.AutoCompleteDataEntity.AutocompleteType autocompleteType) {
|
|
||||||
this.autocompleteType = autocompleteType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getOptionsRoot() {
|
|
||||||
return optionsRoot;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOptionsRoot(String optionsRoot) {
|
|
||||||
this.optionsRoot = optionsRoot;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUrl() {
|
|
||||||
return url;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUrl(String url) {
|
|
||||||
this.url = url;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Boolean getHasAuth() {
|
|
||||||
return hasAuth;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHasAuth(Boolean hasAuth) {
|
|
||||||
this.hasAuth = hasAuth;
|
|
||||||
}
|
|
||||||
|
|
||||||
public AuthAutoCompleteData getAuth() {
|
|
||||||
return auth;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAuth(AuthAutoCompleteData auth) {
|
|
||||||
this.auth = auth;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ComboBoxDataOptionEntity getAutoCompleteOptions() {
|
|
||||||
return autoCompleteOptions;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAutoCompleteOptions(ComboBoxDataOptionEntity autoCompleteOptions) {
|
|
||||||
this.autoCompleteOptions = autoCompleteOptions;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMethod() {
|
|
||||||
return method;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMethod(String method) {
|
|
||||||
this.method = method;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,8 +1,11 @@
|
||||||
package eu.eudat.commons.types.descriptiontemplate.importexport.fielddata;
|
package eu.eudat.commons.types.descriptiontemplate.importexport.fielddata;
|
||||||
|
|
||||||
import eu.eudat.commons.enums.FieldType;
|
import eu.eudat.commons.enums.FieldType;
|
||||||
|
import jakarta.xml.bind.annotation.XmlAccessType;
|
||||||
|
import jakarta.xml.bind.annotation.XmlAccessorType;
|
||||||
import jakarta.xml.bind.annotation.XmlAttribute;
|
import jakarta.xml.bind.annotation.XmlAttribute;
|
||||||
|
|
||||||
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
public abstract class BaseFieldDataImportExport {
|
public abstract class BaseFieldDataImportExport {
|
||||||
@XmlAttribute(name = "label")
|
@XmlAttribute(name = "label")
|
||||||
private String label;
|
private String label;
|
||||||
|
|
|
@ -1,48 +0,0 @@
|
||||||
package eu.eudat.commons.types.descriptiontemplate.importexport.fielddata;
|
|
||||||
|
|
||||||
import jakarta.xml.bind.annotation.XmlAccessType;
|
|
||||||
import jakarta.xml.bind.annotation.XmlAccessorType;
|
|
||||||
import jakarta.xml.bind.annotation.XmlAttribute;
|
|
||||||
|
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
|
||||||
public class ComboBoxDataOptionEntity {
|
|
||||||
@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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -6,20 +6,11 @@ import jakarta.xml.bind.annotation.XmlAccessorType;
|
||||||
import jakarta.xml.bind.annotation.XmlAttribute;
|
import jakarta.xml.bind.annotation.XmlAttribute;
|
||||||
|
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
public class ExternalDatasetDataImportExport extends BaseFieldDataImportExport {
|
public class ExternalDatasetDataImportExport extends LabelAndMultiplicityDataImportExport {
|
||||||
@XmlAttribute(name = "multiAutoComplete")
|
public static final String XmlElementName = "externalDatasetsData";
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,174 @@
|
||||||
|
package eu.eudat.commons.types.descriptiontemplate.importexport.fielddata;
|
||||||
|
|
||||||
|
import jakarta.xml.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
|
public class ExternalSelectImportExport extends LabelAndMultiplicityDataImportExport {
|
||||||
|
public static final String XmlElementName = "externalSelectData";
|
||||||
|
|
||||||
|
|
||||||
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
|
public static class ExternalSelectAuthImportExport {
|
||||||
|
@XmlAttribute(name="url")
|
||||||
|
private String url;
|
||||||
|
@XmlAttribute(name="method")
|
||||||
|
private String method;
|
||||||
|
@XmlAttribute(name="body")
|
||||||
|
private String body;
|
||||||
|
@XmlAttribute(name="path")
|
||||||
|
private String path;
|
||||||
|
@XmlAttribute(name="type")
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
public String getUrl() {
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUrl(String url) {
|
||||||
|
this.url = url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMethod() {
|
||||||
|
return method;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMethod(String method) {
|
||||||
|
this.method = method;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBody() {
|
||||||
|
return body;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBody(String body) {
|
||||||
|
this.body = body;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPath() {
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPath(String path) {
|
||||||
|
this.path = path;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(String type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
|
public static class ExternalSelectSourceBindingImportExport {
|
||||||
|
@XmlAttribute(name="label")
|
||||||
|
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 ExternalSelectSourceImportExport {
|
||||||
|
@XmlAttribute(name="url")
|
||||||
|
private String url;
|
||||||
|
@XmlAttribute(name="method")
|
||||||
|
private String method;
|
||||||
|
@XmlAttribute(name="optionsRoot")
|
||||||
|
private String optionsRoot;
|
||||||
|
@XmlElement(name="sourceBinding")
|
||||||
|
private ExternalSelectSourceBindingImportExport sourceBinding;
|
||||||
|
@XmlAttribute(name="hasAuth")
|
||||||
|
private Boolean hasAuth;
|
||||||
|
@XmlElement(name="auth")
|
||||||
|
private ExternalSelectAuthImportExport auth;
|
||||||
|
|
||||||
|
public String getUrl() {
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUrl(String url) {
|
||||||
|
this.url = url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMethod() {
|
||||||
|
return method;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMethod(String method) {
|
||||||
|
this.method = method;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOptionsRoot() {
|
||||||
|
return optionsRoot;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOptionsRoot(String optionsRoot) {
|
||||||
|
this.optionsRoot = optionsRoot;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ExternalSelectSourceBindingImportExport getSourceBinding() {
|
||||||
|
return sourceBinding;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSourceBinding(ExternalSelectSourceBindingImportExport sourceBinding) {
|
||||||
|
this.sourceBinding = sourceBinding;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean getHasAuth() {
|
||||||
|
return hasAuth;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHasAuth(Boolean hasAuth) {
|
||||||
|
this.hasAuth = hasAuth;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ExternalSelectAuthImportExport getAuth() {
|
||||||
|
return auth;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAuth(ExternalSelectAuthImportExport auth) {
|
||||||
|
this.auth = auth;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@XmlElementWrapper(name = "sources")
|
||||||
|
@XmlElement(name = "source")
|
||||||
|
private List<ExternalSelectSourceImportExport> sources;
|
||||||
|
|
||||||
|
public List<ExternalSelectSourceImportExport> getSources() {
|
||||||
|
return sources;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSources(List<ExternalSelectSourceImportExport> sources) {
|
||||||
|
this.sources = sources;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,16 +6,17 @@ import jakarta.xml.bind.annotation.XmlAttribute;
|
||||||
|
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
public class LabelAndMultiplicityDataImportExport extends BaseFieldDataImportExport {
|
public class LabelAndMultiplicityDataImportExport extends BaseFieldDataImportExport {
|
||||||
|
public static final String XmlElementName = "labelAndMultiplicityData";
|
||||||
|
|
||||||
@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;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,5 +5,6 @@ import jakarta.xml.bind.annotation.XmlAccessorType;
|
||||||
|
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
public class LabelDataImportExport extends BaseFieldDataImportExport {
|
public class LabelDataImportExport extends BaseFieldDataImportExport {
|
||||||
|
public static final String XmlElementName = "labelData";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ import java.util.List;
|
||||||
|
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
public class RadioBoxDataImportExport extends BaseFieldDataImportExport {
|
public class RadioBoxDataImportExport extends BaseFieldDataImportExport {
|
||||||
|
public static final String XmlElementName = "radioBoxData";
|
||||||
|
|
||||||
@XmlElementWrapper(name = "options")
|
@XmlElementWrapper(name = "options")
|
||||||
@XmlElement(name = "option")
|
@XmlElement(name = "option")
|
||||||
|
@ -18,5 +19,29 @@ public class RadioBoxDataImportExport extends BaseFieldDataImportExport {
|
||||||
public void setOptions(List<RadioBoxOption> options) {
|
public void setOptions(List<RadioBoxOption> options) {
|
||||||
this.options = options;
|
this.options = options;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
|
public static class RadioBoxOption {
|
||||||
|
@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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,29 +0,0 @@
|
||||||
package eu.eudat.commons.types.descriptiontemplate.importexport.fielddata;
|
|
||||||
|
|
||||||
import jakarta.xml.bind.annotation.XmlAccessType;
|
|
||||||
import jakarta.xml.bind.annotation.XmlAccessorType;
|
|
||||||
import jakarta.xml.bind.annotation.XmlAttribute;
|
|
||||||
|
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
|
||||||
public class RadioBoxOption {
|
|
||||||
@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;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
package eu.eudat.commons.types.descriptiontemplate.importexport.fielddata;
|
||||||
|
|
||||||
|
import jakarta.xml.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
|
public class SelectDataImportExport extends LabelAndMultiplicityDataImportExport {
|
||||||
|
public static final String XmlElementName = "selectData";
|
||||||
|
@XmlElementWrapper(name = "options")
|
||||||
|
@XmlElement(name = "options")
|
||||||
|
private List<OptionImportExport> options;
|
||||||
|
|
||||||
|
|
||||||
|
public List<OptionImportExport> getOptions() {
|
||||||
|
return options;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOptions(List<OptionImportExport> options) {
|
||||||
|
this.options = options;
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
|
public static class OptionImportExport {
|
||||||
|
@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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -7,6 +7,7 @@ import java.util.List;
|
||||||
|
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
public class UploadDataImportExport extends BaseFieldDataImportExport {
|
public class UploadDataImportExport extends BaseFieldDataImportExport {
|
||||||
|
public static final String XmlElementName = "uploadData";
|
||||||
@XmlElementWrapper(name = "types")
|
@XmlElementWrapper(name = "types")
|
||||||
@XmlElement(name = "type")
|
@XmlElement(name = "type")
|
||||||
private List<UploadDataOption> types;
|
private List<UploadDataOption> types;
|
||||||
|
@ -30,5 +31,28 @@ public class UploadDataImportExport extends BaseFieldDataImportExport {
|
||||||
this.maxFileSizeInMB = maxFileSizeInMB;
|
this.maxFileSizeInMB = maxFileSizeInMB;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
|
public static class UploadDataOption {
|
||||||
|
@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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,29 +0,0 @@
|
||||||
package eu.eudat.commons.types.descriptiontemplate.importexport.fielddata;
|
|
||||||
|
|
||||||
import jakarta.xml.bind.annotation.XmlAccessType;
|
|
||||||
import jakarta.xml.bind.annotation.XmlAccessorType;
|
|
||||||
import jakarta.xml.bind.annotation.XmlAttribute;
|
|
||||||
|
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
|
||||||
public class UploadDataOption {
|
|
||||||
@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;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,33 +0,0 @@
|
||||||
package eu.eudat.commons.types.descriptiontemplate.importexport.fielddata;
|
|
||||||
|
|
||||||
import jakarta.xml.bind.annotation.*;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
|
||||||
public class WordListDataImportExport extends BaseFieldDataImportExport {
|
|
||||||
@XmlElementWrapper(name = "options")
|
|
||||||
@XmlElement(name = "options")
|
|
||||||
private List<ComboBoxDataOptionEntity> options;
|
|
||||||
|
|
||||||
@XmlAttribute(name = "multiList")
|
|
||||||
private Boolean multiList;
|
|
||||||
|
|
||||||
public List<ComboBoxDataOptionEntity> getOptions() {
|
|
||||||
return options;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOptions(List<ComboBoxDataOptionEntity> options) {
|
|
||||||
this.options = options;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Boolean getMultiList() {
|
|
||||||
return multiList;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMultiList(Boolean multiList) {
|
|
||||||
this.multiList = multiList;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -77,8 +77,8 @@ public class DescriptionFieldDepositBuilder extends BaseDepositBuilder<Descripti
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (field.getData().getFieldType()) {
|
switch (field.getData().getFieldType()) {
|
||||||
case AUTO_COMPLETE -> m.setFieldType(FieldType.AUTO_COMPLETE);
|
case EXTERNAL_SELECT -> 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);
|
||||||
|
|
|
@ -45,13 +45,11 @@ public class DefinitionBuilder extends BaseBuilder<Definition, DefinitionEntity>
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
|
|
||||||
//Not Bulk Build because is XML no interaction with db
|
//Not Bulk Build because is XML no interaction with db
|
||||||
FieldSet sectionsFields = fields.extractPrefixed(this.asPrefix(Definition._sections));
|
|
||||||
FieldSet pagesFields = fields.extractPrefixed(this.asPrefix(Definition._pages));
|
FieldSet pagesFields = fields.extractPrefixed(this.asPrefix(Definition._pages));
|
||||||
|
|
||||||
List<Definition> models = new ArrayList<>();
|
List<Definition> models = new ArrayList<>();
|
||||||
for (DefinitionEntity d : data) {
|
for (DefinitionEntity d : data) {
|
||||||
Definition m = new Definition();
|
Definition m = new Definition();
|
||||||
if (!sectionsFields.isEmpty() && d.getSections() != null) m.setSections(this.builderFactory.builder(SectionBuilder.class).authorize(this.authorize).build(sectionsFields, d.getSections()));
|
|
||||||
if (!pagesFields.isEmpty() && d.getPages() != null) m.setPages(this.builderFactory.builder(PageBuilder.class).authorize(this.authorize).build(pagesFields, d.getPages()));
|
if (!pagesFields.isEmpty() && d.getPages() != null) m.setPages(this.builderFactory.builder(PageBuilder.class).authorize(this.authorize).build(pagesFields, d.getPages()));
|
||||||
models.add(m);
|
models.add(m);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,9 @@ import eu.eudat.authorization.AuthorizationFlags;
|
||||||
import eu.eudat.commons.types.descriptiontemplate.PageEntity;
|
import eu.eudat.commons.types.descriptiontemplate.PageEntity;
|
||||||
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.Definition;
|
||||||
import eu.eudat.model.descriptiontemplatedefinition.Page;
|
import eu.eudat.model.descriptiontemplatedefinition.Page;
|
||||||
|
import gr.cite.tools.data.builder.BuilderFactory;
|
||||||
import gr.cite.tools.exception.MyApplicationException;
|
import gr.cite.tools.exception.MyApplicationException;
|
||||||
import gr.cite.tools.fieldset.FieldSet;
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
import gr.cite.tools.logging.DataLogEntry;
|
import gr.cite.tools.logging.DataLogEntry;
|
||||||
|
@ -21,12 +23,15 @@ import java.util.*;
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
public class PageBuilder extends BaseBuilder<Page, PageEntity> {
|
public class PageBuilder extends BaseBuilder<Page, PageEntity> {
|
||||||
|
|
||||||
|
private final BuilderFactory builderFactory;
|
||||||
|
|
||||||
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public PageBuilder(
|
public PageBuilder(
|
||||||
ConventionService conventionService) {
|
ConventionService conventionService, BuilderFactory builderFactory) {
|
||||||
super(conventionService, new LoggerService(LoggerFactory.getLogger(PageBuilder.class)));
|
super(conventionService, new LoggerService(LoggerFactory.getLogger(PageBuilder.class)));
|
||||||
|
this.builderFactory = builderFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PageBuilder authorize(EnumSet<AuthorizationFlags> values) {
|
public PageBuilder authorize(EnumSet<AuthorizationFlags> values) {
|
||||||
|
@ -42,11 +47,13 @@ public class PageBuilder extends BaseBuilder<Page, PageEntity> {
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
|
|
||||||
List<Page> models = new ArrayList<>();
|
List<Page> models = new ArrayList<>();
|
||||||
|
FieldSet sectionsFields = fields.extractPrefixed(this.asPrefix(Page._sections));
|
||||||
for (PageEntity d : data) {
|
for (PageEntity d : data) {
|
||||||
Page m = new Page();
|
Page m = new Page();
|
||||||
if (fields.hasField(this.asIndexer(Page._id))) m.setId(d.getId());
|
if (fields.hasField(this.asIndexer(Page._id))) m.setId(d.getId());
|
||||||
if (fields.hasField(this.asIndexer(Page._ordinal))) m.setOrdinal(d.getOrdinal());
|
if (fields.hasField(this.asIndexer(Page._ordinal))) m.setOrdinal(d.getOrdinal());
|
||||||
if (fields.hasField(this.asIndexer(Page._title))) m.setTitle(d.getTitle());
|
if (fields.hasField(this.asIndexer(Page._title))) m.setTitle(d.getTitle());
|
||||||
|
if (!sectionsFields.isEmpty() && d.getSections() != null) m.setSections(this.builderFactory.builder(SectionBuilder.class).authorize(this.authorize).build(sectionsFields, d.getSections()));
|
||||||
models.add(m);
|
models.add(m);
|
||||||
}
|
}
|
||||||
this.logger.debug("build {} items", Optional.of(models).map(List::size).orElse(0));
|
this.logger.debug("build {} items", Optional.of(models).map(List::size).orElse(0));
|
||||||
|
|
|
@ -56,7 +56,6 @@ public class SectionBuilder extends BaseBuilder<Section, SectionEntity> {
|
||||||
if (fields.hasField(this.asIndexer(Section._defaultVisibility))) m.setDefaultVisibility(d.isDefaultVisibility());
|
if (fields.hasField(this.asIndexer(Section._defaultVisibility))) m.setDefaultVisibility(d.isDefaultVisibility());
|
||||||
if (fields.hasField(this.asIndexer(Section._multiplicity))) m.setMultiplicity(d.getMultiplicity());
|
if (fields.hasField(this.asIndexer(Section._multiplicity))) m.setMultiplicity(d.getMultiplicity());
|
||||||
if (fields.hasField(this.asIndexer(Section._numbering))) m.setNumbering(d.getNumbering());
|
if (fields.hasField(this.asIndexer(Section._numbering))) m.setNumbering(d.getNumbering());
|
||||||
if (fields.hasField(this.asIndexer(Section._page))) m.setPage(d.getPage());
|
|
||||||
if (fields.hasField(this.asIndexer(Section._title))) m.setTitle(d.getTitle());
|
if (fields.hasField(this.asIndexer(Section._title))) m.setTitle(d.getTitle());
|
||||||
if (fields.hasField(this.asIndexer(Section._extendedDescription))) m.setExtendedDescription(d.getExtendedDescription());
|
if (fields.hasField(this.asIndexer(Section._extendedDescription))) m.setExtendedDescription(d.getExtendedDescription());
|
||||||
if (d.getSections() != null) m.setSections(this.builderFactory.builder(SectionBuilder.class).authorize(this.authorize).build(fields, d.getSections()));
|
if (d.getSections() != null) m.setSections(this.builderFactory.builder(SectionBuilder.class).authorize(this.authorize).build(fields, d.getSections()));
|
||||||
|
|
|
@ -1,57 +0,0 @@
|
||||||
package eu.eudat.model.builder.descriptiontemplatedefinition.fielddata;
|
|
||||||
|
|
||||||
import eu.eudat.authorization.AuthorizationFlags;
|
|
||||||
import eu.eudat.commons.types.descriptiontemplate.fielddata.AutoCompleteDataEntity;
|
|
||||||
import eu.eudat.convention.ConventionService;
|
|
||||||
import eu.eudat.model.builder.BaseBuilder;
|
|
||||||
import eu.eudat.model.descriptiontemplatedefinition.fielddata.AuthAutoCompleteData;
|
|
||||||
import gr.cite.tools.exception.MyApplicationException;
|
|
||||||
import gr.cite.tools.fieldset.FieldSet;
|
|
||||||
import gr.cite.tools.logging.DataLogEntry;
|
|
||||||
import gr.cite.tools.logging.LoggerService;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
|
||||||
import org.springframework.context.annotation.Scope;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
@Component
|
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
|
||||||
public class AuthAutoCompleteDataBuilder extends BaseBuilder<AuthAutoCompleteData, AutoCompleteDataEntity.AuthAutoCompleteData> {
|
|
||||||
|
|
||||||
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
public AuthAutoCompleteDataBuilder(
|
|
||||||
ConventionService conventionService) {
|
|
||||||
super(conventionService, new LoggerService(LoggerFactory.getLogger(AuthAutoCompleteDataBuilder.class)));
|
|
||||||
}
|
|
||||||
|
|
||||||
public AuthAutoCompleteDataBuilder authorize(EnumSet<AuthorizationFlags> values) {
|
|
||||||
this.authorize = values;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<AuthAutoCompleteData> build(FieldSet fields, List<AutoCompleteDataEntity.AuthAutoCompleteData> 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.trace(new DataLogEntry("requested fields", fields));
|
|
||||||
if (fields == null || data == null || fields.isEmpty())
|
|
||||||
return new ArrayList<>();
|
|
||||||
|
|
||||||
List<AuthAutoCompleteData> models = new ArrayList<>();
|
|
||||||
for (AutoCompleteDataEntity.AuthAutoCompleteData d : data) {
|
|
||||||
AuthAutoCompleteData m = new AuthAutoCompleteData();
|
|
||||||
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._body))) m.setBody(d.getBody());
|
|
||||||
if (fields.hasField(this.asIndexer(AuthAutoCompleteData._path))) m.setPath(d.getPath());
|
|
||||||
if (fields.hasField(this.asIndexer(AuthAutoCompleteData._type))) m.setType(d.getType());
|
|
||||||
models.add(m);
|
|
||||||
}
|
|
||||||
this.logger.debug("build {} items", Optional.of(models).map(List::size).orElse(0));
|
|
||||||
return models;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,37 +0,0 @@
|
||||||
package eu.eudat.model.builder.descriptiontemplatedefinition.fielddata;
|
|
||||||
|
|
||||||
import eu.eudat.commons.types.descriptiontemplate.fielddata.AutoCompleteDataEntity;
|
|
||||||
import eu.eudat.convention.ConventionService;
|
|
||||||
import eu.eudat.model.descriptiontemplatedefinition.fielddata.AutoCompleteData;
|
|
||||||
import gr.cite.tools.data.builder.BuilderFactory;
|
|
||||||
import gr.cite.tools.fieldset.FieldSet;
|
|
||||||
import gr.cite.tools.logging.LoggerService;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
|
||||||
import org.springframework.context.annotation.Scope;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
@Component
|
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
|
||||||
public class AutoCompleteDataBuilder extends BaseFieldDataBuilder<AutoCompleteData, AutoCompleteDataEntity> {
|
|
||||||
private final BuilderFactory builderFactory;
|
|
||||||
@Autowired
|
|
||||||
public AutoCompleteDataBuilder(ConventionService conventionService, BuilderFactory builderFactory) {
|
|
||||||
super(conventionService, new LoggerService(LoggerFactory.getLogger(AutoCompleteDataBuilder.class)));
|
|
||||||
this.builderFactory = builderFactory;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected AutoCompleteData getInstance() {
|
|
||||||
return new AutoCompleteData();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void buildChild(FieldSet fields, AutoCompleteDataEntity d, AutoCompleteData m) {
|
|
||||||
FieldSet autoCompleteSingleDataListFields = fields.extractPrefixed(this.asPrefix(AutoCompleteData._autoCompleteSingleDataList));
|
|
||||||
if (fields.hasField(this.asIndexer(AutoCompleteData._multiAutoComplete))) m.setMultiAutoComplete(d.getMultiAutoComplete());
|
|
||||||
if (!autoCompleteSingleDataListFields.isEmpty() && d.getAutoCompleteSingleDataList() != null) m.setAutoCompleteSingleDataList(this.builderFactory.builder(AutoCompleteSingleDataBuilder.class).authorize(this.authorize).build(autoCompleteSingleDataListFields, d.getAutoCompleteSingleDataList()));
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,64 +0,0 @@
|
||||||
package eu.eudat.model.builder.descriptiontemplatedefinition.fielddata;
|
|
||||||
|
|
||||||
import eu.eudat.authorization.AuthorizationFlags;
|
|
||||||
import eu.eudat.commons.types.descriptiontemplate.fielddata.AutoCompleteDataEntity;
|
|
||||||
import eu.eudat.convention.ConventionService;
|
|
||||||
import eu.eudat.model.builder.BaseBuilder;
|
|
||||||
import eu.eudat.model.descriptiontemplatedefinition.fielddata.AutoCompleteSingleData;
|
|
||||||
import gr.cite.tools.data.builder.BuilderFactory;
|
|
||||||
import gr.cite.tools.exception.MyApplicationException;
|
|
||||||
import gr.cite.tools.fieldset.FieldSet;
|
|
||||||
import gr.cite.tools.logging.DataLogEntry;
|
|
||||||
import gr.cite.tools.logging.LoggerService;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
|
||||||
import org.springframework.context.annotation.Scope;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
@Component
|
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
|
||||||
public class AutoCompleteSingleDataBuilder extends BaseBuilder<AutoCompleteSingleData, AutoCompleteDataEntity.AutoCompleteSingleData> {
|
|
||||||
|
|
||||||
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
|
||||||
private final BuilderFactory builderFactory;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
public AutoCompleteSingleDataBuilder(
|
|
||||||
ConventionService conventionService, BuilderFactory builderFactory) {
|
|
||||||
super(conventionService, new LoggerService(LoggerFactory.getLogger(AutoCompleteSingleDataBuilder.class)));
|
|
||||||
this.builderFactory = builderFactory;
|
|
||||||
}
|
|
||||||
|
|
||||||
public AutoCompleteSingleDataBuilder authorize(EnumSet<AuthorizationFlags> values) {
|
|
||||||
this.authorize = values;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<AutoCompleteSingleData> build(FieldSet fields, List<AutoCompleteDataEntity.AutoCompleteSingleData> 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.trace(new DataLogEntry("requested fields", fields));
|
|
||||||
if (fields == null || data == null || fields.isEmpty())
|
|
||||||
return new ArrayList<>();
|
|
||||||
|
|
||||||
FieldSet autoCompleteOptionsFields = fields.extractPrefixed(this.asPrefix(AutoCompleteSingleData._autoCompleteOptions));
|
|
||||||
FieldSet authFields = fields.extractPrefixed(this.asPrefix(AutoCompleteSingleData._auth));
|
|
||||||
List<AutoCompleteSingleData> models = new ArrayList<>();
|
|
||||||
for (AutoCompleteDataEntity.AutoCompleteSingleData d : data) {
|
|
||||||
AutoCompleteSingleData m = new AutoCompleteSingleData();
|
|
||||||
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._optionsRoot))) m.setOptionsRoot(d.getOptionsRoot());
|
|
||||||
if (fields.hasField(this.asIndexer(AutoCompleteSingleData._hasAuth))) m.setHasAuth(d.getHasAuth());
|
|
||||||
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 (!authFields.isEmpty() && d.getAuth() != null) m.setAuth(this.builderFactory.builder(AuthAutoCompleteDataBuilder.class).authorize(this.authorize).build(authFields, d.getAuth()));
|
|
||||||
models.add(m);
|
|
||||||
}
|
|
||||||
this.logger.debug("build {} items", Optional.of(models).map(List::size).orElse(0));
|
|
||||||
return models;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -16,7 +16,7 @@ import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
public abstract class BaseFieldDataBuilder<Model extends BaseFieldData, Entity extends BaseFieldDataEntity<?>> extends BaseBuilder<Model, Entity> {
|
public abstract class BaseFieldDataBuilder<Model extends BaseFieldData, Entity extends BaseFieldDataEntity> extends BaseBuilder<Model, Entity> {
|
||||||
|
|
||||||
protected EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
protected EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
||||||
|
|
||||||
|
|
|
@ -1,56 +0,0 @@
|
||||||
package eu.eudat.model.builder.descriptiontemplatedefinition.fielddata;
|
|
||||||
|
|
||||||
import eu.eudat.authorization.AuthorizationFlags;
|
|
||||||
import eu.eudat.commons.types.descriptiontemplate.fielddata.ComboBoxDataEntity;
|
|
||||||
import eu.eudat.convention.ConventionService;
|
|
||||||
import eu.eudat.model.builder.BaseBuilder;
|
|
||||||
import eu.eudat.model.descriptiontemplatedefinition.fielddata.ComboBoxOption;
|
|
||||||
import gr.cite.tools.exception.MyApplicationException;
|
|
||||||
import gr.cite.tools.fieldset.FieldSet;
|
|
||||||
import gr.cite.tools.logging.DataLogEntry;
|
|
||||||
import gr.cite.tools.logging.LoggerService;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
|
||||||
import org.springframework.context.annotation.Scope;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
@Component
|
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
|
||||||
public class ComboBoxOptionBuilder extends BaseBuilder<ComboBoxOption, ComboBoxDataEntity.Option> {
|
|
||||||
|
|
||||||
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
public ComboBoxOptionBuilder(
|
|
||||||
ConventionService conventionService) {
|
|
||||||
super(conventionService, new LoggerService(LoggerFactory.getLogger(ComboBoxOptionBuilder.class)));
|
|
||||||
}
|
|
||||||
|
|
||||||
public ComboBoxOptionBuilder authorize(EnumSet<AuthorizationFlags> values) {
|
|
||||||
this.authorize = values;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<ComboBoxOption> build(FieldSet fields, List<ComboBoxDataEntity.Option> 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.trace(new DataLogEntry("requested fields", fields));
|
|
||||||
if (fields == null || data == null || fields.isEmpty())
|
|
||||||
return new ArrayList<>();
|
|
||||||
|
|
||||||
List<ComboBoxOption> models = new ArrayList<>();
|
|
||||||
for (ComboBoxDataEntity.Option d : data) {
|
|
||||||
ComboBoxOption m = new ComboBoxOption();
|
|
||||||
if (fields.hasField(this.asIndexer(ComboBoxOption._label))) m.setLabel(d.getLabel());
|
|
||||||
if (fields.hasField(this.asIndexer(ComboBoxOption._source))) m.setSource(d.getSource());
|
|
||||||
if (fields.hasField(this.asIndexer(ComboBoxOption._uri))) m.setUri(d.getUri());
|
|
||||||
if (fields.hasField(this.asIndexer(ComboBoxOption._value))) m.setValue(d.getValue());
|
|
||||||
models.add(m);
|
|
||||||
}
|
|
||||||
this.logger.debug("build {} items", Optional.of(models).map(List::size).orElse(0));
|
|
||||||
return models;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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._multipleSelect))) m.setMultipleSelect(d.getMultipleSelect());
|
||||||
if (fields.hasField(this.asIndexer(ExternalDatasetData._type))) m.setType(d.getType());
|
if (fields.hasField(this.asIndexer(ExternalDatasetData._type))) m.setType(d.getType());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,163 @@
|
||||||
|
package eu.eudat.model.builder.descriptiontemplatedefinition.fielddata;
|
||||||
|
|
||||||
|
import eu.eudat.authorization.AuthorizationFlags;
|
||||||
|
import eu.eudat.commons.types.descriptiontemplate.fielddata.ExternalSelectDataEntity;
|
||||||
|
import eu.eudat.convention.ConventionService;
|
||||||
|
import eu.eudat.model.builder.BaseBuilder;
|
||||||
|
import eu.eudat.model.descriptiontemplatedefinition.fielddata.ExternalSelectData;
|
||||||
|
import gr.cite.tools.data.builder.BuilderFactory;
|
||||||
|
import gr.cite.tools.exception.MyApplicationException;
|
||||||
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
|
import gr.cite.tools.logging.DataLogEntry;
|
||||||
|
import gr.cite.tools.logging.LoggerService;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public class ExternalSelectDataBuilder extends BaseFieldDataBuilder<ExternalSelectData, ExternalSelectDataEntity> {
|
||||||
|
private final BuilderFactory builderFactory;
|
||||||
|
@Autowired
|
||||||
|
public ExternalSelectDataBuilder(ConventionService conventionService, BuilderFactory builderFactory) {
|
||||||
|
super(conventionService, new LoggerService(LoggerFactory.getLogger(ExternalSelectDataBuilder.class)));
|
||||||
|
this.builderFactory = builderFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected ExternalSelectData getInstance() {
|
||||||
|
return new ExternalSelectData();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void buildChild(FieldSet fields, ExternalSelectDataEntity d, ExternalSelectData m) {
|
||||||
|
FieldSet sourcesFields = fields.extractPrefixed(this.asPrefix(ExternalSelectData._sources));
|
||||||
|
if (fields.hasField(this.asIndexer(ExternalSelectData._multipleSelect))) m.setMultipleSelect(d.getMultipleSelect());
|
||||||
|
if (!sourcesFields.isEmpty() && d.getSources() != null) m.setSources(this.builderFactory.builder(ExternalSelectSourceBuilder.class).authorize(this.authorize).build(sourcesFields, d.getSources()));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public static class ExternalSelectSourceBindingBuilder extends BaseBuilder<ExternalSelectData.ExternalSelectSourceBinding, ExternalSelectDataEntity.ExternalSelectSourceBindingEntity> {
|
||||||
|
|
||||||
|
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public ExternalSelectSourceBindingBuilder(
|
||||||
|
ConventionService conventionService) {
|
||||||
|
super(conventionService, new LoggerService(LoggerFactory.getLogger(SelectDataBuilder.SelectOptionBuilder.class)));
|
||||||
|
}
|
||||||
|
|
||||||
|
public ExternalSelectSourceBindingBuilder authorize(EnumSet<AuthorizationFlags> values) {
|
||||||
|
this.authorize = values;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ExternalSelectData.ExternalSelectSourceBinding> build(FieldSet fields, List<ExternalSelectDataEntity.ExternalSelectSourceBindingEntity> 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.trace(new DataLogEntry("requested fields", fields));
|
||||||
|
if (fields == null || data == null || fields.isEmpty())
|
||||||
|
return new ArrayList<>();
|
||||||
|
|
||||||
|
List<ExternalSelectData.ExternalSelectSourceBinding> models = new ArrayList<>();
|
||||||
|
for (ExternalSelectDataEntity.ExternalSelectSourceBindingEntity d : data) {
|
||||||
|
ExternalSelectData.ExternalSelectSourceBinding m = new ExternalSelectData.ExternalSelectSourceBinding();
|
||||||
|
if (fields.hasField(this.asIndexer(ExternalSelectData.ExternalSelectSourceBinding._label))) m.setLabel(d.getLabel());
|
||||||
|
if (fields.hasField(this.asIndexer(ExternalSelectData.ExternalSelectSourceBinding._value))) m.setValue(d.getValue());
|
||||||
|
if (fields.hasField(this.asIndexer(ExternalSelectData.ExternalSelectSourceBinding._source))) m.setSource(d.getSource());
|
||||||
|
models.add(m);
|
||||||
|
}
|
||||||
|
this.logger.debug("build {} items", Optional.of(models).map(List::size).orElse(0));
|
||||||
|
return models;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public static class ExternalSelectSourceBuilder extends BaseBuilder<ExternalSelectData.ExternalSelectSource, ExternalSelectDataEntity.ExternalSelectSourceEntity> {
|
||||||
|
|
||||||
|
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
||||||
|
private final BuilderFactory builderFactory;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public ExternalSelectSourceBuilder(
|
||||||
|
ConventionService conventionService, BuilderFactory builderFactory) {
|
||||||
|
super(conventionService, new LoggerService(LoggerFactory.getLogger(ExternalSelectSourceBuilder.class)));
|
||||||
|
this.builderFactory = builderFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ExternalSelectSourceBuilder authorize(EnumSet<AuthorizationFlags> values) {
|
||||||
|
this.authorize = values;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ExternalSelectData.ExternalSelectSource> 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.trace(new DataLogEntry("requested fields", fields));
|
||||||
|
if (fields == null || data == null || fields.isEmpty())
|
||||||
|
return new ArrayList<>();
|
||||||
|
|
||||||
|
FieldSet sourceBindingFields = fields.extractPrefixed(this.asPrefix(ExternalSelectData.ExternalSelectSource._sourceBinding));
|
||||||
|
FieldSet authFields = fields.extractPrefixed(this.asPrefix(ExternalSelectData.ExternalSelectSource._auth));
|
||||||
|
List<ExternalSelectData.ExternalSelectSource> models = new ArrayList<>();
|
||||||
|
for (ExternalSelectDataEntity.ExternalSelectSourceEntity d : data) {
|
||||||
|
ExternalSelectData.ExternalSelectSource m = new ExternalSelectData.ExternalSelectSource();
|
||||||
|
if (fields.hasField(this.asIndexer(ExternalSelectData.ExternalSelectSource._url))) m.setUrl(d.getUrl());
|
||||||
|
if (fields.hasField(this.asIndexer(ExternalSelectData.ExternalSelectSource._optionsRoot))) m.setOptionsRoot(d.getOptionsRoot());
|
||||||
|
if (fields.hasField(this.asIndexer(ExternalSelectData.ExternalSelectSource._hasAuth))) m.setHasAuth(d.getHasAuth());
|
||||||
|
if (fields.hasField(this.asIndexer(ExternalSelectData.ExternalSelectSource._method))) m.setMethod(d.getMethod());
|
||||||
|
if (!sourceBindingFields.isEmpty() && d.getSourceBinding() != null) m.setSourceBinding(this.builderFactory.builder(ExternalSelectSourceBindingBuilder.class).authorize(this.authorize).build(sourceBindingFields, d.getSourceBinding()));
|
||||||
|
if (!authFields.isEmpty() && d.getAuth() != null) m.setAuth(this.builderFactory.builder(ExternalSelectAuthDataBuilder.class).authorize(this.authorize).build(authFields, d.getAuth()));
|
||||||
|
models.add(m);
|
||||||
|
}
|
||||||
|
this.logger.debug("build {} items", Optional.of(models).map(List::size).orElse(0));
|
||||||
|
return models;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public static class ExternalSelectAuthDataBuilder extends BaseBuilder<ExternalSelectData.ExternalSelectAuthData, ExternalSelectDataEntity.ExternalSelectAuthDataEntity> {
|
||||||
|
|
||||||
|
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public ExternalSelectAuthDataBuilder(
|
||||||
|
ConventionService conventionService) {
|
||||||
|
super(conventionService, new LoggerService(LoggerFactory.getLogger(ExternalSelectAuthDataBuilder.class)));
|
||||||
|
}
|
||||||
|
|
||||||
|
public ExternalSelectAuthDataBuilder authorize(EnumSet<AuthorizationFlags> values) {
|
||||||
|
this.authorize = values;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ExternalSelectData.ExternalSelectAuthData> 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.trace(new DataLogEntry("requested fields", fields));
|
||||||
|
if (fields == null || data == null || fields.isEmpty())
|
||||||
|
return new ArrayList<>();
|
||||||
|
|
||||||
|
List<ExternalSelectData.ExternalSelectAuthData> models = new ArrayList<>();
|
||||||
|
for (ExternalSelectDataEntity.ExternalSelectAuthDataEntity d : data) {
|
||||||
|
ExternalSelectData.ExternalSelectAuthData m = new ExternalSelectData.ExternalSelectAuthData();
|
||||||
|
if (fields.hasField(this.asIndexer(ExternalSelectData.ExternalSelectAuthData._url))) m.setUrl(d.getUrl());
|
||||||
|
if (fields.hasField(this.asIndexer(ExternalSelectData.ExternalSelectAuthData._method))) m.setMethod(d.getMethod());
|
||||||
|
if (fields.hasField(this.asIndexer(ExternalSelectData.ExternalSelectAuthData._body))) m.setBody(d.getBody());
|
||||||
|
if (fields.hasField(this.asIndexer(ExternalSelectData.ExternalSelectAuthData._path))) m.setPath(d.getPath());
|
||||||
|
if (fields.hasField(this.asIndexer(ExternalSelectData.ExternalSelectAuthData._type))) m.setType(d.getType());
|
||||||
|
models.add(m);
|
||||||
|
}
|
||||||
|
this.logger.debug("build {} items", Optional.of(models).map(List::size).orElse(0));
|
||||||
|
return models;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -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._multipleSelect))) m.setMultipleSelect(d.getMultipleSelect());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
package eu.eudat.model.builder.descriptiontemplatedefinition.fielddata;
|
package eu.eudat.model.builder.descriptiontemplatedefinition.fielddata;
|
||||||
|
|
||||||
|
import eu.eudat.authorization.AuthorizationFlags;
|
||||||
import eu.eudat.commons.types.descriptiontemplate.fielddata.RadioBoxDataEntity;
|
import eu.eudat.commons.types.descriptiontemplate.fielddata.RadioBoxDataEntity;
|
||||||
import eu.eudat.convention.ConventionService;
|
import eu.eudat.convention.ConventionService;
|
||||||
import eu.eudat.model.builder.descriptiontemplatedefinition.FieldBuilder;
|
import eu.eudat.model.builder.BaseBuilder;
|
||||||
import eu.eudat.model.descriptiontemplatedefinition.fielddata.RadioBoxData;
|
import eu.eudat.model.descriptiontemplatedefinition.fielddata.RadioBoxData;
|
||||||
import eu.eudat.model.descriptiontemplatedefinition.fielddata.RadioBoxOption;
|
|
||||||
import gr.cite.tools.data.builder.BuilderFactory;
|
import gr.cite.tools.data.builder.BuilderFactory;
|
||||||
|
import gr.cite.tools.exception.MyApplicationException;
|
||||||
import gr.cite.tools.fieldset.FieldSet;
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
|
import gr.cite.tools.logging.DataLogEntry;
|
||||||
import gr.cite.tools.logging.LoggerService;
|
import gr.cite.tools.logging.LoggerService;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -14,6 +16,8 @@ import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
public class RadioBoxDataBuilder extends BaseFieldDataBuilder<RadioBoxData, RadioBoxDataEntity> {
|
public class RadioBoxDataBuilder extends BaseFieldDataBuilder<RadioBoxData, RadioBoxDataEntity> {
|
||||||
|
@ -33,4 +37,40 @@ public class RadioBoxDataBuilder extends BaseFieldDataBuilder<RadioBoxData, Radi
|
||||||
FieldSet optionsFields = fields.extractPrefixed(this.asPrefix(RadioBoxData._options));
|
FieldSet optionsFields = fields.extractPrefixed(this.asPrefix(RadioBoxData._options));
|
||||||
if (!optionsFields.isEmpty() && d.getOptions() != null) m.setOptions(this.builderFactory.builder(RadioBoxOptionBuilder.class).authorize(this.authorize).build(optionsFields, d.getOptions()));
|
if (!optionsFields.isEmpty() && d.getOptions() != null) m.setOptions(this.builderFactory.builder(RadioBoxOptionBuilder.class).authorize(this.authorize).build(optionsFields, d.getOptions()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public static class RadioBoxOptionBuilder extends BaseBuilder<RadioBoxData.RadioBoxOption, RadioBoxDataEntity.RadioBoxDataOptionEntity> {
|
||||||
|
|
||||||
|
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public RadioBoxOptionBuilder(
|
||||||
|
ConventionService conventionService) {
|
||||||
|
super(conventionService, new LoggerService(LoggerFactory.getLogger(RadioBoxOptionBuilder.class)));
|
||||||
|
}
|
||||||
|
|
||||||
|
public RadioBoxOptionBuilder authorize(EnumSet<AuthorizationFlags> values) {
|
||||||
|
this.authorize = values;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<RadioBoxData.RadioBoxOption> build(FieldSet fields, List<RadioBoxDataEntity.RadioBoxDataOptionEntity> 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.trace(new DataLogEntry("requested fields", fields));
|
||||||
|
if (fields == null || data == null || fields.isEmpty())
|
||||||
|
return new ArrayList<>();
|
||||||
|
|
||||||
|
List<RadioBoxData.RadioBoxOption> models = new ArrayList<>();
|
||||||
|
for (RadioBoxDataEntity.RadioBoxDataOptionEntity d : data) {
|
||||||
|
RadioBoxData.RadioBoxOption m = new RadioBoxData.RadioBoxOption();
|
||||||
|
if (fields.hasField(this.asIndexer(RadioBoxData.RadioBoxOption._label))) m.setLabel(d.getLabel());
|
||||||
|
if (fields.hasField(this.asIndexer(RadioBoxData.RadioBoxOption._value))) m.setValue(d.getValue());
|
||||||
|
models.add(m);
|
||||||
|
}
|
||||||
|
this.logger.debug("build {} items", Optional.of(models).map(List::size).orElse(0));
|
||||||
|
return models;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,54 +0,0 @@
|
||||||
package eu.eudat.model.builder.descriptiontemplatedefinition.fielddata;
|
|
||||||
|
|
||||||
import eu.eudat.authorization.AuthorizationFlags;
|
|
||||||
import eu.eudat.commons.types.descriptiontemplate.fielddata.RadioBoxDataEntity;
|
|
||||||
import eu.eudat.convention.ConventionService;
|
|
||||||
import eu.eudat.model.builder.BaseBuilder;
|
|
||||||
import eu.eudat.model.descriptiontemplatedefinition.fielddata.RadioBoxOption;
|
|
||||||
import gr.cite.tools.exception.MyApplicationException;
|
|
||||||
import gr.cite.tools.fieldset.FieldSet;
|
|
||||||
import gr.cite.tools.logging.DataLogEntry;
|
|
||||||
import gr.cite.tools.logging.LoggerService;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
|
||||||
import org.springframework.context.annotation.Scope;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
@Component
|
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
|
||||||
public class RadioBoxOptionBuilder extends BaseBuilder<RadioBoxOption, RadioBoxDataEntity.RadioBoxDataOptionEntity> {
|
|
||||||
|
|
||||||
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
public RadioBoxOptionBuilder(
|
|
||||||
ConventionService conventionService) {
|
|
||||||
super(conventionService, new LoggerService(LoggerFactory.getLogger(RadioBoxOptionBuilder.class)));
|
|
||||||
}
|
|
||||||
|
|
||||||
public RadioBoxOptionBuilder authorize(EnumSet<AuthorizationFlags> values) {
|
|
||||||
this.authorize = values;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<RadioBoxOption> build(FieldSet fields, List<RadioBoxDataEntity.RadioBoxDataOptionEntity> 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.trace(new DataLogEntry("requested fields", fields));
|
|
||||||
if (fields == null || data == null || fields.isEmpty())
|
|
||||||
return new ArrayList<>();
|
|
||||||
|
|
||||||
List<RadioBoxOption> models = new ArrayList<>();
|
|
||||||
for (RadioBoxDataEntity.RadioBoxDataOptionEntity d : data) {
|
|
||||||
RadioBoxOption m = new RadioBoxOption();
|
|
||||||
if (fields.hasField(this.asIndexer(RadioBoxOption._label))) m.setLabel(d.getLabel());
|
|
||||||
if (fields.hasField(this.asIndexer(RadioBoxOption._value))) m.setValue(d.getValue());
|
|
||||||
models.add(m);
|
|
||||||
}
|
|
||||||
this.logger.debug("build {} items", Optional.of(models).map(List::size).orElse(0));
|
|
||||||
return models;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,79 @@
|
||||||
|
package eu.eudat.model.builder.descriptiontemplatedefinition.fielddata;
|
||||||
|
|
||||||
|
import eu.eudat.authorization.AuthorizationFlags;
|
||||||
|
import eu.eudat.commons.types.descriptiontemplate.fielddata.SelectDataEntity;
|
||||||
|
import eu.eudat.convention.ConventionService;
|
||||||
|
import eu.eudat.model.builder.BaseBuilder;
|
||||||
|
import eu.eudat.model.descriptiontemplatedefinition.fielddata.SelectData;
|
||||||
|
import gr.cite.tools.data.builder.BuilderFactory;
|
||||||
|
import gr.cite.tools.exception.MyApplicationException;
|
||||||
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
|
import gr.cite.tools.logging.DataLogEntry;
|
||||||
|
import gr.cite.tools.logging.LoggerService;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public class SelectDataBuilder extends BaseFieldDataBuilder<SelectData, SelectDataEntity> {
|
||||||
|
private final BuilderFactory builderFactory;
|
||||||
|
@Autowired
|
||||||
|
public SelectDataBuilder(ConventionService conventionService, BuilderFactory builderFactory) {
|
||||||
|
super(conventionService, new LoggerService(LoggerFactory.getLogger(SelectDataBuilder.class)));
|
||||||
|
this.builderFactory = builderFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected SelectData getInstance() {
|
||||||
|
return new SelectData();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void buildChild(FieldSet fields, SelectDataEntity d, SelectData m) {
|
||||||
|
FieldSet optionsFields = fields.extractPrefixed(this.asPrefix(SelectData._options));
|
||||||
|
if (fields.hasField(this.asIndexer(SelectData._multipleSelect))) m.setMultipleSelect(d.getMultipleSelect());
|
||||||
|
if (!optionsFields.isEmpty() && d.getOptions() != null) m.setOptions(this.builderFactory.builder(SelectOptionBuilder.class).authorize(this.authorize).build(optionsFields, d.getOptions()));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public static class SelectOptionBuilder extends BaseBuilder<SelectData.Option, SelectDataEntity.OptionEntity> {
|
||||||
|
|
||||||
|
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public SelectOptionBuilder(
|
||||||
|
ConventionService conventionService) {
|
||||||
|
super(conventionService, new LoggerService(LoggerFactory.getLogger(SelectOptionBuilder.class)));
|
||||||
|
}
|
||||||
|
|
||||||
|
public SelectOptionBuilder authorize(EnumSet<AuthorizationFlags> values) {
|
||||||
|
this.authorize = values;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SelectData.Option> build(FieldSet fields, List<SelectDataEntity.OptionEntity> 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.trace(new DataLogEntry("requested fields", fields));
|
||||||
|
if (fields == null || data == null || fields.isEmpty())
|
||||||
|
return new ArrayList<>();
|
||||||
|
|
||||||
|
List<SelectData.Option> models = new ArrayList<>();
|
||||||
|
for (SelectDataEntity.OptionEntity d : data) {
|
||||||
|
SelectData.Option m = new SelectData.Option();
|
||||||
|
if (fields.hasField(this.asIndexer(SelectData.Option._label))) m.setLabel(d.getLabel());
|
||||||
|
if (fields.hasField(this.asIndexer(SelectData.Option._value))) m.setValue(d.getValue());
|
||||||
|
models.add(m);
|
||||||
|
}
|
||||||
|
this.logger.debug("build {} items", Optional.of(models).map(List::size).orElse(0));
|
||||||
|
return models;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,10 +1,14 @@
|
||||||
package eu.eudat.model.builder.descriptiontemplatedefinition.fielddata;
|
package eu.eudat.model.builder.descriptiontemplatedefinition.fielddata;
|
||||||
|
|
||||||
|
import eu.eudat.authorization.AuthorizationFlags;
|
||||||
import eu.eudat.commons.types.descriptiontemplate.fielddata.UploadDataEntity;
|
import eu.eudat.commons.types.descriptiontemplate.fielddata.UploadDataEntity;
|
||||||
import eu.eudat.convention.ConventionService;
|
import eu.eudat.convention.ConventionService;
|
||||||
|
import eu.eudat.model.builder.BaseBuilder;
|
||||||
import eu.eudat.model.descriptiontemplatedefinition.fielddata.UploadData;
|
import eu.eudat.model.descriptiontemplatedefinition.fielddata.UploadData;
|
||||||
import gr.cite.tools.data.builder.BuilderFactory;
|
import gr.cite.tools.data.builder.BuilderFactory;
|
||||||
|
import gr.cite.tools.exception.MyApplicationException;
|
||||||
import gr.cite.tools.fieldset.FieldSet;
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
|
import gr.cite.tools.logging.DataLogEntry;
|
||||||
import gr.cite.tools.logging.LoggerService;
|
import gr.cite.tools.logging.LoggerService;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -12,6 +16,8 @@ import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
public class UploadDataBuilder extends BaseFieldDataBuilder<UploadData, UploadDataEntity> {
|
public class UploadDataBuilder extends BaseFieldDataBuilder<UploadData, UploadDataEntity> {
|
||||||
|
@ -31,4 +37,40 @@ public class UploadDataBuilder extends BaseFieldDataBuilder<UploadData, UploadDa
|
||||||
FieldSet typesFields = fields.extractPrefixed(this.asPrefix(UploadData._types));
|
FieldSet typesFields = fields.extractPrefixed(this.asPrefix(UploadData._types));
|
||||||
if (!typesFields.isEmpty() && d.getTypes() != null) m.setTypes(this.builderFactory.builder(UploadOptionBuilder.class).build(typesFields, d.getTypes()));
|
if (!typesFields.isEmpty() && d.getTypes() != null) m.setTypes(this.builderFactory.builder(UploadOptionBuilder.class).build(typesFields, d.getTypes()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public static class UploadOptionBuilder extends BaseBuilder<UploadData.UploadOption, UploadDataEntity.UploadDataOptionEntity> {
|
||||||
|
|
||||||
|
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public UploadOptionBuilder(
|
||||||
|
ConventionService conventionService) {
|
||||||
|
super(conventionService, new LoggerService(LoggerFactory.getLogger(UploadOptionBuilder.class)));
|
||||||
|
}
|
||||||
|
|
||||||
|
public UploadOptionBuilder authorize(EnumSet<AuthorizationFlags> values) {
|
||||||
|
this.authorize = values;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<UploadData.UploadOption> build(FieldSet fields, List<UploadDataEntity.UploadDataOptionEntity> 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.trace(new DataLogEntry("requested fields", fields));
|
||||||
|
if (fields == null || data == null || fields.isEmpty())
|
||||||
|
return new ArrayList<>();
|
||||||
|
|
||||||
|
List<UploadData.UploadOption> models = new ArrayList<>();
|
||||||
|
for (UploadDataEntity.UploadDataOptionEntity d : data) {
|
||||||
|
UploadData.UploadOption m = new UploadData.UploadOption();
|
||||||
|
if (fields.hasField(this.asIndexer(UploadData.UploadOption._label))) m.setLabel(d.getLabel());
|
||||||
|
if (fields.hasField(this.asIndexer(UploadData.UploadOption._value))) m.setValue(d.getValue());
|
||||||
|
models.add(m);
|
||||||
|
}
|
||||||
|
this.logger.debug("build {} items", Optional.of(models).map(List::size).orElse(0));
|
||||||
|
return models;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,54 +0,0 @@
|
||||||
package eu.eudat.model.builder.descriptiontemplatedefinition.fielddata;
|
|
||||||
|
|
||||||
import eu.eudat.authorization.AuthorizationFlags;
|
|
||||||
import eu.eudat.commons.types.descriptiontemplate.fielddata.UploadDataEntity;
|
|
||||||
import eu.eudat.convention.ConventionService;
|
|
||||||
import eu.eudat.model.builder.BaseBuilder;
|
|
||||||
import eu.eudat.model.descriptiontemplatedefinition.fielddata.UploadOption;
|
|
||||||
import gr.cite.tools.exception.MyApplicationException;
|
|
||||||
import gr.cite.tools.fieldset.FieldSet;
|
|
||||||
import gr.cite.tools.logging.DataLogEntry;
|
|
||||||
import gr.cite.tools.logging.LoggerService;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
|
||||||
import org.springframework.context.annotation.Scope;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
@Component
|
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
|
||||||
public class UploadOptionBuilder extends BaseBuilder<UploadOption, UploadDataEntity.UploadDataOptionEntity> {
|
|
||||||
|
|
||||||
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
public UploadOptionBuilder(
|
|
||||||
ConventionService conventionService) {
|
|
||||||
super(conventionService, new LoggerService(LoggerFactory.getLogger(UploadOptionBuilder.class)));
|
|
||||||
}
|
|
||||||
|
|
||||||
public UploadOptionBuilder authorize(EnumSet<AuthorizationFlags> values) {
|
|
||||||
this.authorize = values;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<UploadOption> build(FieldSet fields, List<UploadDataEntity.UploadDataOptionEntity> 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.trace(new DataLogEntry("requested fields", fields));
|
|
||||||
if (fields == null || data == null || fields.isEmpty())
|
|
||||||
return new ArrayList<>();
|
|
||||||
|
|
||||||
List<UploadOption> models = new ArrayList<>();
|
|
||||||
for (UploadDataEntity.UploadDataOptionEntity d : data) {
|
|
||||||
UploadOption m = new UploadOption();
|
|
||||||
if (fields.hasField(this.asIndexer(UploadOption._label))) m.setLabel(d.getLabel());
|
|
||||||
if (fields.hasField(this.asIndexer(UploadOption._value))) m.setValue(d.getValue());
|
|
||||||
models.add(m);
|
|
||||||
}
|
|
||||||
this.logger.debug("build {} items", Optional.of(models).map(List::size).orElse(0));
|
|
||||||
return models;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,37 +0,0 @@
|
||||||
package eu.eudat.model.builder.descriptiontemplatedefinition.fielddata;
|
|
||||||
|
|
||||||
import eu.eudat.commons.types.descriptiontemplate.fielddata.WordListDataEntity;
|
|
||||||
import eu.eudat.convention.ConventionService;
|
|
||||||
import eu.eudat.model.descriptiontemplatedefinition.fielddata.WordListData;
|
|
||||||
import gr.cite.tools.data.builder.BuilderFactory;
|
|
||||||
import gr.cite.tools.fieldset.FieldSet;
|
|
||||||
import gr.cite.tools.logging.LoggerService;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
|
||||||
import org.springframework.context.annotation.Scope;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
@Component
|
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
|
||||||
public class WordListDataBuilder extends BaseFieldDataBuilder<WordListData, WordListDataEntity> {
|
|
||||||
private final BuilderFactory builderFactory;
|
|
||||||
@Autowired
|
|
||||||
public WordListDataBuilder(ConventionService conventionService, BuilderFactory builderFactory) {
|
|
||||||
super(conventionService, new LoggerService(LoggerFactory.getLogger(WordListDataBuilder.class)));
|
|
||||||
this.builderFactory = builderFactory;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected WordListData getInstance() {
|
|
||||||
return new WordListData();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void buildChild(FieldSet fields, WordListDataEntity d, WordListData m) {
|
|
||||||
FieldSet optionsFields = fields.extractPrefixed(this.asPrefix(WordListData._options));
|
|
||||||
if (fields.hasField(this.asIndexer(WordListData._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()));
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -63,7 +63,7 @@ public class DescriptionTemplateDefinitionFileTransformerBuilder extends BaseFil
|
||||||
List<FileTransformerBuilderItemResponse<DefinitionFileTransformerModel, DefinitionEntity>> models = new ArrayList<>();
|
List<FileTransformerBuilderItemResponse<DefinitionFileTransformerModel, DefinitionEntity>> models = new ArrayList<>();
|
||||||
for (DefinitionEntity d : data) {
|
for (DefinitionEntity d : data) {
|
||||||
DefinitionFileTransformerModel m = new DefinitionFileTransformerModel();
|
DefinitionFileTransformerModel m = new DefinitionFileTransformerModel();
|
||||||
m.setPages(collectPages(d.getPages(), d.getSections()));
|
m.setPages(collectPages(d.getPages()));
|
||||||
models.add(new FileTransformerBuilderItemResponse<>(m, d));
|
models.add(new FileTransformerBuilderItemResponse<>(m, d));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,14 +72,14 @@ public class DescriptionTemplateDefinitionFileTransformerBuilder extends BaseFil
|
||||||
return models;
|
return models;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<PageFileTransformerModel> collectPages(List<PageEntity> data, List<SectionEntity> sections) {
|
private List<PageFileTransformerModel> collectPages(List<PageEntity> data) {
|
||||||
List<PageFileTransformerModel> result = new ArrayList<>();
|
List<PageFileTransformerModel> result = new ArrayList<>();
|
||||||
for (PageEntity d: data) {
|
for (PageEntity d: data) {
|
||||||
PageFileTransformerModel m = new PageFileTransformerModel();
|
PageFileTransformerModel m = new PageFileTransformerModel();
|
||||||
m.setId(d.getId());
|
m.setId(d.getId());
|
||||||
m.setOrdinal(d.getOrdinal());
|
m.setOrdinal(d.getOrdinal());
|
||||||
m.setTitle(d.getTitle());
|
m.setTitle(d.getTitle());
|
||||||
m.setSections(collectSections(sections.stream().filter(sectionEntity -> sectionEntity.getPage().equals(d.getId())).toList()));
|
if (d.getSections() != null) m.setSections(collectSections(d.getSections()));
|
||||||
result.add(m);
|
result.add(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,12 +156,12 @@ 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.getSources()));
|
||||||
}
|
}
|
||||||
case ExternalDatasetDataEntity d -> {
|
case ExternalDatasetDataEntity d -> {
|
||||||
m = new ExternalDatasetDataFileTransformerModel();
|
m = new ExternalDatasetDataFileTransformerModel();
|
||||||
|
@ -182,11 +182,11 @@ 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()));
|
||||||
((WordListDataFileTransformerModel) m).setMultiList(d.getMultiList());
|
((WordListDataFileTransformerModel) m).setMultiList(d.getMultipleSelect());
|
||||||
((WordListDataFileTransformerModel) m).setOptions(d.getOptions().stream().map(this::convertComboBoxOption).toList());
|
((WordListDataFileTransformerModel) m).setOptions(d.getOptions().stream().map(this::convertComboBoxOption).toList());
|
||||||
}
|
}
|
||||||
default -> m = null;
|
default -> m = null;
|
||||||
|
@ -205,26 +205,35 @@ 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.getSourceBinding()));
|
||||||
result.add(m);
|
result.add(m);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ComboBoxOptionFileTransformerModel convertComboBoxOption(ComboBoxDataEntity.Option data) {
|
private ComboBoxOptionFileTransformerModel convertComboBoxOption(ExternalSelectDataEntity.ExternalSelectSourceBindingEntity data) {
|
||||||
ComboBoxOptionFileTransformerModel m = new ComboBoxOptionFileTransformerModel();
|
ComboBoxOptionFileTransformerModel m = new ComboBoxOptionFileTransformerModel();
|
||||||
m.setUri(data.getUri());
|
// m.setUri(data.getUri());
|
||||||
m.setSource(data.getSource());
|
m.setSource(data.getSource());
|
||||||
m.setLabel(data.getLabel());
|
m.setLabel(data.getLabel());
|
||||||
m.setValue(data.getValue());
|
m.setValue(data.getValue());
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ComboBoxOptionFileTransformerModel convertComboBoxOption(SelectDataEntity.OptionEntity data) {
|
||||||
|
ComboBoxOptionFileTransformerModel m = new ComboBoxOptionFileTransformerModel();
|
||||||
|
// m.setUri(data.getUri());
|
||||||
|
// m.setSource(data.getSource());
|
||||||
|
m.setLabel(data.getLabel());
|
||||||
|
m.setValue(data.getValue());
|
||||||
|
return m;
|
||||||
|
}
|
||||||
|
|
||||||
private List<UploadOptionFileTransformerModel> convertUploadDataOptions(List<UploadDataEntity.UploadDataOptionEntity> data) {
|
private List<UploadOptionFileTransformerModel> convertUploadDataOptions(List<UploadDataEntity.UploadDataOptionEntity> data) {
|
||||||
List<UploadOptionFileTransformerModel> result = new ArrayList<>();
|
List<UploadOptionFileTransformerModel> result = new ArrayList<>();
|
||||||
for (UploadDataEntity.UploadDataOptionEntity d : data) {
|
for (UploadDataEntity.UploadDataOptionEntity d : data) {
|
||||||
|
|
|
@ -39,8 +39,6 @@ public class DefinitionCensor extends BaseCensor {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
this.authService.authorizeForce(Permission.BrowseDescriptionTemplate);
|
this.authService.authorizeForce(Permission.BrowseDescriptionTemplate);
|
||||||
FieldSet sectionsFields = fields.extractPrefixed(this.asIndexerPrefix(Definition._sections));
|
|
||||||
this.censorFactory.censor(SectionCensor.class).censor(sectionsFields, userId);
|
|
||||||
FieldSet pagesFields = fields.extractPrefixed(this.asIndexerPrefix(Definition._pages));
|
FieldSet pagesFields = fields.extractPrefixed(this.asIndexerPrefix(Definition._pages));
|
||||||
this.censorFactory.censor(PageCensor.class).censor(pagesFields, userId);
|
this.censorFactory.censor(PageCensor.class).censor(pagesFields, userId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,8 @@ package eu.eudat.model.censorship.descriptiontemplatedefinition;
|
||||||
import eu.eudat.authorization.Permission;
|
import eu.eudat.authorization.Permission;
|
||||||
import eu.eudat.convention.ConventionService;
|
import eu.eudat.convention.ConventionService;
|
||||||
import eu.eudat.model.censorship.BaseCensor;
|
import eu.eudat.model.censorship.BaseCensor;
|
||||||
|
import eu.eudat.model.descriptiontemplatedefinition.Definition;
|
||||||
|
import eu.eudat.model.descriptiontemplatedefinition.Page;
|
||||||
import gr.cite.commons.web.authz.service.AuthorizationService;
|
import gr.cite.commons.web.authz.service.AuthorizationService;
|
||||||
import gr.cite.tools.data.censor.CensorFactory;
|
import gr.cite.tools.data.censor.CensorFactory;
|
||||||
import gr.cite.tools.fieldset.FieldSet;
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
|
@ -38,6 +40,8 @@ public class PageCensor extends BaseCensor {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
this.authService.authorizeForce(Permission.BrowseDescriptionTemplate);
|
this.authService.authorizeForce(Permission.BrowseDescriptionTemplate);
|
||||||
|
FieldSet sectionsFields = fields.extractPrefixed(this.asIndexerPrefix(Page._sections));
|
||||||
|
this.censorFactory.censor(SectionCensor.class).censor(sectionsFields, userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,20 +4,9 @@ import java.util.List;
|
||||||
|
|
||||||
public class Definition {
|
public class Definition {
|
||||||
|
|
||||||
public final static String _sections = "sections";
|
|
||||||
private List<Section> sections;
|
|
||||||
|
|
||||||
public final static String _pages = "pages";
|
public final static String _pages = "pages";
|
||||||
private List<Page> pages;
|
private List<Page> pages;
|
||||||
|
|
||||||
public List<Section> getSections() {
|
|
||||||
return sections;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSections(List<Section> sections) {
|
|
||||||
this.sections = sections;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Page> getPages() {
|
public List<Page> getPages() {
|
||||||
return pages;
|
return pages;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,9 @@ public class Page {
|
||||||
public final static String _title = "title";
|
public final static String _title = "title";
|
||||||
private String title;
|
private String title;
|
||||||
|
|
||||||
|
public final static String _sections = "sections";
|
||||||
|
private List<Section> sections;
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
@ -37,6 +40,18 @@ public class Page {
|
||||||
public void setTitle(String title) {
|
public void setTitle(String title) {
|
||||||
this.title = title;
|
this.title = title;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setOrdinal(Integer ordinal) {
|
||||||
|
this.ordinal = ordinal;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Section> getSections() {
|
||||||
|
return sections;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSections(List<Section> sections) {
|
||||||
|
this.sections = sections;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -20,9 +20,6 @@ public class Section {
|
||||||
public final static String _numbering = "numbering";
|
public final static String _numbering = "numbering";
|
||||||
private String numbering; //TODO maybe remove
|
private String numbering; //TODO maybe remove
|
||||||
|
|
||||||
public final static String _page = "page";
|
|
||||||
private String page;
|
|
||||||
|
|
||||||
public final static String _title = "title";
|
public final static String _title = "title";
|
||||||
private String title;
|
private String title;
|
||||||
|
|
||||||
|
@ -78,14 +75,6 @@ public class Section {
|
||||||
this.numbering = numbering;
|
this.numbering = numbering;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPage() {
|
|
||||||
return page;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPage(String page) {
|
|
||||||
this.page = page;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTitle() {
|
public String getTitle() {
|
||||||
return title;
|
return title;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,54 +0,0 @@
|
||||||
package eu.eudat.model.descriptiontemplatedefinition.fielddata;
|
|
||||||
|
|
||||||
public class AuthAutoCompleteData {
|
|
||||||
public final static String _url = "url";
|
|
||||||
private String url;
|
|
||||||
public final static String _method = "method";
|
|
||||||
private String method;
|
|
||||||
public final static String _body = "body";
|
|
||||||
private String body;
|
|
||||||
public final static String _path = "path";
|
|
||||||
private String path;
|
|
||||||
public final static String _type = "type";
|
|
||||||
private String type;
|
|
||||||
|
|
||||||
public String getUrl() {
|
|
||||||
return url;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUrl(String url) {
|
|
||||||
this.url = url;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMethod() {
|
|
||||||
return method;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMethod(String method) {
|
|
||||||
this.method = method;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getBody() {
|
|
||||||
return body;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBody(String body) {
|
|
||||||
this.body = body;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPath() {
|
|
||||||
return path;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPath(String path) {
|
|
||||||
this.path = path;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getType() {
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setType(String type) {
|
|
||||||
this.type = type;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,22 +0,0 @@
|
||||||
package eu.eudat.model.descriptiontemplatedefinition.fielddata;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class AutoCompleteData extends BaseFieldData {
|
|
||||||
public final static String _multiAutoComplete = "multiAutoComplete";
|
|
||||||
private Boolean multiAutoComplete;
|
|
||||||
public final static String _autoCompleteSingleDataList = "autoCompleteSingleDataList";
|
|
||||||
private List<AutoCompleteSingleData> autoCompleteSingleDataList;
|
|
||||||
|
|
||||||
public Boolean getMultiAutoComplete() { return multiAutoComplete; }
|
|
||||||
public void setMultiAutoComplete(Boolean multiAutoComplete) { this.multiAutoComplete = multiAutoComplete; }
|
|
||||||
|
|
||||||
public List<AutoCompleteSingleData> getAutoCompleteSingleDataList() {
|
|
||||||
return autoCompleteSingleDataList;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAutoCompleteSingleDataList(List<AutoCompleteSingleData> autoCompleteSingleDataList) {
|
|
||||||
this.autoCompleteSingleDataList = autoCompleteSingleDataList;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,76 +0,0 @@
|
||||||
package eu.eudat.model.descriptiontemplatedefinition.fielddata;
|
|
||||||
|
|
||||||
import eu.eudat.commons.types.descriptiontemplate.fielddata.AutoCompleteDataEntity;
|
|
||||||
|
|
||||||
public class AutoCompleteSingleData {
|
|
||||||
public final static String _autocompleteType = "autocompleteType";
|
|
||||||
private AutoCompleteDataEntity.AutocompleteType autocompleteType;
|
|
||||||
public final static String _url = "url";
|
|
||||||
private String url;
|
|
||||||
public final static String _autoCompleteOptions = "autoCompleteOptions";
|
|
||||||
private ComboBoxOption autoCompleteOptions;
|
|
||||||
public final static String _optionsRoot = "optionsRoot";
|
|
||||||
private String optionsRoot;
|
|
||||||
public final static String _hasAuth = "hasAuth";
|
|
||||||
private Boolean hasAuth;
|
|
||||||
public final static String _auth = "auth";
|
|
||||||
private AuthAutoCompleteData auth;
|
|
||||||
public final static String _method = "method";
|
|
||||||
private String method;
|
|
||||||
|
|
||||||
public AutoCompleteDataEntity.AutocompleteType getAutocompleteType() {
|
|
||||||
return autocompleteType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAutocompleteType(AutoCompleteDataEntity.AutocompleteType autocompleteType) {
|
|
||||||
this.autocompleteType = autocompleteType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getOptionsRoot() {
|
|
||||||
return optionsRoot;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOptionsRoot(String optionsRoot) {
|
|
||||||
this.optionsRoot = optionsRoot;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUrl() {
|
|
||||||
return url;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUrl(String url) {
|
|
||||||
this.url = url;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Boolean getHasAuth() {
|
|
||||||
return hasAuth;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHasAuth(Boolean hasAuth) {
|
|
||||||
this.hasAuth = hasAuth;
|
|
||||||
}
|
|
||||||
|
|
||||||
public AuthAutoCompleteData getAuth() {
|
|
||||||
return auth;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAuth(AuthAutoCompleteData auth) {
|
|
||||||
this.auth = auth;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ComboBoxOption getAutoCompleteOptions() {
|
|
||||||
return autoCompleteOptions;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAutoCompleteOptions(ComboBoxOption autoCompleteOptions) {
|
|
||||||
this.autoCompleteOptions = autoCompleteOptions;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMethod() {
|
|
||||||
return method;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMethod(String method) {
|
|
||||||
this.method = method;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,46 +0,0 @@
|
||||||
package eu.eudat.model.descriptiontemplatedefinition.fielddata;
|
|
||||||
|
|
||||||
public class ComboBoxOption {
|
|
||||||
public final static String _label = "label";
|
|
||||||
private String label;
|
|
||||||
public final static String _value = "value";
|
|
||||||
private String value;
|
|
||||||
public final static String _source = "source";
|
|
||||||
private String source;
|
|
||||||
public final static String _uri = "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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -3,20 +3,10 @@ package eu.eudat.model.descriptiontemplatedefinition.fielddata;
|
||||||
|
|
||||||
import eu.eudat.commons.enums.FieldDataExternalDatasetType;
|
import eu.eudat.commons.enums.FieldDataExternalDatasetType;
|
||||||
|
|
||||||
public class ExternalDatasetData extends BaseFieldData {
|
public class ExternalDatasetData extends LabelAndMultiplicityData {
|
||||||
public final static String _multiAutoComplete = "multiAutoComplete";
|
|
||||||
private Boolean multiAutoComplete;
|
|
||||||
public final static String _type = "type";
|
public final static String _type = "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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,164 @@
|
||||||
|
package eu.eudat.model.descriptiontemplatedefinition.fielddata;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class ExternalSelectData extends LabelAndMultiplicityData {
|
||||||
|
private List<ExternalSelectSource> sources;
|
||||||
|
|
||||||
|
public final static String _sources = "sources";
|
||||||
|
|
||||||
|
public List<ExternalSelectSource> getSources() {
|
||||||
|
return sources;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSources(List<ExternalSelectSource> sources) {
|
||||||
|
this.sources = sources;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class ExternalSelectSource {
|
||||||
|
private String url;
|
||||||
|
public final static String _url = "url";
|
||||||
|
|
||||||
|
private String method;
|
||||||
|
public final static String _method = "method";
|
||||||
|
private String optionsRoot;
|
||||||
|
public final static String _optionsRoot = "optionsRoot";
|
||||||
|
private ExternalSelectSourceBinding sourceBinding;
|
||||||
|
public final static String _sourceBinding = "sourceBinding";
|
||||||
|
private Boolean hasAuth;
|
||||||
|
public final static String _hasAuth = "hasAuth";
|
||||||
|
private ExternalSelectAuthData auth;
|
||||||
|
public final static String _auth = "auth";
|
||||||
|
|
||||||
|
public String getUrl() {
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUrl(String url) {
|
||||||
|
this.url = url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMethod() {
|
||||||
|
return method;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMethod(String method) {
|
||||||
|
this.method = method;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOptionsRoot() {
|
||||||
|
return optionsRoot;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOptionsRoot(String optionsRoot) {
|
||||||
|
this.optionsRoot = optionsRoot;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ExternalSelectSourceBinding getSourceBinding() {
|
||||||
|
return sourceBinding;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSourceBinding(ExternalSelectSourceBinding sourceBinding) {
|
||||||
|
this.sourceBinding = sourceBinding;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean getHasAuth() {
|
||||||
|
return hasAuth;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHasAuth(Boolean hasAuth) {
|
||||||
|
this.hasAuth = hasAuth;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ExternalSelectAuthData getAuth() {
|
||||||
|
return auth;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAuth(ExternalSelectAuthData auth) {
|
||||||
|
this.auth = auth;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class ExternalSelectSourceBinding {
|
||||||
|
private String label;
|
||||||
|
public final static String _label = "label";
|
||||||
|
private String value;
|
||||||
|
public final static String _value = "value";
|
||||||
|
private String source;
|
||||||
|
public final static String _source = "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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class ExternalSelectAuthData {
|
||||||
|
private String url;
|
||||||
|
public final static String _url = "url";
|
||||||
|
private String method;
|
||||||
|
public final static String _method = "method";
|
||||||
|
private String body;
|
||||||
|
public final static String _body = "body";
|
||||||
|
private String path;
|
||||||
|
public final static String _path = "path";
|
||||||
|
private String type;
|
||||||
|
public final static String _type = "type";
|
||||||
|
|
||||||
|
public String getUrl() {
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUrl(String url) {
|
||||||
|
this.url = url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMethod() {
|
||||||
|
return method;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMethod(String method) {
|
||||||
|
this.method = method;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBody() {
|
||||||
|
return body;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBody(String body) {
|
||||||
|
this.body = body;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPath() {
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPath(String path) {
|
||||||
|
this.path = path;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(String type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,13 +1,13 @@
|
||||||
package eu.eudat.model.descriptiontemplatedefinition.fielddata;
|
package eu.eudat.model.descriptiontemplatedefinition.fielddata;
|
||||||
|
|
||||||
public class LabelAndMultiplicityData extends BaseFieldData {
|
public class LabelAndMultiplicityData extends BaseFieldData {
|
||||||
public final static String _multiAutoComplete = "multiAutoComplete";
|
public final static String _multipleSelect = "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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,4 +16,27 @@ public class RadioBoxData extends BaseFieldData {
|
||||||
public void setOptions(List<RadioBoxOption> options) {
|
public void setOptions(List<RadioBoxOption> options) {
|
||||||
this.options = options;
|
this.options = options;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class RadioBoxOption {
|
||||||
|
public final static String _label = "label";
|
||||||
|
private String label;
|
||||||
|
public final static String _value = "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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
package eu.eudat.model.descriptiontemplatedefinition.fielddata;
|
|
||||||
|
|
||||||
public class RadioBoxOption {
|
|
||||||
public final static String _label = "label";
|
|
||||||
private String label;
|
|
||||||
public final static String _value = "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;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
package eu.eudat.model.descriptiontemplatedefinition.fielddata;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class SelectData extends LabelAndMultiplicityData {
|
||||||
|
public final static String _options = "options";
|
||||||
|
private List<Option> options;
|
||||||
|
|
||||||
|
public List<Option> getOptions() {
|
||||||
|
return options;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOptions(List<Option> options) {
|
||||||
|
this.options = options;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Option {
|
||||||
|
public final static String _label = "label";
|
||||||
|
private String label;
|
||||||
|
public final static String _value = "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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -11,12 +11,13 @@ public class UploadData extends BaseFieldData {
|
||||||
return types;
|
return types;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public final static String _maxFileSizeInMB = "maxFileSizeInMB";
|
||||||
|
private Integer maxFileSizeInMB;
|
||||||
|
|
||||||
public void setTypes(List<UploadOption> types) {
|
public void setTypes(List<UploadOption> types) {
|
||||||
this.types = types;
|
this.types = types;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Integer maxFileSizeInMB;
|
|
||||||
|
|
||||||
public Integer getMaxFileSizeInMB() {
|
public Integer getMaxFileSizeInMB() {
|
||||||
return maxFileSizeInMB;
|
return maxFileSizeInMB;
|
||||||
}
|
}
|
||||||
|
@ -26,5 +27,27 @@ public class UploadData extends BaseFieldData {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static class UploadOption {
|
||||||
|
public final static String _label = "label";
|
||||||
|
private String label;
|
||||||
|
public final static String _value = "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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
package eu.eudat.model.descriptiontemplatedefinition.fielddata;
|
|
||||||
|
|
||||||
public class UploadOption {
|
|
||||||
public final static String _label = "label";
|
|
||||||
private String label;
|
|
||||||
public final static String _value = "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;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,26 +0,0 @@
|
||||||
package eu.eudat.model.descriptiontemplatedefinition.fielddata;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class WordListData extends BaseFieldData {
|
|
||||||
public final static String _options = "options";
|
|
||||||
private List<ComboBoxOption> options;
|
|
||||||
public final static String _multiList = "multiList";
|
|
||||||
private Boolean multiList;
|
|
||||||
|
|
||||||
public List<ComboBoxOption> getOptions() {
|
|
||||||
return options;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOptions(List<ComboBoxOption> options) {
|
|
||||||
this.options = options;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Boolean getMultiList() {
|
|
||||||
return multiList;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMultiList(Boolean multiList) {
|
|
||||||
this.multiList = multiList;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -16,11 +16,11 @@ public class DescriptionPageToDatasetPageMapper {
|
||||||
this.descriptionSectionToDatasetSectionMapper = descriptionSectionToDatasetSectionMapper;
|
this.descriptionSectionToDatasetSectionMapper = descriptionSectionToDatasetSectionMapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DatasetProfilePage toPublicModel(Page page, List<Section> sections) {
|
public DatasetProfilePage toPublicModel(Page page) {
|
||||||
DatasetProfilePage model = new DatasetProfilePage();
|
DatasetProfilePage model = new DatasetProfilePage();
|
||||||
model.setOrdinal(page.getOrdinal());
|
model.setOrdinal(page.getOrdinal());
|
||||||
model.setTitle(page.getTitle());
|
model.setTitle(page.getTitle());
|
||||||
model.setSections(sections.stream().map(descriptionSectionToDatasetSectionMapper::toPublicModel).toList());
|
if (page.getSections() != null) model.setSections(page.getSections().stream().map(x-> descriptionSectionToDatasetSectionMapper.toPublicModel(x, page.getOrdinal())).toList());
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,17 +12,17 @@ public class DescriptionSectionToDatasetSectionMapper {
|
||||||
this.descriptionFieldSetToDatasetFieldSetMapper = descriptionFieldSetToDatasetFieldSetMapper;
|
this.descriptionFieldSetToDatasetFieldSetMapper = descriptionFieldSetToDatasetFieldSetMapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Section toPublicModel(eu.eudat.model.descriptiontemplatedefinition.Section section) {
|
public Section toPublicModel(eu.eudat.model.descriptiontemplatedefinition.Section section, int page) {
|
||||||
Section model = new Section();
|
Section model = new Section();
|
||||||
model.setId(section.getId());
|
model.setId(section.getId());
|
||||||
model.setDescription(section.getDescription());
|
model.setDescription(section.getDescription());
|
||||||
model.setOrdinal(section.getOrdinal());
|
model.setOrdinal(section.getOrdinal());
|
||||||
model.setTitle(section.getTitle());
|
model.setTitle(section.getTitle());
|
||||||
model.setSections(section.getSections().stream().map(this::toPublicModel).toList());
|
model.setSections(section.getSections().stream().map(x-> this.toPublicModel(x, page)).toList());
|
||||||
model.setMultiplicity(section.getMultiplicity());
|
model.setMultiplicity(section.getMultiplicity());
|
||||||
model.setDefaultVisibility(section.getDefaultVisibility());
|
model.setDefaultVisibility(section.getDefaultVisibility());
|
||||||
model.setNumbering(section.getNumbering());
|
model.setNumbering(section.getNumbering());
|
||||||
model.setPage(section.getPage());
|
model.setPage("page_" + page);
|
||||||
model.setCompositeFields(section.getFieldSets().stream().map(descriptionFieldSetToDatasetFieldSetMapper::toPublicModel).toList());
|
model.setCompositeFields(section.getFieldSets().stream().map(descriptionFieldSetToDatasetFieldSetMapper::toPublicModel).toList());
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,17 +23,7 @@ public class DescriptionTemplateToPublicApiDatasetProfileMapper {
|
||||||
Definition definition = descriptionTemplate.getDefinition();
|
Definition definition = descriptionTemplate.getDefinition();
|
||||||
model.setStatus(descriptionTemplate.getStatus().getValue());
|
model.setStatus(descriptionTemplate.getStatus().getValue());
|
||||||
model.setPages(definition.getPages().stream().map(
|
model.setPages(definition.getPages().stream().map(
|
||||||
x -> descriptionPageToDatasetPageMapper.toPublicModel(
|
descriptionPageToDatasetPageMapper::toPublicModel
|
||||||
x,
|
|
||||||
definition.getSections().stream().filter(y -> {
|
|
||||||
try {
|
|
||||||
Integer.parseInt(y.getPage().replace("page_", ""));
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
logger.error("Cannot determine dataset page from input {}", y.getPage());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return Integer.parseInt(y.getPage().replace("page_", "")) == x.getOrdinal();
|
|
||||||
}).toList())
|
|
||||||
).toList());
|
).toList());
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,21 +16,10 @@ import java.util.List;
|
||||||
|
|
||||||
public class DefinitionPersist {
|
public class DefinitionPersist {
|
||||||
|
|
||||||
private List<SectionPersist> sections = null;
|
|
||||||
|
|
||||||
public static final String _sections = "sections";
|
|
||||||
|
|
||||||
private List<PagePersist> pages = null;
|
private List<PagePersist> pages = null;
|
||||||
|
|
||||||
public static final String _pages = "pages";
|
public static final String _pages = "pages";
|
||||||
|
|
||||||
public List<SectionPersist> getSections() {
|
|
||||||
return sections;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSections(List<SectionPersist> sections) {
|
|
||||||
this.sections = sections;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<PagePersist> getPages() {
|
public List<PagePersist> getPages() {
|
||||||
return pages;
|
return pages;
|
||||||
|
@ -64,14 +53,6 @@ public class DefinitionPersist {
|
||||||
@Override
|
@Override
|
||||||
protected List<Specification> specifications(DefinitionPersist item) {
|
protected List<Specification> specifications(DefinitionPersist item) {
|
||||||
return Arrays.asList(
|
return Arrays.asList(
|
||||||
this.spec()
|
|
||||||
.must(() -> !this.isListNullOrEmpty(item.getSections()))
|
|
||||||
.failOn(DefinitionPersist._sections).failWith(messageSource.getMessage("Validation_Required", new Object[]{DefinitionPersist._sections}, LocaleContextHolder.getLocale())),
|
|
||||||
this.navSpec()
|
|
||||||
.iff(() -> !this.isListNullOrEmpty(item.getSections()))
|
|
||||||
.on(DefinitionPersist._sections)
|
|
||||||
.over(item.getSections())
|
|
||||||
.using((itm) -> this.validatorFactory.validator(SectionPersist.SectionPersistValidator.class)),
|
|
||||||
this.spec()
|
this.spec()
|
||||||
.must(() -> !this.isListNullOrEmpty(item.getPages()))
|
.must(() -> !this.isListNullOrEmpty(item.getPages()))
|
||||||
.failOn(DefinitionPersist._pages).failWith(messageSource.getMessage("Validation_Required", new Object[]{DefinitionPersist._pages}, LocaleContextHolder.getLocale())),
|
.failOn(DefinitionPersist._pages).failWith(messageSource.getMessage("Validation_Required", new Object[]{DefinitionPersist._pages}, LocaleContextHolder.getLocale())),
|
||||||
|
|
|
@ -37,11 +37,12 @@ public class FieldSetPersist {
|
||||||
public static final String _description = "description";
|
public static final String _description = "description";
|
||||||
|
|
||||||
private String extendedDescription = null;
|
private String extendedDescription = null;
|
||||||
|
public static final String _extendedDescription = "extendedDescription";
|
||||||
|
|
||||||
private String additionalInformation = null;
|
private String additionalInformation = null;
|
||||||
|
public static final String _additionalInformation = "additionalInformation";
|
||||||
|
|
||||||
private MultiplicityPersist multiplicity = null;
|
private MultiplicityPersist multiplicity = null;
|
||||||
|
|
||||||
public static final String _multiplicity = "multiplicity";
|
public static final String _multiplicity = "multiplicity";
|
||||||
|
|
||||||
private Boolean hasCommentField = null;
|
private Boolean hasCommentField = null;
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package eu.eudat.model.persist.descriptiontemplatedefinition;
|
package eu.eudat.model.persist.descriptiontemplatedefinition;
|
||||||
|
|
||||||
import eu.eudat.commons.validation.BaseValidator;
|
import eu.eudat.commons.validation.BaseValidator;
|
||||||
|
import gr.cite.tools.validation.ValidatorFactory;
|
||||||
import gr.cite.tools.validation.specification.Specification;
|
import gr.cite.tools.validation.specification.Specification;
|
||||||
import eu.eudat.convention.ConventionService;
|
import eu.eudat.convention.ConventionService;
|
||||||
import eu.eudat.errorcode.ErrorThesaurusProperties;
|
import eu.eudat.errorcode.ErrorThesaurusProperties;
|
||||||
|
@ -27,6 +28,10 @@ public class PagePersist {
|
||||||
|
|
||||||
public static final String _title = "title";
|
public static final String _title = "title";
|
||||||
|
|
||||||
|
private List<SectionPersist> sections = null;
|
||||||
|
|
||||||
|
public static final String _sections = "sections";
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
@ -51,6 +56,18 @@ public class PagePersist {
|
||||||
this.title = title;
|
this.title = title;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setOrdinal(Integer ordinal) {
|
||||||
|
this.ordinal = ordinal;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<SectionPersist> getSections() {
|
||||||
|
return sections;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSections(List<SectionPersist> sections) {
|
||||||
|
this.sections = sections;
|
||||||
|
}
|
||||||
|
|
||||||
@Component(PagePersistValidator.ValidatorName)
|
@Component(PagePersistValidator.ValidatorName)
|
||||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
public static class PagePersistValidator extends BaseValidator<PagePersist> {
|
public static class PagePersistValidator extends BaseValidator<PagePersist> {
|
||||||
|
@ -59,9 +76,12 @@ public class PagePersist {
|
||||||
|
|
||||||
private final MessageSource messageSource;
|
private final MessageSource messageSource;
|
||||||
|
|
||||||
protected PagePersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource) {
|
private final ValidatorFactory validatorFactory;
|
||||||
|
|
||||||
|
protected PagePersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource, ValidatorFactory validatorFactory) {
|
||||||
super(conventionService, errors);
|
super(conventionService, errors);
|
||||||
this.messageSource = messageSource;
|
this.messageSource = messageSource;
|
||||||
|
this.validatorFactory = validatorFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -72,6 +92,14 @@ public class PagePersist {
|
||||||
@Override
|
@Override
|
||||||
protected List<Specification> specifications(PagePersist item) {
|
protected List<Specification> specifications(PagePersist item) {
|
||||||
return Arrays.asList(
|
return Arrays.asList(
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isListNullOrEmpty(item.getSections()))
|
||||||
|
.failOn(PagePersist._sections).failWith(messageSource.getMessage("Validation_Required", new Object[]{PagePersist._sections}, LocaleContextHolder.getLocale())),
|
||||||
|
this.navSpec()
|
||||||
|
.iff(() -> !this.isListNullOrEmpty(item.getSections()))
|
||||||
|
.on(PagePersist._sections)
|
||||||
|
.over(item.getSections())
|
||||||
|
.using((itm) -> this.validatorFactory.validator(SectionPersist.SectionPersistValidator.class)),
|
||||||
this.spec()
|
this.spec()
|
||||||
.must(() -> !this.isEmpty(item.getId()))
|
.must(() -> !this.isEmpty(item.getId()))
|
||||||
.failOn(PagePersist._id).failWith(messageSource.getMessage("Validation_Required", new Object[]{PagePersist._id}, LocaleContextHolder.getLocale())),
|
.failOn(PagePersist._id).failWith(messageSource.getMessage("Validation_Required", new Object[]{PagePersist._id}, LocaleContextHolder.getLocale())),
|
||||||
|
|
|
@ -32,10 +32,6 @@ public class SectionPersist {
|
||||||
|
|
||||||
public static final String _multiplicity = "multiplicity";
|
public static final String _multiplicity = "multiplicity";
|
||||||
|
|
||||||
private String page = null;
|
|
||||||
|
|
||||||
public static final String _page = "page";
|
|
||||||
|
|
||||||
private String title = null;
|
private String title = null;
|
||||||
|
|
||||||
public static final String _title = "title";
|
public static final String _title = "title";
|
||||||
|
@ -84,14 +80,6 @@ public class SectionPersist {
|
||||||
this.multiplicity = multiplicity;
|
this.multiplicity = multiplicity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPage() {
|
|
||||||
return page;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPage(String page) {
|
|
||||||
this.page = page;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTitle() {
|
public String getTitle() {
|
||||||
return title;
|
return title;
|
||||||
}
|
}
|
||||||
|
@ -160,9 +148,6 @@ public class SectionPersist {
|
||||||
this.spec()
|
this.spec()
|
||||||
.must(() -> !this.isNull(item.getMultiplicity()))
|
.must(() -> !this.isNull(item.getMultiplicity()))
|
||||||
.failOn(SectionPersist._multiplicity).failWith(messageSource.getMessage("Validation_Required", new Object[]{SectionPersist._multiplicity}, LocaleContextHolder.getLocale())),
|
.failOn(SectionPersist._multiplicity).failWith(messageSource.getMessage("Validation_Required", new Object[]{SectionPersist._multiplicity}, LocaleContextHolder.getLocale())),
|
||||||
this.spec()
|
|
||||||
.must(() -> !this.isEmpty(item.getPage()))
|
|
||||||
.failOn(SectionPersist._page).failWith(messageSource.getMessage("Validation_Required", new Object[]{SectionPersist._page}, LocaleContextHolder.getLocale())),
|
|
||||||
this.spec()
|
this.spec()
|
||||||
.must(() -> !this.isEmpty(item.getTitle()))
|
.must(() -> !this.isEmpty(item.getTitle()))
|
||||||
.failOn(SectionPersist._title).failWith(messageSource.getMessage("Validation_Required", new Object[]{SectionPersist._title}, LocaleContextHolder.getLocale())),
|
.failOn(SectionPersist._title).failWith(messageSource.getMessage("Validation_Required", new Object[]{SectionPersist._title}, LocaleContextHolder.getLocale())),
|
||||||
|
|
|
@ -1,113 +0,0 @@
|
||||||
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
|
|
||||||
|
|
||||||
import eu.eudat.commons.validation.BaseValidator;
|
|
||||||
import gr.cite.tools.validation.specification.Specification;
|
|
||||||
import eu.eudat.convention.ConventionService;
|
|
||||||
import eu.eudat.errorcode.ErrorThesaurusProperties;
|
|
||||||
import org.springframework.context.MessageSource;
|
|
||||||
import org.springframework.context.i18n.LocaleContextHolder;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class AuthAutoCompleteDataPersist {
|
|
||||||
|
|
||||||
private String url = null;
|
|
||||||
|
|
||||||
public static final String _uri = "uri";
|
|
||||||
|
|
||||||
private String method = null;
|
|
||||||
|
|
||||||
public static final String _method = "method";
|
|
||||||
|
|
||||||
private String body = null;
|
|
||||||
|
|
||||||
public static final String _body = "body";
|
|
||||||
|
|
||||||
private String path = null;
|
|
||||||
|
|
||||||
public static final String _path = "path";
|
|
||||||
|
|
||||||
private String type = null;
|
|
||||||
|
|
||||||
public static final String _type = "type";
|
|
||||||
|
|
||||||
public String getUrl() {
|
|
||||||
return url;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUrl(String url) {
|
|
||||||
this.url = url;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMethod() {
|
|
||||||
return method;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMethod(String method) {
|
|
||||||
this.method = method;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getBody() {
|
|
||||||
return body;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBody(String body) {
|
|
||||||
this.body = body;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPath() {
|
|
||||||
return path;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPath(String path) {
|
|
||||||
this.path = path;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getType() {
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setType(String type) {
|
|
||||||
this.type = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class AuthAutoCompleteDataPersistValidator extends BaseValidator<AuthAutoCompleteDataPersist> {
|
|
||||||
|
|
||||||
public static final String ValidatorName = "DescriptionTemplate.AuthAutoCompleteDataPersistValidator";
|
|
||||||
|
|
||||||
private final MessageSource messageSource;
|
|
||||||
|
|
||||||
protected AuthAutoCompleteDataPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource) {
|
|
||||||
super(conventionService, errors);
|
|
||||||
this.messageSource = messageSource;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Class<AuthAutoCompleteDataPersist> modelClass() {
|
|
||||||
return AuthAutoCompleteDataPersist.class;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected List<Specification> specifications(AuthAutoCompleteDataPersist item) {
|
|
||||||
return Arrays.asList(
|
|
||||||
this.spec()
|
|
||||||
.must(() -> !this.isEmpty(item.getUrl()))
|
|
||||||
.failOn(AuthAutoCompleteDataPersist._uri).failWith(messageSource.getMessage("Validation_Required", new Object[]{AuthAutoCompleteDataPersist._uri}, LocaleContextHolder.getLocale())),
|
|
||||||
this.spec()
|
|
||||||
.must(() -> !this.isEmpty(item.getMethod()))
|
|
||||||
.failOn(AuthAutoCompleteDataPersist._method).failWith(messageSource.getMessage("Validation_Required", new Object[]{AuthAutoCompleteDataPersist._method}, LocaleContextHolder.getLocale())),
|
|
||||||
this.spec()
|
|
||||||
.must(() -> !this.isEmpty(item.getBody()))
|
|
||||||
.failOn(AuthAutoCompleteDataPersist._body).failWith(messageSource.getMessage("Validation_Required", new Object[]{AuthAutoCompleteDataPersist._body}, LocaleContextHolder.getLocale())),
|
|
||||||
this.spec()
|
|
||||||
.must(() -> !this.isEmpty(item.getPath()))
|
|
||||||
.failOn(AuthAutoCompleteDataPersist._path).failWith(messageSource.getMessage("Validation_Required", new Object[]{AuthAutoCompleteDataPersist._path}, LocaleContextHolder.getLocale())),
|
|
||||||
this.spec()
|
|
||||||
.must(() -> !this.isEmpty(item.getType()))
|
|
||||||
.failOn(AuthAutoCompleteDataPersist._type).failWith(messageSource.getMessage("Validation_Required", new Object[]{AuthAutoCompleteDataPersist._type}, LocaleContextHolder.getLocale()))
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,77 +0,0 @@
|
||||||
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
|
|
||||||
|
|
||||||
import gr.cite.tools.validation.ValidatorFactory;
|
|
||||||
import gr.cite.tools.validation.specification.Specification;
|
|
||||||
import eu.eudat.convention.ConventionService;
|
|
||||||
import eu.eudat.errorcode.ErrorThesaurusProperties;
|
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
|
||||||
import org.springframework.context.MessageSource;
|
|
||||||
import org.springframework.context.annotation.Scope;
|
|
||||||
import org.springframework.context.i18n.LocaleContextHolder;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class AutoCompleteDataPersist extends BaseFieldDataPersist {
|
|
||||||
|
|
||||||
private Boolean multiAutoComplete = null;
|
|
||||||
|
|
||||||
public static final String _multiAutoComplete = "multiAutoComplete";
|
|
||||||
|
|
||||||
private List<AutoCompleteSingleDataPersist> autoCompleteSingleDataList = null;
|
|
||||||
|
|
||||||
public static final String _autoCompleteSingleDataList = "autoCompleteSingleDataList";
|
|
||||||
|
|
||||||
public Boolean getMultiAutoComplete() {
|
|
||||||
return multiAutoComplete;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMultiAutoComplete(Boolean multiAutoComplete) {
|
|
||||||
this.multiAutoComplete = multiAutoComplete;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<AutoCompleteSingleDataPersist> getAutoCompleteSingleDataList() {
|
|
||||||
return autoCompleteSingleDataList;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAutoCompleteSingleDataList(List<AutoCompleteSingleDataPersist> autoCompleteSingleDataList) {
|
|
||||||
this.autoCompleteSingleDataList = autoCompleteSingleDataList;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Component(AutoCompleteDataPersistValidator.ValidatorName)
|
|
||||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
|
||||||
public static class AutoCompleteDataPersistValidator extends BaseFieldDataPersistValidator<AutoCompleteDataPersist> {
|
|
||||||
|
|
||||||
public static final String ValidatorName = "DescriptionTemplate.AutoCompleteDataPersistValidator";
|
|
||||||
|
|
||||||
private final ValidatorFactory validatorFactory;
|
|
||||||
|
|
||||||
protected AutoCompleteDataPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource, ValidatorFactory validatorFactory) {
|
|
||||||
super(conventionService, errors, messageSource);
|
|
||||||
this.validatorFactory = validatorFactory;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Class<AutoCompleteDataPersist> modelClass() {
|
|
||||||
return AutoCompleteDataPersist.class;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected List<Specification> specifications(AutoCompleteDataPersist item) {
|
|
||||||
List<Specification> specifications = getBaseSpecifications(item);
|
|
||||||
specifications.addAll(Arrays.asList(
|
|
||||||
this.spec()
|
|
||||||
.must(() -> !this.isNull(item.getMultiAutoComplete()))
|
|
||||||
.failOn(AutoCompleteDataPersist._multiAutoComplete).failWith(messageSource.getMessage("Validation_Required", new Object[]{AutoCompleteDataPersist._multiAutoComplete}, LocaleContextHolder.getLocale())),
|
|
||||||
this.navSpec()
|
|
||||||
.iff(() -> !this.isNull(item.getAutoCompleteSingleDataList()))
|
|
||||||
.on(AutoCompleteDataPersist._autoCompleteSingleDataList)
|
|
||||||
.over(item.getAutoCompleteSingleDataList())
|
|
||||||
.using((itm) -> this.validatorFactory.validator(AutoCompleteSingleDataPersist.AutoCompleteSingleDataPersistValidator.class))
|
|
||||||
));
|
|
||||||
return specifications;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,157 +0,0 @@
|
||||||
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
|
|
||||||
|
|
||||||
import eu.eudat.commons.types.descriptiontemplate.fielddata.AutoCompleteDataEntity;
|
|
||||||
import eu.eudat.commons.validation.BaseValidator;
|
|
||||||
import gr.cite.tools.validation.ValidatorFactory;
|
|
||||||
import gr.cite.tools.validation.specification.Specification;
|
|
||||||
import eu.eudat.convention.ConventionService;
|
|
||||||
import eu.eudat.errorcode.ErrorThesaurusProperties;
|
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
|
||||||
import org.springframework.context.MessageSource;
|
|
||||||
import org.springframework.context.annotation.Scope;
|
|
||||||
import org.springframework.context.i18n.LocaleContextHolder;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class AutoCompleteSingleDataPersist {
|
|
||||||
|
|
||||||
private AutoCompleteDataEntity.AutocompleteType autocompleteType;
|
|
||||||
|
|
||||||
public static final String _autocompleteType = "autocompleteType";
|
|
||||||
|
|
||||||
private String url = null;
|
|
||||||
|
|
||||||
public static final String _url = "url";
|
|
||||||
|
|
||||||
private ComboBoxOptionPersist autoCompleteOptions;
|
|
||||||
|
|
||||||
public static final String _autoCompleteOptions = "autoCompleteOptions";
|
|
||||||
|
|
||||||
private String optionsRoot;
|
|
||||||
|
|
||||||
private Boolean hasAuth = null;
|
|
||||||
|
|
||||||
public static final String _hasAuth = "hasAuth";
|
|
||||||
|
|
||||||
private AuthAutoCompleteDataPersist auth;
|
|
||||||
|
|
||||||
public static final String _auth = "auth";
|
|
||||||
|
|
||||||
private String method = null;
|
|
||||||
|
|
||||||
public static final String _method = "method";
|
|
||||||
|
|
||||||
public AutoCompleteDataEntity.AutocompleteType getAutocompleteType() {
|
|
||||||
return autocompleteType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAutocompleteType(AutoCompleteDataEntity.AutocompleteType autocompleteType) {
|
|
||||||
this.autocompleteType = autocompleteType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getOptionsRoot() {
|
|
||||||
return optionsRoot;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOptionsRoot(String optionsRoot) {
|
|
||||||
this.optionsRoot = optionsRoot;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUrl() {
|
|
||||||
return url;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUrl(String url) {
|
|
||||||
this.url = url;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Boolean getHasAuth() {
|
|
||||||
return hasAuth;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHasAuth(Boolean hasAuth) {
|
|
||||||
this.hasAuth = hasAuth;
|
|
||||||
}
|
|
||||||
|
|
||||||
public AuthAutoCompleteDataPersist getAuth() {
|
|
||||||
return auth;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAuth(AuthAutoCompleteDataPersist auth) {
|
|
||||||
this.auth = auth;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ComboBoxOptionPersist getAutoCompleteOptions() {
|
|
||||||
return autoCompleteOptions;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAutoCompleteOptions(ComboBoxOptionPersist autoCompleteOptions) {
|
|
||||||
this.autoCompleteOptions = autoCompleteOptions;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMethod() {
|
|
||||||
return method;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMethod(String method) {
|
|
||||||
this.method = method;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Component(AutoCompleteSingleDataPersistValidator.ValidatorName)
|
|
||||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
|
||||||
public static class AutoCompleteSingleDataPersistValidator extends BaseValidator<AutoCompleteSingleDataPersist> {
|
|
||||||
|
|
||||||
public static final String ValidatorName = "DescriptionTemplate.AutoCompleteSingleDataPersistValidator";
|
|
||||||
|
|
||||||
private final MessageSource messageSource;
|
|
||||||
|
|
||||||
private final ValidatorFactory validatorFactory;
|
|
||||||
|
|
||||||
protected AutoCompleteSingleDataPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource, ValidatorFactory validatorFactory) {
|
|
||||||
super(conventionService, errors);
|
|
||||||
this.messageSource = messageSource;
|
|
||||||
this.validatorFactory = validatorFactory;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Class<AutoCompleteSingleDataPersist> modelClass() {
|
|
||||||
return AutoCompleteSingleDataPersist.class;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected List<Specification> specifications(AutoCompleteSingleDataPersist item) {
|
|
||||||
return Arrays.asList(
|
|
||||||
this.spec()
|
|
||||||
.must(() -> !this.isNull(item.getAutocompleteType()))
|
|
||||||
.failOn(AutoCompleteSingleDataPersist._autocompleteType).failWith(messageSource.getMessage("Validation_Required", new Object[]{AutoCompleteSingleDataPersist._autocompleteType}, LocaleContextHolder.getLocale())),
|
|
||||||
this.spec()
|
|
||||||
.must(() -> !this.isEmpty(item.getUrl()))
|
|
||||||
.failOn(AutoCompleteSingleDataPersist._url).failWith(messageSource.getMessage("Validation_Required", new Object[]{AutoCompleteSingleDataPersist._url}, LocaleContextHolder.getLocale())),
|
|
||||||
this.spec()
|
|
||||||
.must(() -> !this.isNull(item.getHasAuth()))
|
|
||||||
.failOn(AutoCompleteSingleDataPersist._hasAuth).failWith(messageSource.getMessage("Validation_Required", new Object[]{AutoCompleteSingleDataPersist._hasAuth}, LocaleContextHolder.getLocale())),
|
|
||||||
this.spec()
|
|
||||||
.must(() -> !this.isEmpty(item.getMethod()))
|
|
||||||
.failOn(AutoCompleteSingleDataPersist._method).failWith(messageSource.getMessage("Validation_Required", new Object[]{AutoCompleteSingleDataPersist._method}, LocaleContextHolder.getLocale())),
|
|
||||||
|
|
||||||
this.refSpec()
|
|
||||||
.iff(() -> !this.isNull(item.getAutoCompleteOptions()))
|
|
||||||
.on(AutoCompleteSingleDataPersist._autoCompleteOptions)
|
|
||||||
.over(item.getAutoCompleteOptions())
|
|
||||||
.using(() -> this.validatorFactory.validator(ComboBoxOptionPersist.ComboBoxOptionPersistValidator.class)),
|
|
||||||
this.spec()
|
|
||||||
.iff(() -> !this.isNull(item.getHasAuth()) && item.getHasAuth())
|
|
||||||
.must(() -> !this.isNull(item.getAuth()))
|
|
||||||
.failOn(AutoCompleteSingleDataPersist._auth).failWith(messageSource.getMessage("Validation_Required", new Object[]{AutoCompleteSingleDataPersist._auth}, LocaleContextHolder.getLocale())),
|
|
||||||
this.refSpec()
|
|
||||||
.iff(() -> !this.isNull(item.getAuth()))
|
|
||||||
.on(AutoCompleteSingleDataPersist._auth)
|
|
||||||
.over(item.getAuth())
|
|
||||||
.using(() -> this.validatorFactory.validator(AuthAutoCompleteDataPersist.AuthAutoCompleteDataPersistValidator.class))
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -20,7 +20,7 @@ import java.util.List;
|
||||||
property = "fieldType",
|
property = "fieldType",
|
||||||
visible = true)
|
visible = true)
|
||||||
@JsonSubTypes({
|
@JsonSubTypes({
|
||||||
@JsonSubTypes.Type(value = AutoCompleteDataPersist.class, name = FieldType.Names.Autocomplete),
|
@JsonSubTypes.Type(value = ExternalSelectDataPersist.class, name = FieldType.Names.ExternalSelect),
|
||||||
@JsonSubTypes.Type(value = LabelDataPersist.class, name = FieldType.Names.BooleanDecision),
|
@JsonSubTypes.Type(value = LabelDataPersist.class, name = FieldType.Names.BooleanDecision),
|
||||||
@JsonSubTypes.Type(value = LabelAndMultiplicityDataPersist.class, name = FieldType.Names.InternalDmpDatasets),
|
@JsonSubTypes.Type(value = LabelAndMultiplicityDataPersist.class, name = FieldType.Names.InternalDmpDatasets),
|
||||||
@JsonSubTypes.Type(value = LabelAndMultiplicityDataPersist.class, name = FieldType.Names.InternalDmpDmps),
|
@JsonSubTypes.Type(value = LabelAndMultiplicityDataPersist.class, name = FieldType.Names.InternalDmpDmps),
|
||||||
|
@ -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),
|
||||||
|
|
|
@ -1,97 +0,0 @@
|
||||||
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
|
|
||||||
|
|
||||||
import eu.eudat.commons.validation.BaseValidator;
|
|
||||||
import gr.cite.tools.validation.specification.Specification;
|
|
||||||
import eu.eudat.convention.ConventionService;
|
|
||||||
import eu.eudat.errorcode.ErrorThesaurusProperties;
|
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
|
||||||
import org.springframework.context.MessageSource;
|
|
||||||
import org.springframework.context.annotation.Scope;
|
|
||||||
import org.springframework.context.i18n.LocaleContextHolder;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class ComboBoxOptionPersist {
|
|
||||||
|
|
||||||
private String label = null;
|
|
||||||
|
|
||||||
public static final String _label = "label";
|
|
||||||
|
|
||||||
private String value = null;
|
|
||||||
|
|
||||||
public static final String _value = "value";
|
|
||||||
|
|
||||||
private String source = null;
|
|
||||||
|
|
||||||
public static final String _source = "source";
|
|
||||||
|
|
||||||
private String uri = null;
|
|
||||||
|
|
||||||
public static final String _uri = "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;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Component(ComboBoxOptionPersistValidator.ValidatorName)
|
|
||||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
|
||||||
public static class ComboBoxOptionPersistValidator extends BaseValidator<ComboBoxOptionPersist> {
|
|
||||||
|
|
||||||
public static final String ValidatorName = "DescriptionTemplate.ComboBoxOptionPersistValidator";
|
|
||||||
|
|
||||||
private final MessageSource messageSource;
|
|
||||||
|
|
||||||
protected ComboBoxOptionPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource) {
|
|
||||||
super(conventionService, errors);
|
|
||||||
this.messageSource = messageSource;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Class<ComboBoxOptionPersist> modelClass() {
|
|
||||||
return ComboBoxOptionPersist.class;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected List<Specification> specifications(ComboBoxOptionPersist item) {
|
|
||||||
return Arrays.asList(
|
|
||||||
this.spec()
|
|
||||||
.must(() -> !this.isEmpty(item.getLabel()))
|
|
||||||
.failOn(ComboBoxOptionPersist._label).failWith(messageSource.getMessage("Validation_Required", new Object[]{ComboBoxOptionPersist._label}, LocaleContextHolder.getLocale())),
|
|
||||||
this.spec()
|
|
||||||
.must(() -> !this.isEmpty(item.getValue()))
|
|
||||||
.failOn(ComboBoxOptionPersist._value).failWith(messageSource.getMessage("Validation_Required", new Object[]{ComboBoxOptionPersist._value}, LocaleContextHolder.getLocale()))
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -15,20 +15,20 @@ import java.util.List;
|
||||||
|
|
||||||
public class ExternalDatasetDataPersist extends BaseFieldDataPersist {
|
public class ExternalDatasetDataPersist extends BaseFieldDataPersist {
|
||||||
|
|
||||||
private Boolean multiAutoComplete = null;
|
private Boolean multipleSelect = null;
|
||||||
|
|
||||||
public static final String _multiAutoComplete = "multiAutoComplete";
|
public static final String _multipleSelect = "multipleSelect";
|
||||||
|
|
||||||
private FieldDataExternalDatasetType type;
|
private FieldDataExternalDatasetType type;
|
||||||
|
|
||||||
public static final String _type = "type";
|
public static final String _type = "type";
|
||||||
|
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
public FieldDataExternalDatasetType getType() {
|
public FieldDataExternalDatasetType getType() {
|
||||||
|
@ -59,8 +59,8 @@ public class ExternalDatasetDataPersist extends BaseFieldDataPersist {
|
||||||
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.getMultiAutoComplete()))
|
.must(() -> !this.isNull(item.getMultipleSelect()))
|
||||||
.failOn(ExternalDatasetDataPersist._multiAutoComplete).failWith(messageSource.getMessage("Validation_Required", new Object[]{ExternalDatasetDataPersist._multiAutoComplete}, LocaleContextHolder.getLocale())),
|
.failOn(ExternalDatasetDataPersist._multipleSelect).failWith(messageSource.getMessage("Validation_Required", new Object[]{ExternalDatasetDataPersist._multipleSelect}, LocaleContextHolder.getLocale())),
|
||||||
this.spec()
|
this.spec()
|
||||||
.must(() -> !this.isNull(item.getType()))
|
.must(() -> !this.isNull(item.getType()))
|
||||||
.failOn(ExternalDatasetDataPersist._type).failWith(messageSource.getMessage("Validation_Required", new Object[]{ExternalDatasetDataPersist._type}, LocaleContextHolder.getLocale()))
|
.failOn(ExternalDatasetDataPersist._type).failWith(messageSource.getMessage("Validation_Required", new Object[]{ExternalDatasetDataPersist._type}, LocaleContextHolder.getLocale()))
|
||||||
|
|
|
@ -0,0 +1,321 @@
|
||||||
|
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
|
||||||
|
|
||||||
|
import eu.eudat.commons.validation.BaseValidator;
|
||||||
|
import gr.cite.tools.validation.ValidatorFactory;
|
||||||
|
import gr.cite.tools.validation.specification.Specification;
|
||||||
|
import eu.eudat.convention.ConventionService;
|
||||||
|
import eu.eudat.errorcode.ErrorThesaurusProperties;
|
||||||
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
|
import org.springframework.context.MessageSource;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.context.i18n.LocaleContextHolder;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class ExternalSelectDataPersist extends BaseFieldDataPersist {
|
||||||
|
|
||||||
|
private Boolean multipleSelect;
|
||||||
|
|
||||||
|
public static final String _multipleSelect = "multipleSelect";
|
||||||
|
|
||||||
|
private List<ExternalSelectSourcePersist> sources;
|
||||||
|
|
||||||
|
public final static String _sources = "sources";
|
||||||
|
|
||||||
|
public List<ExternalSelectSourcePersist> getSources() {
|
||||||
|
return sources;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSources(List<ExternalSelectSourcePersist> sources) {
|
||||||
|
this.sources = sources;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean getMultipleSelect() {
|
||||||
|
return multipleSelect;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMultipleSelect(Boolean multipleSelect) {
|
||||||
|
this.multipleSelect = multipleSelect;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Component(AutoCompleteDataPersistValidator.ValidatorName)
|
||||||
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public static class AutoCompleteDataPersistValidator extends BaseFieldDataPersistValidator<ExternalSelectDataPersist> {
|
||||||
|
|
||||||
|
public static final String ValidatorName = "DescriptionTemplate.AutoCompleteDataPersistValidator";
|
||||||
|
|
||||||
|
private final ValidatorFactory validatorFactory;
|
||||||
|
|
||||||
|
protected AutoCompleteDataPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource, ValidatorFactory validatorFactory) {
|
||||||
|
super(conventionService, errors, messageSource);
|
||||||
|
this.validatorFactory = validatorFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<ExternalSelectDataPersist> modelClass() {
|
||||||
|
return ExternalSelectDataPersist.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<Specification> specifications(ExternalSelectDataPersist item) {
|
||||||
|
List<Specification> specifications = getBaseSpecifications(item);
|
||||||
|
specifications.addAll(Arrays.asList(
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isNull(item.getMultipleSelect()))
|
||||||
|
.failOn(ExternalSelectDataPersist._multipleSelect).failWith(messageSource.getMessage("Validation_Required", new Object[]{ExternalSelectDataPersist._multipleSelect}, LocaleContextHolder.getLocale())),
|
||||||
|
this.navSpec()
|
||||||
|
.iff(() -> !this.isNull(item.getSources()))
|
||||||
|
.on(ExternalSelectDataPersist._sources)
|
||||||
|
.over(item.getSources())
|
||||||
|
.using((itm) -> this.validatorFactory.validator(ExternalSelectSourcePersist.ExternalSelectSourcePersistValidator.class))
|
||||||
|
));
|
||||||
|
return specifications;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class ExternalSelectSourcePersist {
|
||||||
|
private String url;
|
||||||
|
public final static String _url = "url";
|
||||||
|
private String method;
|
||||||
|
public final static String _method = "method";
|
||||||
|
private String optionsRoot;
|
||||||
|
public final static String _optionsRoot = "optionsRoot";
|
||||||
|
private ExternalSelectSourceBindingPersist sourceBinding;
|
||||||
|
public final static String _sourceBinding = "sourceBinding";
|
||||||
|
private Boolean hasAuth;
|
||||||
|
public final static String _hasAuth = "hasAuth";
|
||||||
|
private ExternalSelectAuthDataPersist auth;
|
||||||
|
public final static String _auth = "auth";
|
||||||
|
|
||||||
|
public String getUrl() {
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUrl(String url) {
|
||||||
|
this.url = url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMethod() {
|
||||||
|
return method;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMethod(String method) {
|
||||||
|
this.method = method;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOptionsRoot() {
|
||||||
|
return optionsRoot;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOptionsRoot(String optionsRoot) {
|
||||||
|
this.optionsRoot = optionsRoot;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ExternalSelectSourceBindingPersist getSourceBinding() {
|
||||||
|
return sourceBinding;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSourceBinding(ExternalSelectSourceBindingPersist sourceBinding) {
|
||||||
|
this.sourceBinding = sourceBinding;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean getHasAuth() {
|
||||||
|
return hasAuth;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHasAuth(Boolean hasAuth) {
|
||||||
|
this.hasAuth = hasAuth;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ExternalSelectAuthDataPersist getAuth() {
|
||||||
|
return auth;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAuth(ExternalSelectAuthDataPersist auth) {
|
||||||
|
this.auth = auth;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Component(ExternalSelectSourcePersist.ExternalSelectSourcePersistValidator.ValidatorName)
|
||||||
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public static class ExternalSelectSourcePersistValidator extends BaseValidator<ExternalSelectSourcePersist> {
|
||||||
|
|
||||||
|
public static final String ValidatorName = "DescriptionTemplate.ExternalSelectSourcePersistValidator";
|
||||||
|
|
||||||
|
private final ValidatorFactory validatorFactory;
|
||||||
|
private final MessageSource messageSource;
|
||||||
|
|
||||||
|
protected ExternalSelectSourcePersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource, ValidatorFactory validatorFactory) {
|
||||||
|
super(conventionService, errors);
|
||||||
|
this.validatorFactory = validatorFactory;
|
||||||
|
this.messageSource = messageSource;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<ExternalSelectSourcePersist> modelClass() {
|
||||||
|
return ExternalSelectSourcePersist.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<Specification> specifications(ExternalSelectSourcePersist item) {
|
||||||
|
return Arrays.asList(
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isNull(item.getUrl()))
|
||||||
|
.failOn(ExternalSelectSourcePersist._url).failWith(messageSource.getMessage("Validation_Required", new Object[]{ExternalSelectSourcePersist._url}, LocaleContextHolder.getLocale())),
|
||||||
|
this.refSpec()
|
||||||
|
.iff(() -> !this.isNull(item.getSourceBinding()))
|
||||||
|
.on(ExternalSelectSourcePersist._sourceBinding)
|
||||||
|
.over(item.getSourceBinding())
|
||||||
|
.using(() -> this.validatorFactory.validator(ExternalSelectSourceBindingPersist.ExternalSelectSourceBindingPersistValidator.class)),
|
||||||
|
this.refSpec()
|
||||||
|
.iff(() -> !this.isNull(item.getAuth()))
|
||||||
|
.on(ExternalSelectSourcePersist._auth)
|
||||||
|
.over(item.getAuth())
|
||||||
|
.using(() -> this.validatorFactory.validator(ExternalSelectAuthDataPersist.ExternalSelectAuthDataPersistValidator.class))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class ExternalSelectSourceBindingPersist {
|
||||||
|
private String label;
|
||||||
|
public final static String _label = "label";
|
||||||
|
private String value;
|
||||||
|
public final static String _value = "value";
|
||||||
|
private String source;
|
||||||
|
public final static String _source = "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;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Component(ExternalSelectSourceBindingPersist.ExternalSelectSourceBindingPersistValidator.ValidatorName)
|
||||||
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public static class ExternalSelectSourceBindingPersistValidator extends BaseValidator<ExternalSelectSourceBindingPersist> {
|
||||||
|
|
||||||
|
public static final String ValidatorName = "DescriptionTemplate.ExternalSelectSourceBindingPersistValidator";
|
||||||
|
|
||||||
|
private final MessageSource messageSource;
|
||||||
|
|
||||||
|
protected ExternalSelectSourceBindingPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource) {
|
||||||
|
super(conventionService, errors);
|
||||||
|
this.messageSource = messageSource;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<ExternalSelectSourceBindingPersist> modelClass() {
|
||||||
|
return ExternalSelectSourceBindingPersist.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<Specification> specifications(ExternalSelectSourceBindingPersist item) {
|
||||||
|
return Arrays.asList(
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isNull(item.getLabel()))
|
||||||
|
.failOn(ExternalSelectSourceBindingPersist._label).failWith(messageSource.getMessage("Validation_Required", new Object[]{ExternalSelectSourceBindingPersist._label}, LocaleContextHolder.getLocale()))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class ExternalSelectAuthDataPersist {
|
||||||
|
private String url;
|
||||||
|
public final static String _url = "url";
|
||||||
|
private String method;
|
||||||
|
public final static String _method = "method";
|
||||||
|
private String body;
|
||||||
|
public final static String _body = "body";
|
||||||
|
private String path;
|
||||||
|
public final static String _path = "path";
|
||||||
|
private String type;
|
||||||
|
public final static String _type = "type";
|
||||||
|
|
||||||
|
public String getUrl() {
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUrl(String url) {
|
||||||
|
this.url = url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMethod() {
|
||||||
|
return method;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMethod(String method) {
|
||||||
|
this.method = method;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBody() {
|
||||||
|
return body;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBody(String body) {
|
||||||
|
this.body = body;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPath() {
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPath(String path) {
|
||||||
|
this.path = path;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(String type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Component(ExternalSelectAuthDataPersist.ExternalSelectAuthDataPersistValidator.ValidatorName)
|
||||||
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public static class ExternalSelectAuthDataPersistValidator extends BaseValidator<ExternalSelectAuthDataPersist> {
|
||||||
|
|
||||||
|
public static final String ValidatorName = "DescriptionTemplate.ExternalSelectAuthDataPersistValidator";
|
||||||
|
|
||||||
|
private final MessageSource messageSource;
|
||||||
|
|
||||||
|
protected ExternalSelectAuthDataPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource) {
|
||||||
|
super(conventionService, errors);
|
||||||
|
this.messageSource = messageSource;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<ExternalSelectAuthDataPersist> modelClass() {
|
||||||
|
return ExternalSelectAuthDataPersist.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<Specification> specifications(ExternalSelectAuthDataPersist item) {
|
||||||
|
return Arrays.asList(
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isNull(item.getUrl()))
|
||||||
|
.failOn(ExternalSelectAuthDataPersist._url).failWith(messageSource.getMessage("Validation_Required", new Object[]{ExternalSelectAuthDataPersist._url}, LocaleContextHolder.getLocale()))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -13,16 +13,16 @@ import java.util.List;
|
||||||
|
|
||||||
public class LabelAndMultiplicityDataPersist extends BaseFieldDataPersist {
|
public class LabelAndMultiplicityDataPersist extends BaseFieldDataPersist {
|
||||||
|
|
||||||
private Boolean multiAutoComplete;
|
private Boolean multipleSelect;
|
||||||
|
|
||||||
public static final String _multiAutoComplete = "multiAutoComplete";
|
public static final String _multipleSelect = "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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Component(LabelAndMultiplicityDataPersist.LabelAndMultiplicityDataPersistValidator.ValidatorName)
|
@Component(LabelAndMultiplicityDataPersist.LabelAndMultiplicityDataPersistValidator.ValidatorName)
|
||||||
|
@ -45,8 +45,8 @@ public class LabelAndMultiplicityDataPersist extends BaseFieldDataPersist {
|
||||||
List<Specification> specifications = getBaseSpecifications(item);
|
List<Specification> specifications = getBaseSpecifications(item);
|
||||||
specifications.add(
|
specifications.add(
|
||||||
this.spec()
|
this.spec()
|
||||||
.must(() -> !this.isNull(item.getMultiAutoComplete()))
|
.must(() -> !this.isNull(item.getMultipleSelect()))
|
||||||
.failOn(LabelAndMultiplicityDataPersist._multiAutoComplete).failWith(messageSource.getMessage("Validation_Required", new Object[]{LabelAndMultiplicityDataPersist._multiAutoComplete}, LocaleContextHolder.getLocale()))
|
.failOn(LabelAndMultiplicityDataPersist._multipleSelect).failWith(messageSource.getMessage("Validation_Required", new Object[]{LabelAndMultiplicityDataPersist._multipleSelect}, LocaleContextHolder.getLocale()))
|
||||||
);
|
);
|
||||||
return specifications;
|
return specifications;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
|
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
|
||||||
|
|
||||||
|
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;
|
||||||
import eu.eudat.convention.ConventionService;
|
import eu.eudat.convention.ConventionService;
|
||||||
|
@ -66,4 +67,62 @@ public class RadioBoxDataPersist extends BaseFieldDataPersist {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class RadioBoxOptionPersist {
|
||||||
|
|
||||||
|
private String label = null;
|
||||||
|
|
||||||
|
public static final String _label = "label";
|
||||||
|
|
||||||
|
private String value = null;
|
||||||
|
|
||||||
|
public static final String _value = "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;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Component(RadioBoxOptionPersistValidator.ValidatorName)
|
||||||
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public static class RadioBoxOptionPersistValidator extends BaseValidator<RadioBoxOptionPersist> {
|
||||||
|
|
||||||
|
public static final String ValidatorName = "DescriptionTemplate.RadioBoxOptionPersistValidator";
|
||||||
|
|
||||||
|
private final MessageSource messageSource;
|
||||||
|
|
||||||
|
protected RadioBoxOptionPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource) {
|
||||||
|
super(conventionService, errors);
|
||||||
|
this.messageSource = messageSource;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<RadioBoxOptionPersist> modelClass() {
|
||||||
|
return RadioBoxOptionPersist.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<Specification> specifications(RadioBoxOptionPersist item) {
|
||||||
|
return Arrays.asList(
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isEmpty(item.getLabel()))
|
||||||
|
.failOn(RadioBoxOptionPersist._label).failWith(messageSource.getMessage("Validation_Required", new Object[]{RadioBoxOptionPersist._label}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isEmpty(item.getValue()))
|
||||||
|
.failOn(RadioBoxOptionPersist._value).failWith(messageSource.getMessage("Validation_Required", new Object[]{RadioBoxOptionPersist._value}, LocaleContextHolder.getLocale()))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,73 +0,0 @@
|
||||||
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
|
|
||||||
|
|
||||||
import eu.eudat.commons.validation.BaseValidator;
|
|
||||||
import gr.cite.tools.validation.specification.Specification;
|
|
||||||
import eu.eudat.convention.ConventionService;
|
|
||||||
import eu.eudat.errorcode.ErrorThesaurusProperties;
|
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
|
||||||
import org.springframework.context.MessageSource;
|
|
||||||
import org.springframework.context.annotation.Scope;
|
|
||||||
import org.springframework.context.i18n.LocaleContextHolder;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class RadioBoxOptionPersist {
|
|
||||||
|
|
||||||
private String label = null;
|
|
||||||
|
|
||||||
public static final String _label = "label";
|
|
||||||
|
|
||||||
private String value = null;
|
|
||||||
|
|
||||||
public static final String _value = "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;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Component(RadioBoxOptionPersistValidator.ValidatorName)
|
|
||||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
|
||||||
public static class RadioBoxOptionPersistValidator extends BaseValidator<RadioBoxOptionPersist> {
|
|
||||||
|
|
||||||
public static final String ValidatorName = "DescriptionTemplate.RadioBoxOptionPersistValidator";
|
|
||||||
|
|
||||||
private final MessageSource messageSource;
|
|
||||||
|
|
||||||
protected RadioBoxOptionPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource) {
|
|
||||||
super(conventionService, errors);
|
|
||||||
this.messageSource = messageSource;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Class<RadioBoxOptionPersist> modelClass() {
|
|
||||||
return RadioBoxOptionPersist.class;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected List<Specification> specifications(RadioBoxOptionPersist item) {
|
|
||||||
return Arrays.asList(
|
|
||||||
this.spec()
|
|
||||||
.must(() -> !this.isEmpty(item.getLabel()))
|
|
||||||
.failOn(RadioBoxOptionPersist._label).failWith(messageSource.getMessage("Validation_Required", new Object[]{RadioBoxOptionPersist._label}, LocaleContextHolder.getLocale())),
|
|
||||||
this.spec()
|
|
||||||
.must(() -> !this.isEmpty(item.getValue()))
|
|
||||||
.failOn(RadioBoxOptionPersist._value).failWith(messageSource.getMessage("Validation_Required", new Object[]{RadioBoxOptionPersist._value}, LocaleContextHolder.getLocale()))
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -0,0 +1,141 @@
|
||||||
|
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
|
||||||
|
|
||||||
|
import eu.eudat.commons.validation.BaseValidator;
|
||||||
|
import gr.cite.tools.validation.ValidatorFactory;
|
||||||
|
import gr.cite.tools.validation.specification.Specification;
|
||||||
|
import eu.eudat.convention.ConventionService;
|
||||||
|
import eu.eudat.errorcode.ErrorThesaurusProperties;
|
||||||
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
|
import org.springframework.context.MessageSource;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.context.i18n.LocaleContextHolder;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class SelectDataPersist extends BaseFieldDataPersist {
|
||||||
|
|
||||||
|
private List<OptionPersist> options = null;
|
||||||
|
|
||||||
|
public static final String _options = "options";
|
||||||
|
|
||||||
|
|
||||||
|
private Boolean multipleSelect = null;
|
||||||
|
|
||||||
|
public static final String _multipleSelect = "multipleSelect";
|
||||||
|
|
||||||
|
public List<OptionPersist> getOptions() {
|
||||||
|
return options;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOptions(List<OptionPersist> options) {
|
||||||
|
this.options = options;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean getMultipleSelect() {
|
||||||
|
return multipleSelect;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMultipleSelect(Boolean multipleSelect) {
|
||||||
|
this.multipleSelect = multipleSelect;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Component(SelectDataPersistValidator.ValidatorName)
|
||||||
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public static class SelectDataPersistValidator extends BaseFieldDataPersistValidator<SelectDataPersist> {
|
||||||
|
|
||||||
|
public static final String ValidatorName = "DescriptionTemplate.SelectDataPersistValidator";
|
||||||
|
|
||||||
|
private final ValidatorFactory validatorFactory;
|
||||||
|
|
||||||
|
protected SelectDataPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource, ValidatorFactory validatorFactory) {
|
||||||
|
super(conventionService, errors, messageSource);
|
||||||
|
this.validatorFactory = validatorFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<SelectDataPersist> modelClass() {
|
||||||
|
return SelectDataPersist.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<Specification> specifications(SelectDataPersist item) {
|
||||||
|
List<Specification> specifications = getBaseSpecifications(item);
|
||||||
|
specifications.addAll(Arrays.asList(
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isNull(item.getMultipleSelect()))
|
||||||
|
.failOn(SelectDataPersist._multipleSelect).failWith(messageSource.getMessage("Validation_Required", new Object[]{SelectDataPersist._multipleSelect}, LocaleContextHolder.getLocale())),
|
||||||
|
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isNull(item.getOptions()))
|
||||||
|
.failOn(SelectDataPersist._options).failWith(messageSource.getMessage("Validation_Required", new Object[]{SelectDataPersist._options}, LocaleContextHolder.getLocale())),
|
||||||
|
this.navSpec()
|
||||||
|
.iff(() -> !this.isNull(item.getOptions()))
|
||||||
|
.on(SelectDataPersist._options)
|
||||||
|
.over(item.getOptions())
|
||||||
|
.using((itm) -> this.validatorFactory.validator(OptionPersist.ComboBoxOptionPersistValidator.class))
|
||||||
|
));
|
||||||
|
return specifications;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class OptionPersist {
|
||||||
|
|
||||||
|
private String label = null;
|
||||||
|
|
||||||
|
public static final String _label = "label";
|
||||||
|
|
||||||
|
private String value = null;
|
||||||
|
|
||||||
|
public static final String _value = "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;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Component(ComboBoxOptionPersistValidator.ValidatorName)
|
||||||
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public static class ComboBoxOptionPersistValidator extends BaseValidator<OptionPersist> {
|
||||||
|
|
||||||
|
public static final String ValidatorName = "DescriptionTemplate.ComboBoxOptionPersistValidator";
|
||||||
|
|
||||||
|
private final MessageSource messageSource;
|
||||||
|
|
||||||
|
protected ComboBoxOptionPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource) {
|
||||||
|
super(conventionService, errors);
|
||||||
|
this.messageSource = messageSource;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<OptionPersist> modelClass() {
|
||||||
|
return OptionPersist.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<Specification> specifications(OptionPersist item) {
|
||||||
|
return Arrays.asList(
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isEmpty(item.getLabel()))
|
||||||
|
.failOn(OptionPersist._label).failWith(messageSource.getMessage("Validation_Required", new Object[]{OptionPersist._label}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isEmpty(item.getValue()))
|
||||||
|
.failOn(OptionPersist._value).failWith(messageSource.getMessage("Validation_Required", new Object[]{OptionPersist._value}, LocaleContextHolder.getLocale()))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,5 +1,6 @@
|
||||||
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
|
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
|
||||||
|
|
||||||
|
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;
|
||||||
import eu.eudat.convention.ConventionService;
|
import eu.eudat.convention.ConventionService;
|
||||||
|
@ -79,5 +80,63 @@ public class UploadDataPersist extends BaseFieldDataPersist {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class UploadOptionPersist {
|
||||||
|
|
||||||
|
private String label = null;
|
||||||
|
|
||||||
|
public static final String _label = "label";
|
||||||
|
|
||||||
|
private String value = null;
|
||||||
|
|
||||||
|
public static final String _value = "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;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Component(UploadOptionPersistValidator.ValidatorName)
|
||||||
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public static class UploadOptionPersistValidator extends BaseValidator<UploadOptionPersist> {
|
||||||
|
|
||||||
|
public static final String ValidatorName = "DescriptionTemplate.UploadOptionPersistValidator";
|
||||||
|
|
||||||
|
private final MessageSource messageSource;
|
||||||
|
|
||||||
|
protected UploadOptionPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource) {
|
||||||
|
super(conventionService, errors);
|
||||||
|
this.messageSource = messageSource;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<UploadOptionPersist> modelClass() {
|
||||||
|
return UploadOptionPersist.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<Specification> specifications(UploadOptionPersist item) {
|
||||||
|
return Arrays.asList(
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isEmpty(item.getLabel()))
|
||||||
|
.failOn(UploadOptionPersist._label).failWith(messageSource.getMessage("Validation_Required", new Object[]{UploadOptionPersist._label}, LocaleContextHolder.getLocale())),
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isEmpty(item.getValue()))
|
||||||
|
.failOn(UploadOptionPersist._value).failWith(messageSource.getMessage("Validation_Required", new Object[]{UploadOptionPersist._value}, LocaleContextHolder.getLocale()))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,73 +0,0 @@
|
||||||
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
|
|
||||||
|
|
||||||
import eu.eudat.commons.validation.BaseValidator;
|
|
||||||
import gr.cite.tools.validation.specification.Specification;
|
|
||||||
import eu.eudat.convention.ConventionService;
|
|
||||||
import eu.eudat.errorcode.ErrorThesaurusProperties;
|
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
|
||||||
import org.springframework.context.MessageSource;
|
|
||||||
import org.springframework.context.annotation.Scope;
|
|
||||||
import org.springframework.context.i18n.LocaleContextHolder;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class UploadOptionPersist {
|
|
||||||
|
|
||||||
private String label = null;
|
|
||||||
|
|
||||||
public static final String _label = "label";
|
|
||||||
|
|
||||||
private String value = null;
|
|
||||||
|
|
||||||
public static final String _value = "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;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Component(UploadOptionPersistValidator.ValidatorName)
|
|
||||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
|
||||||
public static class UploadOptionPersistValidator extends BaseValidator<UploadOptionPersist> {
|
|
||||||
|
|
||||||
public static final String ValidatorName = "DescriptionTemplate.UploadOptionPersistValidator";
|
|
||||||
|
|
||||||
private final MessageSource messageSource;
|
|
||||||
|
|
||||||
protected UploadOptionPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource) {
|
|
||||||
super(conventionService, errors);
|
|
||||||
this.messageSource = messageSource;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Class<UploadOptionPersist> modelClass() {
|
|
||||||
return UploadOptionPersist.class;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected List<Specification> specifications(UploadOptionPersist item) {
|
|
||||||
return Arrays.asList(
|
|
||||||
this.spec()
|
|
||||||
.must(() -> !this.isEmpty(item.getLabel()))
|
|
||||||
.failOn(UploadOptionPersist._label).failWith(messageSource.getMessage("Validation_Required", new Object[]{UploadOptionPersist._label}, LocaleContextHolder.getLocale())),
|
|
||||||
this.spec()
|
|
||||||
.must(() -> !this.isEmpty(item.getValue()))
|
|
||||||
.failOn(UploadOptionPersist._value).failWith(messageSource.getMessage("Validation_Required", new Object[]{UploadOptionPersist._value}, LocaleContextHolder.getLocale()))
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,81 +0,0 @@
|
||||||
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
|
|
||||||
|
|
||||||
import gr.cite.tools.validation.ValidatorFactory;
|
|
||||||
import gr.cite.tools.validation.specification.Specification;
|
|
||||||
import eu.eudat.convention.ConventionService;
|
|
||||||
import eu.eudat.errorcode.ErrorThesaurusProperties;
|
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
|
||||||
import org.springframework.context.MessageSource;
|
|
||||||
import org.springframework.context.annotation.Scope;
|
|
||||||
import org.springframework.context.i18n.LocaleContextHolder;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class WordListDataPersist extends BaseFieldDataPersist {
|
|
||||||
|
|
||||||
private List<ComboBoxOptionPersist> options = null;
|
|
||||||
|
|
||||||
public static final String _options = "options";
|
|
||||||
|
|
||||||
private Boolean multiList = null;
|
|
||||||
|
|
||||||
public static final String _multiList = "multiList";
|
|
||||||
|
|
||||||
public List<ComboBoxOptionPersist> getOptions() {
|
|
||||||
return options;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOptions(List<ComboBoxOptionPersist> options) {
|
|
||||||
this.options = options;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Boolean getMultiList() {
|
|
||||||
return multiList;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMultiList(Boolean multiList) {
|
|
||||||
this.multiList = multiList;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Component(WordListDataPersistValidator.ValidatorName)
|
|
||||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
|
||||||
public static class WordListDataPersistValidator extends BaseFieldDataPersistValidator<WordListDataPersist> {
|
|
||||||
|
|
||||||
public static final String ValidatorName = "DescriptionTemplate.WordListDataPersistValidator";
|
|
||||||
|
|
||||||
private final ValidatorFactory validatorFactory;
|
|
||||||
|
|
||||||
protected WordListDataPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource, ValidatorFactory validatorFactory) {
|
|
||||||
super(conventionService, errors, messageSource);
|
|
||||||
this.validatorFactory = validatorFactory;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Class<WordListDataPersist> modelClass() {
|
|
||||||
return WordListDataPersist.class;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected List<Specification> specifications(WordListDataPersist item) {
|
|
||||||
List<Specification> specifications = getBaseSpecifications(item);
|
|
||||||
specifications.addAll(Arrays.asList(
|
|
||||||
this.spec()
|
|
||||||
.must(() -> !this.isNull(item.getMultiList()))
|
|
||||||
.failOn(WordListDataPersist._multiList).failWith(messageSource.getMessage("Validation_Required", new Object[]{WordListDataPersist._multiList}, LocaleContextHolder.getLocale())),
|
|
||||||
|
|
||||||
this.spec()
|
|
||||||
.must(() -> !this.isNull(item.getOptions()))
|
|
||||||
.failOn(WordListDataPersist._options).failWith(messageSource.getMessage("Validation_Required", new Object[]{WordListDataPersist._options}, LocaleContextHolder.getLocale())),
|
|
||||||
this.navSpec()
|
|
||||||
.iff(() -> !this.isNull(item.getOptions()))
|
|
||||||
.on(WordListDataPersist._options)
|
|
||||||
.over(item.getOptions())
|
|
||||||
.using((itm) -> this.validatorFactory.validator(ComboBoxOptionPersist.ComboBoxOptionPersistValidator.class))
|
|
||||||
));
|
|
||||||
return specifications;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -57,7 +57,7 @@ public class DefinitionPersist {
|
||||||
return Arrays.asList(
|
return Arrays.asList(
|
||||||
this.spec()
|
this.spec()
|
||||||
.must(() -> !this.isListNullOrEmpty(item.getSections()))
|
.must(() -> !this.isListNullOrEmpty(item.getSections()))
|
||||||
.failOn(DefinitionPersist._sections).failWith(messageSource.getMessage("Validation_Required", new Object[]{eu.eudat.model.persist.descriptiontemplatedefinition.DefinitionPersist._sections}, LocaleContextHolder.getLocale())),
|
.failOn(DefinitionPersist._sections).failWith(messageSource.getMessage("Validation_Required", new Object[]{DefinitionPersist._sections}, LocaleContextHolder.getLocale())),
|
||||||
this.navSpec()
|
this.navSpec()
|
||||||
.iff(() -> !this.isListNullOrEmpty(item.getSections()))
|
.iff(() -> !this.isListNullOrEmpty(item.getSections()))
|
||||||
.on(DefinitionPersist._sections)
|
.on(DefinitionPersist._sections)
|
||||||
|
|
|
@ -306,12 +306,7 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
|
||||||
DefinitionEntity data = new DefinitionEntity();
|
DefinitionEntity data = new DefinitionEntity();
|
||||||
if (persist == null)
|
if (persist == null)
|
||||||
return data;
|
return data;
|
||||||
if (!this.conventionService.isListNullOrEmpty(persist.getSections())) {
|
|
||||||
data.setSections(new ArrayList<>());
|
|
||||||
for (SectionPersist sectionPersist : persist.getSections()) {
|
|
||||||
data.getSections().add(this.buildSectionEntity(sectionPersist));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!this.conventionService.isListNullOrEmpty(persist.getPages())) {
|
if (!this.conventionService.isListNullOrEmpty(persist.getPages())) {
|
||||||
data.setPages(new ArrayList<>());
|
data.setPages(new ArrayList<>());
|
||||||
for (PagePersist pagePersist : persist.getPages()) {
|
for (PagePersist pagePersist : persist.getPages()) {
|
||||||
|
@ -332,7 +327,6 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
|
||||||
data.setOrdinal(persist.getOrdinal());
|
data.setOrdinal(persist.getOrdinal());
|
||||||
data.setDefaultVisibility(persist.getDefaultVisibility());
|
data.setDefaultVisibility(persist.getDefaultVisibility());
|
||||||
data.setMultiplicity(persist.getMultiplicity());
|
data.setMultiplicity(persist.getMultiplicity());
|
||||||
data.setPage(persist.getPage());
|
|
||||||
data.setTitle(persist.getTitle());
|
data.setTitle(persist.getTitle());
|
||||||
|
|
||||||
if (!this.conventionService.isListNullOrEmpty(persist.getSections())) {
|
if (!this.conventionService.isListNullOrEmpty(persist.getSections())) {
|
||||||
|
@ -402,7 +396,7 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
private BaseFieldDataEntity<?> buildFieldDataEntity(BaseFieldDataPersist persist) {
|
private BaseFieldDataEntity buildFieldDataEntity(BaseFieldDataPersist persist) {
|
||||||
if (persist == null)
|
if (persist == null)
|
||||||
return null;
|
return null;
|
||||||
return this.fieldDataHelperServiceProvider.get(persist.getFieldType()).applyPersist(persist);
|
return this.fieldDataHelperServiceProvider.get(persist.getFieldType()).applyPersist(persist);
|
||||||
|
@ -442,6 +436,13 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
|
||||||
data.setId(persist.getId());
|
data.setId(persist.getId());
|
||||||
data.setOrdinal(persist.getOrdinal());
|
data.setOrdinal(persist.getOrdinal());
|
||||||
data.setTitle(persist.getTitle());
|
data.setTitle(persist.getTitle());
|
||||||
|
|
||||||
|
if (!this.conventionService.isListNullOrEmpty(persist.getSections())) {
|
||||||
|
data.setSections(new ArrayList<>());
|
||||||
|
for (SectionPersist sectionPersist : persist.getSections()) {
|
||||||
|
data.getSections().add(this.buildSectionEntity(sectionPersist));
|
||||||
|
}
|
||||||
|
}
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -484,12 +485,6 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
|
||||||
if (model == null)
|
if (model == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (model.getSections() != null) {
|
|
||||||
for (Section section : model.getSections()) {
|
|
||||||
this.reassignSection(section);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (model.getPages() != null) {
|
if (model.getPages() != null) {
|
||||||
for (Page page : model.getPages()) {
|
for (Page page : model.getPages()) {
|
||||||
this.reassignPage(page);
|
this.reassignPage(page);
|
||||||
|
@ -501,6 +496,13 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
|
||||||
if (model == null)
|
if (model == null)
|
||||||
return;
|
return;
|
||||||
model.setId(UUID.randomUUID().toString());
|
model.setId(UUID.randomUUID().toString());
|
||||||
|
|
||||||
|
if (model.getSections() != null) {
|
||||||
|
for (Section section : model.getSections()) {
|
||||||
|
this.reassignSection(section);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void reassignSection(Section model) {
|
private void reassignSection(Section model) {
|
||||||
|
@ -632,19 +634,12 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
List<PagePersist> pagesDatasetEntity = new LinkedList<>();
|
List<PagePersist> pagesDatasetEntity = new LinkedList<>();
|
||||||
List<SectionPersist> sectionDatasetEntity = new LinkedList<>();
|
|
||||||
if (!this.conventionService.isListNullOrEmpty(importExport.getPages())) {
|
if (!this.conventionService.isListNullOrEmpty(importExport.getPages())) {
|
||||||
for (PageImportExport xmlPage : importExport.getPages()) {
|
for (PageImportExport xmlPage : importExport.getPages()) {
|
||||||
pagesDatasetEntity.add(this.xmlPageToPersist(xmlPage));
|
pagesDatasetEntity.add(this.xmlPageToPersist(xmlPage));
|
||||||
if (!this.conventionService.isListNullOrEmpty(xmlPage.getSections())) {
|
|
||||||
for (int i = 0; i < xmlPage.getSections().size(); i++) {
|
|
||||||
sectionDatasetEntity.add(this.xmlSectionToPersist(xmlPage.getSections().get(i)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
definitionPersist.setPages(pagesDatasetEntity);
|
definitionPersist.setPages(pagesDatasetEntity);
|
||||||
definitionPersist.setSections(sectionDatasetEntity);
|
|
||||||
|
|
||||||
return definitionPersist;
|
return definitionPersist;
|
||||||
}
|
}
|
||||||
|
@ -654,6 +649,14 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
|
||||||
pageEntity.setId(importExport.getId());
|
pageEntity.setId(importExport.getId());
|
||||||
pageEntity.setOrdinal(importExport.getOrdinal());
|
pageEntity.setOrdinal(importExport.getOrdinal());
|
||||||
pageEntity.setTitle(importExport.getTitle());
|
pageEntity.setTitle(importExport.getTitle());
|
||||||
|
if (!this.conventionService.isListNullOrEmpty(importExport.getSections())) {
|
||||||
|
List<SectionPersist> sectionsListEntity = new LinkedList<>();
|
||||||
|
for (SectionImportExport xmlSection : importExport.getSections()) {
|
||||||
|
sectionsListEntity.add(this.xmlSectionToPersist(xmlSection));
|
||||||
|
}
|
||||||
|
pageEntity.setSections(sectionsListEntity);
|
||||||
|
|
||||||
|
}
|
||||||
return pageEntity;
|
return pageEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -669,7 +672,6 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
|
||||||
sectionEntity.setId(importExport.getId());
|
sectionEntity.setId(importExport.getId());
|
||||||
sectionEntity.setOrdinal(importExport.getOrdinal());
|
sectionEntity.setOrdinal(importExport.getOrdinal());
|
||||||
sectionEntity.setTitle(importExport.getTitle());
|
sectionEntity.setTitle(importExport.getTitle());
|
||||||
sectionEntity.setPage(importExport.getPage());
|
|
||||||
sectionEntity.setDescription(importExport.getDescription());
|
sectionEntity.setDescription(importExport.getDescription());
|
||||||
List<FieldSetPersist> fieldSetEntity = new LinkedList<>();
|
List<FieldSetPersist> fieldSetEntity = new LinkedList<>();
|
||||||
if (!this.conventionService.isListNullOrEmpty(importExport.getFieldSets())) {
|
if (!this.conventionService.isListNullOrEmpty(importExport.getFieldSets())) {
|
||||||
|
@ -688,7 +690,7 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
|
||||||
FieldSetPersist fieldSet1Entity = new FieldSetPersist();
|
FieldSetPersist fieldSet1Entity = new FieldSetPersist();
|
||||||
fieldSet1Entity.setId(importExport.getId());
|
fieldSet1Entity.setId(importExport.getId());
|
||||||
fieldSet1Entity.setOrdinal(importExport.getOrdinal());
|
fieldSet1Entity.setOrdinal(importExport.getOrdinal());
|
||||||
fieldSet1Entity.setHasCommentField(importExport.getCommentField() != null ? importExport.getCommentField() : false);
|
fieldSet1Entity.setHasCommentField(importExport.getHasCommentField() != null ? importExport.getHasCommentField() : false);
|
||||||
fieldSet1Entity.setMultiplicity(importExport.getMultiplicity() != null ? this.xmlMultiplicityToPersist(importExport.getMultiplicity()) : null);
|
fieldSet1Entity.setMultiplicity(importExport.getMultiplicity() != null ? this.xmlMultiplicityToPersist(importExport.getMultiplicity()) : null);
|
||||||
fieldSet1Entity.setTitle(importExport.getTitle());
|
fieldSet1Entity.setTitle(importExport.getTitle());
|
||||||
fieldSet1Entity.setDescription(importExport.getDescription());
|
fieldSet1Entity.setDescription(importExport.getDescription());
|
||||||
|
@ -735,7 +737,7 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
|
||||||
return ruleEntity;
|
return ruleEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MultiplicityPersist xmlMultiplicityToPersist(MultiplicityImportXml importXml) {
|
public MultiplicityPersist xmlMultiplicityToPersist(MultiplicityImportExport importXml) {
|
||||||
MultiplicityPersist multiplicityEntity = new MultiplicityPersist();
|
MultiplicityPersist multiplicityEntity = new MultiplicityPersist();
|
||||||
multiplicityEntity.setMax(importXml.getMax());
|
multiplicityEntity.setMax(importXml.getMax());
|
||||||
multiplicityEntity.setMin(importXml.getMin());
|
multiplicityEntity.setMin(importXml.getMin());
|
||||||
|
@ -769,24 +771,22 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
|
||||||
xml.setDescription(data.getDescription());
|
xml.setDescription(data.getDescription());
|
||||||
List<PageImportExport> pagesDatasetEntity = new LinkedList<>();
|
List<PageImportExport> pagesDatasetEntity = new LinkedList<>();
|
||||||
for (PageEntity xmlPage : entity.getPages()) {
|
for (PageEntity xmlPage : entity.getPages()) {
|
||||||
pagesDatasetEntity.add(this.pageXmlToExport(xmlPage, entity.getSections()));
|
pagesDatasetEntity.add(this.pageXmlToExport(xmlPage));
|
||||||
}
|
}
|
||||||
xml.setPages(pagesDatasetEntity);
|
xml.setPages(pagesDatasetEntity);
|
||||||
|
|
||||||
return xml;
|
return xml;
|
||||||
}
|
}
|
||||||
|
|
||||||
private PageImportExport pageXmlToExport(PageEntity entity, List<SectionEntity> sectionEntities) {
|
private PageImportExport pageXmlToExport(PageEntity entity) {
|
||||||
PageImportExport xml = new PageImportExport();
|
PageImportExport xml = new PageImportExport();
|
||||||
xml.setId(entity.getId());
|
xml.setId(entity.getId());
|
||||||
xml.setOrdinal(entity.getOrdinal());
|
xml.setOrdinal(entity.getOrdinal());
|
||||||
xml.setTitle(entity.getTitle());
|
xml.setTitle(entity.getTitle());
|
||||||
List<SectionImportExport> sectionsListEntity = new LinkedList<>();
|
List<SectionImportExport> sectionsListEntity = new LinkedList<>();
|
||||||
if (!this.conventionService.isListNullOrEmpty(sectionEntities)) {
|
if (!this.conventionService.isListNullOrEmpty(entity.getSections())) {
|
||||||
for (SectionEntity section : sectionEntities) {
|
for (SectionEntity section : entity.getSections()) {
|
||||||
if (section.getPage().equals(entity.getId())) {
|
sectionsListEntity.add(this.sectionXmlToExport(section));
|
||||||
sectionsListEntity.add(this.sectionXmlToExport(section));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
xml.setSections(sectionsListEntity);
|
xml.setSections(sectionsListEntity);
|
||||||
|
@ -808,7 +808,6 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
|
||||||
xml.setId(entity.getId());
|
xml.setId(entity.getId());
|
||||||
xml.setOrdinal(entity.getOrdinal());
|
xml.setOrdinal(entity.getOrdinal());
|
||||||
xml.setTitle(entity.getTitle());
|
xml.setTitle(entity.getTitle());
|
||||||
xml.setPage(entity.getPage());
|
|
||||||
xml.setDescription(entity.getDescription());
|
xml.setDescription(entity.getDescription());
|
||||||
List<FieldSetImportExport> fieldSetEntity = new LinkedList<>();
|
List<FieldSetImportExport> fieldSetEntity = new LinkedList<>();
|
||||||
if (!this.conventionService.isListNullOrEmpty(entity.getFieldSets())) {
|
if (!this.conventionService.isListNullOrEmpty(entity.getFieldSets())) {
|
||||||
|
@ -826,7 +825,7 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
|
||||||
FieldSetImportExport fieldSet1Entity = new FieldSetImportExport();
|
FieldSetImportExport fieldSet1Entity = new FieldSetImportExport();
|
||||||
fieldSet1Entity.setId(entity.getId());
|
fieldSet1Entity.setId(entity.getId());
|
||||||
fieldSet1Entity.setOrdinal(entity.getOrdinal());
|
fieldSet1Entity.setOrdinal(entity.getOrdinal());
|
||||||
fieldSet1Entity.setCommentField(entity.getHasCommentField());
|
fieldSet1Entity.setHasCommentField(entity.getHasCommentField());
|
||||||
fieldSet1Entity.setMultiplicity(entity.getMultiplicity() != null ? this.multiplicityXmlToExport(entity.getMultiplicity()) : null);
|
fieldSet1Entity.setMultiplicity(entity.getMultiplicity() != null ? this.multiplicityXmlToExport(entity.getMultiplicity()) : null);
|
||||||
fieldSet1Entity.setTitle(entity.getTitle());
|
fieldSet1Entity.setTitle(entity.getTitle());
|
||||||
fieldSet1Entity.setDescription(entity.getDescription());
|
fieldSet1Entity.setDescription(entity.getDescription());
|
||||||
|
@ -873,8 +872,8 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
|
||||||
return xml;
|
return xml;
|
||||||
}
|
}
|
||||||
|
|
||||||
private MultiplicityImportXml multiplicityXmlToExport(MultiplicityEntity entity) {
|
private MultiplicityImportExport multiplicityXmlToExport(MultiplicityEntity entity) {
|
||||||
MultiplicityImportXml xml = new MultiplicityImportXml();
|
MultiplicityImportExport xml = new MultiplicityImportExport();
|
||||||
xml.setMax(entity.getMax());
|
xml.setMax(entity.getMax());
|
||||||
xml.setMin(entity.getMin());
|
xml.setMin(entity.getMin());
|
||||||
xml.setPlaceholder(entity.getPlaceholder());
|
xml.setPlaceholder(entity.getPlaceholder());
|
||||||
|
|
|
@ -1,243 +0,0 @@
|
||||||
package eu.eudat.service.fielddatahelper;
|
|
||||||
|
|
||||||
import eu.eudat.authorization.AuthorizationFlags;
|
|
||||||
import eu.eudat.commons.types.descriptiontemplate.fielddata.AutoCompleteDataEntity;
|
|
||||||
import eu.eudat.commons.types.descriptiontemplate.fielddata.ComboBoxDataEntity;
|
|
||||||
import eu.eudat.commons.types.descriptiontemplate.importexport.fielddata.*;
|
|
||||||
import eu.eudat.convention.ConventionService;
|
|
||||||
import eu.eudat.model.builder.descriptiontemplatedefinition.fielddata.AutoCompleteDataBuilder;
|
|
||||||
import eu.eudat.model.descriptiontemplatedefinition.fielddata.AutoCompleteData;
|
|
||||||
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.*;
|
|
||||||
import gr.cite.tools.data.builder.BuilderFactory;
|
|
||||||
import gr.cite.tools.fieldset.FieldSet;
|
|
||||||
import gr.cite.tools.validation.Validator;
|
|
||||||
import gr.cite.tools.validation.ValidatorFactory;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.EnumSet;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Component
|
|
||||||
public class AutoCompleteFieldDataHelperService extends BaseFieldDataHelperService<AutoCompleteData, AutoCompleteDataPersist, AutoCompleteDataEntity, AutoCompleteDataImportExport> {
|
|
||||||
private final ConventionService conventionService;
|
|
||||||
private final BuilderFactory builderFactory;
|
|
||||||
private final ValidatorFactory validatorFactory;
|
|
||||||
|
|
||||||
public AutoCompleteFieldDataHelperService(ConventionService conventionService, BuilderFactory builderFactory, ValidatorFactory validatorFactory) {
|
|
||||||
this.conventionService = conventionService;
|
|
||||||
this.builderFactory = builderFactory;
|
|
||||||
this.validatorFactory = validatorFactory;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public AutoCompleteDataEntity newDataInstanceInternal() {
|
|
||||||
return new AutoCompleteDataEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public AutoCompleteData newModelInstanceInternal() {
|
|
||||||
return new AutoCompleteData();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public AutoCompleteDataPersist newPersistModelInstanceInternal() {
|
|
||||||
return new AutoCompleteDataPersist();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected AutoCompleteDataImportExport newImportExportInstanceInternal() {
|
|
||||||
return new AutoCompleteDataImportExport();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Class<?> getDataClass() {
|
|
||||||
return AutoCompleteDataEntity.class;
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public Class<?> getModelClass() {
|
|
||||||
return AutoCompleteData.class;
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public Class<?> getPersistModelClass() {
|
|
||||||
return AutoCompleteDataPersist.class;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Class<?> getImportExportClass() {
|
|
||||||
return AutoCompleteDataImportExport.class;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Validator getPersistModelValidator() {
|
|
||||||
return this.validatorFactory.validator(AutoCompleteDataPersist.AutoCompleteDataPersistValidator.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<AutoCompleteData> buildInternal(FieldSet fieldSet, List<AutoCompleteDataEntity> data, EnumSet<AuthorizationFlags> authorizationFlags){
|
|
||||||
return this.builderFactory.builder(AutoCompleteDataBuilder.class).authorize(authorizationFlags).build(fieldSet, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected AutoCompleteDataEntity applyPersistInternal(AutoCompleteDataPersist persist, AutoCompleteDataEntity data) {
|
|
||||||
data.setMultiAutoComplete(persist.getMultiAutoComplete());
|
|
||||||
if (!this.conventionService.isListNullOrEmpty(persist.getAutoCompleteSingleDataList())){
|
|
||||||
data.setAutoCompleteSingleDataList(new ArrayList<>());
|
|
||||||
for (AutoCompleteSingleDataPersist autoCompleteSingleDataPersist: persist.getAutoCompleteSingleDataList()) {
|
|
||||||
data.getAutoCompleteSingleDataList().add(this.buildAutoCompleteSingleData(autoCompleteSingleDataPersist));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
private @NotNull AutoCompleteDataEntity.AutoCompleteSingleData buildAutoCompleteSingleData(AutoCompleteSingleDataPersist persist){
|
|
||||||
AutoCompleteDataEntity.AutoCompleteSingleData data = new AutoCompleteDataEntity.AutoCompleteSingleData();
|
|
||||||
if (persist == null) return data;
|
|
||||||
|
|
||||||
data.setUrl(persist.getUrl());
|
|
||||||
data.setAutocompleteType(persist.getAutocompleteType());
|
|
||||||
data.setOptionsRoot(persist.getOptionsRoot());
|
|
||||||
data.setHasAuth(persist.getHasAuth());
|
|
||||||
if(persist.getAutoCompleteOptions() != null) data.setAutoCompleteOptions(this.buildOption(persist.getAutoCompleteOptions()));
|
|
||||||
if(persist.getAuth() != null) data.setAuth(this.buildAuthAutoCompleteData(persist.getAuth()));
|
|
||||||
data.setMethod(persist.getMethod());
|
|
||||||
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
private @NotNull ComboBoxDataEntity.Option buildOption(ComboBoxOptionPersist persist){
|
|
||||||
ComboBoxDataEntity.Option data = new ComboBoxDataEntity.Option();
|
|
||||||
if (persist == null) return data;
|
|
||||||
|
|
||||||
data.setLabel(persist.getLabel());
|
|
||||||
data.setValue(persist.getValue());
|
|
||||||
data.setUri(persist.getUri());
|
|
||||||
data.setSource(persist.getSource());
|
|
||||||
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
private @NotNull AutoCompleteDataEntity.AuthAutoCompleteData buildAuthAutoCompleteData(AuthAutoCompleteDataPersist persist){
|
|
||||||
AutoCompleteDataEntity.AuthAutoCompleteData data = new AutoCompleteDataEntity.AuthAutoCompleteData();
|
|
||||||
if (persist == null) return data;
|
|
||||||
|
|
||||||
data.setBody(persist.getBody());
|
|
||||||
data.setUrl(persist.getUrl());
|
|
||||||
data.setMethod(persist.getMethod());
|
|
||||||
data.setPath(persist.getPath());
|
|
||||||
data.setType(persist.getType());
|
|
||||||
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected AutoCompleteDataPersist importExportMapDataToPersistInternal(AutoCompleteDataImportExport data, AutoCompleteDataPersist persist) {
|
|
||||||
persist.setMultiAutoComplete(data.getMultiAutoComplete());
|
|
||||||
if (!this.conventionService.isListNullOrEmpty(data.getAutoCompleteSingleDataList())){
|
|
||||||
persist.setAutoCompleteSingleDataList(new ArrayList<>());
|
|
||||||
for (AutoCompleteSingleData autoCompleteSingleData: data.getAutoCompleteSingleDataList()) {
|
|
||||||
persist.getAutoCompleteSingleDataList().add(this.buildAutoCompleteSingleData(autoCompleteSingleData));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return persist;
|
|
||||||
}
|
|
||||||
|
|
||||||
private @NotNull AutoCompleteSingleDataPersist buildAutoCompleteSingleData(AutoCompleteSingleData data){
|
|
||||||
AutoCompleteSingleDataPersist persist = new AutoCompleteSingleDataPersist();
|
|
||||||
if (data == null) return persist;
|
|
||||||
|
|
||||||
persist.setUrl(data.getUrl());
|
|
||||||
persist.setAutocompleteType(data.getAutocompleteType());
|
|
||||||
persist.setOptionsRoot(data.getOptionsRoot());
|
|
||||||
persist.setHasAuth(data.getHasAuth());
|
|
||||||
if(data.getAutoCompleteOptions() != null) persist.setAutoCompleteOptions(this.buildOption(data.getAutoCompleteOptions()));
|
|
||||||
if(data.getAuth() != null) persist.setAuth(this.buildAuthAutoCompleteData(data.getAuth()));
|
|
||||||
persist.setMethod(data.getMethod());
|
|
||||||
|
|
||||||
return persist;
|
|
||||||
}
|
|
||||||
|
|
||||||
private @NotNull ComboBoxOptionPersist buildOption(ComboBoxDataOptionEntity data){
|
|
||||||
ComboBoxOptionPersist persist = new ComboBoxOptionPersist();
|
|
||||||
if (data == null) return persist;
|
|
||||||
|
|
||||||
persist.setLabel(data.getLabel());
|
|
||||||
persist.setValue(data.getValue());
|
|
||||||
persist.setUri(data.getUri());
|
|
||||||
persist.setSource(data.getSource());
|
|
||||||
|
|
||||||
return persist;
|
|
||||||
}
|
|
||||||
|
|
||||||
private @NotNull AuthAutoCompleteDataPersist buildAuthAutoCompleteData(AuthAutoCompleteData data){
|
|
||||||
AuthAutoCompleteDataPersist persist = new AuthAutoCompleteDataPersist();
|
|
||||||
if (data == null) return persist;
|
|
||||||
|
|
||||||
persist.setBody(data.getBody());
|
|
||||||
persist.setUrl(data.getUrl());
|
|
||||||
persist.setMethod(data.getMethod());
|
|
||||||
persist.setPath(data.getPath());
|
|
||||||
persist.setType(data.getType());
|
|
||||||
|
|
||||||
return persist;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected AutoCompleteDataImportExport dataToImportExportXmlInternal(AutoCompleteDataEntity data, AutoCompleteDataImportExport xml) {
|
|
||||||
xml.setMultiAutoComplete(data.getMultiAutoComplete());
|
|
||||||
if (!this.conventionService.isListNullOrEmpty(data.getAutoCompleteSingleDataList())){
|
|
||||||
xml.setAutoCompleteSingleDataList(new ArrayList<>());
|
|
||||||
for (AutoCompleteDataEntity.AutoCompleteSingleData autoCompleteSingleData: data.getAutoCompleteSingleDataList()) {
|
|
||||||
xml.getAutoCompleteSingleDataList().add(this.buildAutoCompleteSingleData(autoCompleteSingleData));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return xml;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean isMultiValueInternal(AutoCompleteDataEntity data) {
|
|
||||||
return data.getMultiAutoComplete();
|
|
||||||
}
|
|
||||||
|
|
||||||
private @NotNull AutoCompleteSingleData buildAutoCompleteSingleData(AutoCompleteDataEntity.AutoCompleteSingleData data){
|
|
||||||
AutoCompleteSingleData xml = new AutoCompleteSingleData();
|
|
||||||
if (data == null) return xml;
|
|
||||||
|
|
||||||
xml.setUrl(data.getUrl());
|
|
||||||
xml.setAutocompleteType(data.getAutocompleteType());
|
|
||||||
xml.setOptionsRoot(data.getOptionsRoot());
|
|
||||||
xml.setHasAuth(data.getHasAuth());
|
|
||||||
if(data.getAutoCompleteOptions() != null) xml.setAutoCompleteOptions(this.buildOption(data.getAutoCompleteOptions()));
|
|
||||||
if(data.getAuth() != null) xml.setAuth(this.buildAuthAutoCompleteData(data.getAuth()));
|
|
||||||
xml.setMethod(data.getMethod());
|
|
||||||
|
|
||||||
return xml;
|
|
||||||
}
|
|
||||||
|
|
||||||
private @NotNull ComboBoxDataOptionEntity buildOption(ComboBoxDataEntity.Option data){
|
|
||||||
ComboBoxDataOptionEntity xml = new ComboBoxDataOptionEntity();
|
|
||||||
if (data == null) return xml;
|
|
||||||
|
|
||||||
xml.setLabel(data.getLabel());
|
|
||||||
xml.setValue(data.getValue());
|
|
||||||
xml.setUri(data.getUri());
|
|
||||||
xml.setSource(data.getSource());
|
|
||||||
|
|
||||||
return xml;
|
|
||||||
}
|
|
||||||
|
|
||||||
private @NotNull AuthAutoCompleteData buildAuthAutoCompleteData(AutoCompleteDataEntity.AuthAutoCompleteData data){
|
|
||||||
AuthAutoCompleteData xml = new AuthAutoCompleteData();
|
|
||||||
if (data == null) return xml;
|
|
||||||
|
|
||||||
xml.setBody(data.getBody());
|
|
||||||
xml.setUrl(data.getUrl());
|
|
||||||
xml.setMethod(data.getMethod());
|
|
||||||
xml.setPath(data.getPath());
|
|
||||||
xml.setType(data.getType());
|
|
||||||
|
|
||||||
return xml;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -12,7 +12,7 @@ import java.util.EnumSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public abstract class BaseFieldDataHelperService<M extends BaseFieldData, PM extends BaseFieldDataPersist, D extends BaseFieldDataEntity<?>, IE extends BaseFieldDataImportExport> implements FieldDataHelperService {
|
public abstract class BaseFieldDataHelperService<M extends BaseFieldData, PM extends BaseFieldDataPersist, D extends BaseFieldDataEntity, IE extends BaseFieldDataImportExport> implements FieldDataHelperService {
|
||||||
protected FieldType fieldType;
|
protected FieldType fieldType;
|
||||||
|
|
||||||
protected abstract D newDataInstanceInternal();
|
protected abstract D newDataInstanceInternal();
|
||||||
|
@ -36,7 +36,7 @@ public abstract class BaseFieldDataHelperService<M extends BaseFieldData, PM ext
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldDataEntity<?> newDataInstance() {
|
public BaseFieldDataEntity newDataInstance() {
|
||||||
return this.newDataInstanceInternal();
|
return this.newDataInstanceInternal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ public abstract class BaseFieldDataHelperService<M extends BaseFieldData, PM ext
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldDataImportExport dataToImportExportXml(BaseFieldDataEntity<?> data){
|
public BaseFieldDataImportExport dataToImportExportXml(BaseFieldDataEntity data){
|
||||||
IE xml = this.newImportExportInstanceInternal();
|
IE xml = this.newImportExportInstanceInternal();
|
||||||
xml.setLabel(data.getLabel());
|
xml.setLabel(data.getLabel());
|
||||||
xml.setFieldType(data.getFieldType());
|
xml.setFieldType(data.getFieldType());
|
||||||
|
@ -72,30 +72,30 @@ public abstract class BaseFieldDataHelperService<M extends BaseFieldData, PM ext
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isMultiValue(BaseFieldDataEntity<?> data){
|
public boolean isMultiValue(BaseFieldDataEntity data){
|
||||||
return this.isMultiValueInternal((D)data);
|
return this.isMultiValueInternal((D)data);
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldDataEntity<?> applyPersist(BaseFieldDataPersist persist){
|
public BaseFieldDataEntity applyPersist(BaseFieldDataPersist persist){
|
||||||
BaseFieldDataEntity<?> instance = this.newDataInstance();
|
BaseFieldDataEntity instance = this.newDataInstance();
|
||||||
return this.applyPersist(persist, instance);
|
return this.applyPersist(persist, instance);
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldDataEntity<?> applyPersist(BaseFieldDataPersist persist, BaseFieldDataEntity<?> data){
|
public BaseFieldDataEntity applyPersist(BaseFieldDataPersist persist, BaseFieldDataEntity data){
|
||||||
data.setLabel(persist.getLabel());
|
data.setLabel(persist.getLabel());
|
||||||
data.setFieldType(persist.getFieldType());
|
data.setFieldType(persist.getFieldType());
|
||||||
return this.applyPersistInternal((PM)persist, (D)data);
|
return this.applyPersistInternal((PM)persist, (D)data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldData buildOne(FieldSet fieldSet, BaseFieldDataEntity<?> data, EnumSet<AuthorizationFlags> authorizationFlags){
|
public BaseFieldData buildOne(FieldSet fieldSet, BaseFieldDataEntity data, EnumSet<AuthorizationFlags> authorizationFlags){
|
||||||
List<BaseFieldData> models = this.build(fieldSet, List.of(data), authorizationFlags);
|
List<BaseFieldData> models = this.build(fieldSet, List.of(data), authorizationFlags);
|
||||||
if (models == null || models.isEmpty()) return null;
|
if (models == null || models.isEmpty()) return null;
|
||||||
return models.get(0);
|
return models.get(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<BaseFieldData> build(FieldSet fieldSet, List<BaseFieldDataEntity<?>> data, EnumSet<AuthorizationFlags> authorizationFlags) {
|
public List<BaseFieldData> build(FieldSet fieldSet, List<BaseFieldDataEntity> data, EnumSet<AuthorizationFlags> authorizationFlags) {
|
||||||
return this.buildInternal(fieldSet, data.stream().map(x-> (D) x).collect(Collectors.toList()), authorizationFlags).stream().map(x-> (M)x).collect(Collectors.toList());
|
return this.buildInternal(fieldSet, data.stream().map(x-> (D) x).collect(Collectors.toList()), authorizationFlags).stream().map(x-> (M)x).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,27 +75,27 @@ 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.getMultipleSelect());
|
||||||
data.setType(persist.getType());
|
data.setType(persist.getType());
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ExternalDatasetDataPersist importExportMapDataToPersistInternal(ExternalDatasetDataImportExport data, ExternalDatasetDataPersist persist) {
|
protected ExternalDatasetDataPersist importExportMapDataToPersistInternal(ExternalDatasetDataImportExport data, ExternalDatasetDataPersist persist) {
|
||||||
persist.setMultiAutoComplete(data.getMultiAutoComplete());
|
persist.setMultipleSelect(data.getMultipleSelect());
|
||||||
persist.setType(data.getType());
|
persist.setType(data.getType());
|
||||||
return persist;
|
return persist;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ExternalDatasetDataImportExport dataToImportExportXmlInternal(ExternalDatasetDataEntity data, ExternalDatasetDataImportExport xml) {
|
protected ExternalDatasetDataImportExport dataToImportExportXmlInternal(ExternalDatasetDataEntity data, ExternalDatasetDataImportExport xml) {
|
||||||
xml.setMultiAutoComplete(data.getMultiAutoComplete());
|
xml.setMultipleSelect(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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,236 @@
|
||||||
|
package eu.eudat.service.fielddatahelper;
|
||||||
|
|
||||||
|
import eu.eudat.authorization.AuthorizationFlags;
|
||||||
|
import eu.eudat.commons.types.descriptiontemplate.fielddata.ExternalSelectDataEntity;
|
||||||
|
import eu.eudat.commons.types.descriptiontemplate.importexport.fielddata.*;
|
||||||
|
import eu.eudat.convention.ConventionService;
|
||||||
|
import eu.eudat.model.builder.descriptiontemplatedefinition.fielddata.ExternalSelectDataBuilder;
|
||||||
|
import eu.eudat.model.descriptiontemplatedefinition.fielddata.ExternalSelectData;
|
||||||
|
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.*;
|
||||||
|
import gr.cite.tools.data.builder.BuilderFactory;
|
||||||
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
|
import gr.cite.tools.validation.Validator;
|
||||||
|
import gr.cite.tools.validation.ValidatorFactory;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.EnumSet;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class ExternalSelectFieldDataHelperService extends BaseFieldDataHelperService<ExternalSelectData, ExternalSelectDataPersist, ExternalSelectDataEntity, ExternalSelectImportExport> {
|
||||||
|
private final ConventionService conventionService;
|
||||||
|
private final BuilderFactory builderFactory;
|
||||||
|
private final ValidatorFactory validatorFactory;
|
||||||
|
|
||||||
|
public ExternalSelectFieldDataHelperService(ConventionService conventionService, BuilderFactory builderFactory, ValidatorFactory validatorFactory) {
|
||||||
|
this.conventionService = conventionService;
|
||||||
|
this.builderFactory = builderFactory;
|
||||||
|
this.validatorFactory = validatorFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ExternalSelectDataEntity newDataInstanceInternal() {
|
||||||
|
return new ExternalSelectDataEntity();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ExternalSelectData newModelInstanceInternal() {
|
||||||
|
return new ExternalSelectData();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ExternalSelectDataPersist newPersistModelInstanceInternal() {
|
||||||
|
return new ExternalSelectDataPersist();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected ExternalSelectImportExport newImportExportInstanceInternal() {
|
||||||
|
return new ExternalSelectImportExport();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<?> getDataClass() {
|
||||||
|
return ExternalSelectDataEntity.class;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public Class<?> getModelClass() {
|
||||||
|
return ExternalSelectData.class;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public Class<?> getPersistModelClass() {
|
||||||
|
return ExternalSelectDataPersist.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<?> getImportExportClass() {
|
||||||
|
return ExternalSelectImportExport.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Validator getPersistModelValidator() {
|
||||||
|
return this.validatorFactory.validator(ExternalSelectDataPersist.AutoCompleteDataPersistValidator.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ExternalSelectData> buildInternal(FieldSet fieldSet, List<ExternalSelectDataEntity> data, EnumSet<AuthorizationFlags> authorizationFlags){
|
||||||
|
return this.builderFactory.builder(ExternalSelectDataBuilder.class).authorize(authorizationFlags).build(fieldSet, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected ExternalSelectDataEntity applyPersistInternal(ExternalSelectDataPersist persist, ExternalSelectDataEntity data) {
|
||||||
|
data.setMultipleSelect(persist.getMultipleSelect());
|
||||||
|
if (!this.conventionService.isListNullOrEmpty(persist.getSources())){
|
||||||
|
data.setSources(new ArrayList<>());
|
||||||
|
for (ExternalSelectDataPersist.ExternalSelectSourcePersist sourcePersist: persist.getSources()) {
|
||||||
|
data.getSources().add(this.buildAutoCompleteSingleData(sourcePersist));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
private @NotNull ExternalSelectDataEntity.ExternalSelectSourceEntity buildAutoCompleteSingleData(ExternalSelectDataPersist.ExternalSelectSourcePersist persist){
|
||||||
|
ExternalSelectDataEntity.ExternalSelectSourceEntity data = new ExternalSelectDataEntity.ExternalSelectSourceEntity();
|
||||||
|
if (persist == null) return data;
|
||||||
|
|
||||||
|
data.setUrl(persist.getUrl());
|
||||||
|
data.setOptionsRoot(persist.getOptionsRoot());
|
||||||
|
data.setHasAuth(persist.getHasAuth());
|
||||||
|
if(persist.getSourceBinding() != null) data.setSourceBinding(this.buildOption(persist.getSourceBinding()));
|
||||||
|
if(persist.getAuth() != null) data.setAuth(this.buildAuthAutoCompleteData(persist.getAuth()));
|
||||||
|
data.setMethod(persist.getMethod());
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
private @NotNull ExternalSelectDataEntity.ExternalSelectSourceBindingEntity buildOption(ExternalSelectDataPersist.ExternalSelectSourceBindingPersist persist){
|
||||||
|
ExternalSelectDataEntity.ExternalSelectSourceBindingEntity data = new ExternalSelectDataEntity.ExternalSelectSourceBindingEntity();
|
||||||
|
if (persist == null) return data;
|
||||||
|
|
||||||
|
data.setLabel(persist.getLabel());
|
||||||
|
data.setValue(persist.getValue());
|
||||||
|
data.setSource(persist.getSource());
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
private @NotNull ExternalSelectDataEntity.ExternalSelectAuthDataEntity buildAuthAutoCompleteData(ExternalSelectDataPersist.ExternalSelectAuthDataPersist persist){
|
||||||
|
ExternalSelectDataEntity.ExternalSelectAuthDataEntity data = new ExternalSelectDataEntity.ExternalSelectAuthDataEntity();
|
||||||
|
if (persist == null) return data;
|
||||||
|
|
||||||
|
data.setBody(persist.getBody());
|
||||||
|
data.setUrl(persist.getUrl());
|
||||||
|
data.setMethod(persist.getMethod());
|
||||||
|
data.setPath(persist.getPath());
|
||||||
|
data.setType(persist.getType());
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected ExternalSelectDataPersist importExportMapDataToPersistInternal(ExternalSelectImportExport data, ExternalSelectDataPersist persist) {
|
||||||
|
persist.setMultipleSelect(data.getMultipleSelect());
|
||||||
|
if (!this.conventionService.isListNullOrEmpty(data.getSources())){
|
||||||
|
persist.setSources(new ArrayList<>());
|
||||||
|
for (ExternalSelectImportExport.ExternalSelectSourceImportExport autoCompleteSingleData: data.getSources()) {
|
||||||
|
persist.getSources().add(this.buildAutoCompleteSingleData(autoCompleteSingleData));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return persist;
|
||||||
|
}
|
||||||
|
|
||||||
|
private @NotNull ExternalSelectDataPersist.ExternalSelectSourcePersist buildAutoCompleteSingleData(ExternalSelectImportExport.ExternalSelectSourceImportExport data){
|
||||||
|
ExternalSelectDataPersist.ExternalSelectSourcePersist persist = new ExternalSelectDataPersist.ExternalSelectSourcePersist();
|
||||||
|
if (data == null) return persist;
|
||||||
|
|
||||||
|
persist.setUrl(data.getUrl());
|
||||||
|
persist.setOptionsRoot(data.getOptionsRoot());
|
||||||
|
persist.setHasAuth(data.getHasAuth());
|
||||||
|
if(data.getSourceBinding() != null) persist.setSourceBinding(this.buildOption(data.getSourceBinding()));
|
||||||
|
if(data.getAuth() != null) persist.setAuth(this.buildAuthAutoCompleteData(data.getAuth()));
|
||||||
|
persist.setMethod(data.getMethod());
|
||||||
|
|
||||||
|
return persist;
|
||||||
|
}
|
||||||
|
|
||||||
|
private @NotNull ExternalSelectDataPersist.ExternalSelectSourceBindingPersist buildOption(ExternalSelectImportExport.ExternalSelectSourceBindingImportExport data){
|
||||||
|
ExternalSelectDataPersist.ExternalSelectSourceBindingPersist persist = new ExternalSelectDataPersist.ExternalSelectSourceBindingPersist();
|
||||||
|
if (data == null) return persist;
|
||||||
|
|
||||||
|
persist.setLabel(data.getLabel());
|
||||||
|
persist.setValue(data.getValue());
|
||||||
|
persist.setSource(data.getSource());
|
||||||
|
|
||||||
|
return persist;
|
||||||
|
}
|
||||||
|
|
||||||
|
private @NotNull ExternalSelectDataPersist.ExternalSelectAuthDataPersist buildAuthAutoCompleteData(ExternalSelectImportExport.ExternalSelectAuthImportExport data){
|
||||||
|
ExternalSelectDataPersist.ExternalSelectAuthDataPersist persist = new ExternalSelectDataPersist.ExternalSelectAuthDataPersist();
|
||||||
|
if (data == null) return persist;
|
||||||
|
|
||||||
|
persist.setBody(data.getBody());
|
||||||
|
persist.setUrl(data.getUrl());
|
||||||
|
persist.setMethod(data.getMethod());
|
||||||
|
persist.setPath(data.getPath());
|
||||||
|
persist.setType(data.getType());
|
||||||
|
|
||||||
|
return persist;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected ExternalSelectImportExport dataToImportExportXmlInternal(ExternalSelectDataEntity data, ExternalSelectImportExport xml) {
|
||||||
|
xml.setMultipleSelect(data.getMultipleSelect());
|
||||||
|
if (!this.conventionService.isListNullOrEmpty(data.getSources())){
|
||||||
|
xml.setSources(new ArrayList<>());
|
||||||
|
for (ExternalSelectDataEntity.ExternalSelectSourceEntity externalSelectSourceEntity : data.getSources()) {
|
||||||
|
xml.getSources().add(this.buildAutoCompleteSingleData(externalSelectSourceEntity));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return xml;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean isMultiValueInternal(ExternalSelectDataEntity data) {
|
||||||
|
return data.getMultipleSelect();
|
||||||
|
}
|
||||||
|
|
||||||
|
private @NotNull ExternalSelectImportExport.ExternalSelectSourceImportExport buildAutoCompleteSingleData(ExternalSelectDataEntity.ExternalSelectSourceEntity data){
|
||||||
|
ExternalSelectImportExport.ExternalSelectSourceImportExport xml = new ExternalSelectImportExport.ExternalSelectSourceImportExport();
|
||||||
|
if (data == null) return xml;
|
||||||
|
|
||||||
|
xml.setUrl(data.getUrl());
|
||||||
|
xml.setOptionsRoot(data.getOptionsRoot());
|
||||||
|
xml.setHasAuth(data.getHasAuth());
|
||||||
|
if(data.getSourceBinding() != null) xml.setSourceBinding(this.buildOption(data.getSourceBinding()));
|
||||||
|
if(data.getAuth() != null) xml.setAuth(this.buildAuthAutoCompleteData(data.getAuth()));
|
||||||
|
xml.setMethod(data.getMethod());
|
||||||
|
|
||||||
|
return xml;
|
||||||
|
}
|
||||||
|
|
||||||
|
private @NotNull ExternalSelectImportExport.ExternalSelectSourceBindingImportExport buildOption(ExternalSelectDataEntity.ExternalSelectSourceBindingEntity data){
|
||||||
|
ExternalSelectImportExport.ExternalSelectSourceBindingImportExport xml = new ExternalSelectImportExport.ExternalSelectSourceBindingImportExport();
|
||||||
|
if (data == null) return xml;
|
||||||
|
|
||||||
|
xml.setLabel(data.getLabel());
|
||||||
|
xml.setValue(data.getValue());
|
||||||
|
xml.setSource(data.getSource());
|
||||||
|
|
||||||
|
return xml;
|
||||||
|
}
|
||||||
|
|
||||||
|
private @NotNull ExternalSelectImportExport.ExternalSelectAuthImportExport buildAuthAutoCompleteData(ExternalSelectDataEntity.ExternalSelectAuthDataEntity data){
|
||||||
|
ExternalSelectImportExport.ExternalSelectAuthImportExport xml = new ExternalSelectImportExport.ExternalSelectAuthImportExport();
|
||||||
|
if (data == null) return xml;
|
||||||
|
|
||||||
|
xml.setBody(data.getBody());
|
||||||
|
xml.setUrl(data.getUrl());
|
||||||
|
xml.setMethod(data.getMethod());
|
||||||
|
xml.setPath(data.getPath());
|
||||||
|
xml.setType(data.getType());
|
||||||
|
|
||||||
|
return xml;
|
||||||
|
}
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue