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