DescriptionTemplate refactor

This commit is contained in:
Efstratios Giannopoulos 2023-10-30 15:07:59 +02:00
parent 49d400662b
commit c06253bb20
123 changed files with 2627 additions and 602 deletions

View File

@ -6,10 +6,15 @@ 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> {
COMBO_BOX("combobox"), COMBO_BOX("combobox"), //TODO remove from xml an keep subtypes only AUTO_COMPLETE, WORD_LIST
AUTO_COMPLETE("autocomplete"),
WORD_LIST("wordlist"),
BOOLEAN_DECISION("booleanDecision"), BOOLEAN_DECISION("booleanDecision"),
RADIO_BOX("radiobox"), RADIO_BOX("radiobox"),
INTERNAL_DMP_ENTRIES("internalDmpEntities"), INTERNAL_DMP_ENTRIES("internalDmpEntities"), //TODO remove from xml an keep subtypes only INTERNAL_DMP_ENTRIES_RESEARCHERS. INTERNAL_DMP_ENTRIES_DMPS, INTERNAL_DMP_ENTRIES_DATASETS
INTERNAL_DMP_ENTRIES_RESEARCHERS("internalDmpResearchers"),
INTERNAL_DMP_ENTRIES_DMPS("internalDmpDmps"),
INTERNAL_DMP_ENTRIES_DATASETS("internalDmpDatasets"),
CHECK_BOX("checkBox"), CHECK_BOX("checkBox"),
FREE_TEXT("freetext"), FREE_TEXT("freetext"),
TEXT_AREA("textarea"), TEXT_AREA("textarea"),

View File

@ -3,8 +3,7 @@ package eu.eudat.commons.types.descriptiontemplate;
import eu.eudat.commons.enums.FieldValidationType; import eu.eudat.commons.enums.FieldValidationType;
import eu.eudat.commons.enums.FieldType; import eu.eudat.commons.enums.FieldType;
import eu.eudat.commons.types.common.DatabaseViewStyleDefinition; import eu.eudat.commons.types.common.DatabaseViewStyleDefinition;
import eu.eudat.commons.types.descriptiontemplate.fielddata.BaseFieldDataEntity; import eu.eudat.commons.types.descriptiontemplate.fielddata.*;
import eu.eudat.commons.types.descriptiontemplate.fielddata.FieldDataHelper;
import eu.eudat.commons.types.xml.XmlSerializable; import eu.eudat.commons.types.xml.XmlSerializable;
import eu.eudat.commons.types.xml.XmlBuilder; import eu.eudat.commons.types.xml.XmlBuilder;
import org.w3c.dom.Document; import org.w3c.dom.Document;
@ -24,7 +23,6 @@ public class FieldEntity implements DatabaseViewStyleDefinition, XmlSerializable
private List<RuleEntity> visibilityRules; private List<RuleEntity> visibilityRules;
private BaseFieldDataEntity<?> data; private BaseFieldDataEntity<?> data;
private List<FieldValidationType> validations; private List<FieldValidationType> validations;
private FieldType fieldType;
private Boolean includeInExport; private Boolean includeInExport;
public String getId() { public String getId() {
@ -55,14 +53,6 @@ public class FieldEntity implements DatabaseViewStyleDefinition, XmlSerializable
this.data = data; this.data = data;
} }
public FieldType getFieldType() {
return fieldType;
}
public void setFieldType(FieldType fieldType) {
this.fieldType = fieldType;
}
public String getDefaultValue() { public String getDefaultValue() {
return defaultValue; return defaultValue;
} }
@ -117,8 +107,25 @@ public class FieldEntity implements DatabaseViewStyleDefinition, XmlSerializable
} }
Element viewStyle = doc.createElement("viewStyle"); Element viewStyle = doc.createElement("viewStyle");
viewStyle.setAttribute("renderstyle", this.getFieldType().getValue()); if (this.data != null) {
switch (this.data.getFieldType()){
case COMBO_BOX:
case AUTO_COMPLETE:
case WORD_LIST:{
viewStyle.setAttribute("renderstyle", FieldType.COMBO_BOX.getValue());
break;
}
case INTERNAL_DMP_ENTRIES:
case INTERNAL_DMP_ENTRIES_DMPS:
case INTERNAL_DMP_ENTRIES_DATASETS:
case INTERNAL_DMP_ENTRIES_RESEARCHERS:{
viewStyle.setAttribute("renderstyle", FieldType.INTERNAL_DMP_ENTRIES.getValue());
break;
}
case BOOLEAN_DECISION: viewStyle.setAttribute("renderstyle", this.data.getFieldType().getValue());;
}
}
Element visibilityRulesElement = doc.createElement("visible"); Element visibilityRulesElement = doc.createElement("visible");
if (this.visibilityRules != null && !this.visibilityRules.isEmpty()) { if (this.visibilityRules != null && !this.visibilityRules.isEmpty()) {
for (RuleEntity rule : this.visibilityRules) { for (RuleEntity rule : this.visibilityRules) {
@ -144,7 +151,10 @@ public class FieldEntity implements DatabaseViewStyleDefinition, XmlSerializable
rootElement.appendChild(defaultValue); rootElement.appendChild(defaultValue);
rootElement.appendChild(visibilityRulesElement); rootElement.appendChild(visibilityRulesElement);
rootElement.appendChild(viewStyle); rootElement.appendChild(viewStyle);
if (this.data != null) rootElement.appendChild(this.data.toXml(doc)); if (this.data != null) {
rootElement.appendChild(this.data.toXml(doc));
}
rootElement.setAttribute("export", this.includeInExport == null || this.includeInExport ? "true" : "false"); rootElement.setAttribute("export", this.includeInExport == null || this.includeInExport ? "true" : "false");
return rootElement; return rootElement;
} }
@ -157,7 +167,7 @@ public class FieldEntity implements DatabaseViewStyleDefinition, XmlSerializable
Element viewStyle = (Element) XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "viewStyle"); Element viewStyle = (Element) XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "viewStyle");
this.fieldType = FieldType.of(viewStyle.getAttribute("renderstyle")); FieldType fieldType = FieldType.of(viewStyle.getAttribute("renderstyle"));
Element visibility = (Element) XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "visible"); Element visibility = (Element) XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "visible");
NodeList rulesElements = visibility.getChildNodes(); NodeList rulesElements = visibility.getChildNodes();
@ -189,7 +199,7 @@ public class FieldEntity implements DatabaseViewStyleDefinition, XmlSerializable
Element defaultValue = (Element) XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "defaultValue"); Element defaultValue = (Element) XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "defaultValue");
this.defaultValue = defaultValue.getAttribute("value"); this.defaultValue = defaultValue.getAttribute("value");
this.data = new FieldDataHelper().toFieldData(null, this.getFieldType(), dataElement); this.data = new FieldDataHelper().toFieldData(null, fieldType, dataElement);
if (this.data != null) this.data.fromXml(dataElement); if (this.data != null) this.data.fromXml(dataElement);
this.validations = new LinkedList<>(); this.validations = new LinkedList<>();

View File

@ -22,7 +22,7 @@ public class FieldSetEntity implements DatabaseViewStyleDefinition, XmlSerializa
private String additionalInformation; private String additionalInformation;
private MultiplicityEntity multiplicity; private MultiplicityEntity multiplicity;
private boolean hasCommentField; private boolean hasCommentField;
private String commentFieldValue; //TODO: DescriptionTemplate // private String commentFieldValue; //TODO: DescriptionTemplate
public List<FieldEntity> getFields() { public List<FieldEntity> getFields() {
return fields; return fields;

View File

@ -2,6 +2,8 @@ package eu.eudat.commons.types.descriptiontemplate.fielddata;
import com.fasterxml.jackson.annotation.JsonValue; import com.fasterxml.jackson.annotation.JsonValue;
import eu.eudat.commons.enums.EnumUtils; import eu.eudat.commons.enums.EnumUtils;
import eu.eudat.commons.enums.FieldDataComboBoxType;
import eu.eudat.commons.enums.FieldType;
import eu.eudat.data.converters.enums.DatabaseEnum; import eu.eudat.data.converters.enums.DatabaseEnum;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;
@ -138,6 +140,16 @@ public class AutoCompleteDataEntity extends ComboBoxDataEntity<AutoCompleteDataE
this.autoCompleteSingleDataList = autoCompleteSingleDataList; this.autoCompleteSingleDataList = autoCompleteSingleDataList;
} }
@Override
public FieldDataComboBoxType getFieldSubType() {
return FieldDataComboBoxType.Autocomplete;
}
@Override
public FieldType getFieldType() {
return FieldType.AUTO_COMPLETE;
}
@Override @Override
public Element toXml(Document doc) { public Element toXml(Document doc) {
Element root = super.toXml(doc); Element root = super.toXml(doc);

View File

@ -1,5 +1,6 @@
package eu.eudat.commons.types.descriptiontemplate.fielddata; package eu.eudat.commons.types.descriptiontemplate.fielddata;
import eu.eudat.commons.enums.FieldType;
import eu.eudat.commons.types.xml.XmlSerializable; import eu.eudat.commons.types.xml.XmlSerializable;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;
@ -8,7 +9,8 @@ import java.util.Map;
public abstract class BaseFieldDataEntity<T> implements XmlSerializable<T> { public abstract class BaseFieldDataEntity<T> implements XmlSerializable<T> {
private String label; private String label;
private String subType;
public abstract FieldType getFieldType();
public String getLabel() { public String getLabel() {
return label; return label;
@ -18,13 +20,6 @@ public abstract class BaseFieldDataEntity<T> implements XmlSerializable<T> {
this.label = label; this.label = label;
} }
public String getSubType() {
return subType;
}
public void setSubType(String subType) {
this.subType = subType;
}
public T fromData(Object data) { public T fromData(Object data) {
return null; return null;
@ -34,8 +29,17 @@ public abstract class BaseFieldDataEntity<T> implements XmlSerializable<T> {
return null; return null;
} }
public Element toXml(Document doc) { public Element toXml(Document doc) {
return null; Element root = doc.createElement("data");
root.setAttribute("label", this.getLabel());
return root;
}
public T fromXml(Element item) {
this.setLabel(item.getAttribute("label"));
return (T) this;
} }
public abstract Map<String, Object> toMap(Element item); public abstract Map<String, Object> toMap(Element item);

View File

@ -1,5 +1,6 @@
package eu.eudat.commons.types.descriptiontemplate.fielddata; package eu.eudat.commons.types.descriptiontemplate.fielddata;
import eu.eudat.commons.enums.FieldType;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;
@ -8,6 +9,11 @@ import java.util.Map;
public class BooleanDecisionDataEntity extends BaseFieldDataEntity<BooleanDecisionDataEntity> { public class BooleanDecisionDataEntity extends BaseFieldDataEntity<BooleanDecisionDataEntity> {
@Override
public FieldType getFieldType() {
return FieldType.BOOLEAN_DECISION;
}
@Override @Override
public BooleanDecisionDataEntity fromData(Object data) { public BooleanDecisionDataEntity fromData(Object data) {
if (data != null) { if (data != null) {
@ -21,18 +27,6 @@ public class BooleanDecisionDataEntity extends BaseFieldDataEntity<BooleanDecisi
return null; return null;
} }
@Override
public Element toXml(Document doc) {
Element element = doc.createElement("data");
element.setAttribute("label", this.getLabel());
return element;
}
@Override
public BooleanDecisionDataEntity fromXml(Element item) {
this.setLabel(item.getAttribute("label"));
return this;
}
@Override @Override
public Map<String, Object> toMap(Element item) { public Map<String, Object> toMap(Element item) {

View File

@ -1,5 +1,6 @@
package eu.eudat.commons.types.descriptiontemplate.fielddata; package eu.eudat.commons.types.descriptiontemplate.fielddata;
import eu.eudat.commons.enums.FieldType;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;
@ -9,16 +10,8 @@ import java.util.Map;
public class CheckBoxDataEntity extends BaseFieldDataEntity<CheckBoxDataEntity> { public class CheckBoxDataEntity extends BaseFieldDataEntity<CheckBoxDataEntity> {
@Override @Override
public Element toXml(Document doc) { public FieldType getFieldType() {
Element root = doc.createElement("data"); return FieldType.CHECK_BOX;
root.setAttribute("label", this.getLabel());
return root;
}
@Override
public CheckBoxDataEntity fromXml(Element item) {
this.setLabel(item != null ? item.getAttribute("label") : "");
return this;
} }
@Override @Override

View File

@ -9,6 +9,9 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
public abstract class ComboBoxDataEntity<T> extends BaseFieldDataEntity<T> { public abstract class ComboBoxDataEntity<T> extends BaseFieldDataEntity<T> {
public abstract FieldDataComboBoxType getFieldSubType();
public static class Option implements XmlSerializable<Option> { public static class Option implements XmlSerializable<Option> {
private String label; private String label;
private String value; private String value;
@ -65,26 +68,16 @@ public abstract class ComboBoxDataEntity<T> extends BaseFieldDataEntity<T> {
} }
public FieldDataComboBoxType getType() {
return FieldDataComboBoxType.of(this.getSubType());
}
public void setType(FieldDataComboBoxType type) {
this.setSubType(type.getValue());
}
@Override @Override
public Element toXml(Document doc) { public Element toXml(Document doc) {
Element root = doc.createElement("data"); Element root = super.toXml(doc);
root.setAttribute("type", this.getSubType()); root.setAttribute("type", this.getFieldSubType().toString());
root.setAttribute("label", this.getLabel());
return root; return root;
} }
@Override @Override
public T fromXml(Element item) { public T fromXml(Element item) {
this.setLabel(item.getAttribute("label")); super.fromXml(item);
this.setSubType(item.getAttribute("type"));
return (T) this; return (T) this;
} }
@ -92,7 +85,6 @@ public abstract class ComboBoxDataEntity<T> extends BaseFieldDataEntity<T> {
public T fromData(Object data) { public T fromData(Object data) {
if (data != null) { if (data != null) {
this.setSubType((String) ((Map<String, Object>) data).get("type"));
this.setLabel((String) ((Map<String, Object>) data).get("label")); this.setLabel((String) ((Map<String, Object>) data).get("label"));
} }

View File

@ -1,5 +1,6 @@
package eu.eudat.commons.types.descriptiontemplate.fielddata; package eu.eudat.commons.types.descriptiontemplate.fielddata;
import eu.eudat.commons.enums.FieldType;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;
@ -7,6 +8,11 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
public class CurrencyDataEntity extends BaseFieldDataEntity<CurrencyDataEntity> { public class CurrencyDataEntity extends BaseFieldDataEntity<CurrencyDataEntity> {
@Override
public FieldType getFieldType() {
return FieldType.CURRENCY;
}
@Override @Override
public CurrencyDataEntity fromData(Object data) { public CurrencyDataEntity fromData(Object data) {
if (data != null) { if (data != null) {
@ -20,19 +26,6 @@ public class CurrencyDataEntity extends BaseFieldDataEntity<CurrencyDataEntity>
return null; return null;
} }
@Override
public Element toXml(Document doc) {
Element root = doc.createElement("data");
root.setAttribute("label", this.getLabel());
return root;
}
@Override
public CurrencyDataEntity fromXml(Element item) {
this.setLabel(item != null ? item.getAttribute("label") : "");
return this;
}
@Override @Override
public Map<String, Object> toMap(Element item) { public Map<String, Object> toMap(Element item) {
HashMap dataMap = new HashMap(); HashMap dataMap = new HashMap();

View File

@ -1,5 +1,6 @@
package eu.eudat.commons.types.descriptiontemplate.fielddata; package eu.eudat.commons.types.descriptiontemplate.fielddata;
import eu.eudat.commons.enums.FieldType;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;
@ -7,6 +8,11 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
public class DataRepositoryDataEntity extends BaseFieldDataEntity<DataRepositoryDataEntity> { public class DataRepositoryDataEntity extends BaseFieldDataEntity<DataRepositoryDataEntity> {
@Override
public FieldType getFieldType() {
return FieldType.DATA_REPOSITORIES;
}
private Boolean multiAutoComplete; private Boolean multiAutoComplete;
public Boolean getMultiAutoComplete() { public Boolean getMultiAutoComplete() {
@ -33,8 +39,7 @@ public class DataRepositoryDataEntity extends BaseFieldDataEntity<DataRepository
@Override @Override
public Element toXml(Document doc) { public Element toXml(Document doc) {
Element root = doc.createElement("data"); Element root = super.toXml(doc);
root.setAttribute("label", this.getLabel());
if (this.getMultiAutoComplete() != null) { if (this.getMultiAutoComplete() != null) {
root.setAttribute("multiAutoComplete", this.getMultiAutoComplete().toString()); root.setAttribute("multiAutoComplete", this.getMultiAutoComplete().toString());
} }
@ -43,7 +48,7 @@ public class DataRepositoryDataEntity extends BaseFieldDataEntity<DataRepository
@Override @Override
public DataRepositoryDataEntity fromXml(Element item) { public DataRepositoryDataEntity fromXml(Element item) {
this.setLabel(item != null ? item.getAttribute("label") : ""); super.fromXml(item);
this.setMultiAutoComplete(Boolean.parseBoolean(item.getAttribute("multiAutoComplete"))); this.setMultiAutoComplete(Boolean.parseBoolean(item.getAttribute("multiAutoComplete")));
return this; return this;
} }

View File

@ -1,5 +1,8 @@
package eu.eudat.commons.types.descriptiontemplate.fielddata; package eu.eudat.commons.types.descriptiontemplate.fielddata;
import eu.eudat.commons.enums.FieldDataComboBoxType;
import eu.eudat.commons.enums.FieldDataInternalDmpEntryType;
import eu.eudat.commons.enums.FieldType;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;
@ -16,6 +19,16 @@ public class DatasetAutoCompleteDataEntity extends InternalDmpBaseDataEntity<Dat
this.multiAutoComplete = multiAutoComplete; this.multiAutoComplete = multiAutoComplete;
} }
@Override
public FieldDataInternalDmpEntryType getFieldSubType() {
return FieldDataInternalDmpEntryType.Datasets;
}
@Override
public FieldType getFieldType() {
return FieldType.INTERNAL_DMP_ENTRIES_DATASETS;
}
@Override @Override
public Element toXml(Document doc) { public Element toXml(Document doc) {
Element root = super.toXml(doc); Element root = super.toXml(doc);

View File

@ -1,5 +1,6 @@
package eu.eudat.commons.types.descriptiontemplate.fielddata; package eu.eudat.commons.types.descriptiontemplate.fielddata;
import eu.eudat.commons.enums.FieldType;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;
@ -7,6 +8,10 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
public class DatasetIdentifierDataEntity extends BaseFieldDataEntity<DatasetIdentifierDataEntity> { public class DatasetIdentifierDataEntity extends BaseFieldDataEntity<DatasetIdentifierDataEntity> {
@Override
public FieldType getFieldType() {
return FieldType.DATASET_IDENTIFIER;
}
@Override @Override
public DatasetIdentifierDataEntity fromData(Object data) { public DatasetIdentifierDataEntity fromData(Object data) {
if (data != null) { if (data != null) {
@ -20,19 +25,6 @@ public class DatasetIdentifierDataEntity extends BaseFieldDataEntity<DatasetIden
return null; return null;
} }
@Override
public Element toXml(Document doc) {
Element root = doc.createElement("data");
root.setAttribute("label", this.getLabel());
return root;
}
@Override
public DatasetIdentifierDataEntity fromXml(Element item) {
this.setLabel(item != null ? item.getAttribute("label") : "");
return this;
}
@Override @Override
public Map<String, Object> toMap(Element item) { public Map<String, Object> toMap(Element item) {
HashMap dataMap = new HashMap(); HashMap dataMap = new HashMap();

View File

@ -1,5 +1,6 @@
package eu.eudat.commons.types.descriptiontemplate.fielddata; package eu.eudat.commons.types.descriptiontemplate.fielddata;
import eu.eudat.commons.enums.FieldType;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;
@ -7,6 +8,10 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
public class DatePickerDataEntity extends BaseFieldDataEntity<DatePickerDataEntity> { public class DatePickerDataEntity extends BaseFieldDataEntity<DatePickerDataEntity> {
@Override
public FieldType getFieldType() {
return FieldType.DATE_PICKER;
}
@Override @Override
public DatePickerDataEntity fromData(Object data) { public DatePickerDataEntity fromData(Object data) {
if (data != null) { if (data != null) {
@ -20,19 +25,6 @@ public class DatePickerDataEntity extends BaseFieldDataEntity<DatePickerDataEnti
return null; return null;
} }
@Override
public Element toXml(Document doc) {
Element root = doc.createElement("data");
root.setAttribute("label", this.getLabel());
return root;
}
@Override
public DatePickerDataEntity fromXml(Element item) {
this.setLabel(item != null ? item.getAttribute("label") : "");
return this;
}
@Override @Override
public Map<String, Object> toMap(Element item) { public Map<String, Object> toMap(Element item) {
HashMap dataMap = new HashMap(); HashMap dataMap = new HashMap();

View File

@ -1,5 +1,7 @@
package eu.eudat.commons.types.descriptiontemplate.fielddata; package eu.eudat.commons.types.descriptiontemplate.fielddata;
import eu.eudat.commons.enums.FieldDataInternalDmpEntryType;
import eu.eudat.commons.enums.FieldType;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;
@ -16,6 +18,15 @@ public class DmpAutoCompleteDataEntity extends InternalDmpBaseDataEntity<DmpAuto
this.multiAutoComplete = multiAutoComplete; this.multiAutoComplete = multiAutoComplete;
} }
@Override
public FieldDataInternalDmpEntryType getFieldSubType() {
return FieldDataInternalDmpEntryType.Dmps;
}
@Override
public FieldType getFieldType() {
return FieldType.INTERNAL_DMP_ENTRIES_DMPS;
}
@Override @Override
public Element toXml(Document doc) { public Element toXml(Document doc) {
Element root = super.toXml(doc); Element root = super.toXml(doc);

View File

@ -1,6 +1,7 @@
package eu.eudat.commons.types.descriptiontemplate.fielddata; package eu.eudat.commons.types.descriptiontemplate.fielddata;
import eu.eudat.commons.enums.FieldDataExternalDatasetType; import eu.eudat.commons.enums.FieldDataExternalDatasetType;
import eu.eudat.commons.enums.FieldType;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;
@ -8,6 +9,10 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
public class ExternalDatasetDataEntity extends BaseFieldDataEntity<ExternalDatasetDataEntity> { public class ExternalDatasetDataEntity extends BaseFieldDataEntity<ExternalDatasetDataEntity> {
@Override
public FieldType getFieldType() {
return FieldType.EXTERNAL_DATASETS;
}
private Boolean multiAutoComplete; private Boolean multiAutoComplete;
private FieldDataExternalDatasetType type; private FieldDataExternalDatasetType type;

View File

@ -47,9 +47,9 @@ public class FieldDataHelper {
case UPLOAD: return new UploadDataEntity(); case UPLOAD: return new UploadDataEntity();
case DATE_PICKER: return new DatePickerDataEntity(); case DATE_PICKER: return new DatePickerDataEntity();
case EXTERNAL_DATASETS: return new ExternalDatasetDataEntity(); case EXTERNAL_DATASETS: return new ExternalDatasetDataEntity();
case DATA_REPOSITORIES: case DATA_REPOSITORIES: return new DataRepositoryDataEntity();
case PUB_REPOSITORIES: case PUB_REPOSITORIES: return new PublicationRepositoryDataEntity();
case JOURNAL_REPOSITORIES: return new DataRepositoryDataEntity(); case JOURNAL_REPOSITORIES: return new JournalRepositoryDataEntity();
case TAXONOMIES: return new TaxonomyDataEntity(); case TAXONOMIES: return new TaxonomyDataEntity();
case LICENSES: return new LicenseDataEntity(); case LICENSES: return new LicenseDataEntity();
case PUBLICATIONS: return new PublicationDataEntity(); case PUBLICATIONS: return new PublicationDataEntity();

View File

@ -1,5 +1,6 @@
package eu.eudat.commons.types.descriptiontemplate.fielddata; package eu.eudat.commons.types.descriptiontemplate.fielddata;
import eu.eudat.commons.enums.FieldType;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;
@ -8,6 +9,10 @@ import java.util.Map;
public class FreeTextDataEntity extends BaseFieldDataEntity<FreeTextDataEntity> { public class FreeTextDataEntity extends BaseFieldDataEntity<FreeTextDataEntity> {
@Override
public FieldType getFieldType() {
return FieldType.FREE_TEXT;
}
@Override @Override
public FreeTextDataEntity fromData(Object data) { public FreeTextDataEntity fromData(Object data) {
@ -22,19 +27,6 @@ public class FreeTextDataEntity extends BaseFieldDataEntity<FreeTextDataEntity>
return null; return null;
} }
@Override
public Element toXml(Document doc) {
Element root = doc.createElement("data");
root.setAttribute("label", this.getLabel());
return root;
}
@Override
public FreeTextDataEntity fromXml(Element item) {
this.setLabel(item.getAttribute("label"));
return this;
}
@Override @Override
public Map<String, Object> toMap(Element item) { public Map<String, Object> toMap(Element item) {
HashMap dataMap = new HashMap(); HashMap dataMap = new HashMap();

View File

@ -8,25 +8,19 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
public abstract class InternalDmpBaseDataEntity<T> extends BaseFieldDataEntity<T> { public abstract class InternalDmpBaseDataEntity<T> extends BaseFieldDataEntity<T> {
public FieldDataInternalDmpEntryType getType() {
return FieldDataInternalDmpEntryType.of(this.getSubType()); public abstract FieldDataInternalDmpEntryType getFieldSubType();
}
public void setType(FieldDataInternalDmpEntryType type) {
this.setSubType(type.getValue());
}
@Override @Override
public Element toXml(Document doc) { public Element toXml(Document doc) {
Element root = doc.createElement("data"); Element root = super.toXml(doc);
root.setAttribute("type", this.getType().getValue()); root.setAttribute("type", this.getFieldSubType().toString());
root.setAttribute("label", this.getLabel());
return root; return root;
} }
@Override @Override
public T fromXml(Element item) { public T fromXml(Element item) {
this.setLabel(item.getAttribute("label")); super.fromXml(item);
this.setType(FieldDataInternalDmpEntryType.of(item.getAttribute("type")));
return (T) this; return (T) this;
} }
@ -34,7 +28,6 @@ public abstract class InternalDmpBaseDataEntity<T> extends BaseFieldDataEntity<T
public T fromData(Object data) { public T fromData(Object data) {
if (data != null) { if (data != null) {
this.setType(FieldDataInternalDmpEntryType.of ((String) ((Map<String, Object>) data).get("type")));
this.setLabel((String) ((Map<String, Object>) data).get("label")); this.setLabel((String) ((Map<String, Object>) data).get("label"));
} }

View File

@ -0,0 +1,63 @@
package eu.eudat.commons.types.descriptiontemplate.fielddata;
import eu.eudat.commons.enums.FieldType;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import java.util.HashMap;
import java.util.Map;
public class JournalRepositoryDataEntity extends BaseFieldDataEntity<JournalRepositoryDataEntity> {
@Override
public FieldType getFieldType() {
return FieldType.JOURNAL_REPOSITORIES;
}
private Boolean multiAutoComplete;
public Boolean getMultiAutoComplete() {
return multiAutoComplete;
}
public void setMultiAutoComplete(Boolean multiAutoComplete) {
this.multiAutoComplete = multiAutoComplete;
}
@Override
public JournalRepositoryDataEntity fromData(Object data) {
if (data != null) {
this.setLabel((String) ((Map<String, Object>) data).get("label"));
this.setMultiAutoComplete(((Map<String, Object>) data).get("multiAutoComplete") != null && !((Map<String, Object>) data).get("multiAutoComplete").toString().isEmpty()? Boolean.parseBoolean(((Map<String, Object>) data).get("multiAutoComplete").toString()) : false);
}
return this;
}
@Override
public Object toData() {
return null;
}
@Override
public Element toXml(Document doc) {
Element root = super.toXml(doc);
if (this.getMultiAutoComplete() != null) {
root.setAttribute("multiAutoComplete", this.getMultiAutoComplete().toString());
}
return root;
}
@Override
public JournalRepositoryDataEntity fromXml(Element item) {
super.fromXml(item);
this.setMultiAutoComplete(Boolean.parseBoolean(item.getAttribute("multiAutoComplete")));
return this;
}
@Override
public Map<String, Object> toMap(Element item) {
HashMap dataMap = new HashMap();
dataMap.put("label", item != null && item.getAttributes().getLength() > 0? item.getAttribute("label") : "");
dataMap.put("multiAutoComplete", item != null && item.getAttributes().getLength() > 0 ? item.getAttribute("multiAutocomplete") : false);
return dataMap;
}
}

View File

@ -1,5 +1,6 @@
package eu.eudat.commons.types.descriptiontemplate.fielddata; package eu.eudat.commons.types.descriptiontemplate.fielddata;
import eu.eudat.commons.enums.FieldType;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;
@ -7,6 +8,10 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
public class LicenseDataEntity extends BaseFieldDataEntity<LicenseDataEntity> { public class LicenseDataEntity extends BaseFieldDataEntity<LicenseDataEntity> {
@Override
public FieldType getFieldType() {
return FieldType.LICENSES;
}
private Boolean multiAutoComplete; private Boolean multiAutoComplete;
public Boolean getMultiAutoComplete() { public Boolean getMultiAutoComplete() {
@ -33,8 +38,7 @@ public class LicenseDataEntity extends BaseFieldDataEntity<LicenseDataEntity> {
@Override @Override
public Element toXml(Document doc) { public Element toXml(Document doc) {
Element root = doc.createElement("data"); Element root = super.toXml(doc);
root.setAttribute("label", this.getLabel());
if (this.getMultiAutoComplete() != null) { if (this.getMultiAutoComplete() != null) {
root.setAttribute("multiAutoComplete", this.getMultiAutoComplete().toString()); root.setAttribute("multiAutoComplete", this.getMultiAutoComplete().toString());
} }
@ -43,7 +47,7 @@ public class LicenseDataEntity extends BaseFieldDataEntity<LicenseDataEntity> {
@Override @Override
public LicenseDataEntity fromXml(Element item) { public LicenseDataEntity fromXml(Element item) {
this.setLabel(item != null ? item.getAttribute("label") : ""); super.fromXml(item);
this.setMultiAutoComplete(Boolean.parseBoolean(item.getAttribute("multiAutoComplete"))); this.setMultiAutoComplete(Boolean.parseBoolean(item.getAttribute("multiAutoComplete")));
return this; return this;
} }

View File

@ -1,5 +1,6 @@
package eu.eudat.commons.types.descriptiontemplate.fielddata; package eu.eudat.commons.types.descriptiontemplate.fielddata;
import eu.eudat.commons.enums.FieldType;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;
@ -7,6 +8,10 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
public class OrganizationDataEntity extends BaseFieldDataEntity<OrganizationDataEntity> { public class OrganizationDataEntity extends BaseFieldDataEntity<OrganizationDataEntity> {
@Override
public FieldType getFieldType() {
return FieldType.ORGANIZATIONS;
}
private Boolean multiAutoComplete; private Boolean multiAutoComplete;
public Boolean getMultiAutoComplete() { public Boolean getMultiAutoComplete() {
@ -33,8 +38,7 @@ public class OrganizationDataEntity extends BaseFieldDataEntity<OrganizationData
@Override @Override
public Element toXml(Document doc) { public Element toXml(Document doc) {
Element root = doc.createElement("data"); Element root = super.toXml(doc);
root.setAttribute("label", this.getLabel());
if (this.getMultiAutoComplete() != null) { if (this.getMultiAutoComplete() != null) {
root.setAttribute("multiAutoComplete", this.getMultiAutoComplete().toString()); root.setAttribute("multiAutoComplete", this.getMultiAutoComplete().toString());
} }
@ -43,7 +47,7 @@ public class OrganizationDataEntity extends BaseFieldDataEntity<OrganizationData
@Override @Override
public OrganizationDataEntity fromXml(Element item) { public OrganizationDataEntity fromXml(Element item) {
this.setLabel(item != null ? item.getAttribute("label") : ""); super.fromXml(item);
this.setMultiAutoComplete(Boolean.parseBoolean(item.getAttribute("multiAutoComplete"))); this.setMultiAutoComplete(Boolean.parseBoolean(item.getAttribute("multiAutoComplete")));
return this; return this;
} }

View File

@ -1,5 +1,6 @@
package eu.eudat.commons.types.descriptiontemplate.fielddata; package eu.eudat.commons.types.descriptiontemplate.fielddata;
import eu.eudat.commons.enums.FieldType;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;
@ -7,6 +8,10 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
public class PublicationDataEntity extends BaseFieldDataEntity<PublicationDataEntity> { public class PublicationDataEntity extends BaseFieldDataEntity<PublicationDataEntity> {
@Override
public FieldType getFieldType() {
return FieldType.PUBLICATIONS;
}
private Boolean multiAutoComplete; private Boolean multiAutoComplete;
public Boolean getMultiAutoComplete() { public Boolean getMultiAutoComplete() {
@ -33,8 +38,7 @@ public class PublicationDataEntity extends BaseFieldDataEntity<PublicationDataEn
@Override @Override
public Element toXml(Document doc) { public Element toXml(Document doc) {
Element root = doc.createElement("data"); Element root = super.toXml(doc);
root.setAttribute("label", this.getLabel());
if (this.getMultiAutoComplete() != null) { if (this.getMultiAutoComplete() != null) {
root.setAttribute("multiAutoComplete", this.getMultiAutoComplete().toString()); root.setAttribute("multiAutoComplete", this.getMultiAutoComplete().toString());
} }
@ -43,7 +47,7 @@ public class PublicationDataEntity extends BaseFieldDataEntity<PublicationDataEn
@Override @Override
public PublicationDataEntity fromXml(Element item) { public PublicationDataEntity fromXml(Element item) {
this.setLabel(item != null ? item.getAttribute("label") : ""); super.fromXml(item);
this.setMultiAutoComplete(Boolean.parseBoolean(item.getAttribute("multiAutoComplete"))); this.setMultiAutoComplete(Boolean.parseBoolean(item.getAttribute("multiAutoComplete")));
return this; return this;
} }

View File

@ -0,0 +1,63 @@
package eu.eudat.commons.types.descriptiontemplate.fielddata;
import eu.eudat.commons.enums.FieldType;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import java.util.HashMap;
import java.util.Map;
public class PublicationRepositoryDataEntity extends BaseFieldDataEntity<PublicationRepositoryDataEntity> {
@Override
public FieldType getFieldType() {
return FieldType.PUB_REPOSITORIES;
}
private Boolean multiAutoComplete;
public Boolean getMultiAutoComplete() {
return multiAutoComplete;
}
public void setMultiAutoComplete(Boolean multiAutoComplete) {
this.multiAutoComplete = multiAutoComplete;
}
@Override
public PublicationRepositoryDataEntity fromData(Object data) {
if (data != null) {
this.setLabel((String) ((Map<String, Object>) data).get("label"));
this.setMultiAutoComplete(((Map<String, Object>) data).get("multiAutoComplete") != null && !((Map<String, Object>) data).get("multiAutoComplete").toString().isEmpty()? Boolean.parseBoolean(((Map<String, Object>) data).get("multiAutoComplete").toString()) : false);
}
return this;
}
@Override
public Object toData() {
return null;
}
@Override
public Element toXml(Document doc) {
Element root = super.toXml(doc);
if (this.getMultiAutoComplete() != null) {
root.setAttribute("multiAutoComplete", this.getMultiAutoComplete().toString());
}
return root;
}
@Override
public PublicationRepositoryDataEntity fromXml(Element item) {
super.fromXml(item);
this.setMultiAutoComplete(Boolean.parseBoolean(item.getAttribute("multiAutoComplete")));
return this;
}
@Override
public Map<String, Object> toMap(Element item) {
HashMap dataMap = new HashMap();
dataMap.put("label", item != null && item.getAttributes().getLength() > 0? item.getAttribute("label") : "");
dataMap.put("multiAutoComplete", item != null && item.getAttributes().getLength() > 0 ? item.getAttribute("multiAutocomplete") : false);
return dataMap;
}
}

View File

@ -1,5 +1,6 @@
package eu.eudat.commons.types.descriptiontemplate.fielddata; package eu.eudat.commons.types.descriptiontemplate.fielddata;
import eu.eudat.commons.enums.FieldType;
import eu.eudat.commons.types.xml.XmlSerializable; import eu.eudat.commons.types.xml.XmlSerializable;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;
@ -12,7 +13,10 @@ import java.util.List;
import java.util.Map; import java.util.Map;
public class RadioBoxDataEntity extends BaseFieldDataEntity<RadioBoxDataEntity> { public class RadioBoxDataEntity extends BaseFieldDataEntity<RadioBoxDataEntity> {
@Override
public FieldType getFieldType() {
return FieldType.RADIO_BOX;
}
public class Option implements XmlSerializable<Option> { public class Option implements XmlSerializable<Option> {
private String label; private String label;
private String value; private String value;
@ -85,22 +89,20 @@ public class RadioBoxDataEntity extends BaseFieldDataEntity<RadioBoxDataEntity>
@Override @Override
public Element toXml(Document doc) { public Element toXml(Document doc) {
Element root = doc.createElement("data"); Element root = super.toXml(doc);
Element element = doc.createElement("options"); Element element = doc.createElement("options");
for (Option option : this.options) { for (Option option : this.options) {
element.appendChild(option.toXml(doc)); element.appendChild(option.toXml(doc));
} }
root.setAttribute("label", this.getLabel());
root.appendChild(element); root.appendChild(element);
return root; return root;
} }
@Override @Override
public RadioBoxDataEntity fromXml(Element item) { public RadioBoxDataEntity fromXml(Element item) {
super.fromXml(item);
this.options = new LinkedList<>(); this.options = new LinkedList<>();
Element optionsElement = (Element) item.getElementsByTagName("options").item(0); Element optionsElement = (Element) item.getElementsByTagName("options").item(0);
this.setLabel(item.getAttribute("label"));
if (optionsElement != null) { if (optionsElement != null) {
NodeList optionElements = optionsElement.getChildNodes(); NodeList optionElements = optionsElement.getChildNodes();
for (int temp = 0; temp < optionElements.getLength(); temp++) { for (int temp = 0; temp < optionElements.getLength(); temp++) {

View File

@ -1,5 +1,6 @@
package eu.eudat.commons.types.descriptiontemplate.fielddata; package eu.eudat.commons.types.descriptiontemplate.fielddata;
import eu.eudat.commons.enums.FieldType;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;
@ -7,6 +8,10 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
public class RegistryDataEntity extends BaseFieldDataEntity<RegistryDataEntity> { public class RegistryDataEntity extends BaseFieldDataEntity<RegistryDataEntity> {
@Override
public FieldType getFieldType() {
return FieldType.REGISTRIES;
}
private Boolean multiAutoComplete; private Boolean multiAutoComplete;
public Boolean getMultiAutoComplete() { public Boolean getMultiAutoComplete() {
@ -33,8 +38,7 @@ public class RegistryDataEntity extends BaseFieldDataEntity<RegistryDataEntity>
@Override @Override
public Element toXml(Document doc) { public Element toXml(Document doc) {
Element root = doc.createElement("data"); Element root = super.toXml(doc);
root.setAttribute("label", this.getLabel());
if (this.getMultiAutoComplete() != null) { if (this.getMultiAutoComplete() != null) {
root.setAttribute("multiAutoComplete", this.getMultiAutoComplete().toString()); root.setAttribute("multiAutoComplete", this.getMultiAutoComplete().toString());
} }
@ -43,7 +47,7 @@ public class RegistryDataEntity extends BaseFieldDataEntity<RegistryDataEntity>
@Override @Override
public RegistryDataEntity fromXml(Element item) { public RegistryDataEntity fromXml(Element item) {
this.setLabel(item != null ? item.getAttribute("label") : ""); super.fromXml(item);
this.setMultiAutoComplete(Boolean.parseBoolean(item.getAttribute("multiAutoComplete"))); this.setMultiAutoComplete(Boolean.parseBoolean(item.getAttribute("multiAutoComplete")));
return this; return this;
} }

View File

@ -1,5 +1,7 @@
package eu.eudat.commons.types.descriptiontemplate.fielddata; package eu.eudat.commons.types.descriptiontemplate.fielddata;
import eu.eudat.commons.enums.FieldDataInternalDmpEntryType;
import eu.eudat.commons.enums.FieldType;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;
@ -16,6 +18,16 @@ public class ResearcherAutoCompleteDataEntity extends InternalDmpBaseDataEntity<
this.multiAutoComplete = multiAutoComplete; this.multiAutoComplete = multiAutoComplete;
} }
@Override
public FieldDataInternalDmpEntryType getFieldSubType() {
return FieldDataInternalDmpEntryType.Researchers;
}
@Override
public FieldType getFieldType() {
return FieldType.INTERNAL_DMP_ENTRIES_RESEARCHERS;
}
@Override @Override
public Element toXml(Document doc) { public Element toXml(Document doc) {
Element root = super.toXml(doc); Element root = super.toXml(doc);

View File

@ -1,5 +1,6 @@
package eu.eudat.commons.types.descriptiontemplate.fielddata; package eu.eudat.commons.types.descriptiontemplate.fielddata;
import eu.eudat.commons.enums.FieldType;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;
@ -7,6 +8,10 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
public class ResearcherDataEntity extends BaseFieldDataEntity<ResearcherDataEntity> { public class ResearcherDataEntity extends BaseFieldDataEntity<ResearcherDataEntity> {
@Override
public FieldType getFieldType() {
return FieldType.RESEARCHERS;
}
private Boolean multiAutoComplete; private Boolean multiAutoComplete;
public Boolean getMultiAutoComplete() { public Boolean getMultiAutoComplete() {
@ -33,8 +38,7 @@ public class ResearcherDataEntity extends BaseFieldDataEntity<ResearcherDataEnti
@Override @Override
public Element toXml(Document doc) { public Element toXml(Document doc) {
Element root = doc.createElement("data"); Element root = super.toXml(doc);
root.setAttribute("label", this.getLabel());
if (this.getMultiAutoComplete() != null) { if (this.getMultiAutoComplete() != null) {
root.setAttribute("multiAutoComplete", this.getMultiAutoComplete().toString()); root.setAttribute("multiAutoComplete", this.getMultiAutoComplete().toString());
} }
@ -43,7 +47,7 @@ public class ResearcherDataEntity extends BaseFieldDataEntity<ResearcherDataEnti
@Override @Override
public ResearcherDataEntity fromXml(Element item) { public ResearcherDataEntity fromXml(Element item) {
this.setLabel(item != null ? item.getAttribute("label") : ""); super.fromXml(item);
this.setMultiAutoComplete(Boolean.parseBoolean(item.getAttribute("multiAutoComplete"))); this.setMultiAutoComplete(Boolean.parseBoolean(item.getAttribute("multiAutoComplete")));
return this; return this;
} }

View File

@ -1,5 +1,6 @@
package eu.eudat.commons.types.descriptiontemplate.fielddata; package eu.eudat.commons.types.descriptiontemplate.fielddata;
import eu.eudat.commons.enums.FieldType;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;
@ -8,6 +9,10 @@ import java.util.Map;
public class RichTextAreaDataEntity extends BaseFieldDataEntity<RichTextAreaDataEntity> { public class RichTextAreaDataEntity extends BaseFieldDataEntity<RichTextAreaDataEntity> {
@Override
public FieldType getFieldType() {
return FieldType.RICH_TEXT_AREA;
}
@Override @Override
public RichTextAreaDataEntity fromData(Object data) { public RichTextAreaDataEntity fromData(Object data) {
if (data != null) { if (data != null) {
@ -21,19 +26,6 @@ public class RichTextAreaDataEntity extends BaseFieldDataEntity<RichTextAreaData
return null; return null;
} }
@Override
public Element toXml(Document doc) {
Element root = doc.createElement("data");
root.setAttribute("label", this.getLabel());
return root;
}
@Override
public RichTextAreaDataEntity fromXml(Element item) {
this.setLabel(item.getAttribute("label"));
return this;
}
@Override @Override
public Map<String, Object> toMap(Element item) { public Map<String, Object> toMap(Element item) {
HashMap dataMap = new HashMap(); HashMap dataMap = new HashMap();

View File

@ -1,5 +1,6 @@
package eu.eudat.commons.types.descriptiontemplate.fielddata; package eu.eudat.commons.types.descriptiontemplate.fielddata;
import eu.eudat.commons.enums.FieldType;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;
@ -7,6 +8,10 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
public class ServiceDataEntity extends BaseFieldDataEntity<ServiceDataEntity> { public class ServiceDataEntity extends BaseFieldDataEntity<ServiceDataEntity> {
@Override
public FieldType getFieldType() {
return FieldType.SERVICES;
}
private Boolean multiAutoComplete; private Boolean multiAutoComplete;
public Boolean getMultiAutoComplete() { public Boolean getMultiAutoComplete() {
@ -33,8 +38,7 @@ public class ServiceDataEntity extends BaseFieldDataEntity<ServiceDataEntity> {
@Override @Override
public Element toXml(Document doc) { public Element toXml(Document doc) {
Element root = doc.createElement("data"); Element root = super.toXml(doc);
root.setAttribute("label", this.getLabel());
if (this.getMultiAutoComplete() != null) { if (this.getMultiAutoComplete() != null) {
root.setAttribute("multiAutoComplete", this.getMultiAutoComplete().toString()); root.setAttribute("multiAutoComplete", this.getMultiAutoComplete().toString());
} }
@ -43,7 +47,7 @@ public class ServiceDataEntity extends BaseFieldDataEntity<ServiceDataEntity> {
@Override @Override
public ServiceDataEntity fromXml(Element item) { public ServiceDataEntity fromXml(Element item) {
this.setLabel(item != null ? item.getAttribute("label") : ""); super.fromXml(item);
this.setMultiAutoComplete(Boolean.parseBoolean(item.getAttribute("multiAutoComplete"))); this.setMultiAutoComplete(Boolean.parseBoolean(item.getAttribute("multiAutoComplete")));
return this; return this;
} }

View File

@ -1,5 +1,6 @@
package eu.eudat.commons.types.descriptiontemplate.fielddata; package eu.eudat.commons.types.descriptiontemplate.fielddata;
import eu.eudat.commons.enums.FieldType;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;
@ -7,6 +8,10 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
public class TagDataEntity extends BaseFieldDataEntity<TagDataEntity> { public class TagDataEntity extends BaseFieldDataEntity<TagDataEntity> {
@Override
public FieldType getFieldType() {
return FieldType.TAGS;
}
@Override @Override
public TagDataEntity fromData(Object data) { public TagDataEntity fromData(Object data) {
if (data != null) { if (data != null) {
@ -20,18 +25,6 @@ public class TagDataEntity extends BaseFieldDataEntity<TagDataEntity> {
return null; return null;
} }
@Override
public Element toXml(Document doc) {
Element root = doc.createElement("data");
root.setAttribute("label", this.getLabel());
return root;
}
@Override
public TagDataEntity fromXml(Element item) {
this.setLabel(item != null ? item.getAttribute("label") : "");
return this;
}
@Override @Override
public Map<String, Object> toMap(Element item) { public Map<String, Object> toMap(Element item) {

View File

@ -1,5 +1,6 @@
package eu.eudat.commons.types.descriptiontemplate.fielddata; package eu.eudat.commons.types.descriptiontemplate.fielddata;
import eu.eudat.commons.enums.FieldType;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;
@ -7,6 +8,10 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
public class TaxonomyDataEntity extends BaseFieldDataEntity<TaxonomyDataEntity> { public class TaxonomyDataEntity extends BaseFieldDataEntity<TaxonomyDataEntity> {
@Override
public FieldType getFieldType() {
return FieldType.TAXONOMIES;
}
private Boolean multiAutoComplete; private Boolean multiAutoComplete;
public Boolean getMultiAutoComplete() { public Boolean getMultiAutoComplete() {
@ -33,8 +38,7 @@ public class TaxonomyDataEntity extends BaseFieldDataEntity<TaxonomyDataEntity>
@Override @Override
public Element toXml(Document doc) { public Element toXml(Document doc) {
Element root = doc.createElement("data"); Element root = super.toXml(doc);
root.setAttribute("label", this.getLabel());
if (this.getMultiAutoComplete() != null) { if (this.getMultiAutoComplete() != null) {
root.setAttribute("multiAutoComplete", this.getMultiAutoComplete().toString()); root.setAttribute("multiAutoComplete", this.getMultiAutoComplete().toString());
} }
@ -43,7 +47,7 @@ public class TaxonomyDataEntity extends BaseFieldDataEntity<TaxonomyDataEntity>
@Override @Override
public TaxonomyDataEntity fromXml(Element item) { public TaxonomyDataEntity fromXml(Element item) {
this.setLabel(item != null ? item.getAttribute("label") : ""); super.fromXml(item);
this.setMultiAutoComplete(Boolean.parseBoolean(item.getAttribute("multiAutoComplete"))); this.setMultiAutoComplete(Boolean.parseBoolean(item.getAttribute("multiAutoComplete")));
return this; return this;
} }

View File

@ -1,5 +1,6 @@
package eu.eudat.commons.types.descriptiontemplate.fielddata; package eu.eudat.commons.types.descriptiontemplate.fielddata;
import eu.eudat.commons.enums.FieldType;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;
@ -8,6 +9,11 @@ import java.util.Map;
public class TextAreaDataEntity extends BaseFieldDataEntity<TextAreaDataEntity> { public class TextAreaDataEntity extends BaseFieldDataEntity<TextAreaDataEntity> {
@Override
public FieldType getFieldType() {
return FieldType.TEXT_AREA;
}
@Override @Override
public TextAreaDataEntity fromData(Object data) { public TextAreaDataEntity fromData(Object data) {
if (data != null) { if (data != null) {
@ -21,18 +27,6 @@ public class TextAreaDataEntity extends BaseFieldDataEntity<TextAreaDataEntity>
return null; return null;
} }
@Override
public Element toXml(Document doc) {
Element root = doc.createElement("data");
root.setAttribute("label", this.getLabel());
return root;
}
@Override
public TextAreaDataEntity fromXml(Element item) {
this.setLabel(item.getAttribute("label"));
return this;
}
@Override @Override
public Map<String, Object> toMap(Element item) { public Map<String, Object> toMap(Element item) {

View File

@ -1,5 +1,6 @@
package eu.eudat.commons.types.descriptiontemplate.fielddata; package eu.eudat.commons.types.descriptiontemplate.fielddata;
import eu.eudat.commons.enums.FieldType;
import eu.eudat.commons.types.xml.XmlSerializable; import eu.eudat.commons.types.xml.XmlSerializable;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;
@ -13,6 +14,10 @@ import java.util.Map;
public class UploadDataEntity extends BaseFieldDataEntity<UploadDataEntity> { public class UploadDataEntity extends BaseFieldDataEntity<UploadDataEntity> {
@Override
public FieldType getFieldType() {
return FieldType.UPLOAD;
}
public class Option implements XmlSerializable<UploadDataEntity.Option> { public class Option implements XmlSerializable<UploadDataEntity.Option> {
private String label; private String label;
private String value; private String value;
@ -102,12 +107,11 @@ public class UploadDataEntity extends BaseFieldDataEntity<UploadDataEntity> {
@Override @Override
public Element toXml(Document doc) { public Element toXml(Document doc) {
Element root = doc.createElement("data"); Element root = super.toXml(doc);
Element element = doc.createElement("types"); Element element = doc.createElement("types");
for (UploadDataEntity.Option type : this.types) { for (UploadDataEntity.Option type : this.types) {
element.appendChild(type.toXml(doc)); element.appendChild(type.toXml(doc));
} }
root.setAttribute("label", this.getLabel());
root.setAttribute("maxFileSizeInMB", this.getMaxFileSizeInMB().toString()); root.setAttribute("maxFileSizeInMB", this.getMaxFileSizeInMB().toString());
root.appendChild(element); root.appendChild(element);
return root; return root;
@ -116,8 +120,8 @@ public class UploadDataEntity extends BaseFieldDataEntity<UploadDataEntity> {
@Override @Override
public UploadDataEntity fromXml(Element item) { public UploadDataEntity fromXml(Element item) {
this.types = new LinkedList<>(); this.types = new LinkedList<>();
super.fromXml(item);
Element optionsElement = (Element) item.getElementsByTagName("types").item(0); Element optionsElement = (Element) item.getElementsByTagName("types").item(0);
this.setLabel(item.getAttribute("label"));
if(item.getAttribute("maxFileSizeInMB") != null) { if(item.getAttribute("maxFileSizeInMB") != null) {
this.setMaxFileSizeInMB(Integer.parseInt(item.getAttribute("maxFileSizeInMB"))); this.setMaxFileSizeInMB(Integer.parseInt(item.getAttribute("maxFileSizeInMB")));
} }

View File

@ -1,5 +1,6 @@
package eu.eudat.commons.types.descriptiontemplate.fielddata; package eu.eudat.commons.types.descriptiontemplate.fielddata;
import eu.eudat.commons.enums.FieldType;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;
@ -7,6 +8,10 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
public class ValidationDataEntity extends BaseFieldDataEntity<ValidationDataEntity> { public class ValidationDataEntity extends BaseFieldDataEntity<ValidationDataEntity> {
@Override
public FieldType getFieldType() {
return FieldType.VALIDATION;
}
@Override @Override
public ValidationDataEntity fromData(Object data) { public ValidationDataEntity fromData(Object data) {
if (data != null) { if (data != null) {
@ -20,18 +25,6 @@ public class ValidationDataEntity extends BaseFieldDataEntity<ValidationDataEnti
return null; return null;
} }
@Override
public Element toXml(Document doc) {
Element root = doc.createElement("data");
root.setAttribute("label", this.getLabel());
return root;
}
@Override
public ValidationDataEntity fromXml(Element item) {
this.setLabel(item != null ? item.getAttribute("label") : "");
return this;
}
@Override @Override
public Map<String, Object> toMap(Element item) { public Map<String, Object> toMap(Element item) {

View File

@ -1,5 +1,7 @@
package eu.eudat.commons.types.descriptiontemplate.fielddata; package eu.eudat.commons.types.descriptiontemplate.fielddata;
import eu.eudat.commons.enums.FieldDataComboBoxType;
import eu.eudat.commons.enums.FieldType;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;
import org.w3c.dom.Node; import org.w3c.dom.Node;
@ -31,6 +33,16 @@ public class WordListDataEntity extends ComboBoxDataEntity<WordListDataEntity> {
this.multiList = multiList; this.multiList = multiList;
} }
@Override
public FieldDataComboBoxType getFieldSubType() {
return FieldDataComboBoxType.Wordlist;
}
@Override
public FieldType getFieldType() {
return FieldType.WORD_LIST;
}
@Override @Override
public Element toXml(Document doc) { public Element toXml(Document doc) {
Element root = super.toXml(doc); Element root = super.toXml(doc);

View File

@ -59,15 +59,13 @@ public class FieldBuilder extends BaseBuilder<Field, FieldEntity> {
if (fields.hasField(this.asIndexer(Field._numbering))) m.setNumbering(d.getNumbering()); if (fields.hasField(this.asIndexer(Field._numbering))) m.setNumbering(d.getNumbering());
if (fields.hasField(this.asIndexer(Field._schematics))) m.setSchematics(d.getSchematics()); if (fields.hasField(this.asIndexer(Field._schematics))) m.setSchematics(d.getSchematics());
if (fields.hasField(this.asIndexer(Field._defaultValue))) m.setDefaultValue(d.getDefaultValue()); if (fields.hasField(this.asIndexer(Field._defaultValue))) m.setDefaultValue(d.getDefaultValue());
if (fields.hasField(this.asIndexer(Field._fieldType))) m.setFieldType(d.getFieldType());
if (fields.hasField(this.asIndexer(Field._includeInExport))) m.setIncludeInExport(d.getIncludeInExport()); if (fields.hasField(this.asIndexer(Field._includeInExport))) m.setIncludeInExport(d.getIncludeInExport());
if (fields.hasField(this.asIndexer(Field._validations))) m.setValidations(d.getValidations()); if (fields.hasField(this.asIndexer(Field._validations))) m.setValidations(d.getValidations());
if (fields.hasField(this.asIndexer(Field._numbering))) m.setNumbering(d.getNumbering()); if (fields.hasField(this.asIndexer(Field._numbering))) m.setNumbering(d.getNumbering());
if (fields.hasField(this.asIndexer(Field._numbering))) m.setNumbering(d.getNumbering()); if (fields.hasField(this.asIndexer(Field._numbering))) m.setNumbering(d.getNumbering());
if (!visibilityRulesFields.isEmpty() && d.getVisibilityRules() != null) m.setVisibilityRules(this.builderFactory.builder(RuleBuilder.class).authorize(this.authorize).build(visibilityRulesFields, d.getVisibilityRules())); if (!visibilityRulesFields.isEmpty() && d.getVisibilityRules() != null) m.setVisibilityRules(this.builderFactory.builder(RuleBuilder.class).authorize(this.authorize).build(visibilityRulesFields, d.getVisibilityRules()));
if (!dataFields.isEmpty() && d.getData() != null){ if (!dataFields.isEmpty() && d.getData() != null){
FieldDataHelperService fieldDataHelperService = this.fieldDataHelperServiceProvider.get(d.getFieldType()); FieldDataHelperService fieldDataHelperService = this.fieldDataHelperServiceProvider.get(d.getData().getFieldType());
if (fieldDataHelperService.requireSubType()) fieldDataHelperService.setSubType(d.getData().getSubType());
m.setData(fieldDataHelperService.buildOne(dataFields, d.getData(), this.authorize)); m.setData(fieldDataHelperService.buildOne(dataFields, d.getData(), this.authorize));
} }

View File

@ -14,7 +14,7 @@ import org.springframework.stereotype.Component;
@Component @Component
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class AutoCompleteDataBuilder extends ComboBoxDataBuilder<AutoCompleteData, AutoCompleteDataEntity> { public class AutoCompleteDataBuilder extends BaseFieldDataBuilder<AutoCompleteData, AutoCompleteDataEntity> {
private final BuilderFactory builderFactory; private final BuilderFactory builderFactory;
@Autowired @Autowired
public AutoCompleteDataBuilder(ConventionService conventionService, BuilderFactory builderFactory) { public AutoCompleteDataBuilder(ConventionService conventionService, BuilderFactory builderFactory) {
@ -28,9 +28,10 @@ public class AutoCompleteDataBuilder extends ComboBoxDataBuilder<AutoCompleteDat
} }
@Override @Override
protected void buildComboBoxChild(FieldSet fields, AutoCompleteDataEntity d, AutoCompleteData m) { protected void buildChild(FieldSet fields, AutoCompleteDataEntity d, AutoCompleteData m) {
FieldSet autoCompleteSingleDataListFields = fields.extractPrefixed(this.asPrefix(AutoCompleteData._autoCompleteSingleDataList)); FieldSet autoCompleteSingleDataListFields = fields.extractPrefixed(this.asPrefix(AutoCompleteData._autoCompleteSingleDataList));
if (fields.hasField(this.asIndexer(AutoCompleteData._multiAutoComplete))) m.setMultiAutoComplete(d.getMultiAutoComplete()); if (fields.hasField(this.asIndexer(AutoCompleteData._multiAutoComplete))) m.setMultiAutoComplete(d.getMultiAutoComplete());
if (!autoCompleteSingleDataListFields.isEmpty() && d.getAutoCompleteSingleDataList() != null) m.setAutoCompleteSingleDataList(this.builderFactory.builder(AutoCompleteSingleDataBuilder.class).authorize(this.authorize).build(autoCompleteSingleDataListFields, d.getAutoCompleteSingleDataList())); if (!autoCompleteSingleDataListFields.isEmpty() && d.getAutoCompleteSingleDataList() != null) m.setAutoCompleteSingleDataList(this.builderFactory.builder(AutoCompleteSingleDataBuilder.class).authorize(this.authorize).build(autoCompleteSingleDataListFields, d.getAutoCompleteSingleDataList()));
} }
} }

View File

@ -46,6 +46,7 @@ public abstract class BaseFieldDataBuilder<Model extends BaseFieldData, Entity e
for (Entity d : data) { for (Entity d : data) {
Model m = this.getInstance(); Model m = this.getInstance();
if (fields.hasField(this.asIndexer(Model._label))) m.setLabel(d.getLabel()); if (fields.hasField(this.asIndexer(Model._label))) m.setLabel(d.getLabel());
if (fields.hasField(this.asIndexer(Model._fieldType))) m.setFieldType(d.getFieldType());
this.buildChild(fields, d, m); this.buildChild(fields, d, m);
models.add(m); models.add(m);
} }

View File

@ -1,22 +0,0 @@
package eu.eudat.model.builder.descriptiontemplatedefinition.fielddata;
import eu.eudat.commons.types.descriptiontemplate.fielddata.ComboBoxDataEntity;
import eu.eudat.convention.ConventionService;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.ComboBoxData;
import gr.cite.tools.fieldset.FieldSet;
import gr.cite.tools.logging.LoggerService;
import org.springframework.beans.factory.annotation.Autowired;
public abstract class ComboBoxDataBuilder<M extends ComboBoxData, D extends ComboBoxDataEntity<?>> extends BaseFieldDataBuilder<M, D> {
protected abstract void buildComboBoxChild(FieldSet fields, D d, M m);
@Autowired
public ComboBoxDataBuilder(ConventionService conventionService, LoggerService logger) {
super(conventionService, logger);
}
protected void buildChild(FieldSet fields, D d, M m) {
if (fields.hasField(this.asIndexer(ComboBoxData._type))) m.setType(d.getType());
this.buildComboBoxChild(fields, d, m);
}
}

View File

@ -13,7 +13,7 @@ import org.springframework.stereotype.Component;
@Component @Component
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class DatasetAutoCompleteDataBuilder extends InternalDmpBaseDataBuilder<DatasetAutoCompleteData, DatasetAutoCompleteDataEntity> { public class DatasetAutoCompleteDataBuilder extends BaseFieldDataBuilder<DatasetAutoCompleteData, DatasetAutoCompleteDataEntity> {
@Autowired @Autowired
public DatasetAutoCompleteDataBuilder(ConventionService conventionService) { public DatasetAutoCompleteDataBuilder(ConventionService conventionService) {
@ -25,7 +25,7 @@ public class DatasetAutoCompleteDataBuilder extends InternalDmpBaseDataBuilder<D
} }
@Override @Override
protected void buildInternalDmpChild(FieldSet fields, DatasetAutoCompleteDataEntity m, DatasetAutoCompleteData d) { protected void buildChild(FieldSet fields, DatasetAutoCompleteDataEntity d, DatasetAutoCompleteData m) {
if (fields.hasField(this.asIndexer(DatasetAutoCompleteData._multiAutoComplete))) m.setMultiAutoComplete(d.getMultiAutoComplete()); if (fields.hasField(this.asIndexer(DatasetAutoCompleteData._multiAutoComplete))) m.setMultiAutoComplete(d.getMultiAutoComplete());
} }
} }

View File

@ -13,7 +13,7 @@ import org.springframework.stereotype.Component;
@Component @Component
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class DmpAutoCompleteDataBuilder extends InternalDmpBaseDataBuilder<DmpAutoCompleteData, DmpAutoCompleteDataEntity> { public class DmpAutoCompleteDataBuilder extends BaseFieldDataBuilder<DmpAutoCompleteData, DmpAutoCompleteDataEntity> {
@Autowired @Autowired
public DmpAutoCompleteDataBuilder(ConventionService conventionService) { public DmpAutoCompleteDataBuilder(ConventionService conventionService) {
@ -25,7 +25,8 @@ public class DmpAutoCompleteDataBuilder extends InternalDmpBaseDataBuilder<DmpAu
} }
@Override @Override
protected void buildInternalDmpChild(FieldSet fields, DmpAutoCompleteDataEntity m, DmpAutoCompleteData d) { protected void buildChild(FieldSet fields, DmpAutoCompleteDataEntity d, DmpAutoCompleteData m) {
if (fields.hasField(this.asIndexer(DmpAutoCompleteData._multiAutoComplete))) m.setMultiAutoComplete(d.getMultiAutoComplete()); if (fields.hasField(this.asIndexer(DmpAutoCompleteData._multiAutoComplete))) m.setMultiAutoComplete(d.getMultiAutoComplete());
} }
} }

View File

@ -2,7 +2,6 @@ package eu.eudat.model.builder.descriptiontemplatedefinition.fielddata;
import eu.eudat.commons.types.descriptiontemplate.fielddata.ExternalDatasetDataEntity; import eu.eudat.commons.types.descriptiontemplate.fielddata.ExternalDatasetDataEntity;
import eu.eudat.convention.ConventionService; import eu.eudat.convention.ConventionService;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.ComboBoxOption;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.ExternalDatasetData; import eu.eudat.model.descriptiontemplatedefinition.fielddata.ExternalDatasetData;
import gr.cite.tools.fieldset.FieldSet; import gr.cite.tools.fieldset.FieldSet;
import gr.cite.tools.logging.LoggerService; import gr.cite.tools.logging.LoggerService;

View File

@ -1,22 +0,0 @@
package eu.eudat.model.builder.descriptiontemplatedefinition.fielddata;
import eu.eudat.commons.types.descriptiontemplate.fielddata.InternalDmpBaseDataEntity;
import eu.eudat.convention.ConventionService;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.InternalDmpBaseData;
import gr.cite.tools.fieldset.FieldSet;
import gr.cite.tools.logging.LoggerService;
import org.springframework.beans.factory.annotation.Autowired;
public abstract class InternalDmpBaseDataBuilder<M extends InternalDmpBaseData, D extends InternalDmpBaseDataEntity<?>> extends BaseFieldDataBuilder<M, D> {
protected abstract void buildInternalDmpChild(FieldSet fields, D d, M m);
@Autowired
public InternalDmpBaseDataBuilder(ConventionService conventionService, LoggerService logger) {
super(conventionService, logger);
}
protected void buildChild(FieldSet fields, D d, M m) {
if (fields.hasField(this.asIndexer(InternalDmpBaseData._type))) m.setType(d.getType());
this.buildInternalDmpChild(fields, d, m);
}
}

View File

@ -0,0 +1,31 @@
package eu.eudat.model.builder.descriptiontemplatedefinition.fielddata;
import eu.eudat.commons.types.descriptiontemplate.fielddata.DataRepositoryDataEntity;
import eu.eudat.convention.ConventionService;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.DataRepositoryData;
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 JournalRepositoryDataBuilder extends BaseFieldDataBuilder<DataRepositoryData, DataRepositoryDataEntity> {
@Autowired
public JournalRepositoryDataBuilder(ConventionService conventionService) {
super(conventionService, new LoggerService(LoggerFactory.getLogger(JournalRepositoryDataBuilder.class)));
}
protected DataRepositoryData getInstance() {
return new DataRepositoryData();
}
@Override
protected void buildChild(FieldSet fields, DataRepositoryDataEntity d, DataRepositoryData m) {
if (fields.hasField(this.asIndexer(DataRepositoryData._multiAutoComplete))) m.setMultiAutoComplete(d.getMultiAutoComplete());
}
}

View File

@ -0,0 +1,31 @@
package eu.eudat.model.builder.descriptiontemplatedefinition.fielddata;
import eu.eudat.commons.types.descriptiontemplate.fielddata.DataRepositoryDataEntity;
import eu.eudat.convention.ConventionService;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.DataRepositoryData;
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 PublicationRepositoryDataBuilder extends BaseFieldDataBuilder<DataRepositoryData, DataRepositoryDataEntity> {
@Autowired
public PublicationRepositoryDataBuilder(ConventionService conventionService) {
super(conventionService, new LoggerService(LoggerFactory.getLogger(PublicationRepositoryDataBuilder.class)));
}
protected DataRepositoryData getInstance() {
return new DataRepositoryData();
}
@Override
protected void buildChild(FieldSet fields, DataRepositoryDataEntity d, DataRepositoryData m) {
if (fields.hasField(this.asIndexer(DataRepositoryData._multiAutoComplete))) m.setMultiAutoComplete(d.getMultiAutoComplete());
}
}

View File

@ -13,7 +13,7 @@ import org.springframework.stereotype.Component;
@Component @Component
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class ResearcherAutoCompleteDataBuilder extends InternalDmpBaseDataBuilder<ResearcherAutoCompleteData, ResearcherAutoCompleteDataEntity> { public class ResearcherAutoCompleteDataBuilder extends BaseFieldDataBuilder<ResearcherAutoCompleteData, ResearcherAutoCompleteDataEntity> {
@Autowired @Autowired
public ResearcherAutoCompleteDataBuilder(ConventionService conventionService) { public ResearcherAutoCompleteDataBuilder(ConventionService conventionService) {
@ -25,7 +25,7 @@ public class ResearcherAutoCompleteDataBuilder extends InternalDmpBaseDataBuilde
} }
@Override @Override
protected void buildInternalDmpChild(FieldSet fields, ResearcherAutoCompleteDataEntity d, ResearcherAutoCompleteData m) { protected void buildChild(FieldSet fields, ResearcherAutoCompleteDataEntity d, ResearcherAutoCompleteData m) {
if (fields.hasField(this.asIndexer(ResearcherAutoCompleteData._multiAutoComplete))) m.setMultiAutoComplete(d.getMultiAutoComplete()); if (fields.hasField(this.asIndexer(ResearcherAutoCompleteData._multiAutoComplete))) m.setMultiAutoComplete(d.getMultiAutoComplete());
} }

View File

@ -14,7 +14,7 @@ import org.springframework.stereotype.Component;
@Component @Component
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class WordListDataBuilder extends ComboBoxDataBuilder<WordListData, WordListDataEntity> { public class WordListDataBuilder extends BaseFieldDataBuilder<WordListData, WordListDataEntity> {
private final BuilderFactory builderFactory; private final BuilderFactory builderFactory;
@Autowired @Autowired
public WordListDataBuilder(ConventionService conventionService, BuilderFactory builderFactory) { public WordListDataBuilder(ConventionService conventionService, BuilderFactory builderFactory) {
@ -28,9 +28,10 @@ public class WordListDataBuilder extends ComboBoxDataBuilder<WordListData, WordL
} }
@Override @Override
protected void buildComboBoxChild(FieldSet fields, WordListDataEntity d, WordListData m) { protected void buildChild(FieldSet fields, WordListDataEntity d, WordListData m) {
FieldSet optionsFields = fields.extractPrefixed(this.asPrefix(WordListData._options)); FieldSet optionsFields = fields.extractPrefixed(this.asPrefix(WordListData._options));
if (fields.hasField(this.asIndexer(WordListData._multiList))) m.setMultiList(d.getMultiList()); if (fields.hasField(this.asIndexer(WordListData._multiList))) m.setMultiList(d.getMultiList());
if (!optionsFields.isEmpty() && d.getOptions() != null) m.setOptions(this.builderFactory.builder(ComboBoxOptionBuilder.class).authorize(this.authorize).build(optionsFields, d.getOptions())); if (!optionsFields.isEmpty() && d.getOptions() != null) m.setOptions(this.builderFactory.builder(ComboBoxOptionBuilder.class).authorize(this.authorize).build(optionsFields, d.getOptions()));
} }
} }

View File

@ -0,0 +1,81 @@
package eu.eudat.model.deleter;
import eu.eudat.commons.enums.IsActive;
import eu.eudat.data.DescriptionTemplateEntity;
import eu.eudat.query.DescriptionTemplateQuery;
import gr.cite.tools.data.deleter.Deleter;
import gr.cite.tools.data.deleter.DeleterFactory;
import gr.cite.tools.data.query.QueryFactory;
import gr.cite.tools.logging.LoggerService;
import gr.cite.tools.logging.MapLogEntry;
import jakarta.persistence.EntityManager;
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 javax.management.InvalidApplicationException;
import java.time.Instant;
import java.util.List;
import java.util.Optional;
import java.util.UUID;
@Component
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class DescriptionTemplateDeleter implements Deleter {
private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(DescriptionTemplateDeleter.class));
private final EntityManager entityManager;
protected final QueryFactory queryFactory;
protected final DeleterFactory deleterFactory;
@Autowired
public DescriptionTemplateDeleter(
EntityManager entityManager,
QueryFactory queryFactory,
DeleterFactory deleterFactory
) {
this.entityManager = entityManager;
this.queryFactory = queryFactory;
this.deleterFactory = deleterFactory;
}
public void deleteAndSaveByIds(List<UUID> ids) throws InvalidApplicationException {
logger.debug(new MapLogEntry("collecting to delete").And("count", Optional.ofNullable(ids).map(List::size).orElse(0)).And("ids", ids));
List<DescriptionTemplateEntity> data = this.queryFactory.query(DescriptionTemplateQuery.class).ids(ids).collect();
logger.trace("retrieved {} items", Optional.ofNullable(data).map(List::size).orElse(0));
this.deleteAndSave(data);
}
public void deleteAndSave(List<DescriptionTemplateEntity> data) throws InvalidApplicationException {
logger.debug("will delete {} items", Optional.ofNullable(data).map(List::size).orElse(0));
this.delete(data);
logger.trace("saving changes");
this.entityManager.flush();
logger.trace("changes saved");
}
public void delete(List<DescriptionTemplateEntity> data) throws InvalidApplicationException {
logger.debug("will delete {} items", Optional.ofNullable(data).map(List::size).orElse(0));
if (data == null || data.isEmpty())
return;
//TODO can not delete profile if has Datasets
Instant now = Instant.now();
for (DescriptionTemplateEntity item : data) {
logger.trace("deleting item {}", item.getId());
item.setIsActive(IsActive.Inactive);
item.setUpdatedAt(now);
logger.trace("updating item");
this.entityManager.merge(item);
logger.trace("updated item");
}
}
}

View File

@ -15,7 +15,7 @@ public class Field {
private Integer ordinal; private Integer ordinal;
public final static String _numbering = "numbering"; public final static String _numbering = "numbering";
private String numbering; private String numbering; //TODO maybe remove
public final static String _schematics = "schematics"; public final static String _schematics = "schematics";
private List<String> schematics; private List<String> schematics;
@ -29,9 +29,6 @@ public class Field {
public final static String _validations = "validations"; public final static String _validations = "validations";
private List<FieldValidationType> validations; private List<FieldValidationType> validations;
public final static String _fieldType = "fieldType";
private FieldType fieldType;
public final static String _includeInExport = "includeInExport"; public final static String _includeInExport = "includeInExport";
private Boolean includeInExport; private Boolean includeInExport;
@ -94,14 +91,6 @@ public class Field {
this.validations = validations; this.validations = validations;
} }
public FieldType getFieldType() {
return fieldType;
}
public void setFieldType(FieldType fieldType) {
this.fieldType = fieldType;
}
public Boolean getIncludeInExport() { public Boolean getIncludeInExport() {
return includeInExport; return includeInExport;
} }

View File

@ -9,7 +9,7 @@ public class Page {
private String id; private String id;
public final static String _ordinal = "ordinal"; public final static String _ordinal = "ordinal";
private int ordinal; private Integer ordinal;
public final static String _title = "title"; public final static String _title = "title";
private String title; private String title;

View File

@ -9,7 +9,7 @@ public class Section {
private String id; private String id;
public final static String _ordinal = "ordinal"; public final static String _ordinal = "ordinal";
private int ordinal; private Integer ordinal;
public final static String _defaultVisibility = "defaultVisibility"; public final static String _defaultVisibility = "defaultVisibility";
private Boolean defaultVisibility; private Boolean defaultVisibility;
@ -18,7 +18,7 @@ public class Section {
private Boolean multiplicity; private Boolean multiplicity;
public final static String _numbering = "numbering"; public final static String _numbering = "numbering";
private String numbering; private String numbering; //TODO maybe remove
public final static String _page = "page"; public final static String _page = "page";
private String page; private String page;
@ -30,7 +30,7 @@ public class Section {
private String description; private String description;
public final static String _extendedDescription = "extendedDescription"; public final static String _extendedDescription = "extendedDescription";
private String extendedDescription; private String extendedDescription; //TODO maybe remove
public final static String _sections = "sections"; public final static String _sections = "sections";
private List<Section> sections; private List<Section> sections;

View File

@ -2,7 +2,7 @@ package eu.eudat.model.descriptiontemplatedefinition.fielddata;
import java.util.List; import java.util.List;
public class AutoCompleteData extends ComboBoxData { public class AutoCompleteData extends BaseFieldData {
public final static String _multiAutoComplete = "multiAutoComplete"; public final static String _multiAutoComplete = "multiAutoComplete";
private Boolean multiAutoComplete; private Boolean multiAutoComplete;
public final static String _autoCompleteSingleDataList = "autoCompleteSingleDataList"; public final static String _autoCompleteSingleDataList = "autoCompleteSingleDataList";

View File

@ -1,10 +1,15 @@
package eu.eudat.model.descriptiontemplatedefinition.fielddata; package eu.eudat.model.descriptiontemplatedefinition.fielddata;
import eu.eudat.commons.enums.FieldType;
public abstract class BaseFieldData { public abstract class BaseFieldData {
public final static String _label = "label"; public final static String _label = "label";
private String label; private String label;
public final static String _fieldType = "fieldType";
private FieldType fieldType;
public String getLabel() { public String getLabel() {
return label; return label;
} }
@ -12,4 +17,12 @@ public abstract class BaseFieldData {
public void setLabel(String label) { public void setLabel(String label) {
this.label = label; this.label = label;
} }
public FieldType getFieldType() {
return fieldType;
}
public void setFieldType(FieldType fieldType) {
this.fieldType = fieldType;
}
} }

View File

@ -1,20 +0,0 @@
package eu.eudat.model.descriptiontemplatedefinition.fielddata;
import eu.eudat.commons.enums.FieldDataComboBoxType;
public abstract class ComboBoxData extends BaseFieldData {
public final static String _type = "type";
private FieldDataComboBoxType type;
public FieldDataComboBoxType getType() {
return type;
}
public void setType(FieldDataComboBoxType type) {
this.type = type;
}
}

View File

@ -1,6 +1,6 @@
package eu.eudat.model.descriptiontemplatedefinition.fielddata; package eu.eudat.model.descriptiontemplatedefinition.fielddata;
public class DatasetAutoCompleteData extends InternalDmpBaseData { public class DatasetAutoCompleteData extends BaseFieldData {
public final static String _multiAutoComplete = "multiAutoComplete"; public final static String _multiAutoComplete = "multiAutoComplete";
private Boolean multiAutoComplete; private Boolean multiAutoComplete;

View File

@ -1,6 +1,6 @@
package eu.eudat.model.descriptiontemplatedefinition.fielddata; package eu.eudat.model.descriptiontemplatedefinition.fielddata;
public class DmpAutoCompleteData extends InternalDmpBaseData { public class DmpAutoCompleteData extends BaseFieldData {
public final static String _multiAutoComplete = "multiAutoComplete"; public final static String _multiAutoComplete = "multiAutoComplete";
private Boolean multiAutoComplete; private Boolean multiAutoComplete;

View File

@ -1,15 +0,0 @@
package eu.eudat.model.descriptiontemplatedefinition.fielddata;
import eu.eudat.commons.enums.FieldDataInternalDmpEntryType;
public abstract class InternalDmpBaseData extends BaseFieldData {
public final static String _type = "type";
private FieldDataInternalDmpEntryType type;
public FieldDataInternalDmpEntryType getType() {
return type;
}
public void setType(FieldDataInternalDmpEntryType type) {
this.type = type;
}
}

View File

@ -0,0 +1,14 @@
package eu.eudat.model.descriptiontemplatedefinition.fielddata;
public class JournalRepositoryData extends BaseFieldData {
public final static String _multiAutoComplete = "multiAutoComplete";
private Boolean multiAutoComplete;
public Boolean getMultiAutoComplete() {
return multiAutoComplete;
}
public void setMultiAutoComplete(Boolean multiAutoComplete) {
this.multiAutoComplete = multiAutoComplete;
}
}

View File

@ -0,0 +1,14 @@
package eu.eudat.model.descriptiontemplatedefinition.fielddata;
public class PublicationRepositoryData extends BaseFieldData {
public final static String _multiAutoComplete = "multiAutoComplete";
private Boolean multiAutoComplete;
public Boolean getMultiAutoComplete() {
return multiAutoComplete;
}
public void setMultiAutoComplete(Boolean multiAutoComplete) {
this.multiAutoComplete = multiAutoComplete;
}
}

View File

@ -1,6 +1,6 @@
package eu.eudat.model.descriptiontemplatedefinition.fielddata; package eu.eudat.model.descriptiontemplatedefinition.fielddata;
public class ResearcherAutoCompleteData extends InternalDmpBaseData { public class ResearcherAutoCompleteData extends BaseFieldData {
public final static String _multiAutoComplete = "multiAutoComplete"; public final static String _multiAutoComplete = "multiAutoComplete";
private Boolean multiAutoComplete; private Boolean multiAutoComplete;

View File

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

View File

@ -0,0 +1,137 @@
package eu.eudat.model.persist;
import eu.eudat.commons.enums.DescriptionTemplateStatus;
import eu.eudat.commons.validation.FieldNotNullIfOtherSet;
import eu.eudat.commons.validation.ValidEnum;
import eu.eudat.commons.validation.ValidId;
import eu.eudat.data.DescriptionTemplateEntity;
import eu.eudat.model.persist.descriptiontemplatedefinition.DefinitionPersist;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import java.util.UUID;
@FieldNotNullIfOtherSet(message = "{validation.hashempty}")
public class DescriptionTemplatePersist {
@ValidId(message = "{validation.invalidid}")
private UUID id;
@NotNull(message = "{validation.empty}")
@NotEmpty(message = "{validation.empty}")
@Size(max = DescriptionTemplateEntity._labelLength, message = "{validation.largerthanmax}")
private String label = null;
@NotNull(message = "{validation.empty}")
@NotEmpty(message = "{validation.empty}")
private String description = null;
@NotNull(message = "{validation.empty}")
@ValidId(message = "{validation.invalidid}")
private UUID groupId = null;
@NotNull(message = "{validation.empty}")
private Short version = null;
@NotNull(message = "{validation.empty}")
@NotEmpty(message = "{validation.empty}")
private String language = null;
@NotNull(message = "{validation.empty}")
@ValidId(message = "{validation.invalidid}")
private UUID type = null;
@ValidEnum(message = "{validation.empty}")
private DescriptionTemplateStatus status;
@NotNull(message = "{validation.empty}")
@Valid
private DefinitionPersist definition = null;
private String hash;
public UUID getId() {
return id;
}
public void setId(UUID id) {
this.id = id;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public UUID getGroupId() {
return groupId;
}
public void setGroupId(UUID groupId) {
this.groupId = groupId;
}
public Short getVersion() {
return version;
}
public void setVersion(Short version) {
this.version = version;
}
public String getLanguage() {
return language;
}
public void setLanguage(String language) {
this.language = language;
}
public UUID getType() {
return type;
}
public void setType(UUID type) {
this.type = type;
}
public String getHash() {
return hash;
}
public void setHash(String hash) {
this.hash = hash;
}
public DescriptionTemplateStatus getStatus() {
return status;
}
public void setStatus(DescriptionTemplateStatus status) {
this.status = status;
}
public DefinitionPersist getDefinition() {
return definition;
}
public void setDefinition(DefinitionPersist definition) {
this.definition = definition;
}
}

View File

@ -0,0 +1,33 @@
package eu.eudat.model.persist.descriptiontemplatedefinition;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotNull;
import java.util.List;
public class DefinitionPersist {
@NotNull(message = "{validation.empty}")
@Valid
private List<SectionPersist> sections = null;
@NotNull(message = "{validation.empty}")
@Valid
private List<PagePersist> pages = null;
public List<SectionPersist> getSections() {
return sections;
}
public void setSections(List<SectionPersist> sections) {
this.sections = sections;
}
public List<PagePersist> getPages() {
return pages;
}
public void setPages(List<PagePersist> pages) {
this.pages = pages;
}
}

View File

@ -0,0 +1,99 @@
package eu.eudat.model.persist.descriptiontemplatedefinition;
import eu.eudat.commons.enums.FieldValidationType;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.BaseFieldDataPersist;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import java.util.List;
public class FieldPersist {
@NotNull(message = "{validation.empty}")
@NotEmpty(message = "{validation.empty}")
private String id = null;
@NotNull(message = "{validation.empty}")
private Integer ordinal = null;
private List<String> schematics;
private String defaultValue;
@Valid
private List<RulePersist> visibilityRules;
private List<FieldValidationType> validations;
@NotNull(message = "{validation.empty}")
private Boolean includeInExport = null;
@NotNull(message = "{validation.empty}")
@Valid
private BaseFieldDataPersist data = null;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public Integer getOrdinal() {
return ordinal;
}
public void setOrdinal(Integer ordinal) {
this.ordinal = ordinal;
}
public List<String> getSchematics() {
return schematics;
}
public void setSchematics(List<String> schematics) {
this.schematics = schematics;
}
public String getDefaultValue() {
return defaultValue;
}
public void setDefaultValue(String defaultValue) {
this.defaultValue = defaultValue;
}
public List<RulePersist> getVisibilityRules() {
return visibilityRules;
}
public void setVisibilityRules(List<RulePersist> visibilityRules) {
this.visibilityRules = visibilityRules;
}
public List<FieldValidationType> getValidations() {
return validations;
}
public void setValidations(List<FieldValidationType> validations) {
this.validations = validations;
}
public Boolean getIncludeInExport() {
return includeInExport;
}
public void setIncludeInExport(Boolean includeInExport) {
this.includeInExport = includeInExport;
}
public BaseFieldDataPersist getData() {
return data;
}
public void setData(BaseFieldDataPersist data) {
this.data = data;
}
}

View File

@ -0,0 +1,129 @@
package eu.eudat.model.persist.descriptiontemplatedefinition;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import java.util.List;
public class FieldSetPersist {
@NotNull(message = "{validation.empty}")
@NotEmpty(message = "{validation.empty}")
private String id = null;;
@NotNull(message = "{validation.empty}")
private Integer ordinal = null;;
@NotNull(message = "{validation.empty}")
@NotEmpty(message = "{validation.empty}")
private String numbering = null;;
@NotNull(message = "{validation.empty}")
@NotEmpty(message = "{validation.empty}")
private String title = null;;
@NotNull(message = "{validation.empty}")
@NotEmpty(message = "{validation.empty}")
private String description = null;;
@NotNull(message = "{validation.empty}")
@NotEmpty(message = "{validation.empty}")
private String extendedDescription = null;;
@NotNull(message = "{validation.empty}")
@NotEmpty(message = "{validation.empty}")
private String additionalInformation = null;;
@NotNull(message = "{validation.empty}")
@Valid
private MultiplicityPersist multiplicity= null;
@NotNull(message = "{validation.empty}")
private Boolean hasCommentField = null;
@NotNull(message = "{validation.empty}")
@Valid
private List<FieldPersist> fields = null;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public Integer getOrdinal() {
return ordinal;
}
public void setOrdinal(Integer ordinal) {
this.ordinal = ordinal;
}
public String getNumbering() {
return numbering;
}
public void setNumbering(String numbering) {
this.numbering = numbering;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getExtendedDescription() {
return extendedDescription;
}
public void setExtendedDescription(String extendedDescription) {
this.extendedDescription = extendedDescription;
}
public String getAdditionalInformation() {
return additionalInformation;
}
public void setAdditionalInformation(String additionalInformation) {
this.additionalInformation = additionalInformation;
}
public MultiplicityPersist getMultiplicity() {
return multiplicity;
}
public void setMultiplicity(MultiplicityPersist multiplicity) {
this.multiplicity = multiplicity;
}
public Boolean getHasCommentField() {
return hasCommentField;
}
public void setHasCommentField(Boolean hasCommentField) {
this.hasCommentField = hasCommentField;
}
public List<FieldPersist> getFields() {
return fields;
}
public void setFields(List<FieldPersist> fields) {
this.fields = fields;
}
}

View File

@ -0,0 +1,52 @@
package eu.eudat.model.persist.descriptiontemplatedefinition;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
public abstract class MultiplicityPersist {
@NotNull(message = "{validation.empty}")
private Integer min = null;
@NotNull(message = "{validation.empty}")
private Integer max = null;
@NotNull(message = "{validation.empty}")
@NotEmpty(message = "{validation.empty}")
private String placeholder = null;
@NotNull(message = "{validation.empty}")
private Boolean tableView = null;
public Integer getMin() {
return min;
}
public void setMin(Integer min) {
this.min = min;
}
public Integer getMax() {
return max;
}
public void setMax(Integer max) {
this.max = max;
}
public String getPlaceholder() {
return placeholder;
}
public void setPlaceholder(String placeholder) {
this.placeholder = placeholder;
}
public Boolean getTableView() {
return tableView;
}
public void setTableView(Boolean tableView) {
this.tableView = tableView;
}
}

View File

@ -0,0 +1,44 @@
package eu.eudat.model.persist.descriptiontemplatedefinition;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
public class PagePersist {
@NotNull(message = "{validation.empty}")
@NotEmpty(message = "{validation.empty}")
private String id = null;
@NotNull(message = "{validation.empty}")
private Integer ordinal = null;
@NotNull(message = "{validation.empty}")
@NotEmpty(message = "{validation.empty}")
private String title = null;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public int getOrdinal() {
return ordinal;
}
public void setOrdinal(int ordinal) {
this.ordinal = ordinal;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
}

View File

@ -0,0 +1,33 @@
package eu.eudat.model.persist.descriptiontemplatedefinition;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
public class RulePersist {
@NotNull(message = "{validation.empty}")
@NotEmpty(message = "{validation.empty}")
private String target = null;
@NotNull(message = "{validation.empty}")
@NotEmpty(message = "{validation.empty}")
private String value= null;
public String getTarget() {
return target;
}
public void setTarget(String target) {
this.target = target;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
}

View File

@ -0,0 +1,118 @@
package eu.eudat.model.persist.descriptiontemplatedefinition;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import java.util.List;
public class SectionPersist {
@NotNull(message = "{validation.empty}")
@NotEmpty(message = "{validation.empty}")
private String id = null;
@NotNull(message = "{validation.empty}")
private Integer ordinal = null;
@NotNull(message = "{validation.empty}")
private Boolean defaultVisibility = null;
@NotNull(message = "{validation.empty}")
private Boolean multiplicity = null;
@NotNull(message = "{validation.empty}")
@NotEmpty(message = "{validation.empty}")
private String page = null;
@NotNull(message = "{validation.empty}")
@NotEmpty(message = "{validation.empty}")
private String title = null;
@NotNull(message = "{validation.empty}")
@NotEmpty(message = "{validation.empty}")
private String description = null;
@NotNull(message = "{validation.empty}")
@Valid
private List<SectionPersist> sections = null;
@NotNull(message = "{validation.empty}")
@Valid
private List<FieldSetPersist> fieldSets = null;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public int getOrdinal() {
return ordinal;
}
public void setOrdinal(int ordinal) {
this.ordinal = ordinal;
}
public Boolean getDefaultVisibility() {
return defaultVisibility;
}
public void setDefaultVisibility(Boolean defaultVisibility) {
this.defaultVisibility = defaultVisibility;
}
public Boolean getMultiplicity() {
return multiplicity;
}
public void setMultiplicity(Boolean multiplicity) {
this.multiplicity = multiplicity;
}
public String getPage() {
return page;
}
public void setPage(String page) {
this.page = page;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public List<SectionPersist> getSections() {
return sections;
}
public void setSections(List<SectionPersist> sections) {
this.sections = sections;
}
public List<FieldSetPersist> getFieldSets() {
return fieldSets;
}
public void setFieldSets(List<FieldSetPersist> fieldSets) {
this.fieldSets = fieldSets;
}
}

View File

@ -0,0 +1,66 @@
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
public class AuthAutoCompleteDataPersist {
@NotNull(message = "{validation.empty}")
@NotEmpty(message = "{validation.empty}")
private String url = null;
@NotNull(message = "{validation.empty}")
@NotEmpty(message = "{validation.empty}")
private String method = null;
@NotNull(message = "{validation.empty}")
@NotEmpty(message = "{validation.empty}")
private String body = null;
@NotNull(message = "{validation.empty}")
@NotEmpty(message = "{validation.empty}")
private String path = null;
@NotNull(message = "{validation.empty}")
@NotEmpty(message = "{validation.empty}")
private String type = null;
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;
}
}

View File

@ -0,0 +1,27 @@
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotNull;
import java.util.List;
public class AutoCompleteDataPersist extends BaseFieldDataPersist {
@NotNull(message = "{validation.empty}")
private Boolean multiAutoComplete = null;
@NotNull(message = "{validation.empty}")
@Valid
private List<AutoCompleteSingleDataPersist> autoCompleteSingleDataList = null;
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;
}
}

View File

@ -0,0 +1,88 @@
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
import eu.eudat.commons.types.descriptiontemplate.fielddata.AutoCompleteDataEntity;
import eu.eudat.commons.validation.ValidEnum;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
public class AutoCompleteSingleDataPersist {
@ValidEnum(message = "{validation.empty}")
private AutoCompleteDataEntity.AutocompleteType autocompleteType;
@NotNull(message = "{validation.empty}")
@NotEmpty(message = "{validation.empty}")
private String url = null;
@Valid
private ComboBoxOptionPersist autoCompleteOptions;
private String optionsRoot;
@NotNull(message = "{validation.empty}")
private Boolean hasAuth = null;
@Valid
private AuthAutoCompleteDataPersist auth;
@NotNull(message = "{validation.empty}")
@NotEmpty(message = "{validation.empty}")
private String method = null;
public AutoCompleteDataEntity.AutocompleteType getAutocompleteType() {
return autocompleteType;
}
public void setAutocompleteType(AutoCompleteDataEntity.AutocompleteType autocompleteType) {
this.autocompleteType = autocompleteType;
}
public String getOptionsRoot() {
return optionsRoot;
}
public void setOptionsRoot(String optionsRoot) {
this.optionsRoot = optionsRoot;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public Boolean getHasAuth() {
return hasAuth;
}
public void setHasAuth(Boolean hasAuth) {
this.hasAuth = hasAuth;
}
public AuthAutoCompleteDataPersist getAuth() {
return auth;
}
public void setAuth(AuthAutoCompleteDataPersist auth) {
this.auth = auth;
}
public ComboBoxOptionPersist getAutoCompleteOptions() {
return autoCompleteOptions;
}
public void setAutoCompleteOptions(ComboBoxOptionPersist autoCompleteOptions) {
this.autoCompleteOptions = autoCompleteOptions;
}
public String getMethod() {
return method;
}
public void setMethod(String method) {
this.method = method;
}
}

View File

@ -0,0 +1,71 @@
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import eu.eudat.commons.enums.FieldType;
import eu.eudat.commons.validation.ValidEnum;
import eu.eudat.model.persist.dmpblueprintdefinition.ExtraFieldPersist;
import eu.eudat.model.persist.dmpblueprintdefinition.SystemFieldPersist;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
@JsonTypeInfo(
use = JsonTypeInfo.Id.NAME,
include = JsonTypeInfo.As.PROPERTY,
property = "fieldType",
visible = true)
@JsonSubTypes({
@JsonSubTypes.Type(value = AutoCompleteDataPersist.class, name = "autocomplete"),
@JsonSubTypes.Type(value = BooleanDecisionDataPersist.class, name = "booleanDecision"),
@JsonSubTypes.Type(value = DatasetAutoCompleteDataPersist.class, name = "internalDmpDatasets"),
@JsonSubTypes.Type(value = DmpAutoCompleteDataPersist.class, name = "internalDmpDmps"),
@JsonSubTypes.Type(value = CheckBoxDataPersist.class, name = "checkBox"),
@JsonSubTypes.Type(value = DatePickerDataPersist.class, name = "datePicker"),
@JsonSubTypes.Type(value = ExternalDatasetDataPersist.class, name = "externalDatasets"),
@JsonSubTypes.Type(value = FreeTextDataPersist.class, name = "freetext"),
@JsonSubTypes.Type(value = LicenseDataPersist.class, name = "licenses"),
@JsonSubTypes.Type(value = OrganizationDataPersist.class, name = "organizations"),
@JsonSubTypes.Type(value = PublicationDataPersist.class, name = "publications"),
@JsonSubTypes.Type(value = RadioBoxDataPersist.class, name = "radiobox"),
@JsonSubTypes.Type(value = RegistryDataPersist.class, name = "registries"),
@JsonSubTypes.Type(value = ResearcherAutoCompleteDataPersist.class, name = "internalDmpResearchers"),
@JsonSubTypes.Type(value = ResearcherDataPersist.class, name = "researchers"),
@JsonSubTypes.Type(value = RichTextAreaDataPersist.class, name = "richTextarea"),
@JsonSubTypes.Type(value = ServiceDataPersist.class, name = "services"),
@JsonSubTypes.Type(value = TagDataPersist.class, name = "tags"),
@JsonSubTypes.Type(value = TaxonomyDataPersist.class, name = "taxonomies"),
@JsonSubTypes.Type(value = TextAreaDataPersist.class, name = "textarea"),
@JsonSubTypes.Type(value = UploadDataPersist.class, name = "upload"),
@JsonSubTypes.Type(value = ValidationDataPersist.class, name = "validation"),
@JsonSubTypes.Type(value = DatasetIdentifierDataPersist.class, name = "datasetIdentifier"),
@JsonSubTypes.Type(value = CurrencyDataPersist.class, name = "currency"),
@JsonSubTypes.Type(value = WordListDataPersist.class, name = "wordlist"),
@JsonSubTypes.Type(value = DataRepositoryDataPersist.class, name = "dataRepositories"),
@JsonSubTypes.Type(value = JournalRepositoryDataPersist.class, name = "journalRepositories"),
@JsonSubTypes.Type(value = PublicationRepositoryDataPersist.class, name = "pubRepositories"),
})
public abstract class BaseFieldDataPersist {
@NotNull(message = "{validation.empty}")
@NotEmpty(message = "{validation.empty}")
private String label = null;
@ValidEnum(message = "{validation.empty}")
private FieldType fieldType;
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public FieldType getFieldType() {
return fieldType;
}
public void setFieldType(FieldType fieldType) {
this.fieldType = fieldType;
}
}

View File

@ -0,0 +1,5 @@
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
public class BooleanDecisionDataPersist extends BaseFieldDataPersist {
}

View File

@ -0,0 +1,6 @@
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
public class CheckBoxDataPersist extends BaseFieldDataPersist {
}

View File

@ -0,0 +1,53 @@
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
public class ComboBoxOptionPersist {
@NotNull(message = "{validation.empty}")
@NotEmpty(message = "{validation.empty}")
private String label = null;
@NotNull(message = "{validation.empty}")
@NotEmpty(message = "{validation.empty}")
private String value = null;
@NotNull(message = "{validation.empty}")
@NotEmpty(message = "{validation.empty}")
private String source = null;
@NotNull(message = "{validation.empty}")
@NotEmpty(message = "{validation.empty}")
private String uri = null;
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public String getSource() {
return source;
}
public void setSource(String source) {
this.source = source;
}
public String getUri() {
return uri;
}
public void setUri(String uri) {
this.uri = uri;
}
}

View File

@ -0,0 +1,5 @@
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
public class CurrencyDataPersist extends BaseFieldDataPersist {
}

View File

@ -0,0 +1,16 @@
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
import jakarta.validation.constraints.NotNull;
public class DataRepositoryDataPersist extends BaseFieldDataPersist {
@NotNull(message = "{validation.empty}")
private Boolean multiAutoComplete = null;
public Boolean getMultiAutoComplete() {
return multiAutoComplete;
}
public void setMultiAutoComplete(Boolean multiAutoComplete) {
this.multiAutoComplete = multiAutoComplete;
}
}

View File

@ -0,0 +1,15 @@
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
import jakarta.validation.constraints.NotNull;
public class DatasetAutoCompleteDataPersist extends BaseFieldDataPersist {
@NotNull(message = "{validation.empty}")
private Boolean multiAutoComplete = null;
public Boolean getMultiAutoComplete() {
return multiAutoComplete;
}
public void setMultiAutoComplete(Boolean multiAutoComplete) {
this.multiAutoComplete = multiAutoComplete;
}
}

View File

@ -0,0 +1,6 @@
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
public class DatasetIdentifierDataPersist extends BaseFieldDataPersist {
}

View File

@ -0,0 +1,4 @@
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
public class DatePickerDataPersist extends BaseFieldDataPersist {
}

View File

@ -0,0 +1,16 @@
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
import jakarta.validation.constraints.NotNull;
public class DmpAutoCompleteDataPersist extends BaseFieldDataPersist {
@NotNull(message = "{validation.empty}")
private Boolean multiAutoComplete = null;
public Boolean getMultiAutoComplete() {
return multiAutoComplete;
}
public void setMultiAutoComplete(Boolean multiAutoComplete) {
this.multiAutoComplete = multiAutoComplete;
}
}

View File

@ -0,0 +1,29 @@
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
import eu.eudat.commons.enums.FieldDataExternalDatasetType;
import eu.eudat.commons.validation.ValidEnum;
import jakarta.validation.constraints.NotNull;
public class ExternalDatasetDataPersist extends BaseFieldDataPersist {
@NotNull(message = "{validation.empty}")
private Boolean multiAutoComplete = null;
@ValidEnum(message = "{validation.empty}")
private FieldDataExternalDatasetType type;
public Boolean getMultiAutoComplete() {
return multiAutoComplete;
}
public void setMultiAutoComplete(Boolean multiAutoComplete) {
this.multiAutoComplete = multiAutoComplete;
}
public FieldDataExternalDatasetType getType() {
return type;
}
public void setType(FieldDataExternalDatasetType type) {
this.type = type;
}
}

View File

@ -0,0 +1,4 @@
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
public class FreeTextDataPersist extends BaseFieldDataPersist {
}

View File

@ -0,0 +1,16 @@
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
import jakarta.validation.constraints.NotNull;
public class JournalRepositoryDataPersist extends BaseFieldDataPersist {
@NotNull(message = "{validation.empty}")
private Boolean multiAutoComplete = null;
public Boolean getMultiAutoComplete() {
return multiAutoComplete;
}
public void setMultiAutoComplete(Boolean multiAutoComplete) {
this.multiAutoComplete = multiAutoComplete;
}
}

View File

@ -0,0 +1,17 @@
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
import jakarta.validation.constraints.NotNull;
public class LicenseDataPersist extends BaseFieldDataPersist {
@NotNull(message = "{validation.empty}")
private Boolean multiAutoComplete = null;
public Boolean getMultiAutoComplete() {
return multiAutoComplete;
}
public void setMultiAutoComplete(Boolean multiAutoComplete) {
this.multiAutoComplete = multiAutoComplete;
}
}

View File

@ -0,0 +1,17 @@
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
import jakarta.validation.constraints.NotNull;
public class OrganizationDataPersist extends BaseFieldDataPersist {
@NotNull(message = "{validation.empty}")
private Boolean multiAutoComplete = null;
public Boolean getMultiAutoComplete() {
return multiAutoComplete;
}
public void setMultiAutoComplete(Boolean multiAutoComplete) {
this.multiAutoComplete = multiAutoComplete;
}
}

View File

@ -0,0 +1,18 @@
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
import jakarta.validation.constraints.NotNull;
public class PublicationDataPersist extends BaseFieldDataPersist {
@NotNull(message = "{validation.empty}")
private Boolean multiAutoComplete;
public Boolean getMultiAutoComplete() {
return multiAutoComplete;
}
public void setMultiAutoComplete(Boolean multiAutoComplete) {
this.multiAutoComplete = multiAutoComplete;
}
}

View File

@ -0,0 +1,16 @@
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
import jakarta.validation.constraints.NotNull;
public class PublicationRepositoryDataPersist extends BaseFieldDataPersist {
@NotNull(message = "{validation.empty}")
private Boolean multiAutoComplete = null;
public Boolean getMultiAutoComplete() {
return multiAutoComplete;
}
public void setMultiAutoComplete(Boolean multiAutoComplete) {
this.multiAutoComplete = multiAutoComplete;
}
}

View File

@ -0,0 +1,21 @@
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotNull;
import java.util.List;
public class RadioBoxDataPersist extends BaseFieldDataPersist {
@NotNull(message = "{validation.empty}")
@Valid
private List<RadioBoxOptionPersist> options = null;
public List<RadioBoxOptionPersist> getOptions() {
return options;
}
public void setOptions(List<RadioBoxOptionPersist> options) {
this.options = options;
}
}

View File

@ -0,0 +1,29 @@
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
public class RadioBoxOptionPersist {
@NotNull(message = "{validation.empty}")
@NotEmpty(message = "{validation.empty}")
private String label = null;
@NotNull(message = "{validation.empty}")
@NotEmpty(message = "{validation.empty}")
private String value = null;
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
}

View File

@ -0,0 +1,18 @@
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
import jakarta.validation.constraints.NotNull;
public class RegistryDataPersist extends BaseFieldDataPersist {
@NotNull(message = "{validation.empty}")
private Boolean multiAutoComplete = null;
public Boolean getMultiAutoComplete() {
return multiAutoComplete;
}
public void setMultiAutoComplete(Boolean multiAutoComplete) {
this.multiAutoComplete = multiAutoComplete;
}
}

View File

@ -0,0 +1,15 @@
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
import jakarta.validation.constraints.NotNull;
public class ResearcherAutoCompleteDataPersist extends BaseFieldDataPersist {
@NotNull(message = "{validation.empty}")
private Boolean multiAutoComplete = null;
public Boolean getMultiAutoComplete() {
return multiAutoComplete;
}
public void setMultiAutoComplete(Boolean multiAutoComplete) {
this.multiAutoComplete = multiAutoComplete;
}
}

View File

@ -0,0 +1,18 @@
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
import jakarta.validation.constraints.NotNull;
public class ResearcherDataPersist extends BaseFieldDataPersist {
@NotNull(message = "{validation.empty}")
private Boolean multiAutoComplete = null;
public Boolean getMultiAutoComplete() {
return multiAutoComplete;
}
public void setMultiAutoComplete(Boolean multiAutoComplete) {
this.multiAutoComplete = multiAutoComplete;
}
}

View File

@ -0,0 +1,6 @@
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
public class RichTextAreaDataPersist extends BaseFieldDataPersist {
}

View File

@ -0,0 +1,17 @@
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
import jakarta.validation.constraints.NotNull;
public class ServiceDataPersist extends BaseFieldDataPersist {
@NotNull(message = "{validation.empty}")
private Boolean multiAutoComplete = null;
public Boolean getMultiAutoComplete() {
return multiAutoComplete;
}
public void setMultiAutoComplete(Boolean multiAutoComplete) {
this.multiAutoComplete = multiAutoComplete;
}
}

View File

@ -0,0 +1,5 @@
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
public class TagDataPersist extends BaseFieldDataPersist {
}

View File

@ -0,0 +1,18 @@
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
import jakarta.validation.constraints.NotNull;
public class TaxonomyDataPersist extends BaseFieldDataPersist {
@NotNull(message = "{validation.empty}")
private Boolean multiAutoComplete = null;
public Boolean getMultiAutoComplete() {
return multiAutoComplete;
}
public void setMultiAutoComplete(Boolean multiAutoComplete) {
this.multiAutoComplete = multiAutoComplete;
}
}

View File

@ -0,0 +1,5 @@
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
public class TextAreaDataPersist extends BaseFieldDataPersist {
}

View File

@ -0,0 +1,34 @@
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotNull;
import java.util.List;
public class UploadDataPersist extends BaseFieldDataPersist {
@NotNull(message = "{validation.empty}")
@Valid
private List<UploadOptionPersist> types = null;
public List<UploadOptionPersist> getTypes() {
return types;
}
public void setTypes(List<UploadOptionPersist> types) {
this.types = types;
}
private Integer maxFileSizeInMB;
public Integer getMaxFileSizeInMB() {
return maxFileSizeInMB;
}
public void setMaxFileSizeInMB(Integer maxFileSizeInMB) {
this.maxFileSizeInMB = maxFileSizeInMB;
}
}

Some files were not shown because too many files have changed in this diff Show More