refactor description template xml
This commit is contained in:
parent
59c425a240
commit
6a0d1a7c8b
|
@ -6,7 +6,7 @@ import eu.eudat.data.converters.enums.DatabaseEnum;
|
|||
import java.util.Map;
|
||||
|
||||
public enum FieldType implements DatabaseEnum<String> {
|
||||
AUTO_COMPLETE(Names.Autocomplete),
|
||||
AUTO_COMPLETE(Names.ExternalSelect),
|
||||
SELECT(Names.Select),
|
||||
BOOLEAN_DECISION(Names.BooleanDecision),
|
||||
RADIO_BOX(Names.RadioBox),
|
||||
|
@ -37,12 +37,10 @@ public enum FieldType implements DatabaseEnum<String> {
|
|||
private final String value;
|
||||
|
||||
public static class Names {
|
||||
public static final String ComboBox = "combobox";
|
||||
public static final String Autocomplete = "autocomplete";
|
||||
public static final String Select = "wordlist";
|
||||
public static final String ExternalSelect = "externalSelect";
|
||||
public static final String Select = "select";
|
||||
public static final String BooleanDecision = "booleanDecision";
|
||||
public static final String RadioBox = "radiobox";
|
||||
public static final String InternalDmpEntities = "internalDmpEntities";
|
||||
public static final String InternalDmpResearchers = "internalDmpResearchers";
|
||||
public static final String InternalDmpDmps = "internalDmpDmps";
|
||||
public static final String InternalDmpDatasets = "internalDmpDatasets";
|
||||
|
|
|
@ -8,21 +8,10 @@ import java.util.List;
|
|||
@XmlRootElement(name = "root")
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class DefinitionEntity {
|
||||
@XmlElementWrapper(name = "sections")
|
||||
@XmlElement(name = "section")
|
||||
private List<SectionEntity> sections;
|
||||
@XmlElementWrapper(name = "pages")
|
||||
@XmlElement(name = "page")
|
||||
private List<PageEntity> pages;
|
||||
|
||||
public List<SectionEntity> getSections() {
|
||||
return sections;
|
||||
}
|
||||
|
||||
public void setSections(List<SectionEntity> sections) {
|
||||
this.sections = sections;
|
||||
}
|
||||
|
||||
public List<PageEntity> getPages() {
|
||||
return pages;
|
||||
}
|
||||
|
@ -33,8 +22,8 @@ public class DefinitionEntity {
|
|||
|
||||
public List<FieldEntity> getAllField(){
|
||||
List<FieldEntity> fieldEntities = new ArrayList<>();
|
||||
if (this.getSections() != null){
|
||||
for (SectionEntity sectionEntity: this.getSections()) {
|
||||
if (this.getPages() != null){
|
||||
for (PageEntity sectionEntity: this.getPages()) {
|
||||
fieldEntities.addAll(sectionEntity.getAllField());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,15 +25,15 @@ public class FieldEntity implements DatabaseViewStyleDefinition {
|
|||
private List<RuleEntity> visibilityRules;
|
||||
|
||||
@XmlElements({
|
||||
@XmlElement(name = "labelData", type = LabelDataEntity.class),
|
||||
@XmlElement(name = "labelAndMultiplicityData", type = LabelAndMultiplicityDataEntity.class),
|
||||
@XmlElement(name = "externalDatasetsData", type = ExternalDatasetDataEntity.class),
|
||||
@XmlElement(name = "uploadData", type = UploadDataEntity.class),
|
||||
@XmlElement(name = "radioBoxData", type = RadioBoxDataEntity.class),
|
||||
@XmlElement(name = "wordListData", type = SelectDataEntity.class),
|
||||
@XmlElement(name = "autocompleteData", type = ExternalSelectDataEntity.class),
|
||||
@XmlElement(name = LabelDataEntity.XmlElementName, type = LabelDataEntity.class),
|
||||
@XmlElement(name = LabelAndMultiplicityDataEntity.XmlElementName, type = LabelAndMultiplicityDataEntity.class),
|
||||
@XmlElement(name = ExternalDatasetDataEntity.XmlElementName, type = ExternalDatasetDataEntity.class),
|
||||
@XmlElement(name = UploadDataEntity.XmlElementName, type = UploadDataEntity.class),
|
||||
@XmlElement(name = RadioBoxDataEntity.XmlElementName, type = RadioBoxDataEntity.class),
|
||||
@XmlElement(name = SelectDataEntity.XmlElementName, type = SelectDataEntity.class),
|
||||
@XmlElement(name = ExternalSelectDataEntity.XmlElementName, type = ExternalSelectDataEntity.class),
|
||||
})
|
||||
private BaseFieldDataEntity<?> data;
|
||||
private BaseFieldDataEntity data;
|
||||
@XmlElementWrapper(name = "validations")
|
||||
@XmlElement(name = "validation")
|
||||
private List<FieldValidationType> validations;
|
||||
|
@ -61,10 +61,10 @@ public class FieldEntity implements DatabaseViewStyleDefinition {
|
|||
this.schematics = schematics;
|
||||
}
|
||||
|
||||
public BaseFieldDataEntity<?> getData() {
|
||||
public BaseFieldDataEntity getData() {
|
||||
return data;
|
||||
}
|
||||
public void setData(BaseFieldDataEntity<?> data) {
|
||||
public void setData(BaseFieldDataEntity data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
package eu.eudat.commons.types.descriptiontemplate;
|
||||
|
||||
import eu.eudat.commons.types.common.DatabaseViewStyleDefinition;
|
||||
import jakarta.xml.bind.annotation.XmlAccessType;
|
||||
import jakarta.xml.bind.annotation.XmlAccessorType;
|
||||
import jakarta.xml.bind.annotation.XmlAttribute;
|
||||
import jakarta.xml.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
|
@ -15,6 +16,18 @@ public class PageEntity implements DatabaseViewStyleDefinition {
|
|||
@XmlAttribute(name="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() {
|
||||
return id;
|
||||
}
|
||||
|
@ -39,4 +52,14 @@ public class PageEntity implements DatabaseViewStyleDefinition {
|
|||
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;
|
||||
@XmlAttribute(name="numbering")
|
||||
private String numbering;
|
||||
@XmlAttribute(name="page")
|
||||
private String page;
|
||||
@XmlAttribute(name="title")
|
||||
private String title;
|
||||
@XmlAttribute(name="description")
|
||||
|
@ -58,14 +56,6 @@ public class SectionEntity implements DatabaseViewStyleDefinition{
|
|||
this.defaultVisibility = defaultVisibility;
|
||||
}
|
||||
|
||||
public String getPage() {
|
||||
return page;
|
||||
}
|
||||
|
||||
public void setPage(String page) {
|
||||
this.page = page;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ import java.util.Map;
|
|||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class ExternalDatasetDataEntity extends LabelAndMultiplicityDataEntity {
|
||||
public static final String XmlElementName = "externalDatasetsData";
|
||||
@XmlAttribute(name="type")
|
||||
private FieldDataExternalDatasetType type;
|
||||
|
||||
|
|
|
@ -1,17 +1,13 @@
|
|||
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 java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class ExternalSelectDataEntity extends LabelAndMultiplicityDataEntity {
|
||||
|
||||
public static final String XmlElementName = "externalSelectData";
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public static class ExternalSelectAuthDataEntity {
|
||||
|
@ -106,8 +102,8 @@ public class ExternalSelectDataEntity extends LabelAndMultiplicityDataEntity {
|
|||
private String method;
|
||||
@XmlAttribute(name="optionsRoot")
|
||||
private String optionsRoot;
|
||||
@XmlElement(name="option")
|
||||
private ExternalSelectSourceBindingEntity externalSelectSourceBindingEntity;
|
||||
@XmlElement(name="sourceBinding")
|
||||
private ExternalSelectSourceBindingEntity sourceBinding;
|
||||
@XmlAttribute(name="hasAuth")
|
||||
private Boolean hasAuth;
|
||||
@XmlElement(name="auth")
|
||||
|
@ -143,11 +139,11 @@ public class ExternalSelectDataEntity extends LabelAndMultiplicityDataEntity {
|
|||
this.auth = auth;
|
||||
}
|
||||
|
||||
public ExternalSelectSourceBindingEntity getExternalSelectSourceBindingEntity() {
|
||||
return externalSelectSourceBindingEntity;
|
||||
public ExternalSelectSourceBindingEntity getSourceBinding() {
|
||||
return sourceBinding;
|
||||
}
|
||||
public void setExternalSelectSourceBindingEntity(ExternalSelectSourceBindingEntity externalSelectSourceBindingEntity) {
|
||||
this.externalSelectSourceBindingEntity = externalSelectSourceBindingEntity;
|
||||
public void setSourceBinding(ExternalSelectSourceBindingEntity sourceBinding) {
|
||||
this.sourceBinding = sourceBinding;
|
||||
}
|
||||
|
||||
public String getMethod() {
|
||||
|
@ -159,15 +155,15 @@ public class ExternalSelectDataEntity extends LabelAndMultiplicityDataEntity {
|
|||
}
|
||||
}
|
||||
|
||||
@XmlElementWrapper(name = "autoCompleteSingleDataList")
|
||||
@XmlElement(name = "autoCompleteSingleData")
|
||||
@XmlElementWrapper(name = "sources")
|
||||
@XmlElement(name = "source")
|
||||
private List<ExternalSelectSourceEntity> sources;
|
||||
|
||||
public List<ExternalSelectSourceEntity> getAutoCompleteSingleDataList() {
|
||||
public List<ExternalSelectSourceEntity> getSources() {
|
||||
return sources;
|
||||
}
|
||||
|
||||
public void setAutoCompleteSingleDataList(List<ExternalSelectSourceEntity> externalSelectSourceEntityList) {
|
||||
public void setSources(List<ExternalSelectSourceEntity> externalSelectSourceEntityList) {
|
||||
this.sources = externalSelectSourceEntityList;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
}
|
|
@ -6,6 +6,7 @@ import jakarta.xml.bind.annotation.XmlAttribute;
|
|||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class LabelAndMultiplicityDataEntity extends BaseFieldDataEntity {
|
||||
public static final String XmlElementName = "labelAndMultiplicityData";
|
||||
|
||||
@XmlAttribute(name = "multipleSelect")
|
||||
private Boolean multipleSelect;
|
||||
|
|
|
@ -6,4 +6,5 @@ import jakarta.xml.bind.annotation.XmlAccessorType;
|
|||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class LabelDataEntity extends BaseFieldDataEntity {
|
||||
public static final String XmlElementName = "labelData";
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import java.util.List;
|
|||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class RadioBoxDataEntity extends BaseFieldDataEntity {
|
||||
public static final String XmlElementName = "radioBoxData";
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public static class RadioBoxDataOptionEntity {
|
||||
@XmlAttribute(name="label")
|
||||
|
|
|
@ -6,6 +6,7 @@ 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;
|
||||
|
|
|
@ -7,6 +7,7 @@ import java.util.List;
|
|||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class UploadDataEntity extends BaseFieldDataEntity {
|
||||
public static final String XmlElementName = "uploadData";
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public static class UploadDataOptionEntity {
|
||||
|
|
|
@ -34,13 +34,13 @@ public class FieldImportExport {
|
|||
private FieldType fieldType;
|
||||
|
||||
@XmlElements({
|
||||
@XmlElement(name = "labelData", type = LabelDataImportExport.class),
|
||||
@XmlElement(name = "labelAndMultiplicityData", type = LabelAndMultiplicityDataImportExport.class),
|
||||
@XmlElement(name = "externalDatasetsData", type = ExternalDatasetDataImportExport.class),
|
||||
@XmlElement(name = "uploadData", type = UploadDataImportExport.class),
|
||||
@XmlElement(name = "radioBoxData", type = RadioBoxDataImportExport.class),
|
||||
@XmlElement(name = "wordListData", type = SelectDataImportExport.class),
|
||||
@XmlElement(name = "autocompleteData", type = AutoCompleteDataImportExport.class),
|
||||
@XmlElement(name = LabelDataImportExport.XmlElementName, type = LabelDataImportExport.class),
|
||||
@XmlElement(name = LabelAndMultiplicityDataImportExport.XmlElementName, type = LabelAndMultiplicityDataImportExport.class),
|
||||
@XmlElement(name = ExternalDatasetDataImportExport.XmlElementName, type = ExternalDatasetDataImportExport.class),
|
||||
@XmlElement(name = UploadDataImportExport.XmlElementName, type = UploadDataImportExport.class),
|
||||
@XmlElement(name = RadioBoxDataImportExport.XmlElementName, type = RadioBoxDataImportExport.class),
|
||||
@XmlElement(name = SelectDataImportExport.XmlElementName, type = SelectDataImportExport.class),
|
||||
@XmlElement(name = ExternalSelectImportExport.XmlElementName, type = ExternalSelectImportExport.class),
|
||||
})
|
||||
private BaseFieldDataImportExport data;
|
||||
|
||||
|
|
|
@ -1,11 +1,7 @@
|
|||
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 java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
|
@ -15,23 +11,24 @@ public class FieldSetImportExport {
|
|||
private String id;
|
||||
@XmlAttribute(name="ordinal")
|
||||
private int ordinal;
|
||||
|
||||
@XmlElementWrapper(name = "fields")
|
||||
@XmlElement(name = "field")
|
||||
private List<FieldImportExport> fields;
|
||||
@XmlElement(name = "numbering")
|
||||
@XmlAttribute(name="numbering")
|
||||
private String numbering;
|
||||
@XmlElement(name = "commentField")
|
||||
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")
|
||||
@XmlAttribute(name="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() {
|
||||
return id;
|
||||
|
@ -65,19 +62,18 @@ public class FieldSetImportExport {
|
|||
this.numbering = numbering;
|
||||
}
|
||||
|
||||
public Boolean getCommentField() {
|
||||
return commentField;
|
||||
public Boolean getHasCommentField() {
|
||||
return hasCommentField;
|
||||
}
|
||||
public void setHasCommentField(Boolean hasCommentField) {
|
||||
this.hasCommentField = hasCommentField;
|
||||
}
|
||||
|
||||
public void setCommentField(Boolean commentField) {
|
||||
this.commentField = commentField;
|
||||
}
|
||||
|
||||
public MultiplicityImportXml getMultiplicity() {
|
||||
public MultiplicityImportExport getMultiplicity() {
|
||||
return multiplicity;
|
||||
}
|
||||
|
||||
public void setMultiplicity(MultiplicityImportXml multiplicity) {
|
||||
public void setMultiplicity(MultiplicityImportExport multiplicity) {
|
||||
this.multiplicity = multiplicity;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,27 +1,21 @@
|
|||
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.XmlRootElement;
|
||||
|
||||
|
||||
@XmlRootElement(name = "multiplicity")
|
||||
public class MultiplicityImportXml {
|
||||
private int max;
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class MultiplicityImportExport {
|
||||
@XmlAttribute(name="min")
|
||||
private int min;
|
||||
@XmlAttribute(name="max")
|
||||
private int max;
|
||||
@XmlAttribute(name="placeholder")
|
||||
private String placeholder;
|
||||
@XmlAttribute(name="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() {
|
||||
return min;
|
||||
}
|
||||
|
@ -30,7 +24,14 @@ public class MultiplicityImportXml {
|
|||
this.min = min;
|
||||
}
|
||||
|
||||
@XmlAttribute(name = "placeholder")
|
||||
public int getMax() {
|
||||
return max;
|
||||
}
|
||||
|
||||
public void setMax(int max) {
|
||||
this.max = max;
|
||||
}
|
||||
|
||||
public String getPlaceholder() {
|
||||
return placeholder;
|
||||
}
|
||||
|
@ -39,7 +40,6 @@ public class MultiplicityImportXml {
|
|||
this.placeholder = placeholder;
|
||||
}
|
||||
|
||||
@XmlAttribute(name = "tableView")
|
||||
public boolean getTableView() {
|
||||
return tableView;
|
||||
}
|
|
@ -11,7 +11,6 @@ public class RuleImportExport {
|
|||
@XmlAttribute(name="value")
|
||||
private String value;
|
||||
|
||||
@XmlAttribute(name = "target")
|
||||
public String getTarget() {
|
||||
return target;
|
||||
}
|
||||
|
|
|
@ -10,8 +10,6 @@ public class SectionImportExport {
|
|||
private String id;
|
||||
@XmlAttribute(name = "ordinal")
|
||||
private int ordinal;
|
||||
@XmlAttribute(name = "page")
|
||||
private String page;
|
||||
@XmlAttribute(name = "defaultVisibility")
|
||||
private Boolean defaultVisibility;
|
||||
@XmlElementWrapper(name = "fieldSets")
|
||||
|
@ -45,14 +43,6 @@ public class SectionImportExport {
|
|||
this.ordinal = ordinal;
|
||||
}
|
||||
|
||||
public String getPage() {
|
||||
return page;
|
||||
}
|
||||
|
||||
public void setPage(String page) {
|
||||
this.page = page;
|
||||
}
|
||||
|
||||
public Boolean getDefaultVisibility() {
|
||||
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,81 +0,0 @@
|
|||
package eu.eudat.commons.types.descriptiontemplate.importexport.fielddata;
|
||||
|
||||
import eu.eudat.commons.types.descriptiontemplate.fielddata.ExternalSelectDataEntity;
|
||||
import jakarta.xml.bind.annotation.XmlAccessType;
|
||||
import jakarta.xml.bind.annotation.XmlAccessorType;
|
||||
import jakarta.xml.bind.annotation.XmlAttribute;
|
||||
import jakarta.xml.bind.annotation.XmlElement;
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class AutoCompleteSingleData {
|
||||
@XmlAttribute(name = "autocompleteType")
|
||||
private ExternalSelectDataEntity.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 ExternalSelectDataEntity.AutocompleteType getAutocompleteType() {
|
||||
return autocompleteType;
|
||||
}
|
||||
|
||||
public void setAutocompleteType(ExternalSelectDataEntity.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;
|
||||
|
||||
import eu.eudat.commons.enums.FieldType;
|
||||
import jakarta.xml.bind.annotation.XmlAccessType;
|
||||
import jakarta.xml.bind.annotation.XmlAccessorType;
|
||||
import jakarta.xml.bind.annotation.XmlAttribute;
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public abstract class BaseFieldDataImportExport {
|
||||
@XmlAttribute(name = "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;
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class ExternalDatasetDataImportExport extends BaseFieldDataImportExport {
|
||||
@XmlAttribute(name = "multiAutoComplete")
|
||||
private Boolean multiAutoComplete;
|
||||
public class ExternalDatasetDataImportExport extends LabelAndMultiplicityDataImportExport {
|
||||
public static final String XmlElementName = "externalDatasetsData";
|
||||
@XmlAttribute(name = "type")
|
||||
private FieldDataExternalDatasetType type;
|
||||
|
||||
public Boolean getMultiAutoComplete() {
|
||||
return multiAutoComplete;
|
||||
}
|
||||
|
||||
public void setMultiAutoComplete(Boolean multiAutoComplete) {
|
||||
this.multiAutoComplete = multiAutoComplete;
|
||||
}
|
||||
|
||||
public FieldDataExternalDatasetType getType() {
|
||||
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)
|
||||
public class LabelAndMultiplicityDataImportExport extends BaseFieldDataImportExport {
|
||||
public static final String XmlElementName = "labelAndMultiplicityData";
|
||||
|
||||
@XmlAttribute(name = "multiAutoComplete")
|
||||
private Boolean multiAutoComplete;
|
||||
@XmlAttribute(name = "multipleSelect")
|
||||
private Boolean multipleSelect;
|
||||
|
||||
public Boolean getMultiAutoComplete() {
|
||||
return multiAutoComplete;
|
||||
public Boolean getMultipleSelect() {
|
||||
return multipleSelect;
|
||||
}
|
||||
|
||||
public void setMultiAutoComplete(Boolean multiAutoComplete) {
|
||||
this.multiAutoComplete = multiAutoComplete;
|
||||
public void setMultipleSelect(Boolean multipleSelect) {
|
||||
this.multipleSelect = multipleSelect;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -5,5 +5,6 @@ import jakarta.xml.bind.annotation.XmlAccessorType;
|
|||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class LabelDataImportExport extends BaseFieldDataImportExport {
|
||||
public static final String XmlElementName = "labelData";
|
||||
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import java.util.List;
|
|||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class RadioBoxDataImportExport extends BaseFieldDataImportExport {
|
||||
public static final String XmlElementName = "radioBoxData";
|
||||
|
||||
@XmlElementWrapper(name = "options")
|
||||
@XmlElement(name = "option")
|
||||
|
@ -18,5 +19,29 @@ public class RadioBoxDataImportExport extends BaseFieldDataImportExport {
|
|||
public void setOptions(List<RadioBoxOption> 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;
|
||||
}
|
||||
}
|
|
@ -5,29 +5,41 @@ import jakarta.xml.bind.annotation.*;
|
|||
import java.util.List;
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class SelectDataImportExport extends BaseFieldDataImportExport {
|
||||
public class SelectDataImportExport extends LabelAndMultiplicityDataImportExport {
|
||||
public static final String XmlElementName = "selectData";
|
||||
@XmlElementWrapper(name = "options")
|
||||
@XmlElement(name = "options")
|
||||
private List<ComboBoxDataOptionEntity> options;
|
||||
private List<OptionImportExport> options;
|
||||
|
||||
@XmlAttribute(name = "multiList")
|
||||
private Boolean multiList;
|
||||
|
||||
public List<ComboBoxDataOptionEntity> getOptions() {
|
||||
public List<OptionImportExport> getOptions() {
|
||||
return options;
|
||||
}
|
||||
|
||||
public void setOptions(List<ComboBoxDataOptionEntity> options) {
|
||||
public void setOptions(List<OptionImportExport> options) {
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
public Boolean getMultiList() {
|
||||
return multiList;
|
||||
@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 void setMultiList(Boolean multiList) {
|
||||
this.multiList = multiList;
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import java.util.List;
|
|||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class UploadDataImportExport extends BaseFieldDataImportExport {
|
||||
public static final String XmlElementName = "uploadData";
|
||||
@XmlElementWrapper(name = "types")
|
||||
@XmlElement(name = "type")
|
||||
private List<UploadDataOption> types;
|
||||
|
@ -30,5 +31,28 @@ public class UploadDataImportExport extends BaseFieldDataImportExport {
|
|||
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;
|
||||
}
|
||||
}
|
|
@ -45,13 +45,11 @@ public class DefinitionBuilder extends BaseBuilder<Definition, DefinitionEntity>
|
|||
return new ArrayList<>();
|
||||
|
||||
//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));
|
||||
|
||||
List<Definition> models = new ArrayList<>();
|
||||
for (DefinitionEntity d : data) {
|
||||
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()));
|
||||
models.add(m);
|
||||
}
|
||||
|
|
|
@ -4,7 +4,9 @@ import eu.eudat.authorization.AuthorizationFlags;
|
|||
import eu.eudat.commons.types.descriptiontemplate.PageEntity;
|
||||
import eu.eudat.convention.ConventionService;
|
||||
import eu.eudat.model.builder.BaseBuilder;
|
||||
import eu.eudat.model.descriptiontemplatedefinition.Definition;
|
||||
import eu.eudat.model.descriptiontemplatedefinition.Page;
|
||||
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;
|
||||
|
@ -21,12 +23,15 @@ import java.util.*;
|
|||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public class PageBuilder extends BaseBuilder<Page, PageEntity> {
|
||||
|
||||
private final BuilderFactory builderFactory;
|
||||
|
||||
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
||||
|
||||
@Autowired
|
||||
public PageBuilder(
|
||||
ConventionService conventionService) {
|
||||
ConventionService conventionService, BuilderFactory builderFactory) {
|
||||
super(conventionService, new LoggerService(LoggerFactory.getLogger(PageBuilder.class)));
|
||||
this.builderFactory = builderFactory;
|
||||
}
|
||||
|
||||
public PageBuilder authorize(EnumSet<AuthorizationFlags> values) {
|
||||
|
@ -42,11 +47,13 @@ public class PageBuilder extends BaseBuilder<Page, PageEntity> {
|
|||
return new ArrayList<>();
|
||||
|
||||
List<Page> models = new ArrayList<>();
|
||||
FieldSet sectionsFields = fields.extractPrefixed(this.asPrefix(Page._sections));
|
||||
for (PageEntity d : data) {
|
||||
Page m = new Page();
|
||||
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._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);
|
||||
}
|
||||
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._multiplicity))) m.setMultiplicity(d.getMultiplicity());
|
||||
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._extendedDescription))) m.setExtendedDescription(d.getExtendedDescription());
|
||||
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.ExternalSelectDataEntity;
|
||||
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, ExternalSelectDataEntity.ExternalSelectAuthDataEntity> {
|
||||
|
||||
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<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<AuthAutoCompleteData> models = new ArrayList<>();
|
||||
for (ExternalSelectDataEntity.ExternalSelectAuthDataEntity 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.ExternalSelectDataEntity;
|
||||
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, ExternalSelectDataEntity> {
|
||||
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, ExternalSelectDataEntity d, AutoCompleteData m) {
|
||||
FieldSet autoCompleteSingleDataListFields = fields.extractPrefixed(this.asPrefix(AutoCompleteData._autoCompleteSingleDataList));
|
||||
if (fields.hasField(this.asIndexer(AutoCompleteData._multiAutoComplete))) m.setMultiAutoComplete(d.getMultipleSelect());
|
||||
if (!autoCompleteSingleDataListFields.isEmpty() && d.getAutoCompleteSingleDataList() != null) m.setAutoCompleteSingleDataList(this.builderFactory.builder(AutoCompleteSingleDataBuilder.class).authorize(this.authorize).build(autoCompleteSingleDataListFields, d.getAutoCompleteSingleDataList()));
|
||||
|
||||
}
|
||||
}
|
|
@ -1,64 +0,0 @@
|
|||
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.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, ExternalSelectDataEntity.ExternalSelectSourceEntity> {
|
||||
|
||||
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<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 autoCompleteOptionsFields = fields.extractPrefixed(this.asPrefix(AutoCompleteSingleData._autoCompleteOptions));
|
||||
FieldSet authFields = fields.extractPrefixed(this.asPrefix(AutoCompleteSingleData._auth));
|
||||
List<AutoCompleteSingleData> models = new ArrayList<>();
|
||||
for (ExternalSelectDataEntity.ExternalSelectSourceEntity 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.getExternalSelectSourceBindingEntity() != null) m.setAutoCompleteOptions(this.builderFactory.builder(ComboBoxOptionBuilder.class).authorize(this.authorize).build(autoCompleteOptionsFields, d.getExternalSelectSourceBindingEntity()));
|
||||
if (!authFields.isEmpty() && d.getAuth() != null) m.setAuth(this.builderFactory.builder(AuthAutoCompleteDataBuilder.class).authorize(this.authorize).build(authFields, d.getAuth()));
|
||||
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.*;
|
||||
|
||||
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);
|
||||
|
||||
|
|
|
@ -1,55 +0,0 @@
|
|||
package eu.eudat.model.builder.descriptiontemplatedefinition.fielddata;
|
||||
|
||||
import eu.eudat.authorization.AuthorizationFlags;
|
||||
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
|
||||
protected void buildChild(FieldSet fields, ExternalDatasetDataEntity d, ExternalDatasetData m) {
|
||||
if (fields.hasField(this.asIndexer(ExternalDatasetData._multiAutoComplete))) m.setMultiAutoComplete(d.getMultipleSelect());
|
||||
if (fields.hasField(this.asIndexer(ExternalDatasetData._multipleSelect))) m.setMultipleSelect(d.getMultipleSelect());
|
||||
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
|
||||
protected void buildChild(FieldSet fields, LabelAndMultiplicityDataEntity d, LabelAndMultiplicityData m) {
|
||||
if (fields.hasField(this.asIndexer(LabelAndMultiplicityData._multiAutoComplete))) m.setMultiAutoComplete(d.getMultipleSelect());
|
||||
if (fields.hasField(this.asIndexer(LabelAndMultiplicityData._multipleSelect))) m.setMultipleSelect(d.getMultipleSelect());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
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.descriptiontemplatedefinition.FieldBuilder;
|
||||
import eu.eudat.model.builder.BaseBuilder;
|
||||
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.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;
|
||||
|
@ -14,6 +16,8 @@ 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 RadioBoxDataBuilder extends BaseFieldDataBuilder<RadioBoxData, RadioBoxDataEntity> {
|
||||
|
@ -33,4 +37,40 @@ public class RadioBoxDataBuilder extends BaseFieldDataBuilder<RadioBoxData, Radi
|
|||
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()));
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
}
|
|
@ -1,10 +1,14 @@
|
|||
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;
|
||||
|
@ -12,6 +16,8 @@ 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> {
|
||||
|
@ -30,8 +36,44 @@ public class SelectDataBuilder extends BaseFieldDataBuilder<SelectData, SelectDa
|
|||
@Override
|
||||
protected void buildChild(FieldSet fields, SelectDataEntity d, SelectData m) {
|
||||
FieldSet optionsFields = fields.extractPrefixed(this.asPrefix(SelectData._options));
|
||||
if (fields.hasField(this.asIndexer(SelectData._multiList))) m.setMultiList(d.getMultiList());
|
||||
if (!optionsFields.isEmpty() && d.getOptions() != null) m.setOptions(this.builderFactory.builder(ComboBoxOptionBuilder.class).authorize(this.authorize).build(optionsFields, d.getOptions()));
|
||||
if (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;
|
||||
|
||||
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.UploadData;
|
||||
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;
|
||||
|
@ -12,6 +16,8 @@ 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 UploadDataBuilder extends BaseFieldDataBuilder<UploadData, UploadDataEntity> {
|
||||
|
@ -31,4 +37,40 @@ public class UploadDataBuilder extends BaseFieldDataBuilder<UploadData, UploadDa
|
|||
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()));
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
}
|
|
@ -63,7 +63,7 @@ public class DescriptionTemplateDefinitionFileTransformerBuilder extends BaseFil
|
|||
List<FileTransformerBuilderItemResponse<DefinitionFileTransformerModel, DefinitionEntity>> models = new ArrayList<>();
|
||||
for (DefinitionEntity d : data) {
|
||||
DefinitionFileTransformerModel m = new DefinitionFileTransformerModel();
|
||||
m.setPages(collectPages(d.getPages(), d.getSections()));
|
||||
m.setPages(collectPages(d.getPages()));
|
||||
models.add(new FileTransformerBuilderItemResponse<>(m, d));
|
||||
}
|
||||
|
||||
|
@ -72,14 +72,14 @@ public class DescriptionTemplateDefinitionFileTransformerBuilder extends BaseFil
|
|||
return models;
|
||||
}
|
||||
|
||||
private List<PageFileTransformerModel> collectPages(List<PageEntity> data, List<SectionEntity> sections) {
|
||||
private List<PageFileTransformerModel> collectPages(List<PageEntity> data) {
|
||||
List<PageFileTransformerModel> result = new ArrayList<>();
|
||||
for (PageEntity d: data) {
|
||||
PageFileTransformerModel m = new PageFileTransformerModel();
|
||||
m.setId(d.getId());
|
||||
m.setOrdinal(d.getOrdinal());
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -161,7 +161,7 @@ public class DescriptionTemplateDefinitionFileTransformerBuilder extends BaseFil
|
|||
m.setLabel(d.getLabel());
|
||||
m.setFieldType(FieldType.of(d.getFieldType().getValue()));
|
||||
((AutoCompleteDataFileTransformerModel)m).setMultiAutoComplete(d.getMultipleSelect());
|
||||
((AutoCompleteDataFileTransformerModel) m).setAutoCompleteSingleDataList(convertAutoCompleteSingleData(d.getAutoCompleteSingleDataList()));
|
||||
((AutoCompleteDataFileTransformerModel) m).setAutoCompleteSingleDataList(convertAutoCompleteSingleData(d.getSources()));
|
||||
}
|
||||
case ExternalDatasetDataEntity d -> {
|
||||
m = new ExternalDatasetDataFileTransformerModel();
|
||||
|
@ -186,7 +186,7 @@ public class DescriptionTemplateDefinitionFileTransformerBuilder extends BaseFil
|
|||
m = new WordListDataFileTransformerModel();
|
||||
m.setLabel(d.getLabel());
|
||||
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());
|
||||
}
|
||||
default -> m = null;
|
||||
|
@ -210,21 +210,30 @@ public class DescriptionTemplateDefinitionFileTransformerBuilder extends BaseFil
|
|||
for (ExternalSelectDataEntity.ExternalSelectSourceEntity d : data) {
|
||||
AutoCompleteSingleDataFileTransformerModel m = new AutoCompleteSingleDataFileTransformerModel();
|
||||
m.setUrl(d.getUrl());
|
||||
m.setAutoCompleteOptions(convertComboBoxOption(d.getExternalSelectSourceBindingEntity()));
|
||||
m.setAutoCompleteOptions(convertComboBoxOption(d.getSourceBinding()));
|
||||
result.add(m);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private ComboBoxOptionFileTransformerModel convertComboBoxOption(ComboBoxDataEntity.Option data) {
|
||||
private ComboBoxOptionFileTransformerModel convertComboBoxOption(ExternalSelectDataEntity.ExternalSelectSourceBindingEntity data) {
|
||||
ComboBoxOptionFileTransformerModel m = new ComboBoxOptionFileTransformerModel();
|
||||
m.setUri(data.getUri());
|
||||
// m.setUri(data.getUri());
|
||||
m.setSource(data.getSource());
|
||||
m.setLabel(data.getLabel());
|
||||
m.setValue(data.getValue());
|
||||
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) {
|
||||
List<UploadOptionFileTransformerModel> result = new ArrayList<>();
|
||||
for (UploadDataEntity.UploadDataOptionEntity d : data) {
|
||||
|
|
|
@ -39,8 +39,6 @@ public class DefinitionCensor extends BaseCensor {
|
|||
return;
|
||||
|
||||
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));
|
||||
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.convention.ConventionService;
|
||||
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.tools.data.censor.CensorFactory;
|
||||
import gr.cite.tools.fieldset.FieldSet;
|
||||
|
@ -38,6 +40,8 @@ public class PageCensor extends BaseCensor {
|
|||
return;
|
||||
|
||||
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 final static String _sections = "sections";
|
||||
private List<Section> sections;
|
||||
|
||||
public final static String _pages = "pages";
|
||||
private List<Page> pages;
|
||||
|
||||
public List<Section> getSections() {
|
||||
return sections;
|
||||
}
|
||||
|
||||
public void setSections(List<Section> sections) {
|
||||
this.sections = sections;
|
||||
}
|
||||
|
||||
public List<Page> getPages() {
|
||||
return pages;
|
||||
}
|
||||
|
|
|
@ -14,6 +14,9 @@ public class Page {
|
|||
public final static String _title = "title";
|
||||
private String title;
|
||||
|
||||
public final static String _sections = "sections";
|
||||
private List<Section> sections;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
@ -37,6 +40,18 @@ public class Page {
|
|||
public void setTitle(String 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";
|
||||
private String numbering; //TODO maybe remove
|
||||
|
||||
public final static String _page = "page";
|
||||
private String page;
|
||||
|
||||
public final static String _title = "title";
|
||||
private String title;
|
||||
|
||||
|
@ -78,14 +75,6 @@ public class Section {
|
|||
this.numbering = numbering;
|
||||
}
|
||||
|
||||
public String getPage() {
|
||||
return page;
|
||||
}
|
||||
|
||||
public void setPage(String page) {
|
||||
this.page = page;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
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.ExternalSelectDataEntity;
|
||||
|
||||
public class AutoCompleteSingleData {
|
||||
public final static String _autocompleteType = "autocompleteType";
|
||||
private ExternalSelectDataEntity.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 ExternalSelectDataEntity.AutocompleteType getAutocompleteType() {
|
||||
return autocompleteType;
|
||||
}
|
||||
|
||||
public void setAutocompleteType(ExternalSelectDataEntity.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;
|
||||
|
||||
public class ExternalDatasetData extends BaseFieldData {
|
||||
public final static String _multiAutoComplete = "multiAutoComplete";
|
||||
private Boolean multiAutoComplete;
|
||||
public class ExternalDatasetData extends LabelAndMultiplicityData {
|
||||
public final static String _type = "type";
|
||||
private FieldDataExternalDatasetType type;
|
||||
|
||||
public Boolean getMultiAutoComplete() {
|
||||
return multiAutoComplete;
|
||||
}
|
||||
|
||||
public void setMultiAutoComplete(Boolean multiAutoComplete) {
|
||||
this.multiAutoComplete = multiAutoComplete;
|
||||
}
|
||||
|
||||
public FieldDataExternalDatasetType getType() {
|
||||
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;
|
||||
|
||||
public class LabelAndMultiplicityData extends BaseFieldData {
|
||||
public final static String _multiAutoComplete = "multiAutoComplete";
|
||||
private Boolean multiAutoComplete;
|
||||
public final static String _multipleSelect = "multipleSelect";
|
||||
private Boolean multipleSelect;
|
||||
|
||||
public Boolean getMultiAutoComplete() {
|
||||
return multiAutoComplete;
|
||||
public Boolean getMultipleSelect() {
|
||||
return multipleSelect;
|
||||
}
|
||||
public void setMultiAutoComplete(Boolean multiAutoComplete) {
|
||||
this.multiAutoComplete = multiAutoComplete;
|
||||
public void setMultipleSelect(Boolean multipleSelect) {
|
||||
this.multipleSelect = multipleSelect;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,4 +16,27 @@ public class RadioBoxData extends BaseFieldData {
|
|||
public void setOptions(List<RadioBoxOption> 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;
|
||||
}
|
||||
}
|
|
@ -2,25 +2,38 @@ package eu.eudat.model.descriptiontemplatedefinition.fielddata;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
public class SelectData extends BaseFieldData {
|
||||
public class SelectData extends LabelAndMultiplicityData {
|
||||
public final static String _options = "options";
|
||||
private List<ComboBoxOption> options;
|
||||
public final static String _multiList = "multiList";
|
||||
private Boolean multiList;
|
||||
private List<Option> options;
|
||||
|
||||
public List<ComboBoxOption> getOptions() {
|
||||
public List<Option> getOptions() {
|
||||
return options;
|
||||
}
|
||||
|
||||
public void setOptions(List<ComboBoxOption> options) {
|
||||
public void setOptions(List<Option> options) {
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
public Boolean getMultiList() {
|
||||
return multiList;
|
||||
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 setMultiList(Boolean multiList) {
|
||||
this.multiList = multiList;
|
||||
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;
|
||||
}
|
||||
|
||||
public final static String _maxFileSizeInMB = "maxFileSizeInMB";
|
||||
private Integer maxFileSizeInMB;
|
||||
|
||||
public void setTypes(List<UploadOption> types) {
|
||||
this.types = types;
|
||||
}
|
||||
|
||||
private Integer maxFileSizeInMB;
|
||||
|
||||
public Integer getMaxFileSizeInMB() {
|
||||
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;
|
||||
}
|
||||
}
|
|
@ -16,11 +16,11 @@ public class DescriptionPageToDatasetPageMapper {
|
|||
this.descriptionSectionToDatasetSectionMapper = descriptionSectionToDatasetSectionMapper;
|
||||
}
|
||||
|
||||
public DatasetProfilePage toPublicModel(Page page, List<Section> sections) {
|
||||
public DatasetProfilePage toPublicModel(Page page) {
|
||||
DatasetProfilePage model = new DatasetProfilePage();
|
||||
model.setOrdinal(page.getOrdinal());
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,17 +12,17 @@ public class DescriptionSectionToDatasetSectionMapper {
|
|||
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();
|
||||
model.setId(section.getId());
|
||||
model.setDescription(section.getDescription());
|
||||
model.setOrdinal(section.getOrdinal());
|
||||
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.setDefaultVisibility(section.getDefaultVisibility());
|
||||
model.setNumbering(section.getNumbering());
|
||||
model.setPage(section.getPage());
|
||||
model.setPage("page_" + page);
|
||||
model.setCompositeFields(section.getFieldSets().stream().map(descriptionFieldSetToDatasetFieldSetMapper::toPublicModel).toList());
|
||||
return model;
|
||||
}
|
||||
|
|
|
@ -23,17 +23,7 @@ public class DescriptionTemplateToPublicApiDatasetProfileMapper {
|
|||
Definition definition = descriptionTemplate.getDefinition();
|
||||
model.setStatus(descriptionTemplate.getStatus().getValue());
|
||||
model.setPages(definition.getPages().stream().map(
|
||||
x -> 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())
|
||||
descriptionPageToDatasetPageMapper::toPublicModel
|
||||
).toList());
|
||||
return model;
|
||||
}
|
||||
|
|
|
@ -16,21 +16,10 @@ import java.util.List;
|
|||
|
||||
public class DefinitionPersist {
|
||||
|
||||
private List<SectionPersist> sections = null;
|
||||
|
||||
public static final String _sections = "sections";
|
||||
|
||||
private List<PagePersist> pages = null;
|
||||
|
||||
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() {
|
||||
return pages;
|
||||
|
@ -64,14 +53,6 @@ public class DefinitionPersist {
|
|||
@Override
|
||||
protected List<Specification> specifications(DefinitionPersist item) {
|
||||
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()
|
||||
.must(() -> !this.isListNullOrEmpty(item.getPages()))
|
||||
.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";
|
||||
|
||||
private String extendedDescription = null;
|
||||
public static final String _extendedDescription = "extendedDescription";
|
||||
|
||||
private String additionalInformation = null;
|
||||
public static final String _additionalInformation = "additionalInformation";
|
||||
|
||||
private MultiplicityPersist multiplicity = null;
|
||||
|
||||
public static final String _multiplicity = "multiplicity";
|
||||
|
||||
private Boolean hasCommentField = null;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package eu.eudat.model.persist.descriptiontemplatedefinition;
|
||||
|
||||
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;
|
||||
|
@ -27,6 +28,10 @@ public class PagePersist {
|
|||
|
||||
public static final String _title = "title";
|
||||
|
||||
private List<SectionPersist> sections = null;
|
||||
|
||||
public static final String _sections = "sections";
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
@ -51,6 +56,18 @@ public class PagePersist {
|
|||
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)
|
||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public static class PagePersistValidator extends BaseValidator<PagePersist> {
|
||||
|
@ -59,9 +76,12 @@ public class PagePersist {
|
|||
|
||||
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);
|
||||
this.messageSource = messageSource;
|
||||
this.validatorFactory = validatorFactory;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -72,6 +92,14 @@ public class PagePersist {
|
|||
@Override
|
||||
protected List<Specification> specifications(PagePersist item) {
|
||||
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()
|
||||
.must(() -> !this.isEmpty(item.getId()))
|
||||
.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";
|
||||
|
||||
private String page = null;
|
||||
|
||||
public static final String _page = "page";
|
||||
|
||||
private String title = null;
|
||||
|
||||
public static final String _title = "title";
|
||||
|
@ -84,14 +80,6 @@ public class SectionPersist {
|
|||
this.multiplicity = multiplicity;
|
||||
}
|
||||
|
||||
public String getPage() {
|
||||
return page;
|
||||
}
|
||||
|
||||
public void setPage(String page) {
|
||||
this.page = page;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
@ -160,9 +148,6 @@ public class SectionPersist {
|
|||
this.spec()
|
||||
.must(() -> !this.isNull(item.getMultiplicity()))
|
||||
.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()
|
||||
.must(() -> !this.isEmpty(item.getTitle()))
|
||||
.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.ExternalSelectDataEntity;
|
||||
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 ExternalSelectDataEntity.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 ExternalSelectDataEntity.AutocompleteType getAutocompleteType() {
|
||||
return autocompleteType;
|
||||
}
|
||||
|
||||
public void setAutocompleteType(ExternalSelectDataEntity.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",
|
||||
visible = true)
|
||||
@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 = LabelAndMultiplicityDataPersist.class, name = FieldType.Names.InternalDmpDatasets),
|
||||
@JsonSubTypes.Type(value = LabelAndMultiplicityDataPersist.class, name = FieldType.Names.InternalDmpDmps),
|
||||
|
|
|
@ -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 {
|
||||
|
||||
private Boolean multiAutoComplete = null;
|
||||
private Boolean multipleSelect = null;
|
||||
|
||||
public static final String _multiAutoComplete = "multiAutoComplete";
|
||||
public static final String _multipleSelect = "multipleSelect";
|
||||
|
||||
private FieldDataExternalDatasetType type;
|
||||
|
||||
public static final String _type = "type";
|
||||
|
||||
public Boolean getMultiAutoComplete() {
|
||||
return multiAutoComplete;
|
||||
public Boolean getMultipleSelect() {
|
||||
return multipleSelect;
|
||||
}
|
||||
|
||||
public void setMultiAutoComplete(Boolean multiAutoComplete) {
|
||||
this.multiAutoComplete = multiAutoComplete;
|
||||
public void setMultipleSelect(Boolean multipleSelect) {
|
||||
this.multipleSelect = multipleSelect;
|
||||
}
|
||||
|
||||
public FieldDataExternalDatasetType getType() {
|
||||
|
@ -59,8 +59,8 @@ public class ExternalDatasetDataPersist extends BaseFieldDataPersist {
|
|||
List<Specification> specifications = getBaseSpecifications(item);
|
||||
specifications.addAll(Arrays.asList(
|
||||
this.spec()
|
||||
.must(() -> !this.isNull(item.getMultiAutoComplete()))
|
||||
.failOn(ExternalDatasetDataPersist._multiAutoComplete).failWith(messageSource.getMessage("Validation_Required", new Object[]{ExternalDatasetDataPersist._multiAutoComplete}, LocaleContextHolder.getLocale())),
|
||||
.must(() -> !this.isNull(item.getMultipleSelect()))
|
||||
.failOn(ExternalDatasetDataPersist._multipleSelect).failWith(messageSource.getMessage("Validation_Required", new Object[]{ExternalDatasetDataPersist._multipleSelect}, LocaleContextHolder.getLocale())),
|
||||
this.spec()
|
||||
.must(() -> !this.isNull(item.getType()))
|
||||
.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 {
|
||||
|
||||
private Boolean multiAutoComplete;
|
||||
private Boolean multipleSelect;
|
||||
|
||||
public static final String _multiAutoComplete = "multiAutoComplete";
|
||||
public static final String _multipleSelect = "multipleSelect";
|
||||
|
||||
public Boolean getMultiAutoComplete() {
|
||||
return multiAutoComplete;
|
||||
public Boolean getMultipleSelect() {
|
||||
return multipleSelect;
|
||||
}
|
||||
|
||||
public void setMultiAutoComplete(Boolean multiAutoComplete) {
|
||||
this.multiAutoComplete = multiAutoComplete;
|
||||
public void setMultipleSelect(Boolean multipleSelect) {
|
||||
this.multipleSelect = multipleSelect;
|
||||
}
|
||||
|
||||
@Component(LabelAndMultiplicityDataPersist.LabelAndMultiplicityDataPersistValidator.ValidatorName)
|
||||
|
@ -45,8 +45,8 @@ public class LabelAndMultiplicityDataPersist extends BaseFieldDataPersist {
|
|||
List<Specification> specifications = getBaseSpecifications(item);
|
||||
specifications.add(
|
||||
this.spec()
|
||||
.must(() -> !this.isNull(item.getMultiAutoComplete()))
|
||||
.failOn(LabelAndMultiplicityDataPersist._multiAutoComplete).failWith(messageSource.getMessage("Validation_Required", new Object[]{LabelAndMultiplicityDataPersist._multiAutoComplete}, LocaleContextHolder.getLocale()))
|
||||
.must(() -> !this.isNull(item.getMultipleSelect()))
|
||||
.failOn(LabelAndMultiplicityDataPersist._multipleSelect).failWith(messageSource.getMessage("Validation_Required", new Object[]{LabelAndMultiplicityDataPersist._multipleSelect}, LocaleContextHolder.getLocale()))
|
||||
);
|
||||
return specifications;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
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;
|
||||
|
@ -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()))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
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;
|
||||
|
@ -15,28 +16,29 @@ import java.util.List;
|
|||
|
||||
public class SelectDataPersist extends BaseFieldDataPersist {
|
||||
|
||||
private List<ComboBoxOptionPersist> options = null;
|
||||
private List<OptionPersist> options = null;
|
||||
|
||||
public static final String _options = "options";
|
||||
|
||||
private Boolean multiList = null;
|
||||
|
||||
public static final String _multiList = "multiList";
|
||||
private Boolean multipleSelect = null;
|
||||
|
||||
public List<ComboBoxOptionPersist> getOptions() {
|
||||
public static final String _multipleSelect = "multipleSelect";
|
||||
|
||||
public List<OptionPersist> getOptions() {
|
||||
return options;
|
||||
}
|
||||
|
||||
public void setOptions(List<ComboBoxOptionPersist> options) {
|
||||
public void setOptions(List<OptionPersist> options) {
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
public Boolean getMultiList() {
|
||||
return multiList;
|
||||
public Boolean getMultipleSelect() {
|
||||
return multipleSelect;
|
||||
}
|
||||
|
||||
public void setMultiList(Boolean multiList) {
|
||||
this.multiList = multiList;
|
||||
public void setMultipleSelect(Boolean multipleSelect) {
|
||||
this.multipleSelect = multipleSelect;
|
||||
}
|
||||
|
||||
@Component(SelectDataPersistValidator.ValidatorName)
|
||||
|
@ -62,8 +64,8 @@ public class SelectDataPersist extends BaseFieldDataPersist {
|
|||
List<Specification> specifications = getBaseSpecifications(item);
|
||||
specifications.addAll(Arrays.asList(
|
||||
this.spec()
|
||||
.must(() -> !this.isNull(item.getMultiList()))
|
||||
.failOn(SelectDataPersist._multiList).failWith(messageSource.getMessage("Validation_Required", new Object[]{SelectDataPersist._multiList}, LocaleContextHolder.getLocale())),
|
||||
.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()))
|
||||
|
@ -72,10 +74,68 @@ public class SelectDataPersist extends BaseFieldDataPersist {
|
|||
.iff(() -> !this.isNull(item.getOptions()))
|
||||
.on(SelectDataPersist._options)
|
||||
.over(item.getOptions())
|
||||
.using((itm) -> this.validatorFactory.validator(ComboBoxOptionPersist.ComboBoxOptionPersistValidator.class))
|
||||
.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;
|
||||
|
||||
import eu.eudat.commons.validation.BaseValidator;
|
||||
import gr.cite.tools.validation.ValidatorFactory;
|
||||
import gr.cite.tools.validation.specification.Specification;
|
||||
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()))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -57,7 +57,7 @@ public class DefinitionPersist {
|
|||
return Arrays.asList(
|
||||
this.spec()
|
||||
.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()
|
||||
.iff(() -> !this.isListNullOrEmpty(item.getSections()))
|
||||
.on(DefinitionPersist._sections)
|
||||
|
|
|
@ -306,12 +306,7 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
|
|||
DefinitionEntity data = new DefinitionEntity();
|
||||
if (persist == null)
|
||||
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())) {
|
||||
data.setPages(new ArrayList<>());
|
||||
for (PagePersist pagePersist : persist.getPages()) {
|
||||
|
@ -332,7 +327,6 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
|
|||
data.setOrdinal(persist.getOrdinal());
|
||||
data.setDefaultVisibility(persist.getDefaultVisibility());
|
||||
data.setMultiplicity(persist.getMultiplicity());
|
||||
data.setPage(persist.getPage());
|
||||
data.setTitle(persist.getTitle());
|
||||
|
||||
if (!this.conventionService.isListNullOrEmpty(persist.getSections())) {
|
||||
|
@ -402,7 +396,7 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
|
|||
return data;
|
||||
}
|
||||
|
||||
private BaseFieldDataEntity<?> buildFieldDataEntity(BaseFieldDataPersist persist) {
|
||||
private BaseFieldDataEntity buildFieldDataEntity(BaseFieldDataPersist persist) {
|
||||
if (persist == null)
|
||||
return null;
|
||||
return this.fieldDataHelperServiceProvider.get(persist.getFieldType()).applyPersist(persist);
|
||||
|
@ -442,6 +436,13 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
|
|||
data.setId(persist.getId());
|
||||
data.setOrdinal(persist.getOrdinal());
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -484,12 +485,6 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
|
|||
if (model == null)
|
||||
return;
|
||||
|
||||
if (model.getSections() != null) {
|
||||
for (Section section : model.getSections()) {
|
||||
this.reassignSection(section);
|
||||
}
|
||||
}
|
||||
|
||||
if (model.getPages() != null) {
|
||||
for (Page page : model.getPages()) {
|
||||
this.reassignPage(page);
|
||||
|
@ -501,6 +496,13 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
|
|||
if (model == null)
|
||||
return;
|
||||
model.setId(UUID.randomUUID().toString());
|
||||
|
||||
if (model.getSections() != null) {
|
||||
for (Section section : model.getSections()) {
|
||||
this.reassignSection(section);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void reassignSection(Section model) {
|
||||
|
@ -632,19 +634,12 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
|
|||
return null;
|
||||
|
||||
List<PagePersist> pagesDatasetEntity = new LinkedList<>();
|
||||
List<SectionPersist> sectionDatasetEntity = new LinkedList<>();
|
||||
if (!this.conventionService.isListNullOrEmpty(importExport.getPages())) {
|
||||
for (PageImportExport xmlPage : importExport.getPages()) {
|
||||
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.setSections(sectionDatasetEntity);
|
||||
|
||||
return definitionPersist;
|
||||
}
|
||||
|
@ -654,6 +649,14 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
|
|||
pageEntity.setId(importExport.getId());
|
||||
pageEntity.setOrdinal(importExport.getOrdinal());
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -669,7 +672,6 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
|
|||
sectionEntity.setId(importExport.getId());
|
||||
sectionEntity.setOrdinal(importExport.getOrdinal());
|
||||
sectionEntity.setTitle(importExport.getTitle());
|
||||
sectionEntity.setPage(importExport.getPage());
|
||||
sectionEntity.setDescription(importExport.getDescription());
|
||||
List<FieldSetPersist> fieldSetEntity = new LinkedList<>();
|
||||
if (!this.conventionService.isListNullOrEmpty(importExport.getFieldSets())) {
|
||||
|
@ -688,7 +690,7 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
|
|||
FieldSetPersist fieldSet1Entity = new FieldSetPersist();
|
||||
fieldSet1Entity.setId(importExport.getId());
|
||||
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.setTitle(importExport.getTitle());
|
||||
fieldSet1Entity.setDescription(importExport.getDescription());
|
||||
|
@ -735,7 +737,7 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
|
|||
return ruleEntity;
|
||||
}
|
||||
|
||||
public MultiplicityPersist xmlMultiplicityToPersist(MultiplicityImportXml importXml) {
|
||||
public MultiplicityPersist xmlMultiplicityToPersist(MultiplicityImportExport importXml) {
|
||||
MultiplicityPersist multiplicityEntity = new MultiplicityPersist();
|
||||
multiplicityEntity.setMax(importXml.getMax());
|
||||
multiplicityEntity.setMin(importXml.getMin());
|
||||
|
@ -769,26 +771,24 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
|
|||
xml.setDescription(data.getDescription());
|
||||
List<PageImportExport> pagesDatasetEntity = new LinkedList<>();
|
||||
for (PageEntity xmlPage : entity.getPages()) {
|
||||
pagesDatasetEntity.add(this.pageXmlToExport(xmlPage, entity.getSections()));
|
||||
pagesDatasetEntity.add(this.pageXmlToExport(xmlPage));
|
||||
}
|
||||
xml.setPages(pagesDatasetEntity);
|
||||
|
||||
return xml;
|
||||
}
|
||||
|
||||
private PageImportExport pageXmlToExport(PageEntity entity, List<SectionEntity> sectionEntities) {
|
||||
private PageImportExport pageXmlToExport(PageEntity entity) {
|
||||
PageImportExport xml = new PageImportExport();
|
||||
xml.setId(entity.getId());
|
||||
xml.setOrdinal(entity.getOrdinal());
|
||||
xml.setTitle(entity.getTitle());
|
||||
List<SectionImportExport> sectionsListEntity = new LinkedList<>();
|
||||
if (!this.conventionService.isListNullOrEmpty(sectionEntities)) {
|
||||
for (SectionEntity section : sectionEntities) {
|
||||
if (section.getPage().equals(entity.getId())) {
|
||||
if (!this.conventionService.isListNullOrEmpty(entity.getSections())) {
|
||||
for (SectionEntity section : entity.getSections()) {
|
||||
sectionsListEntity.add(this.sectionXmlToExport(section));
|
||||
}
|
||||
}
|
||||
}
|
||||
xml.setSections(sectionsListEntity);
|
||||
|
||||
return xml;
|
||||
|
@ -808,7 +808,6 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
|
|||
xml.setId(entity.getId());
|
||||
xml.setOrdinal(entity.getOrdinal());
|
||||
xml.setTitle(entity.getTitle());
|
||||
xml.setPage(entity.getPage());
|
||||
xml.setDescription(entity.getDescription());
|
||||
List<FieldSetImportExport> fieldSetEntity = new LinkedList<>();
|
||||
if (!this.conventionService.isListNullOrEmpty(entity.getFieldSets())) {
|
||||
|
@ -826,7 +825,7 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
|
|||
FieldSetImportExport fieldSet1Entity = new FieldSetImportExport();
|
||||
fieldSet1Entity.setId(entity.getId());
|
||||
fieldSet1Entity.setOrdinal(entity.getOrdinal());
|
||||
fieldSet1Entity.setCommentField(entity.getHasCommentField());
|
||||
fieldSet1Entity.setHasCommentField(entity.getHasCommentField());
|
||||
fieldSet1Entity.setMultiplicity(entity.getMultiplicity() != null ? this.multiplicityXmlToExport(entity.getMultiplicity()) : null);
|
||||
fieldSet1Entity.setTitle(entity.getTitle());
|
||||
fieldSet1Entity.setDescription(entity.getDescription());
|
||||
|
@ -873,8 +872,8 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
|
|||
return xml;
|
||||
}
|
||||
|
||||
private MultiplicityImportXml multiplicityXmlToExport(MultiplicityEntity entity) {
|
||||
MultiplicityImportXml xml = new MultiplicityImportXml();
|
||||
private MultiplicityImportExport multiplicityXmlToExport(MultiplicityEntity entity) {
|
||||
MultiplicityImportExport xml = new MultiplicityImportExport();
|
||||
xml.setMax(entity.getMax());
|
||||
xml.setMin(entity.getMin());
|
||||
xml.setPlaceholder(entity.getPlaceholder());
|
||||
|
|
|
@ -1,242 +0,0 @@
|
|||
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.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, ExternalSelectDataEntity, 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 ExternalSelectDataEntity newDataInstanceInternal() {
|
||||
return new ExternalSelectDataEntity();
|
||||
}
|
||||
|
||||
@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 ExternalSelectDataEntity.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<ExternalSelectDataEntity> data, EnumSet<AuthorizationFlags> authorizationFlags){
|
||||
return this.builderFactory.builder(AutoCompleteDataBuilder.class).authorize(authorizationFlags).build(fieldSet, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ExternalSelectDataEntity applyPersistInternal(AutoCompleteDataPersist persist, ExternalSelectDataEntity data) {
|
||||
data.setMultipleSelect(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 ExternalSelectDataEntity.ExternalSelectSourceEntity buildAutoCompleteSingleData(AutoCompleteSingleDataPersist persist){
|
||||
ExternalSelectDataEntity.ExternalSelectSourceEntity data = new ExternalSelectDataEntity.ExternalSelectSourceEntity();
|
||||
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.setExternalSelectSourceBindingEntity(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 ExternalSelectDataEntity.ExternalSelectAuthDataEntity buildAuthAutoCompleteData(AuthAutoCompleteDataPersist 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 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(ExternalSelectDataEntity data, AutoCompleteDataImportExport xml) {
|
||||
xml.setMultiAutoComplete(data.getMultipleSelect());
|
||||
if (!this.conventionService.isListNullOrEmpty(data.getAutoCompleteSingleDataList())){
|
||||
xml.setAutoCompleteSingleDataList(new ArrayList<>());
|
||||
for (ExternalSelectDataEntity.ExternalSelectSourceEntity externalSelectSourceEntity : data.getAutoCompleteSingleDataList()) {
|
||||
xml.getAutoCompleteSingleDataList().add(this.buildAutoCompleteSingleData(externalSelectSourceEntity));
|
||||
}
|
||||
}
|
||||
return xml;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isMultiValueInternal(ExternalSelectDataEntity data) {
|
||||
return data.getMultipleSelect();
|
||||
}
|
||||
|
||||
private @NotNull AutoCompleteSingleData buildAutoCompleteSingleData(ExternalSelectDataEntity.ExternalSelectSourceEntity 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.getExternalSelectSourceBindingEntity() != null) xml.setAutoCompleteOptions(this.buildOption(data.getExternalSelectSourceBindingEntity()));
|
||||
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(ExternalSelectDataEntity.ExternalSelectAuthDataEntity 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.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 abstract D newDataInstanceInternal();
|
||||
|
@ -36,7 +36,7 @@ public abstract class BaseFieldDataHelperService<M extends BaseFieldData, PM ext
|
|||
}
|
||||
|
||||
@Override
|
||||
public BaseFieldDataEntity<?> newDataInstance() {
|
||||
public BaseFieldDataEntity newDataInstance() {
|
||||
return this.newDataInstanceInternal();
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ public abstract class BaseFieldDataHelperService<M extends BaseFieldData, PM ext
|
|||
}
|
||||
|
||||
@Override
|
||||
public BaseFieldDataImportExport dataToImportExportXml(BaseFieldDataEntity<?> data){
|
||||
public BaseFieldDataImportExport dataToImportExportXml(BaseFieldDataEntity data){
|
||||
IE xml = this.newImportExportInstanceInternal();
|
||||
xml.setLabel(data.getLabel());
|
||||
xml.setFieldType(data.getFieldType());
|
||||
|
@ -72,30 +72,30 @@ public abstract class BaseFieldDataHelperService<M extends BaseFieldData, PM ext
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isMultiValue(BaseFieldDataEntity<?> data){
|
||||
public boolean isMultiValue(BaseFieldDataEntity data){
|
||||
return this.isMultiValueInternal((D)data);
|
||||
}
|
||||
@Override
|
||||
public BaseFieldDataEntity<?> applyPersist(BaseFieldDataPersist persist){
|
||||
BaseFieldDataEntity<?> instance = this.newDataInstance();
|
||||
public BaseFieldDataEntity applyPersist(BaseFieldDataPersist persist){
|
||||
BaseFieldDataEntity instance = this.newDataInstance();
|
||||
return this.applyPersist(persist, instance);
|
||||
}
|
||||
@Override
|
||||
public BaseFieldDataEntity<?> applyPersist(BaseFieldDataPersist persist, BaseFieldDataEntity<?> data){
|
||||
public BaseFieldDataEntity applyPersist(BaseFieldDataPersist persist, BaseFieldDataEntity data){
|
||||
data.setLabel(persist.getLabel());
|
||||
data.setFieldType(persist.getFieldType());
|
||||
return this.applyPersistInternal((PM)persist, (D)data);
|
||||
}
|
||||
|
||||
@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);
|
||||
if (models == null || models.isEmpty()) return null;
|
||||
return models.get(0);
|
||||
}
|
||||
|
||||
@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());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -75,21 +75,21 @@ public class ExternalDatasetFieldDataHelperService extends BaseFieldDataHelperSe
|
|||
|
||||
@Override
|
||||
protected ExternalDatasetDataEntity applyPersistInternal(ExternalDatasetDataPersist persist, ExternalDatasetDataEntity data) {
|
||||
data.setMultipleSelect(persist.getMultiAutoComplete());
|
||||
data.setMultipleSelect(persist.getMultipleSelect());
|
||||
data.setType(persist.getType());
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ExternalDatasetDataPersist importExportMapDataToPersistInternal(ExternalDatasetDataImportExport data, ExternalDatasetDataPersist persist) {
|
||||
persist.setMultiAutoComplete(data.getMultiAutoComplete());
|
||||
persist.setMultipleSelect(data.getMultipleSelect());
|
||||
persist.setType(data.getType());
|
||||
return persist;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ExternalDatasetDataImportExport dataToImportExportXmlInternal(ExternalDatasetDataEntity data, ExternalDatasetDataImportExport xml) {
|
||||
xml.setMultiAutoComplete(data.getMultipleSelect());
|
||||
xml.setMultipleSelect(data.getMultipleSelect());
|
||||
xml.setType(data.getType());
|
||||
return xml;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -14,7 +14,7 @@ import java.util.List;
|
|||
|
||||
public interface FieldDataHelperService {
|
||||
FieldType getFieldType();
|
||||
BaseFieldDataEntity<?> newDataInstance();
|
||||
BaseFieldDataEntity newDataInstance();
|
||||
BaseFieldData newModelInstance();
|
||||
BaseFieldDataPersist newPersistModelInstance();
|
||||
BaseFieldDataImportExport newImportExportInstance();
|
||||
|
@ -23,11 +23,11 @@ public interface FieldDataHelperService {
|
|||
Class<?> getPersistModelClass();
|
||||
Class<?> getImportExportClass();
|
||||
Validator getPersistModelValidator();
|
||||
List<BaseFieldData> build(gr.cite.tools.fieldset.FieldSet fieldSet, List<BaseFieldDataEntity<?>> data, EnumSet<AuthorizationFlags> authorizationFlags);
|
||||
BaseFieldData buildOne(FieldSet fieldSet, BaseFieldDataEntity<?> data, EnumSet<AuthorizationFlags> authorizationFlags);
|
||||
BaseFieldDataEntity<?> applyPersist(BaseFieldDataPersist persist);
|
||||
BaseFieldDataEntity<?> applyPersist(BaseFieldDataPersist persist, BaseFieldDataEntity<?> data);
|
||||
List<BaseFieldData> build(gr.cite.tools.fieldset.FieldSet fieldSet, List<BaseFieldDataEntity> data, EnumSet<AuthorizationFlags> authorizationFlags);
|
||||
BaseFieldData buildOne(FieldSet fieldSet, BaseFieldDataEntity data, EnumSet<AuthorizationFlags> authorizationFlags);
|
||||
BaseFieldDataEntity applyPersist(BaseFieldDataPersist persist);
|
||||
BaseFieldDataEntity applyPersist(BaseFieldDataPersist persist, BaseFieldDataEntity data);
|
||||
BaseFieldDataPersist importExportMapDataToPersist(BaseFieldDataImportExport xml);
|
||||
BaseFieldDataImportExport dataToImportExportXml(BaseFieldDataEntity<?> data);
|
||||
boolean isMultiValue(BaseFieldDataEntity<?> data);
|
||||
BaseFieldDataImportExport dataToImportExportXml(BaseFieldDataEntity data);
|
||||
boolean isMultiValue(BaseFieldDataEntity data);
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ public class FieldDataHelperServiceProvider {
|
|||
break;
|
||||
}
|
||||
case AUTO_COMPLETE: {
|
||||
item = this.applicationContext.getBean(AutoCompleteFieldDataHelperService.class);
|
||||
item = this.applicationContext.getBean(ExternalSelectFieldDataHelperService.class);
|
||||
break;
|
||||
}
|
||||
default: throw new RuntimeException("unrecognized builder " + type.getValue());
|
||||
|
|
|
@ -76,19 +76,19 @@ public class LabelAndMultiplicityFieldDataHelperService extends BaseFieldDataHel
|
|||
|
||||
@Override
|
||||
protected LabelAndMultiplicityDataEntity applyPersistInternal(LabelAndMultiplicityDataPersist persist, LabelAndMultiplicityDataEntity data) {
|
||||
data.setMultipleSelect(persist.getMultiAutoComplete());
|
||||
data.setMultipleSelect(persist.getMultipleSelect());
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected LabelAndMultiplicityDataPersist importExportMapDataToPersistInternal(LabelAndMultiplicityDataImportExport data, LabelAndMultiplicityDataPersist persist){
|
||||
persist.setMultiAutoComplete(data.getMultiAutoComplete());
|
||||
persist.setMultipleSelect(data.getMultipleSelect());
|
||||
return persist;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected LabelAndMultiplicityDataImportExport dataToImportExportXmlInternal(LabelAndMultiplicityDataEntity data, LabelAndMultiplicityDataImportExport xml) {
|
||||
xml.setMultiAutoComplete(data.getMultipleSelect());
|
||||
xml.setMultipleSelect(data.getMultipleSelect());
|
||||
return xml;
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ package eu.eudat.service.fielddatahelper;
|
|||
import eu.eudat.authorization.AuthorizationFlags;
|
||||
import eu.eudat.commons.types.descriptiontemplate.fielddata.RadioBoxDataEntity;
|
||||
import eu.eudat.commons.types.descriptiontemplate.importexport.fielddata.RadioBoxDataImportExport;
|
||||
import eu.eudat.commons.types.descriptiontemplate.importexport.fielddata.RadioBoxOption;
|
||||
import eu.eudat.convention.ConventionService;
|
||||
import eu.eudat.model.builder.descriptiontemplatedefinition.fielddata.RadioBoxDataBuilder;
|
||||
import eu.eudat.model.descriptiontemplatedefinition.fielddata.RadioBoxData;
|
||||
|
@ -85,14 +84,14 @@ public class RadioBoxFieldDataHelperService extends BaseFieldDataHelperService<R
|
|||
protected RadioBoxDataEntity applyPersistInternal(RadioBoxDataPersist persist, RadioBoxDataEntity data) {
|
||||
if (!this.conventionService.isListNullOrEmpty(persist.getOptions())){
|
||||
data.setOptions(new ArrayList<>());
|
||||
for (RadioBoxOptionPersist radioBoxOptionPersist: persist.getOptions()) {
|
||||
for (RadioBoxDataPersist.RadioBoxOptionPersist radioBoxOptionPersist: persist.getOptions()) {
|
||||
data.getOptions().add(this.buildOption(radioBoxOptionPersist));
|
||||
}
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
private @NotNull RadioBoxDataEntity.RadioBoxDataOptionEntity buildOption(RadioBoxOptionPersist persist){
|
||||
private @NotNull RadioBoxDataEntity.RadioBoxDataOptionEntity buildOption(RadioBoxDataPersist.RadioBoxOptionPersist persist){
|
||||
RadioBoxDataEntity.RadioBoxDataOptionEntity data = new RadioBoxDataEntity.RadioBoxDataOptionEntity();
|
||||
if (persist == null) return data;
|
||||
|
||||
|
@ -106,15 +105,15 @@ public class RadioBoxFieldDataHelperService extends BaseFieldDataHelperService<R
|
|||
protected RadioBoxDataPersist importExportMapDataToPersistInternal(RadioBoxDataImportExport data, RadioBoxDataPersist persist){
|
||||
if (!this.conventionService.isListNullOrEmpty(data.getOptions())){
|
||||
persist.setOptions(new ArrayList<>());
|
||||
for (RadioBoxOption radioBoxOption: data.getOptions()) {
|
||||
for (RadioBoxDataImportExport.RadioBoxOption radioBoxOption: data.getOptions()) {
|
||||
persist.getOptions().add(this.buildOption(radioBoxOption));
|
||||
}
|
||||
}
|
||||
return persist;
|
||||
}
|
||||
|
||||
private @NotNull RadioBoxOptionPersist buildOption(RadioBoxOption data){
|
||||
RadioBoxOptionPersist persist = new RadioBoxOptionPersist();
|
||||
private @NotNull RadioBoxDataPersist.RadioBoxOptionPersist buildOption(RadioBoxDataImportExport.RadioBoxOption data){
|
||||
RadioBoxDataPersist.RadioBoxOptionPersist persist = new RadioBoxDataPersist.RadioBoxOptionPersist();
|
||||
if (data == null) return persist;
|
||||
|
||||
persist.setLabel(data.getLabel());
|
||||
|
@ -139,8 +138,8 @@ public class RadioBoxFieldDataHelperService extends BaseFieldDataHelperService<R
|
|||
return false;
|
||||
}
|
||||
|
||||
private @NotNull RadioBoxOption buildOption(RadioBoxDataEntity.RadioBoxDataOptionEntity data){
|
||||
RadioBoxOption xml = new RadioBoxOption();
|
||||
private @NotNull RadioBoxDataImportExport.RadioBoxOption buildOption(RadioBoxDataEntity.RadioBoxDataOptionEntity data){
|
||||
RadioBoxDataImportExport.RadioBoxOption xml = new RadioBoxDataImportExport.RadioBoxOption();
|
||||
if (data == null) return xml;
|
||||
|
||||
xml.setLabel(data.getLabel());
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
package eu.eudat.service.fielddatahelper;
|
||||
|
||||
import eu.eudat.authorization.AuthorizationFlags;
|
||||
import eu.eudat.commons.types.descriptiontemplate.fielddata.*;
|
||||
import eu.eudat.commons.types.descriptiontemplate.fielddata.SelectDataEntity;
|
||||
import eu.eudat.commons.types.descriptiontemplate.importexport.fielddata.ComboBoxDataOptionEntity;
|
||||
import eu.eudat.commons.types.descriptiontemplate.importexport.fielddata.SelectDataImportExport;
|
||||
import eu.eudat.convention.ConventionService;
|
||||
import eu.eudat.model.builder.descriptiontemplatedefinition.fielddata.SelectDataBuilder;
|
||||
|
@ -84,10 +82,10 @@ public class SelectFieldDataHelperService extends BaseFieldDataHelperService<Sel
|
|||
|
||||
@Override
|
||||
protected SelectDataEntity applyPersistInternal(SelectDataPersist persist, SelectDataEntity data) {
|
||||
data.setMultiList(persist.getMultiList());
|
||||
data.setMultipleSelect(persist.getMultipleSelect());
|
||||
if (!this.conventionService.isListNullOrEmpty(persist.getOptions())){
|
||||
data.setOptions(new ArrayList<>());
|
||||
for (ComboBoxOptionPersist optionPersist: persist.getOptions()) {
|
||||
for (SelectDataPersist.OptionPersist optionPersist: persist.getOptions()) {
|
||||
data.getOptions().add(this.buildOption(optionPersist));
|
||||
}
|
||||
}
|
||||
|
@ -95,48 +93,44 @@ public class SelectFieldDataHelperService extends BaseFieldDataHelperService<Sel
|
|||
}
|
||||
|
||||
|
||||
private @NotNull ComboBoxDataEntity.Option buildOption(ComboBoxOptionPersist persist){
|
||||
ComboBoxDataEntity.Option data = new ComboBoxDataEntity.Option();
|
||||
private @NotNull SelectDataEntity.OptionEntity buildOption(SelectDataPersist.OptionPersist persist){
|
||||
SelectDataEntity.OptionEntity data = new SelectDataEntity.OptionEntity();
|
||||
if (persist == null) return data;
|
||||
|
||||
data.setLabel(persist.getLabel());
|
||||
data.setValue(persist.getValue());
|
||||
data.setUri(persist.getUri());
|
||||
data.setSource(persist.getSource());
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SelectDataPersist importExportMapDataToPersistInternal(SelectDataImportExport data, SelectDataPersist persist) {
|
||||
persist.setMultiList(data.getMultiList());
|
||||
persist.setMultipleSelect(data.getMultipleSelect());
|
||||
if (!this.conventionService.isListNullOrEmpty(data.getOptions())){
|
||||
persist.setOptions(new ArrayList<>());
|
||||
for (ComboBoxDataOptionEntity option: data.getOptions()) {
|
||||
for (SelectDataImportExport.OptionImportExport option: data.getOptions()) {
|
||||
persist.getOptions().add(this.buildOption(option));
|
||||
}
|
||||
}
|
||||
return persist;
|
||||
}
|
||||
|
||||
private @NotNull ComboBoxOptionPersist buildOption(ComboBoxDataOptionEntity data){
|
||||
ComboBoxOptionPersist persist = new ComboBoxOptionPersist();
|
||||
private @NotNull SelectDataPersist.OptionPersist buildOption(SelectDataImportExport.OptionImportExport data){
|
||||
SelectDataPersist.OptionPersist persist = new SelectDataPersist.OptionPersist();
|
||||
if (data == null) return persist;
|
||||
|
||||
persist.setLabel(data.getLabel());
|
||||
persist.setValue(data.getValue());
|
||||
persist.setUri(data.getUri());
|
||||
persist.setSource(data.getSource());
|
||||
|
||||
return persist;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SelectDataImportExport dataToImportExportXmlInternal(SelectDataEntity data, SelectDataImportExport xml) {
|
||||
xml.setMultiList(data.getMultiList());
|
||||
xml.setMultipleSelect(data.getMultipleSelect());
|
||||
if (!this.conventionService.isListNullOrEmpty(data.getOptions())){
|
||||
xml.setOptions(new ArrayList<>());
|
||||
for (ComboBoxDataEntity.Option option: data.getOptions()) {
|
||||
for (SelectDataEntity.OptionEntity option: data.getOptions()) {
|
||||
xml.getOptions().add(this.buildOption(option));
|
||||
}
|
||||
}
|
||||
|
@ -145,17 +139,15 @@ public class SelectFieldDataHelperService extends BaseFieldDataHelperService<Sel
|
|||
|
||||
@Override
|
||||
protected boolean isMultiValueInternal(SelectDataEntity data) {
|
||||
return data.getMultiList();
|
||||
return data.getMultipleSelect();
|
||||
}
|
||||
|
||||
private @NotNull ComboBoxDataOptionEntity buildOption(ComboBoxDataEntity.Option data){
|
||||
ComboBoxDataOptionEntity xml = new ComboBoxDataOptionEntity();
|
||||
private @NotNull SelectDataImportExport.OptionImportExport buildOption(SelectDataEntity.OptionEntity data){
|
||||
SelectDataImportExport.OptionImportExport xml = new SelectDataImportExport.OptionImportExport();
|
||||
if (data == null) return xml;
|
||||
|
||||
xml.setLabel(data.getLabel());
|
||||
xml.setValue(data.getValue());
|
||||
xml.setUri(data.getUri());
|
||||
xml.setSource(data.getSource());
|
||||
|
||||
return xml;
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@ package eu.eudat.service.fielddatahelper;
|
|||
import eu.eudat.authorization.AuthorizationFlags;
|
||||
import eu.eudat.commons.types.descriptiontemplate.fielddata.UploadDataEntity;
|
||||
import eu.eudat.commons.types.descriptiontemplate.importexport.fielddata.UploadDataImportExport;
|
||||
import eu.eudat.commons.types.descriptiontemplate.importexport.fielddata.UploadDataOption;
|
||||
import eu.eudat.convention.ConventionService;
|
||||
import eu.eudat.model.builder.descriptiontemplatedefinition.fielddata.UploadDataBuilder;
|
||||
import eu.eudat.model.descriptiontemplatedefinition.fielddata.UploadData;
|
||||
|
@ -86,7 +85,7 @@ public class UploadFieldDataHelperService extends BaseFieldDataHelperService<Upl
|
|||
protected UploadDataEntity applyPersistInternal(UploadDataPersist persist, UploadDataEntity data) {
|
||||
if (!this.conventionService.isListNullOrEmpty(persist.getTypes())){
|
||||
data.setTypes(new ArrayList<>());
|
||||
for (UploadOptionPersist uploadOptionPersist: persist.getTypes()) {
|
||||
for (UploadDataPersist.UploadOptionPersist uploadOptionPersist: persist.getTypes()) {
|
||||
data.getTypes().add(this.buildOption(uploadOptionPersist));
|
||||
}
|
||||
}
|
||||
|
@ -94,7 +93,7 @@ public class UploadFieldDataHelperService extends BaseFieldDataHelperService<Upl
|
|||
return data;
|
||||
}
|
||||
|
||||
private @NotNull UploadDataEntity.UploadDataOptionEntity buildOption(UploadOptionPersist persist){
|
||||
private @NotNull UploadDataEntity.UploadDataOptionEntity buildOption(UploadDataPersist.UploadOptionPersist persist){
|
||||
UploadDataEntity.UploadDataOptionEntity data = new UploadDataEntity.UploadDataOptionEntity();
|
||||
if (persist == null) return data;
|
||||
|
||||
|
@ -108,7 +107,7 @@ public class UploadFieldDataHelperService extends BaseFieldDataHelperService<Upl
|
|||
protected UploadDataPersist importExportMapDataToPersistInternal(UploadDataImportExport data, UploadDataPersist persist) {
|
||||
if (!this.conventionService.isListNullOrEmpty(data.getTypes())){
|
||||
persist.setTypes(new ArrayList<>());
|
||||
for (UploadDataOption option: data.getTypes()) {
|
||||
for (UploadDataImportExport.UploadDataOption option: data.getTypes()) {
|
||||
persist.getTypes().add(this.buildOption(option));
|
||||
}
|
||||
}
|
||||
|
@ -116,8 +115,8 @@ public class UploadFieldDataHelperService extends BaseFieldDataHelperService<Upl
|
|||
return persist;
|
||||
}
|
||||
|
||||
private @NotNull UploadOptionPersist buildOption(UploadDataOption data){
|
||||
UploadOptionPersist persist = new UploadOptionPersist();
|
||||
private @NotNull UploadDataPersist.UploadOptionPersist buildOption(UploadDataImportExport.UploadDataOption data){
|
||||
UploadDataPersist.UploadOptionPersist persist = new UploadDataPersist.UploadOptionPersist();
|
||||
if (data == null) return persist;
|
||||
|
||||
persist.setLabel(data.getLabel());
|
||||
|
@ -143,8 +142,8 @@ public class UploadFieldDataHelperService extends BaseFieldDataHelperService<Upl
|
|||
return false;
|
||||
}
|
||||
|
||||
private @NotNull UploadDataOption buildOption(UploadDataEntity.UploadDataOptionEntity data){
|
||||
UploadDataOption xml = new UploadDataOption();
|
||||
private @NotNull UploadDataImportExport.UploadDataOption buildOption(UploadDataEntity.UploadDataOptionEntity data){
|
||||
UploadDataImportExport.UploadDataOption xml = new UploadDataImportExport.UploadDataOption();
|
||||
if (data == null) return xml;
|
||||
|
||||
xml.setLabel(data.getLabel());
|
||||
|
|
|
@ -391,9 +391,9 @@ public class PrefillingServiceImpl implements PrefillingService {
|
|||
return !normalizedValues.isEmpty() ? (isMultiSelect ? normalizedValues : normalizedValues.getFirst()) : null;
|
||||
} else {
|
||||
SelectDataEntity selectDataEntity = (SelectDataEntity)fieldEntity.getData();
|
||||
isMultiSelect = selectDataEntity.getMultiList();
|
||||
isMultiSelect = selectDataEntity.getMultipleSelect();
|
||||
if (selectDataEntity.getOptions() != null) {
|
||||
for (ComboBoxDataEntity.Option option : selectDataEntity.getOptions()) {
|
||||
for (SelectDataEntity.OptionEntity option : selectDataEntity.getOptions()) {
|
||||
if (parsedValues.contains(option.getValue())) {
|
||||
normalizedValues.add(option.getValue());
|
||||
}
|
||||
|
@ -427,7 +427,7 @@ public class PrefillingServiceImpl implements PrefillingService {
|
|||
List<Map<String, String>> rawResults = new ArrayList<>();
|
||||
genericUrls.setFetchMode(FetchStrategy.FIRST);
|
||||
urlCriteria.setLike(like);
|
||||
for (ExternalSelectDataEntity.ExternalSelectSourceEntity singleData : data.getAutoCompleteSingleDataList()) {
|
||||
for (ExternalSelectDataEntity.ExternalSelectSourceEntity singleData : data.getSources()) {
|
||||
UrlConfiguration urlConfiguration = new UrlConfiguration();
|
||||
try {
|
||||
URI uri;
|
||||
|
@ -436,10 +436,11 @@ public class PrefillingServiceImpl implements PrefillingService {
|
|||
} else {
|
||||
uri = new URI(singleData.getUrl());
|
||||
}
|
||||
String source = singleData.getExternalSelectSourceBindingEntity().getSource();
|
||||
String source = singleData.getSourceBinding().getSource();
|
||||
source = source != null && !source.isEmpty() ? source : uri.getHost();
|
||||
String uriString = singleData.getExternalSelectSourceBindingEntity().getUri();
|
||||
uriString = uriString != null && !uriString.isEmpty() ? uriString : "uri";
|
||||
// String uriString = singleData.getSourceBinding().getUrl();
|
||||
// uriString = uriString != null && !uriString.isEmpty() ? uriString : "uri";
|
||||
String uriString = "uri";
|
||||
String parsedUrl = singleData.getUrl();
|
||||
parsedUrl = parsedUrl.replace("%20", " ");
|
||||
parsedUrl = parsedUrl.replace("%22", "\"");
|
||||
|
@ -455,9 +456,9 @@ public class PrefillingServiceImpl implements PrefillingService {
|
|||
DataUrlConfiguration dataUrlConfiguration = new DataUrlConfiguration();
|
||||
dataUrlConfiguration.setPath(singleData.getOptionsRoot());
|
||||
DataFieldsUrlConfiguration fieldsUrlConfiguration = new DataFieldsUrlConfiguration();
|
||||
fieldsUrlConfiguration.setId(singleData.getExternalSelectSourceBindingEntity().getValue());
|
||||
fieldsUrlConfiguration.setName(singleData.getExternalSelectSourceBindingEntity().getLabel());
|
||||
fieldsUrlConfiguration.setSource(singleData.getExternalSelectSourceBindingEntity().getSource().isEmpty()? null : singleData.getExternalSelectSourceBindingEntity().getSource());
|
||||
fieldsUrlConfiguration.setId(singleData.getSourceBinding().getValue());
|
||||
fieldsUrlConfiguration.setName(singleData.getSourceBinding().getLabel());
|
||||
fieldsUrlConfiguration.setSource(singleData.getSourceBinding().getSource().isEmpty()? null : singleData.getSourceBinding().getSource());
|
||||
fieldsUrlConfiguration.setUri(uriString);
|
||||
dataUrlConfiguration.setFieldsUrlConfiguration(fieldsUrlConfiguration);
|
||||
urlConfiguration.setKey(source);
|
||||
|
@ -474,8 +475,8 @@ public class PrefillingServiceImpl implements PrefillingService {
|
|||
}
|
||||
genericUrls.getUrls().add(urlConfiguration);
|
||||
List<Map<String, String>> singleResults = this.remoteFetcherService.getExternalGeneric(urlCriteria, genericUrls);
|
||||
if (!singleResults.isEmpty() && !singleResults.get(0).containsKey("source") && !singleData.getExternalSelectSourceBindingEntity().getSource().isEmpty()) {
|
||||
singleResults.forEach(singleResult -> singleResult.put("source", singleData.getExternalSelectSourceBindingEntity().getSource()));
|
||||
if (!singleResults.isEmpty() && !singleResults.get(0).containsKey("source") && !singleData.getSourceBinding().getSource().isEmpty()) {
|
||||
singleResults.forEach(singleResult -> singleResult.put("source", singleData.getSourceBinding().getSource()));
|
||||
}
|
||||
rawResults.addAll(singleResults);
|
||||
genericUrls.getUrls().clear();
|
||||
|
|
|
@ -161,38 +161,37 @@ public class PublicDatasetsDescriptionDocumentation extends BaseController {
|
|||
String.join(".", Description._descriptionTemplate, DescriptionTemplate._definition, Definition._pages, Page._id),
|
||||
String.join(".", Description._descriptionTemplate, DescriptionTemplate._definition, Definition._pages, Page._ordinal),
|
||||
String.join(".", Description._descriptionTemplate, DescriptionTemplate._definition, Definition._pages, Page._title),
|
||||
String.join(".", Description._descriptionTemplate, DescriptionTemplate._definition, Definition._sections, Section._id),
|
||||
String.join(".", Description._descriptionTemplate, DescriptionTemplate._definition, Definition._sections, Section._description),
|
||||
String.join(".", Description._descriptionTemplate, DescriptionTemplate._definition, Definition._sections, Section._extendedDescription),
|
||||
String.join(".", Description._descriptionTemplate, DescriptionTemplate._definition, Definition._sections, Section._title),
|
||||
String.join(".", Description._descriptionTemplate, DescriptionTemplate._definition, Definition._sections, Section._multiplicity),
|
||||
String.join(".", Description._descriptionTemplate, DescriptionTemplate._definition, Definition._sections, Section._numbering),
|
||||
String.join(".", Description._descriptionTemplate, DescriptionTemplate._definition, Definition._sections, Section._ordinal),
|
||||
String.join(".", Description._descriptionTemplate, DescriptionTemplate._definition, Definition._sections, Section._sections),
|
||||
String.join(".", Description._descriptionTemplate, DescriptionTemplate._definition, Definition._sections, Section._page),
|
||||
String.join(".", Description._descriptionTemplate, DescriptionTemplate._definition, Definition._sections, Section._fieldSets, FieldSet._id),
|
||||
String.join(".", Description._descriptionTemplate, DescriptionTemplate._definition, Definition._sections, Section._fieldSets, FieldSet._description),
|
||||
String.join(".", Description._descriptionTemplate, DescriptionTemplate._definition, Definition._sections, Section._fieldSets, FieldSet._extendedDescription),
|
||||
String.join(".", Description._descriptionTemplate, DescriptionTemplate._definition, Definition._sections, Section._fieldSets, FieldSet._ordinal),
|
||||
String.join(".", Description._descriptionTemplate, DescriptionTemplate._definition, Definition._sections, Section._fieldSets, FieldSet._additionalInformation),
|
||||
String.join(".", Description._descriptionTemplate, DescriptionTemplate._definition, Definition._sections, Section._fieldSets, FieldSet._multiplicity, Multiplicity._min),
|
||||
String.join(".", Description._descriptionTemplate, DescriptionTemplate._definition, Definition._sections, Section._fieldSets, FieldSet._multiplicity, Multiplicity._max),
|
||||
String.join(".", Description._descriptionTemplate, DescriptionTemplate._definition, Definition._sections, Section._fieldSets, FieldSet._multiplicity, Multiplicity._placeholder),
|
||||
String.join(".", Description._descriptionTemplate, DescriptionTemplate._definition, Definition._sections, Section._fieldSets, FieldSet._multiplicity, Multiplicity._tableView),
|
||||
String.join(".", Description._descriptionTemplate, DescriptionTemplate._definition, Definition._sections, Section._fieldSets, FieldSet._numbering),
|
||||
String.join(".", Description._descriptionTemplate, DescriptionTemplate._definition, Definition._sections, Section._fieldSets, FieldSet._title),
|
||||
String.join(".", Description._descriptionTemplate, DescriptionTemplate._definition, Definition._sections, Section._fieldSets, FieldSet._fields),
|
||||
String.join(".", Description._descriptionTemplate, DescriptionTemplate._definition, Definition._sections, Section._fieldSets, FieldSet._fields, Field._id),
|
||||
String.join(".", Description._descriptionTemplate, DescriptionTemplate._definition, Definition._sections, Section._fieldSets, FieldSet._fields, Field._numbering),
|
||||
String.join(".", Description._descriptionTemplate, DescriptionTemplate._definition, Definition._sections, Section._fieldSets, FieldSet._fields, Field._ordinal),
|
||||
String.join(".", Description._descriptionTemplate, DescriptionTemplate._definition, Definition._sections, Section._fieldSets, FieldSet._fields, Field._data, BaseFieldData._label),
|
||||
String.join(".", Description._descriptionTemplate, DescriptionTemplate._definition, Definition._sections, Section._fieldSets, FieldSet._fields, Field._data, BaseFieldData._fieldType),
|
||||
String.join(".", Description._descriptionTemplate, DescriptionTemplate._definition, Definition._sections, Section._fieldSets, FieldSet._fields, Field._schematics),
|
||||
String.join(".", Description._descriptionTemplate, DescriptionTemplate._definition, Definition._sections, Section._fieldSets, FieldSet._fields, Field._defaultValue),
|
||||
String.join(".", Description._descriptionTemplate, DescriptionTemplate._definition, Definition._sections, Section._fieldSets, FieldSet._fields, Field._includeInExport),
|
||||
String.join(".", Description._descriptionTemplate, DescriptionTemplate._definition, Definition._sections, Section._fieldSets, FieldSet._fields, Field._validations),
|
||||
String.join(".", Description._descriptionTemplate, DescriptionTemplate._definition, Definition._sections, Section._fieldSets, FieldSet._fields, Field._visibilityRules, Rule._target),
|
||||
String.join(".", Description._descriptionTemplate, DescriptionTemplate._definition, Definition._sections, Section._fieldSets, FieldSet._fields, Field._visibilityRules, Rule._value),
|
||||
String.join(".", Description._descriptionTemplate, DescriptionTemplate._definition, Definition._pages, Page._sections, Section._id),
|
||||
String.join(".", Description._descriptionTemplate, DescriptionTemplate._definition, Definition._pages, Page._sections, Section._description),
|
||||
String.join(".", Description._descriptionTemplate, DescriptionTemplate._definition, Definition._pages, Page._sections, Section._extendedDescription),
|
||||
String.join(".", Description._descriptionTemplate, DescriptionTemplate._definition, Definition._pages, Page._sections, Section._title),
|
||||
String.join(".", Description._descriptionTemplate, DescriptionTemplate._definition, Definition._pages, Page._sections, Section._multiplicity),
|
||||
String.join(".", Description._descriptionTemplate, DescriptionTemplate._definition, Definition._pages, Page._sections, Section._numbering),
|
||||
String.join(".", Description._descriptionTemplate, DescriptionTemplate._definition, Definition._pages, Page._sections, Section._ordinal),
|
||||
String.join(".", Description._descriptionTemplate, DescriptionTemplate._definition, Definition._pages, Page._sections, Section._sections),
|
||||
String.join(".", Description._descriptionTemplate, DescriptionTemplate._definition, Definition._pages, Page._sections, Section._fieldSets, FieldSet._id),
|
||||
String.join(".", Description._descriptionTemplate, DescriptionTemplate._definition, Definition._pages, Page._sections, Section._fieldSets, FieldSet._description),
|
||||
String.join(".", Description._descriptionTemplate, DescriptionTemplate._definition, Definition._pages, Page._sections, Section._fieldSets, FieldSet._extendedDescription),
|
||||
String.join(".", Description._descriptionTemplate, DescriptionTemplate._definition, Definition._pages, Page._sections, Section._fieldSets, FieldSet._ordinal),
|
||||
String.join(".", Description._descriptionTemplate, DescriptionTemplate._definition, Definition._pages, Page._sections, Section._fieldSets, FieldSet._additionalInformation),
|
||||
String.join(".", Description._descriptionTemplate, DescriptionTemplate._definition, Definition._pages, Page._sections, Section._fieldSets, FieldSet._multiplicity, Multiplicity._min),
|
||||
String.join(".", Description._descriptionTemplate, DescriptionTemplate._definition, Definition._pages, Page._sections, Section._fieldSets, FieldSet._multiplicity, Multiplicity._max),
|
||||
String.join(".", Description._descriptionTemplate, DescriptionTemplate._definition, Definition._pages, Page._sections, Section._fieldSets, FieldSet._multiplicity, Multiplicity._placeholder),
|
||||
String.join(".", Description._descriptionTemplate, DescriptionTemplate._definition, Definition._pages, Page._sections, Section._fieldSets, FieldSet._multiplicity, Multiplicity._tableView),
|
||||
String.join(".", Description._descriptionTemplate, DescriptionTemplate._definition, Definition._pages, Page._sections, Section._fieldSets, FieldSet._numbering),
|
||||
String.join(".", Description._descriptionTemplate, DescriptionTemplate._definition, Definition._pages, Page._sections, Section._fieldSets, FieldSet._title),
|
||||
String.join(".", Description._descriptionTemplate, DescriptionTemplate._definition, Definition._pages, Page._sections, Section._fieldSets, FieldSet._fields),
|
||||
String.join(".", Description._descriptionTemplate, DescriptionTemplate._definition, Definition._pages, Page._sections, Section._fieldSets, FieldSet._fields, Field._id),
|
||||
String.join(".", Description._descriptionTemplate, DescriptionTemplate._definition, Definition._pages, Page._sections, Section._fieldSets, FieldSet._fields, Field._numbering),
|
||||
String.join(".", Description._descriptionTemplate, DescriptionTemplate._definition, Definition._pages, Page._sections, Section._fieldSets, FieldSet._fields, Field._ordinal),
|
||||
String.join(".", Description._descriptionTemplate, DescriptionTemplate._definition, Definition._pages, Page._sections, Section._fieldSets, FieldSet._fields, Field._data, BaseFieldData._label),
|
||||
String.join(".", Description._descriptionTemplate, DescriptionTemplate._definition, Definition._pages, Page._sections, Section._fieldSets, FieldSet._fields, Field._data, BaseFieldData._fieldType),
|
||||
String.join(".", Description._descriptionTemplate, DescriptionTemplate._definition, Definition._pages, Page._sections, Section._fieldSets, FieldSet._fields, Field._schematics),
|
||||
String.join(".", Description._descriptionTemplate, DescriptionTemplate._definition, Definition._pages, Page._sections, Section._fieldSets, FieldSet._fields, Field._defaultValue),
|
||||
String.join(".", Description._descriptionTemplate, DescriptionTemplate._definition, Definition._pages, Page._sections, Section._fieldSets, FieldSet._fields, Field._includeInExport),
|
||||
String.join(".", Description._descriptionTemplate, DescriptionTemplate._definition, Definition._pages, Page._sections, Section._fieldSets, FieldSet._fields, Field._validations),
|
||||
String.join(".", Description._descriptionTemplate, DescriptionTemplate._definition, Definition._pages, Page._sections, Section._fieldSets, FieldSet._fields, Field._visibilityRules, Rule._target),
|
||||
String.join(".", Description._descriptionTemplate, DescriptionTemplate._definition, Definition._pages, Page._sections, Section._fieldSets, FieldSet._fields, Field._visibilityRules, Rule._value),
|
||||
Description._createdAt,
|
||||
Description._updatedAt,
|
||||
Description._finalizedAt
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue