Initial Commit
This commit is contained in:
commit
f6d1538464
|
@ -0,0 +1,6 @@
|
|||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
.idea
|
||||
*.class
|
||||
target
|
|
@ -0,0 +1,63 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>gr.cite.opendmp</groupId>
|
||||
<artifactId>file-transformer-base</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>21</maven.compiler.source>
|
||||
<maven.compiler.target>21</maven.compiler.target>
|
||||
<maven.compiler.release>21</maven.compiler.release>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-core</artifactId>
|
||||
<version>2.15.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-annotations</artifactId>
|
||||
<version>2.15.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>2.15.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>jakarta.validation</groupId>
|
||||
<artifactId>jakarta.validation-api</artifactId>
|
||||
<version>3.0.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>jakarta.xml.bind</groupId>
|
||||
<artifactId>jakarta.xml.bind-api</artifactId>
|
||||
<version>4.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jaxb</groupId>
|
||||
<artifactId>jaxb-core</artifactId>
|
||||
<version>4.0.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>2.0.7</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>3.12.0</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
||||
</project>
|
|
@ -0,0 +1,5 @@
|
|||
package eu.eudat.file.transformer.entities.common;
|
||||
|
||||
|
||||
public interface DatabaseDefinition {
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
package eu.eudat.file.transformer.entities.common;
|
||||
|
||||
public interface DatabaseModelDefinition extends DatabaseDefinition {
|
||||
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
package eu.eudat.file.transformer.entities.common;
|
||||
|
||||
public interface DatabaseViewStyleDefinition extends DatabaseDefinition {
|
||||
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
package eu.eudat.file.transformer.entities.definition;
|
||||
|
||||
public interface DefinitionSerializable<T, U> {
|
||||
T fromDefinition(U object);
|
||||
}
|
|
@ -0,0 +1,84 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate;
|
||||
|
||||
import eu.eudat.file.transformer.entities.definition.DefinitionSerializable;
|
||||
import eu.eudat.file.transformer.entities.xml.XmlBuilder;
|
||||
import eu.eudat.file.transformer.entities.xml.XmlSerializable;
|
||||
import eu.eudat.file.transformer.model.descriptiontemplatedefinition.Definition;
|
||||
import eu.eudat.file.transformer.model.descriptiontemplatedefinition.Page;
|
||||
import eu.eudat.file.transformer.model.descriptiontemplatedefinition.Section;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
public class DefinitionEntity implements DefinitionSerializable<DefinitionEntity, Definition> {
|
||||
private List<SectionEntity> sections;
|
||||
private List<PageEntity> pages;
|
||||
|
||||
public List<SectionEntity> getSections() {
|
||||
return sections;
|
||||
}
|
||||
|
||||
public void setSections(List<SectionEntity> sections) {
|
||||
this.sections = sections;
|
||||
}
|
||||
|
||||
public List<PageEntity> getPages() {
|
||||
return pages;
|
||||
}
|
||||
|
||||
public void setPages(List<PageEntity> pageEntities) {
|
||||
this.pages = pageEntities;
|
||||
}
|
||||
|
||||
/*@Override
|
||||
public Element toXml(Document doc) {
|
||||
Element root = doc.createElement("root");
|
||||
Element sections = doc.createElement("sections");
|
||||
Element pages = doc.createElement("pages");
|
||||
for (SectionEntity sectionEntity : this.sections) {
|
||||
sectionEntity.setNumbering("" + (this.sections.indexOf(sectionEntity) + 1));
|
||||
sections.appendChild(sectionEntity.toXml(doc));
|
||||
}
|
||||
|
||||
for (PageEntity pageEntity : this.pages) {
|
||||
pages.appendChild(pageEntity.toXml(doc));
|
||||
}
|
||||
|
||||
root.appendChild(pages);
|
||||
root.appendChild(sections);
|
||||
return root;
|
||||
}*/
|
||||
public List<FieldEntity> getFieldById(String id){
|
||||
List<FieldEntity> fieldEntities = new ArrayList<>();
|
||||
if (id == null || id.isBlank()) return fieldEntities;
|
||||
if (this.getSections() != null){
|
||||
for (SectionEntity sectionEntity: this.getSections()) {
|
||||
fieldEntities.addAll(sectionEntity.getFieldById(id));
|
||||
}
|
||||
}
|
||||
return fieldEntities;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DefinitionEntity fromDefinition(Definition object) {
|
||||
this.sections = new LinkedList();
|
||||
if (object.getSections() != null) {
|
||||
for (Section section : object.getSections()) {
|
||||
this.sections.add(new SectionEntity().fromDefinition(section));
|
||||
}
|
||||
}
|
||||
if (object.getPages() != null) {
|
||||
this.pages = new LinkedList<>();
|
||||
for (Page page: object.getPages()) {
|
||||
this.pages.add(new PageEntity().fromDefinition(page));
|
||||
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,270 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate;
|
||||
|
||||
import eu.eudat.file.transformer.entities.common.DatabaseViewStyleDefinition;
|
||||
import eu.eudat.file.transformer.entities.definition.DefinitionSerializable;
|
||||
import eu.eudat.file.transformer.entities.descriptiontemplate.fielddata.BaseFieldDataEntity;
|
||||
import eu.eudat.file.transformer.entities.descriptiontemplate.fielddata.FieldDataHelper;
|
||||
import eu.eudat.file.transformer.entities.xml.XmlBuilder;
|
||||
import eu.eudat.file.transformer.enums.FieldType;
|
||||
import eu.eudat.file.transformer.enums.FieldValidationType;
|
||||
import eu.eudat.file.transformer.model.descriptiontemplatedefinition.Field;
|
||||
import eu.eudat.file.transformer.model.descriptiontemplatedefinition.Rule;
|
||||
import eu.eudat.file.transformer.model.descriptiontemplatedefinition.fielddata.BaseFieldData;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
public class FieldEntity implements DatabaseViewStyleDefinition, DefinitionSerializable<FieldEntity, Field> {
|
||||
private String id;
|
||||
private int ordinal;
|
||||
private List<String> schematics;
|
||||
private String numbering;
|
||||
private String defaultValue;
|
||||
private List<RuleEntity> visibilityRules;
|
||||
private BaseFieldDataEntity<BaseFieldDataEntity, BaseFieldData> data;
|
||||
private List<FieldValidationType> validations;
|
||||
private Boolean includeInExport;
|
||||
|
||||
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 List<String> getSchematics() {
|
||||
return schematics;
|
||||
}
|
||||
public void setSchematics(List<String> schematics) {
|
||||
this.schematics = schematics;
|
||||
}
|
||||
|
||||
public BaseFieldDataEntity<BaseFieldDataEntity, BaseFieldData> getData() {
|
||||
return data;
|
||||
}
|
||||
public void setData(BaseFieldDataEntity<BaseFieldDataEntity, BaseFieldData> data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public String getDefaultValue() {
|
||||
return defaultValue;
|
||||
}
|
||||
public void setDefaultValue(String defaultValue) {
|
||||
this.defaultValue = defaultValue;
|
||||
}
|
||||
|
||||
|
||||
public List<FieldValidationType> getValidations() {
|
||||
return validations;
|
||||
}
|
||||
public void setValidations(List<FieldValidationType> validations) {
|
||||
this.validations = validations;
|
||||
}
|
||||
|
||||
public String getNumbering() {
|
||||
return numbering;
|
||||
}
|
||||
public void setNumbering(String numbering) {
|
||||
this.numbering = numbering;
|
||||
}
|
||||
|
||||
public Boolean getIncludeInExport() {
|
||||
return includeInExport;
|
||||
}
|
||||
|
||||
public void setIncludeInExport(Boolean includeInExport) {
|
||||
this.includeInExport = includeInExport;
|
||||
}
|
||||
|
||||
public List<RuleEntity> getVisibilityRules() {
|
||||
return visibilityRules;
|
||||
}
|
||||
|
||||
public void setVisibilityRules(List<RuleEntity> visibilityRules) {
|
||||
this.visibilityRules = visibilityRules;
|
||||
}
|
||||
|
||||
/*@Override
|
||||
public Element toXml(Document doc) {
|
||||
Element rootElement = doc.createElement("field");
|
||||
rootElement.setAttribute("id", this.id);
|
||||
rootElement.setAttribute("ordinal", "" + this.ordinal);
|
||||
|
||||
Element schematics = doc.createElement("schematics");
|
||||
if (this.schematics != null) {
|
||||
for (String s : this.schematics) {
|
||||
Element schematic = doc.createElement("schematic");
|
||||
schematic.setTextContent(s);
|
||||
schematics.appendChild(schematic);
|
||||
}
|
||||
}
|
||||
|
||||
Element viewStyle = doc.createElement("viewStyle");
|
||||
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");
|
||||
if (this.visibilityRules != null && !this.visibilityRules.isEmpty()) {
|
||||
for (RuleEntity rule : this.visibilityRules) {
|
||||
visibilityRulesElement.appendChild(rule.toXml(doc));
|
||||
}
|
||||
}
|
||||
Element defaultValue = doc.createElement("defaultValue");
|
||||
defaultValue.setAttribute("value", this.getDefaultValue());
|
||||
|
||||
Element validations = doc.createElement("validations");
|
||||
for (FieldValidationType validationType : this.validations) {
|
||||
Element validation = doc.createElement("validation");
|
||||
validation.setAttribute("type", "" + validationType.getValue());
|
||||
validations.appendChild(validation);
|
||||
}
|
||||
|
||||
Element numbering = doc.createElement("numbering");
|
||||
numbering.setTextContent(this.numbering);
|
||||
|
||||
rootElement.appendChild(schematics);
|
||||
rootElement.appendChild(numbering);
|
||||
rootElement.appendChild(validations);
|
||||
rootElement.appendChild(defaultValue);
|
||||
rootElement.appendChild(visibilityRulesElement);
|
||||
rootElement.appendChild(viewStyle);
|
||||
if (this.data != null) {
|
||||
rootElement.appendChild(this.data.toXml(doc));
|
||||
|
||||
}
|
||||
rootElement.setAttribute("export", this.includeInExport == null || this.includeInExport ? "true" : "false");
|
||||
return rootElement;
|
||||
}*/
|
||||
|
||||
/*@Override
|
||||
public FieldEntity fromXml(Element element) {
|
||||
this.id = element.getAttribute("id");
|
||||
this.ordinal = Integer.parseInt(element.getAttribute("ordinal"));
|
||||
|
||||
|
||||
Element viewStyle = (Element) XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "viewStyle");
|
||||
|
||||
FieldType fieldType = FieldType.of(viewStyle.getAttribute("renderstyle"));
|
||||
|
||||
Element visibility = (Element) XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "visible");
|
||||
NodeList rulesElements = visibility.getChildNodes();
|
||||
this.visibilityRules = new LinkedList();
|
||||
for (int temp = 0; temp < rulesElements.getLength(); temp++) {
|
||||
Node ruleElement = rulesElements.item(temp);
|
||||
if (ruleElement.getNodeType() == Node.ELEMENT_NODE) {
|
||||
this.visibilityRules.add(new RuleEntity().fromXml((Element) ruleElement));
|
||||
}
|
||||
}
|
||||
|
||||
Element numbering = XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "numbering");
|
||||
if (numbering != null) this.numbering = numbering.getTextContent();
|
||||
|
||||
this.schematics = new LinkedList<>();
|
||||
Element schematics = (Element) XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "schematics");
|
||||
if(schematics != null){
|
||||
NodeList schematicElements = schematics.getChildNodes();
|
||||
for (int temp = 0; temp < schematicElements.getLength(); temp++) {
|
||||
Node schematicElement = schematicElements.item(temp);
|
||||
if (schematicElement.getNodeType() == Node.ELEMENT_NODE) {
|
||||
this.schematics.add(schematicElement.getTextContent());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Element dataElement = (Element) XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "data");
|
||||
|
||||
Element defaultValue = (Element) XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "defaultValue");
|
||||
|
||||
this.defaultValue = defaultValue.getAttribute("value");
|
||||
String subType = dataElement != null ? dataElement.getAttribute("type") : null;
|
||||
this.data = new FieldDataHelper().create(fieldType, subType);
|
||||
if (this.data != null) this.data.fromXml(dataElement);
|
||||
|
||||
this.validations = new LinkedList<>();
|
||||
Element validations = (Element) XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "validations");
|
||||
if (validations != null) {
|
||||
NodeList validationElements = validations.getChildNodes();
|
||||
for (int temp = 0; temp < validationElements.getLength(); temp++) {
|
||||
Node validationElement = validationElements.item(temp);
|
||||
if (validationElement.getNodeType() == Node.ELEMENT_NODE) {
|
||||
Short enumValue = Short.parseShort(((Element) validationElement).getAttribute("type"));
|
||||
FieldValidationType validationType = FieldValidationType.of(enumValue);
|
||||
this.validations.add(validationType);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (element.hasAttribute("export")) {
|
||||
this.includeInExport = Boolean.parseBoolean(element.getAttribute("export"));
|
||||
} else {
|
||||
this.includeInExport = true;
|
||||
}
|
||||
return this;
|
||||
}*/
|
||||
|
||||
@Override
|
||||
public FieldEntity fromDefinition(Field object) {
|
||||
this.id = object.getId();
|
||||
this.ordinal = object.getOrdinal();
|
||||
this.visibilityRules = new LinkedList();
|
||||
if (object.getVisibilityRules() != null) {
|
||||
for (Rule rule : object.getVisibilityRules()) {
|
||||
this.visibilityRules.add(new RuleEntity().fromDefinition(rule));
|
||||
}
|
||||
}
|
||||
|
||||
this.numbering = object.getNumbering();
|
||||
|
||||
this.schematics = new LinkedList<>();
|
||||
if(object.getSchematics() != null){
|
||||
this.schematics.addAll(object.getSchematics());
|
||||
}
|
||||
|
||||
this.defaultValue = object.getDefaultValue();
|
||||
|
||||
FieldType fieldType = switch (object.getData().getFieldType()) {
|
||||
case AUTO_COMPLETE, WORD_LIST -> FieldType.COMBO_BOX;
|
||||
case INTERNAL_DMP_ENTRIES_DMPS, INTERNAL_DMP_ENTRIES_DATASETS, INTERNAL_DMP_ENTRIES_RESEARCHERS -> FieldType.INTERNAL_DMP_ENTRIES;
|
||||
default -> object.getData().getFieldType();
|
||||
};
|
||||
String subType = object.getData().getFieldType().getValue();
|
||||
this.data = (BaseFieldDataEntity<BaseFieldDataEntity, BaseFieldData>) new FieldDataHelper().create(fieldType, subType);
|
||||
if (this.data != null) this.data.fromDefinition(object.getData());
|
||||
|
||||
this.validations = new LinkedList<>();
|
||||
if (object.getValidations() != null) {
|
||||
this.validations.addAll(object.getValidations());
|
||||
}
|
||||
if (object.getIncludeInExport() != null) {
|
||||
this.includeInExport = object.getIncludeInExport();
|
||||
} else {
|
||||
this.includeInExport = true;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,189 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate;
|
||||
import eu.eudat.file.transformer.entities.common.DatabaseViewStyleDefinition;
|
||||
import eu.eudat.file.transformer.entities.definition.DefinitionSerializable;
|
||||
import eu.eudat.file.transformer.entities.xml.XmlBuilder;
|
||||
import eu.eudat.file.transformer.entities.xml.XmlSerializable;
|
||||
import eu.eudat.file.transformer.model.descriptiontemplatedefinition.Field;
|
||||
import eu.eudat.file.transformer.model.descriptiontemplatedefinition.FieldSet;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
public class FieldSetEntity implements DatabaseViewStyleDefinition, DefinitionSerializable<FieldSetEntity, FieldSet> {
|
||||
private String id;
|
||||
private int ordinal;
|
||||
private List<FieldEntity> fields;
|
||||
private String numbering;
|
||||
private String title;
|
||||
private String description;
|
||||
private String extendedDescription;
|
||||
private String additionalInformation;
|
||||
private MultiplicityEntity multiplicity;
|
||||
private boolean hasCommentField;
|
||||
// private String commentFieldValue; //TODO: DescriptionTemplate
|
||||
|
||||
public List<FieldEntity> getFields() {
|
||||
return fields;
|
||||
}
|
||||
public void setFields(List<FieldEntity> fieldEntities) {
|
||||
this.fields = fieldEntities;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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 MultiplicityEntity getMultiplicity() {
|
||||
return multiplicity;
|
||||
}
|
||||
public void setMultiplicity(MultiplicityEntity multiplicity) {
|
||||
this.multiplicity = multiplicity;
|
||||
}
|
||||
|
||||
public boolean getHasCommentField() {
|
||||
return hasCommentField;
|
||||
}
|
||||
public void setHasCommentField(boolean hasCommentField) {
|
||||
this.hasCommentField = hasCommentField;
|
||||
}
|
||||
|
||||
// public String getCommentFieldValue() {
|
||||
// return commentFieldValue;
|
||||
// }
|
||||
// public void setCommentFieldValue(String commentFieldValue) {
|
||||
// this.commentFieldValue = commentFieldValue;
|
||||
// }
|
||||
|
||||
public String getNumbering() {
|
||||
return numbering;
|
||||
}
|
||||
public void setNumbering(String numbering) {
|
||||
this.numbering = numbering;
|
||||
}
|
||||
|
||||
public String getAdditionalInformation() {
|
||||
return additionalInformation;
|
||||
}
|
||||
public void setAdditionalInformation(String additionalInformation) {
|
||||
this.additionalInformation = additionalInformation;
|
||||
}
|
||||
|
||||
/* @Override
|
||||
public Element toXml(Document doc) {
|
||||
Element fieldSet = doc.createElement("fieldSet");
|
||||
fieldSet.setAttribute("id", this.id);
|
||||
fieldSet.setAttribute("ordinal", "" + this.ordinal);
|
||||
Element title = doc.createElement("title");
|
||||
title.setTextContent(this.title);
|
||||
|
||||
Element description = doc.createElement("description");
|
||||
description.setTextContent(this.description);
|
||||
|
||||
Element extendedDescription = doc.createElement("extendedDescription");
|
||||
extendedDescription.setTextContent(this.extendedDescription);
|
||||
|
||||
Element additionalInformation = doc.createElement("additionalInformation");
|
||||
additionalInformation.setTextContent(this.additionalInformation);
|
||||
|
||||
Element multiplicity = doc.createElement("multiplicity");
|
||||
multiplicity.setAttribute("min", "" + this.multiplicity.getMin());
|
||||
multiplicity.setAttribute("max", "" + this.multiplicity.getMax());
|
||||
multiplicity.setAttribute("placeholder", this.multiplicity.getPlaceholder());
|
||||
multiplicity.setAttribute("tableView", String.valueOf(this.multiplicity.getTableView()));
|
||||
|
||||
Element commentField = doc.createElement("commentField");
|
||||
commentField.setAttribute("hasCommentField", "" + this.hasCommentField);
|
||||
// commentField.setAttribute("commentFieldValue", this.commentFieldValue);
|
||||
|
||||
Element numbering = doc.createElement("numbering");
|
||||
numbering.setTextContent(this.numbering);
|
||||
|
||||
Element fieldsElement = doc.createElement("fields");
|
||||
for (FieldEntity fieldEntity : fields) {
|
||||
fieldEntity.setNumbering(this.numbering + "." + (this.fields.indexOf(fieldEntity) + 1));
|
||||
fieldsElement.appendChild(fieldEntity.toXml(doc));
|
||||
}
|
||||
|
||||
fieldSet.appendChild(numbering);
|
||||
fieldSet.appendChild(commentField);
|
||||
fieldSet.appendChild(fieldsElement);
|
||||
fieldSet.appendChild(multiplicity);
|
||||
fieldSet.appendChild(title);
|
||||
fieldSet.appendChild(description);
|
||||
fieldSet.appendChild(extendedDescription);
|
||||
fieldSet.appendChild(additionalInformation);
|
||||
return fieldSet;
|
||||
}*/
|
||||
|
||||
public List<FieldEntity> getFieldById(String id){
|
||||
if (this.getFields() == null || id == null || id.isBlank()) return new ArrayList<>();
|
||||
|
||||
return this.getFields().stream().filter(x-> id.equals(x.getId())).toList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public FieldSetEntity fromDefinition(FieldSet object) {
|
||||
this.id = object.getId();
|
||||
this.ordinal = object.getOrdinal();
|
||||
this.fields = new LinkedList();
|
||||
this.title = object.getTitle();
|
||||
this.description = object.getDescription();
|
||||
this.extendedDescription = object.getExtendedDescription();
|
||||
if (object.getAdditionalInformation() != null)
|
||||
this.additionalInformation = object.getAdditionalInformation();
|
||||
this.hasCommentField = object.getHasCommentField();
|
||||
// this.commentFieldValue = commentField.getAttribute("commentFieldValue");
|
||||
this.numbering = object.getNumbering();
|
||||
|
||||
if (object.getFields() != null) {
|
||||
for (Field field: object.getFields()) {
|
||||
this.fields.add(new FieldEntity().fromDefinition(field));
|
||||
}
|
||||
}
|
||||
|
||||
if (object.getMultiplicity() != null) {
|
||||
this.multiplicity = new MultiplicityEntity();
|
||||
this.multiplicity.setMin(object.getMultiplicity().getMin());
|
||||
this.multiplicity.setMax(object.getMultiplicity().getMax());
|
||||
this.multiplicity.setPlaceholder(object.getMultiplicity().getPlaceholder());
|
||||
this.multiplicity.setTableView(object.getMultiplicity().getTableView());
|
||||
}
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate;
|
||||
|
||||
public class MultiplicityEntity {
|
||||
|
||||
private int min;
|
||||
private int max;
|
||||
private String placeholder;
|
||||
private boolean tableView;
|
||||
|
||||
public int getMin() {
|
||||
return min;
|
||||
}
|
||||
|
||||
public void setMin(int min) {
|
||||
this.min = min;
|
||||
}
|
||||
|
||||
public int getMax() {
|
||||
return max;
|
||||
}
|
||||
|
||||
public void setMax(int 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;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate;
|
||||
|
||||
import eu.eudat.file.transformer.entities.common.DatabaseViewStyleDefinition;
|
||||
import eu.eudat.file.transformer.entities.definition.DefinitionSerializable;
|
||||
import eu.eudat.file.transformer.entities.xml.XmlSerializable;
|
||||
import eu.eudat.file.transformer.model.descriptiontemplatedefinition.Page;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
|
||||
public class PageEntity implements DatabaseViewStyleDefinition, DefinitionSerializable<PageEntity, Page> {
|
||||
private String id;
|
||||
private int ordinal;
|
||||
private String title;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/*@Override
|
||||
public Element toXml(Document doc) {
|
||||
Element root = doc.createElement("page");
|
||||
root.setAttribute("title", this.title);
|
||||
root.setAttribute("ordinal", "" + this.ordinal);
|
||||
root.setAttribute("id", this.id);
|
||||
return root;
|
||||
}*/
|
||||
|
||||
@Override
|
||||
public PageEntity fromDefinition(Page object) {
|
||||
this.ordinal = object.getOrdinal();
|
||||
this.id = object.getId();
|
||||
this.title = object.getTitle();
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate;
|
||||
|
||||
import eu.eudat.file.transformer.entities.definition.DefinitionSerializable;
|
||||
import eu.eudat.file.transformer.entities.xml.XmlSerializable;
|
||||
import eu.eudat.file.transformer.model.descriptiontemplatedefinition.Rule;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
public class RuleEntity implements XmlSerializable<RuleEntity>, DefinitionSerializable<RuleEntity, Rule> {
|
||||
private String target;
|
||||
private String value;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Element toXml(Document doc) {
|
||||
Element rule = doc.createElement("rule");
|
||||
rule.setAttribute("target", this.target);
|
||||
|
||||
Element value = doc.createElement("value");
|
||||
value.setTextContent(this.value);
|
||||
|
||||
rule.appendChild(value);
|
||||
return rule;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RuleEntity fromXml(Element item) {
|
||||
this.target = item.getAttribute("target");
|
||||
|
||||
Element value = (Element) item.getElementsByTagName("value").item(0);
|
||||
if (value != null) {
|
||||
this.value = value.getTextContent();
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public RuleEntity fromDefinition(Rule object) {
|
||||
this.target = object.getTarget();
|
||||
|
||||
if (object.getValue() != null) {
|
||||
this.value = object.getValue();
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,214 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate;
|
||||
import eu.eudat.file.transformer.entities.common.DatabaseViewStyleDefinition;
|
||||
import eu.eudat.file.transformer.entities.definition.DefinitionSerializable;
|
||||
import eu.eudat.file.transformer.entities.xml.XmlBuilder;
|
||||
import eu.eudat.file.transformer.entities.xml.XmlSerializable;
|
||||
import eu.eudat.file.transformer.model.descriptiontemplatedefinition.FieldSet;
|
||||
import eu.eudat.file.transformer.model.descriptiontemplatedefinition.Section;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
public class SectionEntity implements DatabaseViewStyleDefinition, DefinitionSerializable<SectionEntity, Section> {
|
||||
private String id;
|
||||
private int ordinal;
|
||||
private boolean defaultVisibility;
|
||||
private String numbering;
|
||||
private String page;
|
||||
private String title;
|
||||
private String description;
|
||||
private String extendedDescription;
|
||||
private List<SectionEntity> sections;
|
||||
private List<FieldSetEntity> fieldSets;
|
||||
private Boolean multiplicity;
|
||||
|
||||
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 isDefaultVisibility() {
|
||||
return defaultVisibility;
|
||||
}
|
||||
|
||||
public void setDefaultVisibility(boolean defaultVisibility) {
|
||||
this.defaultVisibility = defaultVisibility;
|
||||
}
|
||||
|
||||
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<SectionEntity> getSections() {
|
||||
return sections;
|
||||
}
|
||||
|
||||
public void setSections(List<SectionEntity> sections) {
|
||||
this.sections = sections;
|
||||
}
|
||||
|
||||
public List<FieldSetEntity> getFieldSets() {
|
||||
return fieldSets;
|
||||
}
|
||||
|
||||
public void setFieldSets(List<FieldSetEntity> fieldSetEntities) {
|
||||
this.fieldSets = fieldSetEntities;
|
||||
}
|
||||
|
||||
public String getExtendedDescription() {
|
||||
return extendedDescription;
|
||||
}
|
||||
|
||||
public void setExtendedDescription(String extendedDescription) {
|
||||
this.extendedDescription = extendedDescription;
|
||||
}
|
||||
|
||||
public String getNumbering() {
|
||||
return numbering;
|
||||
}
|
||||
|
||||
public void setNumbering(String numbering) {
|
||||
this.numbering = numbering;
|
||||
}
|
||||
|
||||
public Boolean getMultiplicity() {
|
||||
return multiplicity;
|
||||
}
|
||||
|
||||
public void setMultiplicity(Boolean multiplicity) {
|
||||
this.multiplicity = multiplicity;
|
||||
}
|
||||
|
||||
/*@Override
|
||||
public Element toXml(Document doc) {
|
||||
Element rootElement = doc.createElement("section");
|
||||
rootElement.setAttribute("id", this.id);
|
||||
rootElement.setAttribute("ordinal", "" + this.ordinal);
|
||||
rootElement.setAttribute("defaultVisibility", "" + this.defaultVisibility);
|
||||
rootElement.setAttribute("page", "" + this.page);
|
||||
rootElement.setAttribute("multiplicity", (this.multiplicity != null ? "" + this.multiplicity : "false"));
|
||||
|
||||
Element description = doc.createElement("description");
|
||||
description.setTextContent(this.description);
|
||||
|
||||
Element extendedDescription = doc.createElement("extendedDescription");
|
||||
extendedDescription.setTextContent(this.extendedDescription);
|
||||
|
||||
Element numbering = doc.createElement("numbering");
|
||||
numbering.setTextContent(this.numbering);
|
||||
|
||||
Element title = doc.createElement("title");
|
||||
title.setTextContent(this.title);
|
||||
|
||||
if (sections != null) {
|
||||
Element sections = doc.createElement("sections");
|
||||
for (SectionEntity sectionEntity : this.sections) {
|
||||
sectionEntity.setNumbering(this.numbering + "." + (this.sections.indexOf(sectionEntity) + 1));
|
||||
sections.appendChild(sectionEntity.toXml(doc));
|
||||
}
|
||||
rootElement.appendChild(sections);
|
||||
}
|
||||
|
||||
if (this.fieldSets != null) {
|
||||
Element formGroups = doc.createElement("fieldSets");
|
||||
for (FieldSetEntity fieldSetEntity : this.fieldSets) {
|
||||
fieldSetEntity.setNumbering(this.numbering + "." + (this.fieldSets.indexOf(fieldSetEntity) + 1));
|
||||
formGroups.appendChild(fieldSetEntity.toXml(doc));
|
||||
}
|
||||
rootElement.appendChild(formGroups);
|
||||
}
|
||||
|
||||
rootElement.appendChild(numbering);
|
||||
rootElement.appendChild(title);
|
||||
rootElement.appendChild(extendedDescription);
|
||||
rootElement.appendChild(description);
|
||||
|
||||
return rootElement;
|
||||
}*/
|
||||
|
||||
public List<FieldEntity> getFieldById(String id){
|
||||
List<FieldEntity> fieldEntities = new ArrayList<>();
|
||||
if (id == null || id.isBlank()) return fieldEntities;
|
||||
if (this.getFieldSets() != null){
|
||||
for (FieldSetEntity fieldSetEntity: this.getFieldSets()) {
|
||||
fieldEntities.addAll(fieldSetEntity.getFieldById(id));
|
||||
}
|
||||
}
|
||||
if (this.getSections() != null){
|
||||
for (SectionEntity sectionEntity: this.getSections()) {
|
||||
fieldEntities.addAll(sectionEntity.getFieldById(id));
|
||||
}
|
||||
}
|
||||
return fieldEntities;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SectionEntity fromDefinition(Section object) {
|
||||
this.id = object.getId();
|
||||
this.ordinal = object.getOrdinal();
|
||||
this.defaultVisibility = object.getDefaultVisibility();
|
||||
this.page = object.getPage();
|
||||
this.multiplicity = object.getMultiplicity();
|
||||
|
||||
this.description = object.getDescription();
|
||||
|
||||
this.extendedDescription = object.getExtendedDescription();
|
||||
|
||||
this.numbering = object.getNumbering();
|
||||
|
||||
this.title = object.getTitle();
|
||||
|
||||
if (object.getSections() != null) {
|
||||
this.sections = new LinkedList<>();
|
||||
for (Section section: object.getSections()) {
|
||||
this.sections.add(new SectionEntity().fromDefinition(section));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (object.getFieldSets() != null) {
|
||||
this.fieldSets = new LinkedList<>();
|
||||
for (FieldSet fieldSet: object.getFieldSets()) {
|
||||
this.fieldSets.add(new FieldSetEntity().fromDefinition(fieldSet));
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,308 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate.fielddata;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import eu.eudat.file.transformer.enums.DatabaseEnum;
|
||||
import eu.eudat.file.transformer.enums.EnumUtils;
|
||||
import eu.eudat.file.transformer.enums.FieldDataComboBoxType;
|
||||
import eu.eudat.file.transformer.enums.FieldType;
|
||||
import eu.eudat.file.transformer.model.descriptiontemplatedefinition.fielddata.AutoCompleteData;
|
||||
import eu.eudat.file.transformer.model.descriptiontemplatedefinition.fielddata.AutoCompleteSingleData;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class AutoCompleteDataEntity extends ComboBoxDataEntity<AutoCompleteDataEntity, AutoCompleteData> {
|
||||
|
||||
public static class AuthAutoCompleteData {
|
||||
private String url;
|
||||
private String method;
|
||||
private String body;
|
||||
private String path;
|
||||
private String type;
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public String getMethod() {
|
||||
return method;
|
||||
}
|
||||
|
||||
public void setMethod(String method) {
|
||||
this.method = method;
|
||||
}
|
||||
|
||||
public String getBody() {
|
||||
return body;
|
||||
}
|
||||
|
||||
public void setBody(String body) {
|
||||
this.body = body;
|
||||
}
|
||||
|
||||
public String getPath() {
|
||||
return path;
|
||||
}
|
||||
|
||||
public void setPath(String path) {
|
||||
this.path = path;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
}
|
||||
public static class AutoCompleteSingleData {
|
||||
private AutocompleteType autocompleteType;
|
||||
private String url;
|
||||
private ComboBoxDataEntity.Option autoCompleteOptions;
|
||||
private String optionsRoot;
|
||||
private Boolean hasAuth;
|
||||
private AuthAutoCompleteData auth;
|
||||
private String method;
|
||||
|
||||
public AutocompleteType getAutocompleteType() {
|
||||
return autocompleteType;
|
||||
}
|
||||
|
||||
public void setAutocompleteType(AutocompleteType autocompleteType) {
|
||||
this.autocompleteType = autocompleteType;
|
||||
}
|
||||
|
||||
public String getOptionsRoot() {
|
||||
return optionsRoot;
|
||||
}
|
||||
public void setOptionsRoot(String optionsRoot) {
|
||||
this.optionsRoot = optionsRoot;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public Boolean getHasAuth() {
|
||||
return hasAuth;
|
||||
}
|
||||
|
||||
public void setHasAuth(Boolean hasAuth) {
|
||||
this.hasAuth = hasAuth;
|
||||
}
|
||||
|
||||
public AuthAutoCompleteData getAuth() {
|
||||
return auth;
|
||||
}
|
||||
|
||||
public void setAuth(AuthAutoCompleteData auth) {
|
||||
this.auth = auth;
|
||||
}
|
||||
|
||||
public ComboBoxDataEntity.Option getAutoCompleteOptions() {
|
||||
return autoCompleteOptions;
|
||||
}
|
||||
public void setAutoCompleteOptions(ComboBoxDataEntity.Option autoCompleteOptions) {
|
||||
this.autoCompleteOptions = autoCompleteOptions;
|
||||
}
|
||||
|
||||
public String getMethod() {
|
||||
return method;
|
||||
}
|
||||
|
||||
public void setMethod(String method) {
|
||||
this.method = method;
|
||||
}
|
||||
}
|
||||
|
||||
private Boolean multiAutoComplete;
|
||||
private List<AutoCompleteSingleData> autoCompleteSingleDataList;
|
||||
|
||||
public Boolean getMultiAutoComplete() { return multiAutoComplete; }
|
||||
public void setMultiAutoComplete(Boolean multiAutoComplete) { this.multiAutoComplete = multiAutoComplete; }
|
||||
|
||||
public List<AutoCompleteSingleData> getAutoCompleteSingleDataList() {
|
||||
return autoCompleteSingleDataList;
|
||||
}
|
||||
|
||||
public void setAutoCompleteSingleDataList(List<AutoCompleteSingleData> autoCompleteSingleDataList) {
|
||||
this.autoCompleteSingleDataList = autoCompleteSingleDataList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FieldDataComboBoxType getFieldSubType() {
|
||||
return FieldDataComboBoxType.Autocomplete;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FieldType getFieldType() {
|
||||
return FieldType.AUTO_COMPLETE;
|
||||
}
|
||||
|
||||
/*@Override
|
||||
public Element toXml(Document doc) {
|
||||
Element root = super.toXml(doc);
|
||||
if (this.multiAutoComplete != null)
|
||||
root.setAttribute("multiAutoComplete", this.multiAutoComplete.toString());
|
||||
for (AutoCompleteSingleData singleData: this.autoCompleteSingleDataList) {
|
||||
Element parent = doc.createElement("autocompleteSingle");
|
||||
parent.setAttribute("url", singleData.url);
|
||||
parent.setAttribute("optionsRoot", singleData.optionsRoot);
|
||||
parent.setAttribute("autoCompleteType", Integer.toString(singleData.autocompleteType.getValue()));
|
||||
parent.setAttribute("hasAuth", Boolean.toString(singleData.hasAuth));
|
||||
parent.setAttribute("method", singleData.method);
|
||||
Element element = doc.createElement("option");
|
||||
element.setAttribute("label", singleData.autoCompleteOptions.getLabel());
|
||||
element.setAttribute("value", singleData.autoCompleteOptions.getValue());
|
||||
element.setAttribute("source", singleData.autoCompleteOptions.getSource());
|
||||
parent.appendChild(element);
|
||||
if (singleData.hasAuth) {
|
||||
Element authElement = doc.createElement("auth");
|
||||
authElement.setAttribute("url", singleData.auth.url);
|
||||
authElement.setAttribute("method", singleData.auth.method);
|
||||
authElement.setAttribute("body", singleData.auth.body);
|
||||
authElement.setAttribute("path", singleData.auth.path);
|
||||
authElement.setAttribute("type", singleData.auth.type);
|
||||
parent.appendChild(authElement);
|
||||
}
|
||||
root.appendChild(parent);
|
||||
}
|
||||
return root;
|
||||
}*/
|
||||
|
||||
/*@Override
|
||||
public AutoCompleteDataEntity fromXml(Element item) {
|
||||
super.fromXml(item);
|
||||
this.autoCompleteSingleDataList = new ArrayList<>();
|
||||
NodeList items = item.getElementsByTagName("autocompleteSingle");
|
||||
if (items != null && items.getLength() > 0) {
|
||||
for (int i = 0; i < items.getLength(); i++) {
|
||||
this.autoCompleteSingleDataList.add(new AutoCompleteSingleData());
|
||||
Element single = (Element) items.item(i);
|
||||
this.mapFromXml(single, this.autoCompleteSingleDataList.get(i));
|
||||
}
|
||||
} else {
|
||||
this.autoCompleteSingleDataList.add(new AutoCompleteSingleData());
|
||||
this.mapFromXml(item, this.autoCompleteSingleDataList.get(0));
|
||||
}
|
||||
this.multiAutoComplete = Boolean.parseBoolean(item.getAttribute("multiAutoComplete"));
|
||||
return this;
|
||||
}*/
|
||||
|
||||
/*
|
||||
private void mapFromXml(Element item, AutoCompleteSingleData singleData) {
|
||||
singleData.url = item.getAttribute("url");
|
||||
singleData.optionsRoot = item.getAttribute("optionsRoot");
|
||||
this.multiAutoComplete = Boolean.parseBoolean(item.getAttribute("multiAutoComplete"));
|
||||
if (item.getAttribute("autoCompleteType") == null || item.getAttribute("autoCompleteType").equals("") ) {
|
||||
singleData.autocompleteType = AutocompleteType.UNCACHED;
|
||||
} else {
|
||||
singleData.autocompleteType = AutocompleteType.of(Integer.parseInt(item.getAttribute("autoCompleteType")));
|
||||
}
|
||||
singleData.hasAuth = Boolean.parseBoolean(item.getAttribute("hasAuth"));
|
||||
singleData.method = item.hasAttribute("method") ? item.getAttribute("method") : "GET";
|
||||
Element optionElement = (Element) item.getElementsByTagName("option").item(0);
|
||||
if (optionElement != null) {
|
||||
singleData.autoCompleteOptions = new Option();
|
||||
singleData.autoCompleteOptions.setLabel(optionElement.getAttribute("label"));
|
||||
singleData.autoCompleteOptions.setValue(optionElement.getAttribute("value"));
|
||||
singleData.autoCompleteOptions.setSource(optionElement.getAttribute("source"));
|
||||
singleData.autoCompleteOptions.setUri(optionElement.getAttribute("uri"));
|
||||
}
|
||||
if (singleData.hasAuth) {
|
||||
Element authElement = (Element) item.getElementsByTagName("auth").item(0);
|
||||
if (authElement != null) {
|
||||
singleData.auth = new AuthAutoCompleteData();
|
||||
singleData.auth.setUrl(authElement.getAttribute("url"));
|
||||
singleData.auth.setMethod(authElement.getAttribute("method"));
|
||||
singleData.auth.setBody(authElement.getAttribute("body"));
|
||||
singleData.auth.setPath(authElement.getAttribute("path"));
|
||||
singleData.auth.setType(authElement.getAttribute("type"));
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
public enum AutocompleteType implements DatabaseEnum<Integer> {
|
||||
UNCACHED(0),
|
||||
CACHED(1);
|
||||
|
||||
private final int value;
|
||||
|
||||
AutocompleteType(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public Integer getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
private static final Map<Integer, AutocompleteType> map = EnumUtils.getEnumValueMap(AutocompleteType.class);
|
||||
|
||||
public static AutocompleteType of(int i) {
|
||||
return map.get(i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AutoCompleteDataEntity fromDefinition(AutoCompleteData item) {
|
||||
super.fromDefinition(item);
|
||||
this.autoCompleteSingleDataList = new ArrayList<>();
|
||||
if (item.getAutoCompleteSingleDataList() != null && !item.getAutoCompleteSingleDataList().isEmpty()) {
|
||||
for (eu.eudat.file.transformer.model.descriptiontemplatedefinition.fielddata.AutoCompleteSingleData singleData : item.getAutoCompleteSingleDataList()) {
|
||||
AutoCompleteSingleData single = new AutoCompleteSingleData();
|
||||
this.mapFromDefinition(singleData, single);
|
||||
this.autoCompleteSingleDataList.add(single);
|
||||
}
|
||||
} else {
|
||||
this.autoCompleteSingleDataList.add(new AutoCompleteSingleData());
|
||||
this.mapFromDefinition(item.getAutoCompleteSingleDataList().get(0), this.autoCompleteSingleDataList.get(0));
|
||||
}
|
||||
this.multiAutoComplete = item.getMultiAutoComplete();
|
||||
return this;
|
||||
}
|
||||
|
||||
private void mapFromDefinition(eu.eudat.file.transformer.model.descriptiontemplatedefinition.fielddata.AutoCompleteSingleData item, AutoCompleteSingleData singleData) {
|
||||
singleData.url = item.getUrl();
|
||||
singleData.optionsRoot = item.getOptionsRoot();
|
||||
this.multiAutoComplete = false;
|
||||
if (item.getAutocompleteType() == null ) {
|
||||
singleData.autocompleteType = AutocompleteType.UNCACHED;
|
||||
} else {
|
||||
singleData.autocompleteType = item.getAutocompleteType();
|
||||
}
|
||||
singleData.hasAuth = item.getHasAuth() != null ? item.getHasAuth() : false;
|
||||
singleData.method = item.getMethod() != null && !item.getMethod().isEmpty() ? item.getMethod() : "GET";
|
||||
if (item.getAutoCompleteOptions() != null) {
|
||||
singleData.autoCompleteOptions = new Option();
|
||||
singleData.autoCompleteOptions.setLabel(item.getAutoCompleteOptions().getLabel());
|
||||
singleData.autoCompleteOptions.setValue(item.getAutoCompleteOptions().getValue());
|
||||
singleData.autoCompleteOptions.setSource(item.getAutoCompleteOptions().getSource());
|
||||
singleData.autoCompleteOptions.setUri(item.getAutoCompleteOptions().getUri());
|
||||
}
|
||||
if (singleData.hasAuth) {
|
||||
if (item.getAuth() != null) {
|
||||
singleData.auth = new AuthAutoCompleteData();
|
||||
singleData.auth.setUrl(item.getAuth().getUrl());
|
||||
singleData.auth.setMethod(item.getAuth().getMethod());
|
||||
singleData.auth.setBody(item.getAuth().getBody());
|
||||
singleData.auth.setPath(item.getAuth().getPath());
|
||||
singleData.auth.setType(item.getAuth().getType());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate.fielddata;
|
||||
|
||||
import eu.eudat.file.transformer.entities.definition.DefinitionSerializable;
|
||||
import eu.eudat.file.transformer.entities.xml.XmlSerializable;
|
||||
import eu.eudat.file.transformer.enums.FieldType;
|
||||
import eu.eudat.file.transformer.model.descriptiontemplatedefinition.fielddata.BaseFieldData;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
public abstract class BaseFieldDataEntity<T extends BaseFieldDataEntity, U extends BaseFieldData> implements DefinitionSerializable<T, U> {
|
||||
private String label;
|
||||
|
||||
public abstract FieldType getFieldType();
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
/*public Element toXml(Document doc) {
|
||||
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 T fromDefinition(U object) {
|
||||
this.setLabel(object.getLabel());
|
||||
return (T) this;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate.fielddata;
|
||||
|
||||
import eu.eudat.file.transformer.enums.FieldType;
|
||||
import eu.eudat.file.transformer.model.descriptiontemplatedefinition.fielddata.BooleanDecisionData;
|
||||
|
||||
public class BooleanDecisionDataEntity extends BaseFieldDataEntity<BooleanDecisionDataEntity, BooleanDecisionData> {
|
||||
|
||||
@Override
|
||||
public FieldType getFieldType() {
|
||||
return FieldType.BOOLEAN_DECISION;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate.fielddata;
|
||||
|
||||
import eu.eudat.file.transformer.enums.FieldType;
|
||||
import eu.eudat.file.transformer.model.descriptiontemplatedefinition.fielddata.CheckBoxData;
|
||||
|
||||
public class CheckBoxDataEntity extends BaseFieldDataEntity<CheckBoxDataEntity, CheckBoxData> {
|
||||
|
||||
@Override
|
||||
public FieldType getFieldType() {
|
||||
return FieldType.CHECK_BOX;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,96 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate.fielddata;
|
||||
|
||||
import eu.eudat.file.transformer.entities.definition.DefinitionSerializable;
|
||||
import eu.eudat.file.transformer.entities.xml.XmlSerializable;
|
||||
import eu.eudat.file.transformer.enums.FieldDataComboBoxType;
|
||||
import eu.eudat.file.transformer.model.descriptiontemplatedefinition.fielddata.BaseFieldData;
|
||||
import eu.eudat.file.transformer.model.descriptiontemplatedefinition.fielddata.ComboBoxOption;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
public abstract class ComboBoxDataEntity<T extends ComboBoxDataEntity, U extends BaseFieldData> extends BaseFieldDataEntity<T, U> {
|
||||
|
||||
public abstract FieldDataComboBoxType getFieldSubType();
|
||||
|
||||
public static class Option implements DefinitionSerializable<Option, ComboBoxOption> {
|
||||
private String label;
|
||||
private String value;
|
||||
private String source;
|
||||
private String uri;
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getSource() {
|
||||
return source;
|
||||
}
|
||||
public void setSource(String source) {
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
public String getUri() {
|
||||
return uri;
|
||||
}
|
||||
|
||||
public void setUri(String uri) {
|
||||
this.uri = uri;
|
||||
}
|
||||
|
||||
/*@Override
|
||||
public Element toXml(Document doc) {
|
||||
Element option = doc.createElement("option");
|
||||
option.setAttribute("label", this.label);
|
||||
option.setAttribute("value", this.value);
|
||||
option.setAttribute("source", this.source);
|
||||
option.setAttribute("uri", this.uri);
|
||||
return option;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Option fromXml(Element item) {
|
||||
this.label = item.getAttribute("label");
|
||||
this.value = item.getAttribute("value");
|
||||
this.source = item.getAttribute("source");
|
||||
this.uri = item.getAttribute("uri");
|
||||
return this;
|
||||
}*/
|
||||
|
||||
@Override
|
||||
public Option fromDefinition(ComboBoxOption object) {
|
||||
this.label = object.getLabel();
|
||||
this.value = object.getValue();
|
||||
this.source = object.getSource();
|
||||
this.uri = object.getUri();
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
/*@Override
|
||||
public Element toXml(Document doc) {
|
||||
Element root = super.toXml(doc);
|
||||
root.setAttribute("type", this.getFieldSubType().toString());
|
||||
return root;
|
||||
}
|
||||
|
||||
@Override
|
||||
public T fromXml(Element item) {
|
||||
super.fromXml(item);
|
||||
return (T) this;
|
||||
}*/
|
||||
|
||||
public T fromDefinition(U object) {
|
||||
super.fromDefinition(object);
|
||||
return (T) this;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate.fielddata;
|
||||
|
||||
import eu.eudat.file.transformer.enums.FieldType;
|
||||
import eu.eudat.file.transformer.model.descriptiontemplatedefinition.fielddata.CurrencyData;
|
||||
|
||||
public class CurrencyDataEntity extends BaseFieldDataEntity<CurrencyDataEntity, CurrencyData> {
|
||||
@Override
|
||||
public FieldType getFieldType() {
|
||||
return FieldType.CURRENCY;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate.fielddata;
|
||||
|
||||
import eu.eudat.file.transformer.enums.FieldType;
|
||||
import eu.eudat.file.transformer.model.descriptiontemplatedefinition.fielddata.DataRepositoryData;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
public class DataRepositoryDataEntity extends BaseFieldDataEntity<DataRepositoryDataEntity, DataRepositoryData> {
|
||||
@Override
|
||||
public FieldType getFieldType() {
|
||||
return FieldType.DATA_REPOSITORIES;
|
||||
}
|
||||
|
||||
private Boolean multiAutoComplete;
|
||||
|
||||
public Boolean getMultiAutoComplete() {
|
||||
return multiAutoComplete;
|
||||
}
|
||||
|
||||
public void setMultiAutoComplete(Boolean multiAutoComplete) {
|
||||
this.multiAutoComplete = multiAutoComplete;
|
||||
}
|
||||
|
||||
/*@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 DataRepositoryDataEntity fromXml(Element item) {
|
||||
super.fromXml(item);
|
||||
this.setMultiAutoComplete(Boolean.parseBoolean(item.getAttribute("multiAutoComplete")));
|
||||
return this;
|
||||
}*/
|
||||
|
||||
public DataRepositoryDataEntity fromDefinition(DataRepositoryData item) {
|
||||
super.fromDefinition(item);
|
||||
this.setMultiAutoComplete(item.getMultiAutoComplete());
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate.fielddata;
|
||||
|
||||
import eu.eudat.file.transformer.enums.FieldDataInternalDmpEntryType;
|
||||
import eu.eudat.file.transformer.enums.FieldType;
|
||||
import eu.eudat.file.transformer.model.descriptiontemplatedefinition.fielddata.DatasetAutoCompleteData;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
public class DatasetAutoCompleteDataEntity extends InternalDmpBaseDataEntity<DatasetAutoCompleteDataEntity, DatasetAutoCompleteData> {
|
||||
private Boolean multiAutoComplete;
|
||||
|
||||
public Boolean getMultiAutoComplete() {
|
||||
return multiAutoComplete;
|
||||
}
|
||||
public void setMultiAutoComplete(Boolean multiAutoComplete) {
|
||||
this.multiAutoComplete = multiAutoComplete;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FieldDataInternalDmpEntryType getFieldSubType() {
|
||||
return FieldDataInternalDmpEntryType.Datasets;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FieldType getFieldType() {
|
||||
return FieldType.INTERNAL_DMP_ENTRIES_DATASETS;
|
||||
}
|
||||
|
||||
/*@Override
|
||||
public Element toXml(Document doc) {
|
||||
Element root = super.toXml(doc);
|
||||
root.setAttribute("multiAutoComplete", this.multiAutoComplete.toString());
|
||||
|
||||
return root;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DatasetAutoCompleteDataEntity fromXml(Element item) {
|
||||
super.fromXml(item);
|
||||
this.multiAutoComplete = Boolean.parseBoolean(item.getAttribute("multiAutoComplete"));
|
||||
|
||||
return this;
|
||||
}*/
|
||||
|
||||
public DatasetAutoCompleteDataEntity fromDefinition(DatasetAutoCompleteData item) {
|
||||
super.fromDefinition(item);
|
||||
this.multiAutoComplete = item.getMultiAutoComplete();
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate.fielddata;
|
||||
|
||||
import eu.eudat.file.transformer.enums.FieldType;
|
||||
import eu.eudat.file.transformer.model.descriptiontemplatedefinition.fielddata.DatasetIdentifierData;
|
||||
|
||||
public class DatasetIdentifierDataEntity extends BaseFieldDataEntity<DatasetIdentifierDataEntity, DatasetIdentifierData> {
|
||||
@Override
|
||||
public FieldType getFieldType() {
|
||||
return FieldType.DATASET_IDENTIFIER;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate.fielddata;
|
||||
|
||||
import eu.eudat.file.transformer.enums.FieldType;
|
||||
import eu.eudat.file.transformer.model.descriptiontemplatedefinition.fielddata.DatePickerData;
|
||||
|
||||
public class DatePickerDataEntity extends BaseFieldDataEntity<DatePickerDataEntity, DatePickerData> {
|
||||
@Override
|
||||
public FieldType getFieldType() {
|
||||
return FieldType.DATE_PICKER;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate.fielddata;
|
||||
|
||||
import eu.eudat.file.transformer.enums.FieldDataInternalDmpEntryType;
|
||||
import eu.eudat.file.transformer.enums.FieldType;
|
||||
import eu.eudat.file.transformer.model.descriptiontemplatedefinition.fielddata.DmpAutoCompleteData;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
public class DmpAutoCompleteDataEntity extends InternalDmpBaseDataEntity<DmpAutoCompleteDataEntity, DmpAutoCompleteData> {
|
||||
private Boolean multiAutoComplete;
|
||||
|
||||
public Boolean getMultiAutoComplete() {
|
||||
return multiAutoComplete;
|
||||
}
|
||||
public void setMultiAutoComplete(Boolean multiAutoComplete) {
|
||||
this.multiAutoComplete = multiAutoComplete;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FieldDataInternalDmpEntryType getFieldSubType() {
|
||||
return FieldDataInternalDmpEntryType.Dmps;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FieldType getFieldType() {
|
||||
return FieldType.INTERNAL_DMP_ENTRIES_DMPS;
|
||||
}
|
||||
/*@Override
|
||||
public Element toXml(Document doc) {
|
||||
Element root = super.toXml(doc);
|
||||
root.setAttribute("multiAutoComplete", this.multiAutoComplete.toString());
|
||||
|
||||
return root;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DmpAutoCompleteDataEntity fromXml(Element item) {
|
||||
super.fromXml(item);
|
||||
this.multiAutoComplete = Boolean.parseBoolean(item.getAttribute("multiAutoComplete"));
|
||||
|
||||
return this;
|
||||
}*/
|
||||
|
||||
public DmpAutoCompleteDataEntity fromDefinition(DmpAutoCompleteData item) {
|
||||
super.fromDefinition(item);
|
||||
this.multiAutoComplete = item.getMultiAutoComplete();
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate.fielddata;
|
||||
|
||||
import eu.eudat.file.transformer.enums.FieldDataExternalDatasetType;
|
||||
import eu.eudat.file.transformer.enums.FieldType;
|
||||
import eu.eudat.file.transformer.model.descriptiontemplatedefinition.fielddata.ExternalDatasetData;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
public class ExternalDatasetDataEntity extends BaseFieldDataEntity<ExternalDatasetDataEntity, ExternalDatasetData> {
|
||||
@Override
|
||||
public FieldType getFieldType() {
|
||||
return FieldType.EXTERNAL_DATASETS;
|
||||
}
|
||||
private Boolean multiAutoComplete;
|
||||
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;
|
||||
}
|
||||
|
||||
/*@Override
|
||||
public Element toXml(Document doc) {
|
||||
Element root = doc.createElement("data");
|
||||
root.setAttribute("label", this.getLabel());
|
||||
if (this.getMultiAutoComplete() != null) {
|
||||
root.setAttribute("multiAutoComplete", this.getMultiAutoComplete().toString());
|
||||
}
|
||||
if (this.getType() != null) {
|
||||
root.setAttribute("type", this.getType().getValue());
|
||||
}
|
||||
return root;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExternalDatasetDataEntity fromXml(Element item) {
|
||||
this.setLabel(item != null ? item.getAttribute("label") : "");
|
||||
this.setMultiAutoComplete(Boolean.parseBoolean(item.getAttribute("multiAutoComplete")));
|
||||
this.setType(item.getAttribute("type") != null ? FieldDataExternalDatasetType.of(item.getAttribute("type")): FieldDataExternalDatasetType.Other);
|
||||
return this;
|
||||
}*/
|
||||
|
||||
public ExternalDatasetDataEntity fromDefinition(ExternalDatasetData item) {
|
||||
super.fromDefinition(item);
|
||||
this.setMultiAutoComplete(item.getMultiAutoComplete());
|
||||
this.setType(item.getType() != null ? item.getType(): FieldDataExternalDatasetType.Other);
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate.fielddata;
|
||||
|
||||
|
||||
import eu.eudat.file.transformer.enums.FieldDataComboBoxType;
|
||||
import eu.eudat.file.transformer.enums.FieldDataInternalDmpEntryType;
|
||||
import eu.eudat.file.transformer.enums.FieldType;
|
||||
|
||||
public class FieldDataHelper {
|
||||
public BaseFieldDataEntity<?, ?> create(FieldType type, String subType) {
|
||||
switch (type) {
|
||||
case COMBO_BOX: {
|
||||
if (subType != null && !subType.isBlank()) {
|
||||
switch (FieldDataComboBoxType.of(subType)) {
|
||||
case Wordlist: {
|
||||
return new WordListDataEntity();
|
||||
}
|
||||
case Autocomplete: {
|
||||
return new AutoCompleteDataEntity();
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case INTERNAL_DMP_ENTRIES: {
|
||||
if (subType != null && !subType.isBlank()) {
|
||||
switch (FieldDataInternalDmpEntryType.of(subType)){
|
||||
case Dmps: {
|
||||
return new DmpAutoCompleteDataEntity();
|
||||
}
|
||||
case Datasets: {
|
||||
return new DatasetAutoCompleteDataEntity();
|
||||
}
|
||||
case Researchers : {
|
||||
return new ResearcherAutoCompleteDataEntity();
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case BOOLEAN_DECISION: return new BooleanDecisionDataEntity();
|
||||
case RADIO_BOX: return new RadioBoxDataEntity();
|
||||
case CHECK_BOX: return new CheckBoxDataEntity();
|
||||
case FREE_TEXT: return new FreeTextDataEntity();
|
||||
case TEXT_AREA: return new TextAreaDataEntity();
|
||||
case RICH_TEXT_AREA: return new RichTextAreaDataEntity();
|
||||
case UPLOAD: return new UploadDataEntity();
|
||||
case DATE_PICKER: return new DatePickerDataEntity();
|
||||
case EXTERNAL_DATASETS: return new ExternalDatasetDataEntity();
|
||||
case DATA_REPOSITORIES: return new DataRepositoryDataEntity();
|
||||
case PUB_REPOSITORIES: return new PublicationRepositoryDataEntity();
|
||||
case JOURNAL_REPOSITORIES: return new JournalRepositoryDataEntity();
|
||||
case TAXONOMIES: return new TaxonomyDataEntity();
|
||||
case LICENSES: return new LicenseDataEntity();
|
||||
case PUBLICATIONS: return new PublicationDataEntity();
|
||||
case REGISTRIES: return new RegistryDataEntity();
|
||||
case SERVICES: return new ServiceDataEntity();
|
||||
case TAGS: return new TagDataEntity();
|
||||
case RESEARCHERS: return new ResearcherDataEntity();
|
||||
case ORGANIZATIONS: return new OrganizationDataEntity();
|
||||
case DATASET_IDENTIFIER: return new DatasetIdentifierDataEntity();
|
||||
case CURRENCY: return new CurrencyDataEntity();
|
||||
case VALIDATION: return new ValidationDataEntity();
|
||||
default: return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate.fielddata;
|
||||
|
||||
import eu.eudat.file.transformer.enums.FieldType;
|
||||
import eu.eudat.file.transformer.model.descriptiontemplatedefinition.fielddata.FreeTextData;
|
||||
|
||||
public class FreeTextDataEntity extends BaseFieldDataEntity<FreeTextDataEntity, FreeTextData> {
|
||||
@Override
|
||||
public FieldType getFieldType() {
|
||||
return FieldType.FREE_TEXT;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate.fielddata;
|
||||
|
||||
import eu.eudat.file.transformer.enums.FieldDataInternalDmpEntryType;
|
||||
import eu.eudat.file.transformer.model.descriptiontemplatedefinition.fielddata.BaseFieldData;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
public abstract class InternalDmpBaseDataEntity<T extends BaseFieldDataEntity, U extends BaseFieldData> extends BaseFieldDataEntity<T, U> {
|
||||
|
||||
public abstract FieldDataInternalDmpEntryType getFieldSubType();
|
||||
|
||||
/*@Override
|
||||
public Element toXml(Document doc) {
|
||||
Element root = super.toXml(doc);
|
||||
root.setAttribute("type", this.getFieldSubType().toString());
|
||||
return root;
|
||||
}
|
||||
|
||||
@Override
|
||||
public T fromXml(Element item) {
|
||||
super.fromXml(item);
|
||||
return (T) this;
|
||||
}*/
|
||||
|
||||
public T fromDefinition(U item) {
|
||||
super.fromDefinition(item);
|
||||
return (T) this;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate.fielddata;
|
||||
|
||||
import eu.eudat.file.transformer.enums.FieldType;
|
||||
import eu.eudat.file.transformer.model.descriptiontemplatedefinition.fielddata.JournalRepositoryData;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
public class JournalRepositoryDataEntity extends BaseFieldDataEntity<JournalRepositoryDataEntity, JournalRepositoryData> {
|
||||
@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 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 JournalRepositoryDataEntity fromDefinition(JournalRepositoryData object) {
|
||||
super.fromDefinition(object);
|
||||
this.setMultiAutoComplete(object.getMultiAutoComplete());
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate.fielddata;
|
||||
|
||||
import eu.eudat.file.transformer.enums.FieldType;
|
||||
import eu.eudat.file.transformer.model.descriptiontemplatedefinition.fielddata.LicenseData;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
public class LicenseDataEntity extends BaseFieldDataEntity<LicenseDataEntity, LicenseData> {
|
||||
@Override
|
||||
public FieldType getFieldType() {
|
||||
return FieldType.LICENSES;
|
||||
}
|
||||
private Boolean multiAutoComplete;
|
||||
|
||||
public Boolean getMultiAutoComplete() {
|
||||
return multiAutoComplete;
|
||||
}
|
||||
|
||||
public void setMultiAutoComplete(Boolean multiAutoComplete) {
|
||||
this.multiAutoComplete = multiAutoComplete;
|
||||
}
|
||||
|
||||
/*@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 LicenseDataEntity fromXml(Element item) {
|
||||
super.fromXml(item);
|
||||
this.setMultiAutoComplete(Boolean.parseBoolean(item.getAttribute("multiAutoComplete")));
|
||||
return this;
|
||||
}*/
|
||||
|
||||
@Override
|
||||
public LicenseDataEntity fromDefinition(LicenseData object) {
|
||||
super.fromDefinition(object);
|
||||
this.multiAutoComplete = object.getMultiAutoComplete();
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate.fielddata;
|
||||
|
||||
import eu.eudat.file.transformer.enums.FieldType;
|
||||
import eu.eudat.file.transformer.model.descriptiontemplatedefinition.fielddata.OrganizationData;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
public class OrganizationDataEntity extends BaseFieldDataEntity<OrganizationDataEntity, OrganizationData> {
|
||||
@Override
|
||||
public FieldType getFieldType() {
|
||||
return FieldType.ORGANIZATIONS;
|
||||
}
|
||||
private Boolean multiAutoComplete;
|
||||
|
||||
public Boolean getMultiAutoComplete() {
|
||||
return multiAutoComplete;
|
||||
}
|
||||
|
||||
public void setMultiAutoComplete(Boolean multiAutoComplete) {
|
||||
this.multiAutoComplete = multiAutoComplete;
|
||||
}
|
||||
|
||||
/*@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 OrganizationDataEntity fromXml(Element item) {
|
||||
super.fromXml(item);
|
||||
this.setMultiAutoComplete(Boolean.parseBoolean(item.getAttribute("multiAutoComplete")));
|
||||
return this;
|
||||
}*/
|
||||
|
||||
@Override
|
||||
public OrganizationDataEntity fromDefinition(OrganizationData object) {
|
||||
super.fromDefinition(object);
|
||||
this.multiAutoComplete = object.getMultiAutoComplete();
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate.fielddata;
|
||||
import eu.eudat.file.transformer.enums.FieldType;
|
||||
import eu.eudat.file.transformer.model.descriptiontemplatedefinition.fielddata.PublicationData;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
public class PublicationDataEntity extends BaseFieldDataEntity<PublicationDataEntity, PublicationData> {
|
||||
@Override
|
||||
public FieldType getFieldType() {
|
||||
return FieldType.PUBLICATIONS;
|
||||
}
|
||||
private Boolean multiAutoComplete;
|
||||
|
||||
public Boolean getMultiAutoComplete() {
|
||||
return multiAutoComplete;
|
||||
}
|
||||
|
||||
public void setMultiAutoComplete(Boolean multiAutoComplete) {
|
||||
this.multiAutoComplete = multiAutoComplete;
|
||||
}
|
||||
/*@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 PublicationDataEntity fromXml(Element item) {
|
||||
super.fromXml(item);
|
||||
this.setMultiAutoComplete(Boolean.parseBoolean(item.getAttribute("multiAutoComplete")));
|
||||
return this;
|
||||
}*/
|
||||
|
||||
@Override
|
||||
public PublicationDataEntity fromDefinition(PublicationData object) {
|
||||
super.fromDefinition(object);
|
||||
this.multiAutoComplete = object.getMultiAutoComplete();
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate.fielddata;
|
||||
|
||||
import eu.eudat.file.transformer.enums.FieldType;
|
||||
import eu.eudat.file.transformer.model.descriptiontemplatedefinition.fielddata.PublicationRepositoryData;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
public class PublicationRepositoryDataEntity extends BaseFieldDataEntity<PublicationRepositoryDataEntity, PublicationRepositoryData> {
|
||||
@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 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 PublicationRepositoryDataEntity fromDefinition(PublicationRepositoryData object) {
|
||||
super.fromDefinition(object);
|
||||
this.multiAutoComplete = object.getMultiAutoComplete();
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,114 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate.fielddata;
|
||||
|
||||
import eu.eudat.file.transformer.entities.definition.DefinitionSerializable;
|
||||
import eu.eudat.file.transformer.entities.xml.XmlSerializable;
|
||||
import eu.eudat.file.transformer.enums.FieldType;
|
||||
import eu.eudat.file.transformer.model.descriptiontemplatedefinition.fielddata.RadioBoxData;
|
||||
import eu.eudat.file.transformer.model.descriptiontemplatedefinition.fielddata.RadioBoxOption;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
public class RadioBoxDataEntity extends BaseFieldDataEntity<RadioBoxDataEntity, RadioBoxData> {
|
||||
@Override
|
||||
public FieldType getFieldType() {
|
||||
return FieldType.RADIO_BOX;
|
||||
}
|
||||
public static class Option implements DefinitionSerializable<Option, RadioBoxOption> {
|
||||
private String label;
|
||||
private String value;
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/* @Override
|
||||
public Element toXml(Document doc) {
|
||||
Element option = doc.createElement("option");
|
||||
option.setAttribute("label", this.label);
|
||||
option.setAttribute("value", this.value);
|
||||
return option;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Option fromXml(Element item) {
|
||||
this.label = item.getAttribute("label");
|
||||
this.value = item.getAttribute("value");
|
||||
return this;
|
||||
}*/
|
||||
|
||||
public Option fromDefinition(RadioBoxOption item) {
|
||||
this.label = item.getLabel();
|
||||
this.value = item.getValue();
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private List<Option> options;
|
||||
|
||||
public List<Option> getOptions() {
|
||||
return options;
|
||||
}
|
||||
|
||||
public void setOptions(List<Option> options) {
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
/*@Override
|
||||
public Element toXml(Document doc) {
|
||||
Element root = super.toXml(doc);
|
||||
Element element = doc.createElement("options");
|
||||
for (Option option : this.options) {
|
||||
element.appendChild(option.toXml(doc));
|
||||
}
|
||||
root.appendChild(element);
|
||||
return root;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RadioBoxDataEntity fromXml(Element item) {
|
||||
super.fromXml(item);
|
||||
this.options = new LinkedList<>();
|
||||
Element optionsElement = (Element) item.getElementsByTagName("options").item(0);
|
||||
if (optionsElement != null) {
|
||||
NodeList optionElements = optionsElement.getChildNodes();
|
||||
for (int temp = 0; temp < optionElements.getLength(); temp++) {
|
||||
Node optionElement = optionElements.item(temp);
|
||||
if (optionElement.getNodeType() == Node.ELEMENT_NODE) {
|
||||
this.options.add(new Option().fromXml((Element) optionElement));
|
||||
}
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}*/
|
||||
|
||||
@Override
|
||||
public RadioBoxDataEntity fromDefinition(RadioBoxData object) {
|
||||
super.fromDefinition(object);
|
||||
this.options = new LinkedList<>();
|
||||
if (object.getOptions() != null) {
|
||||
for (RadioBoxOption option : object.getOptions()) {
|
||||
this.options.add(new Option().fromDefinition(option));
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate.fielddata;
|
||||
|
||||
import eu.eudat.file.transformer.enums.FieldType;
|
||||
import eu.eudat.file.transformer.model.descriptiontemplatedefinition.fielddata.RegistryData;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
public class RegistryDataEntity extends BaseFieldDataEntity<RegistryDataEntity, RegistryData> {
|
||||
@Override
|
||||
public FieldType getFieldType() {
|
||||
return FieldType.REGISTRIES;
|
||||
}
|
||||
private Boolean multiAutoComplete;
|
||||
|
||||
public Boolean getMultiAutoComplete() {
|
||||
return multiAutoComplete;
|
||||
}
|
||||
|
||||
public void setMultiAutoComplete(Boolean multiAutoComplete) {
|
||||
this.multiAutoComplete = multiAutoComplete;
|
||||
}
|
||||
/*@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 RegistryDataEntity fromXml(Element item) {
|
||||
super.fromXml(item);
|
||||
this.setMultiAutoComplete(Boolean.parseBoolean(item.getAttribute("multiAutoComplete")));
|
||||
return this;
|
||||
}*/
|
||||
|
||||
@Override
|
||||
public RegistryDataEntity fromDefinition(RegistryData object) {
|
||||
super.fromDefinition(object);
|
||||
this.multiAutoComplete = object.getMultiAutoComplete();
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate.fielddata;
|
||||
|
||||
import eu.eudat.file.transformer.enums.FieldDataInternalDmpEntryType;
|
||||
import eu.eudat.file.transformer.enums.FieldType;
|
||||
import eu.eudat.file.transformer.model.descriptiontemplatedefinition.fielddata.ResearcherAutoCompleteData;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
public class ResearcherAutoCompleteDataEntity extends InternalDmpBaseDataEntity<ResearcherAutoCompleteDataEntity, ResearcherAutoCompleteData> {
|
||||
private Boolean multiAutoComplete;
|
||||
|
||||
public Boolean getMultiAutoComplete() {
|
||||
return multiAutoComplete;
|
||||
}
|
||||
public void setMultiAutoComplete(Boolean multiAutoComplete) {
|
||||
this.multiAutoComplete = multiAutoComplete;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FieldDataInternalDmpEntryType getFieldSubType() {
|
||||
return FieldDataInternalDmpEntryType.Researchers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FieldType getFieldType() {
|
||||
return FieldType.INTERNAL_DMP_ENTRIES_RESEARCHERS;
|
||||
}
|
||||
|
||||
/*@Override
|
||||
public Element toXml(Document doc) {
|
||||
Element root = super.toXml(doc);
|
||||
root.setAttribute("multiAutoComplete", this.multiAutoComplete != null ? this.multiAutoComplete.toString() : "false");
|
||||
|
||||
return root;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResearcherAutoCompleteDataEntity fromXml(Element item) {
|
||||
super.fromXml(item);
|
||||
this.multiAutoComplete = Boolean.parseBoolean(item.getAttribute("multiAutoComplete"));
|
||||
|
||||
return this;
|
||||
}*/
|
||||
|
||||
@Override
|
||||
public ResearcherAutoCompleteDataEntity fromDefinition(ResearcherAutoCompleteData item) {
|
||||
super.fromDefinition(item);
|
||||
this.multiAutoComplete = item.getMultiAutoComplete();
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate.fielddata;
|
||||
|
||||
import eu.eudat.file.transformer.enums.FieldType;
|
||||
import eu.eudat.file.transformer.model.descriptiontemplatedefinition.fielddata.ResearcherData;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
public class ResearcherDataEntity extends BaseFieldDataEntity<ResearcherDataEntity, ResearcherData> {
|
||||
@Override
|
||||
public FieldType getFieldType() {
|
||||
return FieldType.RESEARCHERS;
|
||||
}
|
||||
private Boolean multiAutoComplete;
|
||||
|
||||
public Boolean getMultiAutoComplete() {
|
||||
return multiAutoComplete;
|
||||
}
|
||||
|
||||
public void setMultiAutoComplete(Boolean multiAutoComplete) {
|
||||
this.multiAutoComplete = multiAutoComplete;
|
||||
}
|
||||
|
||||
/*@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 ResearcherDataEntity fromXml(Element item) {
|
||||
super.fromXml(item);
|
||||
this.setMultiAutoComplete(Boolean.parseBoolean(item.getAttribute("multiAutoComplete")));
|
||||
return this;
|
||||
}*/
|
||||
|
||||
@Override
|
||||
public ResearcherDataEntity fromDefinition(ResearcherData object) {
|
||||
super.fromDefinition(object);
|
||||
this.multiAutoComplete = object.getMultiAutoComplete();
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate.fielddata;
|
||||
|
||||
import eu.eudat.file.transformer.enums.FieldType;
|
||||
import eu.eudat.file.transformer.model.descriptiontemplatedefinition.fielddata.RichTextAreaData;
|
||||
|
||||
|
||||
public class RichTextAreaDataEntity extends BaseFieldDataEntity<RichTextAreaDataEntity, RichTextAreaData> {
|
||||
@Override
|
||||
public FieldType getFieldType() {
|
||||
return FieldType.RICH_TEXT_AREA;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate.fielddata;
|
||||
|
||||
import eu.eudat.file.transformer.enums.FieldType;
|
||||
import eu.eudat.file.transformer.model.descriptiontemplatedefinition.fielddata.ServiceData;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
public class ServiceDataEntity extends BaseFieldDataEntity<ServiceDataEntity, ServiceData> {
|
||||
@Override
|
||||
public FieldType getFieldType() {
|
||||
return FieldType.SERVICES;
|
||||
}
|
||||
private Boolean multiAutoComplete;
|
||||
|
||||
public Boolean getMultiAutoComplete() {
|
||||
return multiAutoComplete;
|
||||
}
|
||||
|
||||
public void setMultiAutoComplete(Boolean multiAutoComplete) {
|
||||
this.multiAutoComplete = multiAutoComplete;
|
||||
}
|
||||
|
||||
/*@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 ServiceDataEntity fromXml(Element item) {
|
||||
super.fromXml(item);
|
||||
this.setMultiAutoComplete(Boolean.parseBoolean(item.getAttribute("multiAutoComplete")));
|
||||
return this;
|
||||
}*/
|
||||
|
||||
@Override
|
||||
public ServiceDataEntity fromDefinition(ServiceData object) {
|
||||
super.fromDefinition(object);
|
||||
this.multiAutoComplete = object.getMultiAutoComplete();
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate.fielddata;
|
||||
|
||||
import eu.eudat.file.transformer.enums.FieldType;
|
||||
import eu.eudat.file.transformer.model.descriptiontemplatedefinition.fielddata.TagData;
|
||||
|
||||
public class TagDataEntity extends BaseFieldDataEntity<TagDataEntity, TagData> {
|
||||
@Override
|
||||
public FieldType getFieldType() {
|
||||
return FieldType.TAGS;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate.fielddata;
|
||||
|
||||
import eu.eudat.file.transformer.enums.FieldType;
|
||||
import eu.eudat.file.transformer.model.descriptiontemplatedefinition.fielddata.TaxonomyData;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
public class TaxonomyDataEntity extends BaseFieldDataEntity<TaxonomyDataEntity, TaxonomyData> {
|
||||
@Override
|
||||
public FieldType getFieldType() {
|
||||
return FieldType.TAXONOMIES;
|
||||
}
|
||||
private Boolean multiAutoComplete;
|
||||
|
||||
public Boolean getMultiAutoComplete() {
|
||||
return multiAutoComplete;
|
||||
}
|
||||
|
||||
public void setMultiAutoComplete(Boolean multiAutoComplete) {
|
||||
this.multiAutoComplete = multiAutoComplete;
|
||||
}
|
||||
|
||||
/*@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 TaxonomyDataEntity fromXml(Element item) {
|
||||
super.fromXml(item);
|
||||
this.setMultiAutoComplete(Boolean.parseBoolean(item.getAttribute("multiAutoComplete")));
|
||||
return this;
|
||||
}*/
|
||||
|
||||
@Override
|
||||
public TaxonomyDataEntity fromDefinition(TaxonomyData object) {
|
||||
super.fromDefinition(object);
|
||||
this.multiAutoComplete = object.getMultiAutoComplete();
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate.fielddata;
|
||||
|
||||
import eu.eudat.file.transformer.enums.FieldType;
|
||||
import eu.eudat.file.transformer.model.descriptiontemplatedefinition.fielddata.TextAreaData;
|
||||
|
||||
|
||||
public class TextAreaDataEntity extends BaseFieldDataEntity<TextAreaDataEntity, TextAreaData> {
|
||||
@Override
|
||||
public FieldType getFieldType() {
|
||||
return FieldType.TEXT_AREA;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,132 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate.fielddata;
|
||||
|
||||
import eu.eudat.file.transformer.entities.definition.DefinitionSerializable;
|
||||
import eu.eudat.file.transformer.entities.xml.XmlSerializable;
|
||||
import eu.eudat.file.transformer.enums.FieldType;
|
||||
import eu.eudat.file.transformer.model.descriptiontemplatedefinition.fielddata.UploadData;
|
||||
import eu.eudat.file.transformer.model.descriptiontemplatedefinition.fielddata.UploadOption;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class UploadDataEntity extends BaseFieldDataEntity<UploadDataEntity, UploadData> {
|
||||
@Override
|
||||
public FieldType getFieldType() {
|
||||
return FieldType.UPLOAD;
|
||||
}
|
||||
public static class Option implements DefinitionSerializable<Option, UploadOption> {
|
||||
private String label;
|
||||
private String value;
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/*@Override
|
||||
public Element toXml(Document doc) {
|
||||
Element option = doc.createElement("option");
|
||||
option.setAttribute("label", this.label);
|
||||
option.setAttribute("value", this.value);
|
||||
return option;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Option fromXml(Element item) {
|
||||
this.label = item.getAttribute("label");
|
||||
this.value = item.getAttribute("value");
|
||||
return this;
|
||||
}*/
|
||||
|
||||
|
||||
@Override
|
||||
public Option fromDefinition(UploadOption object) {
|
||||
this.label = object.getLabel();
|
||||
this.value = object.getValue();
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
private List<Option> types;
|
||||
|
||||
public List<Option> getTypes() {
|
||||
return types;
|
||||
}
|
||||
|
||||
public void setTypes(List<Option> types) {
|
||||
this.types = types;
|
||||
}
|
||||
|
||||
private Integer maxFileSizeInMB;
|
||||
|
||||
public Integer getMaxFileSizeInMB() {
|
||||
return maxFileSizeInMB;
|
||||
}
|
||||
|
||||
public void setMaxFileSizeInMB(Integer maxFileSizeInMB) {
|
||||
this.maxFileSizeInMB = maxFileSizeInMB;
|
||||
}
|
||||
|
||||
/*@Override
|
||||
public Element toXml(Document doc) {
|
||||
Element root = super.toXml(doc);
|
||||
Element element = doc.createElement("types");
|
||||
for (Option type : this.types) {
|
||||
element.appendChild(type.toXml(doc));
|
||||
}
|
||||
root.setAttribute("maxFileSizeInMB", this.getMaxFileSizeInMB().toString());
|
||||
root.appendChild(element);
|
||||
return root;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UploadDataEntity fromXml(Element item) {
|
||||
this.types = new LinkedList<>();
|
||||
super.fromXml(item);
|
||||
Element optionsElement = (Element) item.getElementsByTagName("types").item(0);
|
||||
if(item.getAttribute("maxFileSizeInMB") != null) {
|
||||
this.setMaxFileSizeInMB(Integer.parseInt(item.getAttribute("maxFileSizeInMB")));
|
||||
}
|
||||
if (optionsElement != null) {
|
||||
NodeList optionElements = optionsElement.getChildNodes();
|
||||
for (int temp = 0; temp < optionElements.getLength(); temp++) {
|
||||
Node optionElement = optionElements.item(temp);
|
||||
if (optionElement.getNodeType() == Node.ELEMENT_NODE) {
|
||||
this.types.add(new Option().fromXml((Element) optionElement));
|
||||
}
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}*/
|
||||
|
||||
@Override
|
||||
public UploadDataEntity fromDefinition(UploadData object) {
|
||||
this.types = new LinkedList<>();
|
||||
super.fromDefinition(object);
|
||||
if(object.getMaxFileSizeInMB() != null) {
|
||||
this.setMaxFileSizeInMB(object.getMaxFileSizeInMB());
|
||||
}
|
||||
if (!object.getTypes().isEmpty() && object.getTypes().get(0) != null) {
|
||||
for (UploadOption option: object.getTypes()) {
|
||||
this.types.add(new Option().fromDefinition(option));
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate.fielddata;
|
||||
|
||||
import eu.eudat.file.transformer.enums.FieldType;
|
||||
import eu.eudat.file.transformer.model.descriptiontemplatedefinition.fielddata.ValidationData;
|
||||
|
||||
public class ValidationDataEntity extends BaseFieldDataEntity<ValidationDataEntity, ValidationData> {
|
||||
@Override
|
||||
public FieldType getFieldType() {
|
||||
return FieldType.VALIDATION;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,94 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate.fielddata;
|
||||
|
||||
import eu.eudat.file.transformer.enums.FieldDataComboBoxType;
|
||||
import eu.eudat.file.transformer.enums.FieldType;
|
||||
import eu.eudat.file.transformer.model.descriptiontemplatedefinition.fielddata.ComboBoxOption;
|
||||
import eu.eudat.file.transformer.model.descriptiontemplatedefinition.fielddata.WordListData;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
public class WordListDataEntity extends ComboBoxDataEntity<WordListDataEntity, WordListData> {
|
||||
private List<Option> options;
|
||||
|
||||
private Boolean multiList;
|
||||
|
||||
public List<Option> getOptions() {
|
||||
return options;
|
||||
}
|
||||
|
||||
public void setOptions(List<Option> options) {
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
public Boolean getMultiList() {
|
||||
return multiList;
|
||||
}
|
||||
|
||||
public void setMultiList(Boolean multiList) {
|
||||
this.multiList = multiList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FieldDataComboBoxType getFieldSubType() {
|
||||
return FieldDataComboBoxType.Wordlist;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FieldType getFieldType() {
|
||||
return FieldType.WORD_LIST;
|
||||
}
|
||||
|
||||
/*@Override
|
||||
public Element toXml(Document doc) {
|
||||
Element root = super.toXml(doc);
|
||||
root.setAttribute("multiList", this.multiList != null ? this.multiList.toString() : "false");
|
||||
Element element = doc.createElement("options");
|
||||
if (this.options != null) {
|
||||
for (Option option : this.options) {
|
||||
element.appendChild(option.toXml(doc));
|
||||
}
|
||||
}
|
||||
root.appendChild(element);
|
||||
return root;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WordListDataEntity fromXml(Element item) {
|
||||
super.fromXml(item);
|
||||
this.options = new LinkedList<>();
|
||||
Element optionsElement = (Element) item.getElementsByTagName("options").item(0);
|
||||
|
||||
if (optionsElement != null) {
|
||||
NodeList optionElements = optionsElement.getChildNodes();
|
||||
for (int temp = 0; temp < optionElements.getLength(); temp++) {
|
||||
Node optionElement = optionElements.item(temp);
|
||||
if (optionElement.getNodeType() == Node.ELEMENT_NODE) {
|
||||
this.options.add(new Option().fromXml((Element) optionElement));
|
||||
}
|
||||
}
|
||||
}
|
||||
Boolean temp = Boolean.parseBoolean(item.getAttribute("multiList"));
|
||||
this.multiList = temp != null ? temp : false;
|
||||
return this;
|
||||
}*/
|
||||
|
||||
@Override
|
||||
public WordListDataEntity fromDefinition(WordListData object) {
|
||||
super.fromDefinition(object);
|
||||
this.options = new LinkedList<>();
|
||||
|
||||
if (object.getOptions() != null) {
|
||||
for (ComboBoxOption option: object.getOptions()) {
|
||||
this.options.add(new Option().fromDefinition(option));
|
||||
}
|
||||
}
|
||||
Boolean temp = object.getMultiList();
|
||||
this.multiList = temp != null ? temp : false;
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate.importexport;
|
||||
|
||||
|
||||
import jakarta.xml.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@XmlRootElement(name = "root")
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class DescriptionTemplateImportExport {
|
||||
@XmlAttribute(name = "description")
|
||||
private String description;
|
||||
@XmlAttribute(name = "language")
|
||||
private String language;
|
||||
@XmlAttribute(name = "type")
|
||||
private UUID type;
|
||||
@XmlElementWrapper(name = "pages")
|
||||
@XmlElement(name = "page")
|
||||
private List<PageImportExport> pages;
|
||||
|
||||
|
||||
public List<PageImportExport> getPages() {
|
||||
return pages;
|
||||
}
|
||||
|
||||
public void setPages(List<PageImportExport> pages) {
|
||||
this.pages = pages;
|
||||
}
|
||||
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,144 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate.importexport;
|
||||
|
||||
import eu.eudat.file.transformer.entities.descriptiontemplate.importexport.fielddata.*;
|
||||
import eu.eudat.file.transformer.enums.FieldType;
|
||||
import eu.eudat.file.transformer.enums.FieldValidationType;
|
||||
import jakarta.xml.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class FieldImportExport {
|
||||
|
||||
@XmlAttribute(name = "id")
|
||||
private String id;
|
||||
|
||||
@XmlAttribute(name = "ordinal")
|
||||
private int ordinal;
|
||||
|
||||
@XmlElement(name = "numbering")
|
||||
private String numbering;
|
||||
|
||||
@XmlElementWrapper(name = "validations")
|
||||
@XmlElement(name = "validation")
|
||||
private List<FieldValidationType> validations;
|
||||
|
||||
@XmlElement(name = "defaultValue")
|
||||
private String defaultValue;
|
||||
|
||||
@XmlElementWrapper(name = "visibilityRules")
|
||||
@XmlElement(name = "visibilityRule")
|
||||
private List<RuleImportExport> visibilityRules;
|
||||
|
||||
@XmlElement(name = "fieldType")
|
||||
private FieldType fieldType;
|
||||
|
||||
@XmlElements(value = {
|
||||
@XmlElement(name = FieldType.Names.CheckBox, type = CheckBoxDataImportExport.class),
|
||||
@XmlElement(name = FieldType.Names.Validation, type = ValidationDataImportExport.class),
|
||||
@XmlElement(name = FieldType.Names.TextArea, type = TextAreaDataImportExport.class),
|
||||
@XmlElement(name = FieldType.Names.Taxonomies, type = TaxonomyDataImportExport.class),
|
||||
@XmlElement(name = FieldType.Names.Tags, type = TagDataImportExport.class),
|
||||
@XmlElement(name = FieldType.Names.Services, type = ServiceDataImportExport.class),
|
||||
@XmlElement(name = FieldType.Names.RichTextarea, type = RichTextAreaDataImportExport.class),
|
||||
@XmlElement(name = FieldType.Names.Researchers, type = ResearcherDataImportExport.class),
|
||||
@XmlElement(name = FieldType.Names.Registries, type = RegistryDataImportExport.class),
|
||||
@XmlElement(name = FieldType.Names.PubRepositories, type = PublicationRepositoryDataImportExport.class),
|
||||
@XmlElement(name = FieldType.Names.Publications, type = PublicationDataImportExport.class),
|
||||
@XmlElement(name = FieldType.Names.Organizations, type = OrganizationDataImportExport.class),
|
||||
@XmlElement(name = FieldType.Names.Licenses, type = LicenseDataImportExport.class),
|
||||
@XmlElement(name = FieldType.Names.JournalRepositories, type = JournalRepositoryDataImportExport.class),
|
||||
@XmlElement(name = FieldType.Names.FreeText, type = FreeTextDataImportExport.class),
|
||||
@XmlElement(name = FieldType.Names.ExternalDatasets, type = ExternalDatasetDataImportExport.class),
|
||||
@XmlElement(name = FieldType.Names.DatePicker, type = DatePickerDataImportExport.class),
|
||||
@XmlElement(name = FieldType.Names.DatasetIdentifier, type = DatasetIdentifierDataImportExport.class),
|
||||
@XmlElement(name = FieldType.Names.DataRepositories, type = DataRepositoryDataImportExport.class),
|
||||
@XmlElement(name = FieldType.Names.Currency, type = CurrencyDataImportExport.class),
|
||||
@XmlElement(name = FieldType.Names.BooleanDecision, type = BooleanDecisionDataImportExport.class),
|
||||
@XmlElement(name = FieldType.Names.Upload, type = UploadDataImportExport.class),
|
||||
@XmlElement(name = FieldType.Names.RadioBox, type = RadioBoxDataImportExport.class),
|
||||
@XmlElement(name = FieldType.Names.Wordlist, type = WordListDataImportExport.class),
|
||||
@XmlElement(name = FieldType.Names.Autocomplete, type = AutoCompleteDataImportExport.class),
|
||||
@XmlElement(name = FieldType.Names.InternalDmpDatasets, type = DatasetAutoCompleteDataImportExport.class),
|
||||
@XmlElement(name = FieldType.Names.InternalDmpDmps, type = DmpAutoCompleteDataImportExport.class),
|
||||
@XmlElement(name = FieldType.Names.InternalDmpResearchers, type = ResearcherAutoCompleteDataImportExport.class),
|
||||
})
|
||||
private BaseFieldDataImportExport data;
|
||||
|
||||
@XmlElementWrapper(name = "schematics")
|
||||
@XmlElement(name = "schematic")
|
||||
private List<String> schematics;
|
||||
|
||||
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 getNumbering() {
|
||||
return numbering;
|
||||
}
|
||||
|
||||
public void setNumbering(String numbering) {
|
||||
this.numbering = numbering;
|
||||
}
|
||||
|
||||
public String getDefaultValue() {
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
public void setDefaultValue(String defaultValue) {
|
||||
this.defaultValue = defaultValue;
|
||||
}
|
||||
|
||||
public FieldType getFieldType() {
|
||||
return fieldType;
|
||||
}
|
||||
|
||||
public void setFieldType(FieldType fieldType) {
|
||||
this.fieldType = fieldType;
|
||||
}
|
||||
|
||||
public BaseFieldDataImportExport getData() {
|
||||
return this.data;
|
||||
}
|
||||
|
||||
public void setData(BaseFieldDataImportExport data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public List<FieldValidationType> getValidations() {
|
||||
return validations;
|
||||
}
|
||||
|
||||
public void setValidations(List<FieldValidationType> validations) {
|
||||
this.validations = validations;
|
||||
}
|
||||
|
||||
public List<String> getSchematics() {
|
||||
return schematics;
|
||||
}
|
||||
|
||||
public void setSchematics(List<String> schematics) {
|
||||
this.schematics = schematics;
|
||||
}
|
||||
|
||||
public List<RuleImportExport> getVisibilityRules() {
|
||||
return visibilityRules;
|
||||
}
|
||||
|
||||
public void setVisibilityRules(List<RuleImportExport> visibilityRules) {
|
||||
this.visibilityRules = visibilityRules;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,112 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate.importexport;
|
||||
|
||||
import jakarta.xml.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class FieldSetImportExport {
|
||||
|
||||
@XmlAttribute(name = "id")
|
||||
private String id;
|
||||
@XmlAttribute(name = "ordinal")
|
||||
private int ordinal;
|
||||
@XmlElementWrapper(name = "fields")
|
||||
@XmlElement(name = "field")
|
||||
private List<FieldImportExport> fields;
|
||||
@XmlElement(name = "numbering")
|
||||
private String numbering;
|
||||
@XmlElement(name = "commentField")
|
||||
private Boolean commentField;
|
||||
@XmlElement(name = "multiplicity")
|
||||
private MultiplicityImportXml multiplicity;
|
||||
@XmlElement(name = "description")
|
||||
private String description;
|
||||
@XmlElement(name = "extendedDescription")
|
||||
private String extendedDescription;
|
||||
@XmlElement(name = "additionalInformation")
|
||||
private String additionalInformation;
|
||||
@XmlElement(name = "title")
|
||||
private String title;
|
||||
|
||||
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 List<FieldImportExport> getFields() {
|
||||
return fields;
|
||||
}
|
||||
|
||||
public void setFields(List<FieldImportExport> fields) {
|
||||
this.fields = fields;
|
||||
}
|
||||
|
||||
public String getNumbering() {
|
||||
return numbering;
|
||||
}
|
||||
|
||||
public void setNumbering(String numbering) {
|
||||
this.numbering = numbering;
|
||||
}
|
||||
|
||||
public Boolean getCommentField() {
|
||||
return commentField;
|
||||
}
|
||||
|
||||
public void setCommentField(Boolean commentField) {
|
||||
this.commentField = commentField;
|
||||
}
|
||||
|
||||
public MultiplicityImportXml getMultiplicity() {
|
||||
return multiplicity;
|
||||
}
|
||||
|
||||
public void setMultiplicity(MultiplicityImportXml multiplicity) {
|
||||
this.multiplicity = multiplicity;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return 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 void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate.importexport;
|
||||
|
||||
import jakarta.xml.bind.annotation.XmlAttribute;
|
||||
import jakarta.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
|
||||
@XmlRootElement(name = "multiplicity")
|
||||
public class MultiplicityImportXml {
|
||||
private int max;
|
||||
private int min;
|
||||
private String placeholder;
|
||||
private boolean tableView;
|
||||
|
||||
@XmlAttribute(name = "max")
|
||||
public int getMax() {
|
||||
return max;
|
||||
}
|
||||
|
||||
public void setMax(int max) {
|
||||
this.max = max;
|
||||
}
|
||||
|
||||
@XmlAttribute(name = "min")
|
||||
public int getMin() {
|
||||
return min;
|
||||
}
|
||||
|
||||
public void setMin(int min) {
|
||||
this.min = min;
|
||||
}
|
||||
|
||||
@XmlAttribute(name = "placeholder")
|
||||
public String getPlaceholder() {
|
||||
return placeholder;
|
||||
}
|
||||
|
||||
public void setPlaceholder(String placeholder) {
|
||||
this.placeholder = placeholder;
|
||||
}
|
||||
|
||||
@XmlAttribute(name = "tableView")
|
||||
public boolean getTableView() {
|
||||
return tableView;
|
||||
}
|
||||
|
||||
public void setTableView(boolean tableView) {
|
||||
this.tableView = tableView;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate.importexport;
|
||||
|
||||
import jakarta.xml.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class PageImportExport {
|
||||
@XmlAttribute(name = "id")
|
||||
private String id;
|
||||
@XmlAttribute(name = "ordinal")
|
||||
private int ordinal;
|
||||
|
||||
@XmlAttribute(name = "title")
|
||||
private String title;
|
||||
@XmlElementWrapper(name = "sections")
|
||||
@XmlElement(name = "section")
|
||||
private List<SectionImportExport> sections;
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public List<SectionImportExport> getSections() {
|
||||
return sections;
|
||||
}
|
||||
|
||||
public void setSections(List<SectionImportExport> sections) {
|
||||
this.sections = sections;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate.importexport;
|
||||
|
||||
import jakarta.xml.bind.annotation.*;
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class RuleImportExport {
|
||||
|
||||
@XmlAttribute(name = "target")
|
||||
private String target;
|
||||
@XmlAttribute(name = "value")
|
||||
private String value;
|
||||
|
||||
@XmlAttribute(name = "target")
|
||||
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;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,112 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate.importexport;
|
||||
|
||||
import jakarta.xml.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class SectionImportExport {
|
||||
@XmlAttribute(name = "id")
|
||||
private String id;
|
||||
@XmlAttribute(name = "ordinal")
|
||||
private int ordinal;
|
||||
@XmlAttribute(name = "page")
|
||||
private String page;
|
||||
@XmlAttribute(name = "defaultVisibility")
|
||||
private Boolean defaultVisibility;
|
||||
@XmlElementWrapper(name = "fieldSets")
|
||||
@XmlElement(name = "fieldSet")
|
||||
private List<FieldSetImportExport> fieldSets;
|
||||
@XmlElement(name = "numbering")
|
||||
private String numbering;
|
||||
@XmlElement(name = "description")
|
||||
private String description;
|
||||
@XmlElement(name = "title")
|
||||
private String title;
|
||||
@XmlElementWrapper(name = "sections")
|
||||
@XmlElement(name = "section")
|
||||
private List<SectionImportExport> sections;
|
||||
@XmlAttribute(name = "multiplicity")
|
||||
private Boolean multiplicity;
|
||||
|
||||
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 getPage() {
|
||||
return page;
|
||||
}
|
||||
|
||||
public void setPage(String page) {
|
||||
this.page = page;
|
||||
}
|
||||
|
||||
public Boolean getDefaultVisibility() {
|
||||
return defaultVisibility;
|
||||
}
|
||||
|
||||
public void setDefaultVisibility(Boolean defaultVisibility) {
|
||||
this.defaultVisibility = defaultVisibility;
|
||||
}
|
||||
|
||||
public List<FieldSetImportExport> getFieldSets() {
|
||||
return fieldSets;
|
||||
}
|
||||
|
||||
public void setFieldSets(List<FieldSetImportExport> fieldSets) {
|
||||
this.fieldSets = fieldSets;
|
||||
}
|
||||
|
||||
public String getNumbering() {
|
||||
return numbering;
|
||||
}
|
||||
|
||||
public void setNumbering(String numbering) {
|
||||
this.numbering = numbering;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public List<SectionImportExport> getSections() {
|
||||
return sections;
|
||||
}
|
||||
|
||||
public void setSections(List<SectionImportExport> sections) {
|
||||
this.sections = sections;
|
||||
}
|
||||
|
||||
public Boolean getMultiplicity() {
|
||||
return multiplicity;
|
||||
}
|
||||
|
||||
public void setMultiplicity(Boolean multiplicity) {
|
||||
this.multiplicity = multiplicity;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate.importexport.fielddata;
|
||||
|
||||
import jakarta.xml.bind.annotation.XmlAccessType;
|
||||
import jakarta.xml.bind.annotation.XmlAccessorType;
|
||||
import jakarta.xml.bind.annotation.XmlAttribute;
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class AuthAutoCompleteData {
|
||||
@XmlAttribute(name = "url")
|
||||
private String url;
|
||||
@XmlAttribute(name = "method")
|
||||
private String method;
|
||||
@XmlAttribute(name = "body")
|
||||
private String body;
|
||||
@XmlAttribute(name = "path")
|
||||
private String path;
|
||||
@XmlAttribute(name = "type")
|
||||
private String type;
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public String getMethod() {
|
||||
return method;
|
||||
}
|
||||
|
||||
public void setMethod(String method) {
|
||||
this.method = method;
|
||||
}
|
||||
|
||||
public String getBody() {
|
||||
return body;
|
||||
}
|
||||
|
||||
public void setBody(String body) {
|
||||
this.body = body;
|
||||
}
|
||||
|
||||
public String getPath() {
|
||||
return path;
|
||||
}
|
||||
|
||||
public void setPath(String path) {
|
||||
this.path = path;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate.importexport.fielddata;
|
||||
|
||||
import jakarta.xml.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class AutoCompleteDataImportExport extends BaseFieldDataImportExport {
|
||||
|
||||
@XmlAttribute(name = "multiAutoComplete")
|
||||
private Boolean multiAutoComplete;
|
||||
|
||||
@XmlElementWrapper(name = "autoCompleteSingleDataList")
|
||||
@XmlElement(name = "autoCompleteSingleData")
|
||||
private List<AutoCompleteSingleData> autoCompleteSingleDataList;
|
||||
|
||||
public Boolean getMultiAutoComplete() { return multiAutoComplete; }
|
||||
public void setMultiAutoComplete(Boolean multiAutoComplete) { this.multiAutoComplete = multiAutoComplete; }
|
||||
|
||||
public List<AutoCompleteSingleData> getAutoCompleteSingleDataList() {
|
||||
return autoCompleteSingleDataList;
|
||||
}
|
||||
|
||||
public void setAutoCompleteSingleDataList(List<AutoCompleteSingleData> autoCompleteSingleDataList) {
|
||||
this.autoCompleteSingleDataList = autoCompleteSingleDataList;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,81 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate.importexport.fielddata;
|
||||
|
||||
import eu.eudat.file.transformer.entities.descriptiontemplate.fielddata.AutoCompleteDataEntity;
|
||||
import jakarta.xml.bind.annotation.XmlAccessType;
|
||||
import jakarta.xml.bind.annotation.XmlAccessorType;
|
||||
import jakarta.xml.bind.annotation.XmlAttribute;
|
||||
import jakarta.xml.bind.annotation.XmlElement;
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class AutoCompleteSingleData {
|
||||
@XmlAttribute(name = "autocompleteType")
|
||||
private AutoCompleteDataEntity.AutocompleteType autocompleteType;
|
||||
@XmlAttribute(name = "url")
|
||||
private String url;
|
||||
@XmlElement(name = "autoCompleteOptions")
|
||||
private ComboBoxDataOptionEntity autoCompleteOptions;
|
||||
@XmlAttribute(name = "optionsRoot")
|
||||
private String optionsRoot;
|
||||
@XmlAttribute(name = "hasAuth")
|
||||
private Boolean hasAuth;
|
||||
@XmlElement(name = "auth")
|
||||
private AuthAutoCompleteData auth;
|
||||
@XmlAttribute(name = "method")
|
||||
private String method;
|
||||
|
||||
public AutoCompleteDataEntity.AutocompleteType getAutocompleteType() {
|
||||
return autocompleteType;
|
||||
}
|
||||
|
||||
public void setAutocompleteType(AutoCompleteDataEntity.AutocompleteType autocompleteType) {
|
||||
this.autocompleteType = autocompleteType;
|
||||
}
|
||||
|
||||
public String getOptionsRoot() {
|
||||
return optionsRoot;
|
||||
}
|
||||
|
||||
public void setOptionsRoot(String optionsRoot) {
|
||||
this.optionsRoot = optionsRoot;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public Boolean getHasAuth() {
|
||||
return hasAuth;
|
||||
}
|
||||
|
||||
public void setHasAuth(Boolean hasAuth) {
|
||||
this.hasAuth = hasAuth;
|
||||
}
|
||||
|
||||
public AuthAutoCompleteData getAuth() {
|
||||
return auth;
|
||||
}
|
||||
|
||||
public void setAuth(AuthAutoCompleteData auth) {
|
||||
this.auth = auth;
|
||||
}
|
||||
|
||||
public ComboBoxDataOptionEntity getAutoCompleteOptions() {
|
||||
return autoCompleteOptions;
|
||||
}
|
||||
|
||||
public void setAutoCompleteOptions(ComboBoxDataOptionEntity autoCompleteOptions) {
|
||||
this.autoCompleteOptions = autoCompleteOptions;
|
||||
}
|
||||
|
||||
public String getMethod() {
|
||||
return method;
|
||||
}
|
||||
|
||||
public void setMethod(String method) {
|
||||
this.method = method;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate.importexport.fielddata;
|
||||
|
||||
public abstract class BaseFieldDataImportExport {
|
||||
private String label;
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate.importexport.fielddata;
|
||||
|
||||
import jakarta.xml.bind.annotation.XmlAccessType;
|
||||
import jakarta.xml.bind.annotation.XmlAccessorType;
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class BooleanDecisionDataImportExport extends BaseFieldDataImportExport {
|
||||
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate.importexport.fielddata;
|
||||
|
||||
import jakarta.xml.bind.annotation.XmlAccessType;
|
||||
import jakarta.xml.bind.annotation.XmlAccessorType;
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class CheckBoxDataImportExport extends BaseFieldDataImportExport {
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate.importexport.fielddata;
|
||||
|
||||
import jakarta.xml.bind.annotation.XmlAccessType;
|
||||
import jakarta.xml.bind.annotation.XmlAccessorType;
|
||||
import jakarta.xml.bind.annotation.XmlAttribute;
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class ComboBoxDataOptionEntity {
|
||||
@XmlAttribute(name = "label")
|
||||
private String label;
|
||||
@XmlAttribute(name = "value")
|
||||
private String value;
|
||||
@XmlAttribute(name = "source")
|
||||
private String source;
|
||||
@XmlAttribute(name = "uri")
|
||||
private String uri;
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getSource() {
|
||||
return source;
|
||||
}
|
||||
public void setSource(String source) {
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
public String getUri() {
|
||||
return uri;
|
||||
}
|
||||
|
||||
public void setUri(String uri) {
|
||||
this.uri = uri;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate.importexport.fielddata;
|
||||
|
||||
import jakarta.xml.bind.annotation.XmlAccessType;
|
||||
import jakarta.xml.bind.annotation.XmlAccessorType;
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class CurrencyDataImportExport extends BaseFieldDataImportExport {
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate.importexport.fielddata;
|
||||
|
||||
import jakarta.xml.bind.annotation.XmlAccessType;
|
||||
import jakarta.xml.bind.annotation.XmlAccessorType;
|
||||
import jakarta.xml.bind.annotation.XmlAttribute;
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class DataRepositoryDataImportExport extends BaseFieldDataImportExport {
|
||||
|
||||
@XmlAttribute(name = "multiAutoComplete")
|
||||
private Boolean multiAutoComplete;
|
||||
|
||||
public Boolean getMultiAutoComplete() {
|
||||
return multiAutoComplete;
|
||||
}
|
||||
|
||||
public void setMultiAutoComplete(Boolean multiAutoComplete) {
|
||||
this.multiAutoComplete = multiAutoComplete;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate.importexport.fielddata;
|
||||
|
||||
import jakarta.xml.bind.annotation.XmlAccessType;
|
||||
import jakarta.xml.bind.annotation.XmlAccessorType;
|
||||
import jakarta.xml.bind.annotation.XmlAttribute;
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class DatasetAutoCompleteDataImportExport extends BaseFieldDataImportExport {
|
||||
@XmlAttribute(name = "multiAutoComplete")
|
||||
private Boolean multiAutoComplete;
|
||||
|
||||
public Boolean getMultiAutoComplete() {
|
||||
return multiAutoComplete;
|
||||
}
|
||||
public void setMultiAutoComplete(Boolean multiAutoComplete) {
|
||||
this.multiAutoComplete = multiAutoComplete;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate.importexport.fielddata;
|
||||
|
||||
import jakarta.xml.bind.annotation.XmlAccessType;
|
||||
import jakarta.xml.bind.annotation.XmlAccessorType;
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class DatasetIdentifierDataImportExport extends BaseFieldDataImportExport {
|
||||
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate.importexport.fielddata;
|
||||
|
||||
import jakarta.xml.bind.annotation.XmlAccessType;
|
||||
import jakarta.xml.bind.annotation.XmlAccessorType;
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class DatePickerDataImportExport extends BaseFieldDataImportExport {
|
||||
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate.importexport.fielddata;
|
||||
|
||||
import jakarta.xml.bind.annotation.XmlAccessType;
|
||||
import jakarta.xml.bind.annotation.XmlAccessorType;
|
||||
import jakarta.xml.bind.annotation.XmlAttribute;
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class DmpAutoCompleteDataImportExport extends BaseFieldDataImportExport {
|
||||
@XmlAttribute(name = "multiAutoComplete")
|
||||
private Boolean multiAutoComplete;
|
||||
|
||||
public Boolean getMultiAutoComplete() {
|
||||
return multiAutoComplete;
|
||||
}
|
||||
public void setMultiAutoComplete(Boolean multiAutoComplete) {
|
||||
this.multiAutoComplete = multiAutoComplete;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate.importexport.fielddata;
|
||||
|
||||
import eu.eudat.file.transformer.enums.FieldDataExternalDatasetType;
|
||||
import jakarta.xml.bind.annotation.XmlAccessType;
|
||||
import jakarta.xml.bind.annotation.XmlAccessorType;
|
||||
import jakarta.xml.bind.annotation.XmlAttribute;
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class ExternalDatasetDataImportExport extends BaseFieldDataImportExport {
|
||||
@XmlAttribute(name = "multiAutoComplete")
|
||||
private Boolean multiAutoComplete;
|
||||
@XmlAttribute(name = "type")
|
||||
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;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate.importexport.fielddata;
|
||||
|
||||
import jakarta.xml.bind.annotation.XmlAccessType;
|
||||
import jakarta.xml.bind.annotation.XmlAccessorType;
|
||||
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class FreeTextDataImportExport extends BaseFieldDataImportExport {
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate.importexport.fielddata;
|
||||
|
||||
import jakarta.xml.bind.annotation.XmlAccessType;
|
||||
import jakarta.xml.bind.annotation.XmlAccessorType;
|
||||
import jakarta.xml.bind.annotation.XmlAttribute;
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class JournalRepositoryDataImportExport extends BaseFieldDataImportExport {
|
||||
@XmlAttribute(name = "multiAutoComplete")
|
||||
private Boolean multiAutoComplete;
|
||||
|
||||
public Boolean getMultiAutoComplete() {
|
||||
return multiAutoComplete;
|
||||
}
|
||||
|
||||
public void setMultiAutoComplete(Boolean multiAutoComplete) {
|
||||
this.multiAutoComplete = multiAutoComplete;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate.importexport.fielddata;
|
||||
|
||||
import jakarta.xml.bind.annotation.XmlAccessType;
|
||||
import jakarta.xml.bind.annotation.XmlAccessorType;
|
||||
import jakarta.xml.bind.annotation.XmlAttribute;
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class LicenseDataImportExport extends BaseFieldDataImportExport {
|
||||
@XmlAttribute(name = "multiAutoComplete")
|
||||
private Boolean multiAutoComplete;
|
||||
|
||||
public Boolean getMultiAutoComplete() {
|
||||
return multiAutoComplete;
|
||||
}
|
||||
|
||||
public void setMultiAutoComplete(Boolean multiAutoComplete) {
|
||||
this.multiAutoComplete = multiAutoComplete;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate.importexport.fielddata;
|
||||
|
||||
import jakarta.xml.bind.annotation.XmlAccessType;
|
||||
import jakarta.xml.bind.annotation.XmlAccessorType;
|
||||
import jakarta.xml.bind.annotation.XmlAttribute;
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class OrganizationDataImportExport extends BaseFieldDataImportExport {
|
||||
@XmlAttribute(name = "multiAutoComplete")
|
||||
private Boolean multiAutoComplete;
|
||||
|
||||
public Boolean getMultiAutoComplete() {
|
||||
return multiAutoComplete;
|
||||
}
|
||||
|
||||
public void setMultiAutoComplete(Boolean multiAutoComplete) {
|
||||
this.multiAutoComplete = multiAutoComplete;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate.importexport.fielddata;
|
||||
|
||||
import jakarta.xml.bind.annotation.XmlAccessType;
|
||||
import jakarta.xml.bind.annotation.XmlAccessorType;
|
||||
import jakarta.xml.bind.annotation.XmlAttribute;
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class PublicationDataImportExport extends BaseFieldDataImportExport {
|
||||
@XmlAttribute(name = "multiAutoComplete")
|
||||
private Boolean multiAutoComplete;
|
||||
|
||||
public Boolean getMultiAutoComplete() {
|
||||
return multiAutoComplete;
|
||||
}
|
||||
|
||||
public void setMultiAutoComplete(Boolean multiAutoComplete) {
|
||||
this.multiAutoComplete = multiAutoComplete;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate.importexport.fielddata;
|
||||
|
||||
import jakarta.xml.bind.annotation.XmlAccessType;
|
||||
import jakarta.xml.bind.annotation.XmlAccessorType;
|
||||
import jakarta.xml.bind.annotation.XmlAttribute;
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class PublicationRepositoryDataImportExport extends BaseFieldDataImportExport {
|
||||
|
||||
@XmlAttribute(name = "multiAutoComplete")
|
||||
private Boolean multiAutoComplete;
|
||||
|
||||
public Boolean getMultiAutoComplete() {
|
||||
return multiAutoComplete;
|
||||
}
|
||||
|
||||
public void setMultiAutoComplete(Boolean multiAutoComplete) {
|
||||
this.multiAutoComplete = multiAutoComplete;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate.importexport.fielddata;
|
||||
|
||||
import jakarta.xml.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class RadioBoxDataImportExport extends BaseFieldDataImportExport {
|
||||
|
||||
@XmlElementWrapper(name = "options")
|
||||
@XmlElement(name = "option")
|
||||
private List<RadioBoxOption> options;
|
||||
|
||||
public List<RadioBoxOption> getOptions() {
|
||||
return options;
|
||||
}
|
||||
|
||||
public void setOptions(List<RadioBoxOption> options) {
|
||||
this.options = options;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate.importexport.fielddata;
|
||||
|
||||
import jakarta.xml.bind.annotation.XmlAccessType;
|
||||
import jakarta.xml.bind.annotation.XmlAccessorType;
|
||||
import jakarta.xml.bind.annotation.XmlAttribute;
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class RadioBoxOption {
|
||||
@XmlAttribute(name = "label")
|
||||
private String label;
|
||||
@XmlAttribute(name = "value")
|
||||
private String value;
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate.importexport.fielddata;
|
||||
|
||||
import jakarta.xml.bind.annotation.XmlAccessType;
|
||||
import jakarta.xml.bind.annotation.XmlAccessorType;
|
||||
import jakarta.xml.bind.annotation.XmlAttribute;
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class RegistryDataImportExport extends BaseFieldDataImportExport {
|
||||
@XmlAttribute(name = "multiAutoComplete")
|
||||
private Boolean multiAutoComplete;
|
||||
|
||||
public Boolean getMultiAutoComplete() {
|
||||
return multiAutoComplete;
|
||||
}
|
||||
|
||||
public void setMultiAutoComplete(Boolean multiAutoComplete) {
|
||||
this.multiAutoComplete = multiAutoComplete;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate.importexport.fielddata;
|
||||
|
||||
import jakarta.xml.bind.annotation.XmlAccessType;
|
||||
import jakarta.xml.bind.annotation.XmlAccessorType;
|
||||
import jakarta.xml.bind.annotation.XmlAttribute;
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class ResearcherAutoCompleteDataImportExport extends BaseFieldDataImportExport {
|
||||
@XmlAttribute(name = "multiAutoComplete")
|
||||
private Boolean multiAutoComplete;
|
||||
|
||||
public Boolean getMultiAutoComplete() {
|
||||
return multiAutoComplete;
|
||||
}
|
||||
public void setMultiAutoComplete(Boolean multiAutoComplete) {
|
||||
this.multiAutoComplete = multiAutoComplete;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate.importexport.fielddata;
|
||||
|
||||
import jakarta.xml.bind.annotation.XmlAccessType;
|
||||
import jakarta.xml.bind.annotation.XmlAccessorType;
|
||||
import jakarta.xml.bind.annotation.XmlAttribute;
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class ResearcherDataImportExport extends BaseFieldDataImportExport {
|
||||
@XmlAttribute(name = "multiAutoComplete")
|
||||
private Boolean multiAutoComplete;
|
||||
|
||||
public Boolean getMultiAutoComplete() {
|
||||
return multiAutoComplete;
|
||||
}
|
||||
|
||||
public void setMultiAutoComplete(Boolean multiAutoComplete) {
|
||||
this.multiAutoComplete = multiAutoComplete;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate.importexport.fielddata;
|
||||
|
||||
import jakarta.xml.bind.annotation.XmlAccessType;
|
||||
import jakarta.xml.bind.annotation.XmlAccessorType;
|
||||
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class RichTextAreaDataImportExport extends BaseFieldDataImportExport {
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate.importexport.fielddata;
|
||||
|
||||
import jakarta.xml.bind.annotation.XmlAccessType;
|
||||
import jakarta.xml.bind.annotation.XmlAccessorType;
|
||||
import jakarta.xml.bind.annotation.XmlAttribute;
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class ServiceDataImportExport extends BaseFieldDataImportExport {
|
||||
@XmlAttribute(name = "multiAutoComplete")
|
||||
private Boolean multiAutoComplete;
|
||||
|
||||
public Boolean getMultiAutoComplete() {
|
||||
return multiAutoComplete;
|
||||
}
|
||||
|
||||
public void setMultiAutoComplete(Boolean multiAutoComplete) {
|
||||
this.multiAutoComplete = multiAutoComplete;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate.importexport.fielddata;
|
||||
|
||||
import jakarta.xml.bind.annotation.XmlAccessType;
|
||||
import jakarta.xml.bind.annotation.XmlAccessorType;
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class TagDataImportExport extends BaseFieldDataImportExport {
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate.importexport.fielddata;
|
||||
|
||||
import jakarta.xml.bind.annotation.XmlAccessType;
|
||||
import jakarta.xml.bind.annotation.XmlAccessorType;
|
||||
import jakarta.xml.bind.annotation.XmlAttribute;
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class TaxonomyDataImportExport extends BaseFieldDataImportExport {
|
||||
@XmlAttribute(name = "multiAutoComplete")
|
||||
private Boolean multiAutoComplete;
|
||||
|
||||
public Boolean getMultiAutoComplete() {
|
||||
return multiAutoComplete;
|
||||
}
|
||||
|
||||
public void setMultiAutoComplete(Boolean multiAutoComplete) {
|
||||
this.multiAutoComplete = multiAutoComplete;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate.importexport.fielddata;
|
||||
|
||||
import jakarta.xml.bind.annotation.XmlAccessType;
|
||||
import jakarta.xml.bind.annotation.XmlAccessorType;
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class TextAreaDataImportExport extends BaseFieldDataImportExport {
|
||||
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate.importexport.fielddata;
|
||||
|
||||
import jakarta.xml.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class UploadDataImportExport extends BaseFieldDataImportExport {
|
||||
@XmlElementWrapper(name = "types")
|
||||
@XmlElement(name = "type")
|
||||
private List<UploadDataOption> types;
|
||||
|
||||
@XmlAttribute(name = "maxFileSizeInMB")
|
||||
private Integer maxFileSizeInMB;
|
||||
|
||||
public List<UploadDataOption> getTypes() {
|
||||
return types;
|
||||
}
|
||||
|
||||
public void setTypes(List<UploadDataOption> types) {
|
||||
this.types = types;
|
||||
}
|
||||
|
||||
public Integer getMaxFileSizeInMB() {
|
||||
return maxFileSizeInMB;
|
||||
}
|
||||
|
||||
public void setMaxFileSizeInMB(Integer maxFileSizeInMB) {
|
||||
this.maxFileSizeInMB = maxFileSizeInMB;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate.importexport.fielddata;
|
||||
|
||||
import jakarta.xml.bind.annotation.XmlAccessType;
|
||||
import jakarta.xml.bind.annotation.XmlAccessorType;
|
||||
import jakarta.xml.bind.annotation.XmlAttribute;
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class UploadDataOption {
|
||||
@XmlAttribute(name = "label")
|
||||
private String label;
|
||||
@XmlAttribute(name = "value")
|
||||
private String value;
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate.importexport.fielddata;
|
||||
|
||||
import jakarta.xml.bind.annotation.XmlAccessType;
|
||||
import jakarta.xml.bind.annotation.XmlAccessorType;
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class ValidationDataImportExport extends BaseFieldDataImportExport {
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate.importexport.fielddata;
|
||||
|
||||
import jakarta.xml.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class WordListDataImportExport extends BaseFieldDataImportExport {
|
||||
@XmlElementWrapper(name = "options")
|
||||
@XmlElement(name = "options")
|
||||
private List<ComboBoxDataOptionEntity> options;
|
||||
|
||||
@XmlAttribute(name = "multiList")
|
||||
private Boolean multiList;
|
||||
|
||||
public List<ComboBoxDataOptionEntity> getOptions() {
|
||||
return options;
|
||||
}
|
||||
|
||||
public void setOptions(List<ComboBoxDataOptionEntity> options) {
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
public Boolean getMultiList() {
|
||||
return multiList;
|
||||
}
|
||||
|
||||
public void setMultiList(Boolean multiList) {
|
||||
this.multiList = multiList;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate.todelete;
|
||||
|
||||
public class DefaultValueEntity {
|
||||
private String type;
|
||||
private String value;
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate.todelete;
|
||||
|
||||
import eu.eudat.file.transformer.enums.FieldType;
|
||||
|
||||
public class FieldDescriptionEntity {
|
||||
private FieldType fieldType;
|
||||
private String cssClass;
|
||||
|
||||
public FieldType getFieldType() {
|
||||
return fieldType;
|
||||
}
|
||||
|
||||
public void setFieldType(FieldType fieldType) {
|
||||
this.fieldType = fieldType;
|
||||
}
|
||||
|
||||
public String getCssClass() {
|
||||
return cssClass;
|
||||
}
|
||||
|
||||
public void setCssClass(String cssClass) {
|
||||
this.cssClass = cssClass;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
package eu.eudat.file.transformer.entities.descriptiontemplate.todelete;
|
||||
|
||||
import eu.eudat.file.transformer.entities.descriptiontemplate.RuleEntity;
|
||||
import eu.eudat.file.transformer.entities.xml.XmlSerializable;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
public class VisibilityEntity implements XmlSerializable<VisibilityEntity> {
|
||||
private List<RuleEntity> rules;
|
||||
private String style;
|
||||
|
||||
public List<RuleEntity> getRules() {
|
||||
return rules;
|
||||
}
|
||||
|
||||
public void setRules(List<RuleEntity> rules) {
|
||||
this.rules = rules;
|
||||
}
|
||||
|
||||
public String getStyle() {
|
||||
return style;
|
||||
}
|
||||
|
||||
public void setStyle(String style) {
|
||||
this.style = style;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Element toXml(Document doc) {
|
||||
Element root = doc.createElement("visible");
|
||||
root.setAttribute("style", this.style);
|
||||
if (rules != null && !rules.isEmpty()) {
|
||||
for (RuleEntity rule : rules) {
|
||||
root.appendChild(rule.toXml(doc));
|
||||
}
|
||||
}
|
||||
return root;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VisibilityEntity fromXml(Element item) {
|
||||
this.style = item.getAttribute("style");
|
||||
this.rules = new LinkedList();
|
||||
NodeList rulesElements = item.getChildNodes();
|
||||
for (int temp = 0; temp < rulesElements.getLength(); temp++) {
|
||||
Node ruleElement = rulesElements.item(temp);
|
||||
if (ruleElement.getNodeType() == Node.ELEMENT_NODE) {
|
||||
this.rules.add(new RuleEntity().fromXml((Element) ruleElement));
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
package eu.eudat.file.transformer.entities.user.components.commons;
|
||||
|
||||
import eu.eudat.file.transformer.entities.descriptiontemplate.RuleEntity;
|
||||
|
||||
public class Rule {
|
||||
private String sourceField;
|
||||
private String targetField;
|
||||
private String requiredValue;
|
||||
private String type;
|
||||
|
||||
public String getSourceField() {
|
||||
return sourceField;
|
||||
}
|
||||
|
||||
public void setSourceField(String sourceField) {
|
||||
this.sourceField = sourceField;
|
||||
}
|
||||
|
||||
public String getTargetField() {
|
||||
return targetField;
|
||||
}
|
||||
|
||||
public void setTargetField(String targetField) {
|
||||
this.targetField = targetField;
|
||||
}
|
||||
|
||||
public String getRequiredValue() {
|
||||
return requiredValue;
|
||||
}
|
||||
|
||||
public void setRequiredValue(String requiredValue) {
|
||||
this.requiredValue = requiredValue;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public Rule fromDefinitionRule(RuleEntity rule) {
|
||||
this.targetField = rule.getTarget();
|
||||
this.requiredValue = rule.getValue();
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,305 @@
|
|||
package eu.eudat.file.transformer.entities.user.components.datasetprofile;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import eu.eudat.file.transformer.entities.descriptiontemplate.FieldEntity;
|
||||
import eu.eudat.file.transformer.entities.descriptiontemplate.MultiplicityEntity;
|
||||
import eu.eudat.file.transformer.entities.descriptiontemplate.todelete.DefaultValueEntity;
|
||||
import eu.eudat.file.transformer.entities.descriptiontemplate.todelete.FieldDescriptionEntity;
|
||||
import eu.eudat.file.transformer.entities.descriptiontemplate.todelete.VisibilityEntity;
|
||||
import eu.eudat.file.transformer.entities.user.composite.PropertiesModelBuilder;
|
||||
import eu.eudat.file.transformer.enums.FieldValidationType;
|
||||
import eu.eudat.file.transformer.model.properties.PropertiesGenerator;
|
||||
import eu.eudat.file.transformer.utils.interfaces.ViewStyleDefinition;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class Field implements Comparable, PropertiesModelBuilder, ViewStyleDefinition<FieldEntity>, PropertiesGenerator {
|
||||
private static final Logger logger = LoggerFactory.getLogger(Field.class);
|
||||
private String id;
|
||||
private Integer ordinal;
|
||||
private Object value;
|
||||
private FieldDescriptionEntity viewStyle;
|
||||
private String datatype;
|
||||
private String numbering;
|
||||
private int page;
|
||||
private DefaultValueEntity defaultValue;
|
||||
private MultiplicityEntity multiplicity;
|
||||
private Object data;
|
||||
private List<Field> multiplicityItems;
|
||||
private List<FieldValidationType> validations;
|
||||
private VisibilityEntity visible;
|
||||
private List<String> schematics;
|
||||
|
||||
private Boolean export;
|
||||
|
||||
public List<Field> getMultiplicityItems() {
|
||||
return multiplicityItems;
|
||||
}
|
||||
|
||||
public void setMultiplicityItems(List<Field> multiplicityItems) {
|
||||
this.multiplicityItems = multiplicityItems;
|
||||
}
|
||||
|
||||
public void setOrdinal(Integer ordinal) {
|
||||
this.ordinal = ordinal;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getOrdinal() {
|
||||
return ordinal;
|
||||
}
|
||||
|
||||
public void setOrdinal(int ordinal) {
|
||||
this.ordinal = ordinal;
|
||||
}
|
||||
|
||||
public Object getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(Object value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public FieldDescriptionEntity getViewStyle() {
|
||||
return viewStyle;
|
||||
}
|
||||
|
||||
public void setViewStyle(FieldDescriptionEntity viewStyle) {
|
||||
this.viewStyle = viewStyle;
|
||||
}
|
||||
|
||||
public int getPage() {
|
||||
return page;
|
||||
}
|
||||
|
||||
public void setPage(int page) {
|
||||
this.page = page;
|
||||
}
|
||||
|
||||
public DefaultValueEntity getDefaultValue() {
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
public void setDefaultValue(DefaultValueEntity defaultValue) {
|
||||
this.defaultValue = defaultValue;
|
||||
}
|
||||
|
||||
public String getDatatype() {
|
||||
return datatype;
|
||||
}
|
||||
|
||||
public void setDatatype(String datatype) {
|
||||
this.datatype = datatype;
|
||||
}
|
||||
|
||||
public MultiplicityEntity getMultiplicity() {
|
||||
return multiplicity;
|
||||
}
|
||||
|
||||
public void setMultiplicity(MultiplicityEntity multiplicity) {
|
||||
this.multiplicity = multiplicity;
|
||||
}
|
||||
|
||||
public Object getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(Object data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public VisibilityEntity getVisible() {
|
||||
return visible;
|
||||
}
|
||||
|
||||
public void setVisible(VisibilityEntity visible) {
|
||||
this.visible = visible;
|
||||
}
|
||||
|
||||
public List<Integer> getValidations() {
|
||||
if(this.validations == null) {
|
||||
return null;
|
||||
}
|
||||
return this.validations.stream().map(item -> (int) item.getValue()).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public void setValidations(List<Integer> validations) {
|
||||
this.validations = validations.stream().map(x-> FieldValidationType.of(x.shortValue())).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public String getNumbering() {
|
||||
return numbering;
|
||||
}
|
||||
|
||||
public void setNumbering(String numbering) {
|
||||
this.numbering = numbering;
|
||||
}
|
||||
|
||||
public List<String> getSchematics() {
|
||||
return schematics;
|
||||
}
|
||||
|
||||
public void setSchematics(List<String> schematics) {
|
||||
this.schematics = schematics;
|
||||
}
|
||||
|
||||
public Boolean getExport() {
|
||||
return export;
|
||||
}
|
||||
|
||||
public void setExport(Boolean export) {
|
||||
this.export = export;
|
||||
}
|
||||
|
||||
Field cloneForMultiplicity(String key, List<eu.eudat.file.transformer.model.descriptionproperties.Field> properties, int index) {
|
||||
Field newField = new Field();
|
||||
newField.id = key;
|
||||
newField.ordinal = this.ordinal;
|
||||
newField.value = properties.stream().filter(field -> field.getKey().equals(key)).findFirst().orElse(null);
|
||||
newField.viewStyle = this.viewStyle;
|
||||
newField.datatype = this.datatype;
|
||||
newField.page = this.page;
|
||||
newField.defaultValue = this.defaultValue;
|
||||
newField.data = this.data;
|
||||
newField.validations = this.validations;
|
||||
newField.schematics = this.schematics;
|
||||
newField.numbering = "mult" + index + "_" + this.numbering;
|
||||
newField.export = this.export;
|
||||
return newField;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FieldEntity toDatabaseDefinition(FieldEntity fieldEntity) {
|
||||
fieldEntity.setId(this.id);
|
||||
fieldEntity.setOrdinal(this.ordinal);
|
||||
throw new UnsupportedOperationException(" Use new logic");
|
||||
//TODO: Use new logic
|
||||
// fieldEntity.setData(new FieldDataHelper().toFieldData(data, this.viewStyle.getFieldType()));
|
||||
// fieldEntity.setDefaultValue(this.defaultValue.getValue());
|
||||
// fieldEntity.setVisibilityRules(this.visible.getRules());
|
||||
// fieldEntity.setValidations(this.validations);
|
||||
// fieldEntity.setSchematics(this.schematics);
|
||||
// fieldEntity.setIncludeInExport(this.export);
|
||||
// return fieldEntity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromDatabaseDefinition(FieldEntity item) {
|
||||
this.id = item.getId();
|
||||
this.ordinal = item.getOrdinal();
|
||||
FieldDescriptionEntity fieldDescription = new FieldDescriptionEntity();
|
||||
fieldDescription.setFieldType(item.getData().getFieldType());
|
||||
this.viewStyle = fieldDescription;
|
||||
this.numbering = item.getNumbering();
|
||||
this.data = item.getData();
|
||||
|
||||
DefaultValueEntity defaultValueEntity = new DefaultValueEntity();
|
||||
defaultValueEntity.setValue(item.getDefaultValue());
|
||||
this.defaultValue = defaultValueEntity;
|
||||
VisibilityEntity visibilityEntity = new VisibilityEntity();
|
||||
visibilityEntity.setRules(item.getVisibilityRules());
|
||||
this.visible = visibilityEntity;
|
||||
this.validations = item.getValidations();
|
||||
this.schematics = item.getSchematics();
|
||||
this.export = item.getIncludeInExport();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromJsonObject(List<eu.eudat.file.transformer.model.descriptionproperties.Field> properties) {
|
||||
eu.eudat.file.transformer.model.descriptionproperties.Field field = properties.stream().filter(field1 -> field1.getKey().equals(this.id)).findFirst().orElse(null);
|
||||
if (field == null)
|
||||
return;
|
||||
try {
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
List<String> stringList = mapper.readValue(field.getValue(), LinkedList.class);
|
||||
this.value = stringList;
|
||||
} catch ( NullPointerException | IOException e) {
|
||||
try {
|
||||
this.value = (String) field.getValue();
|
||||
} catch (ClassCastException ce) {
|
||||
this.value = field.getValue();
|
||||
}
|
||||
}
|
||||
|
||||
this.multiplicityItems = new LinkedList<>();
|
||||
List<String> compositeKeys = properties.stream().map(eu.eudat.file.transformer.model.descriptionproperties.Field::getKey).filter(key -> key.startsWith("multiple_" + this.getId())).collect(Collectors.toList());
|
||||
int index = 1;
|
||||
for (String key : compositeKeys) {
|
||||
this.multiplicityItems.add(this.cloneForMultiplicity(key, properties, index));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(Object o) {
|
||||
Field comparedField = (Field) o;
|
||||
if(this.ordinal != null) {
|
||||
return this.ordinal.compareTo(comparedField.getOrdinal());
|
||||
} else if (comparedField.getOrdinal() != null) {
|
||||
return comparedField.getOrdinal().compareTo(this.ordinal);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromJsonObject(Map<String, Object> properties, String path) {
|
||||
this.value = (String) properties.get(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toMap(Map<String, Object> fieldValues) {
|
||||
if (this.value != null) {
|
||||
if ((this.viewStyle != null && this.viewStyle.getFieldType().equals("datasetIdentifier") && this.value instanceof Map || this.value instanceof Collection)) {
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
String valueString = null;
|
||||
try {
|
||||
valueString = mapper.writeValueAsString(this.value);
|
||||
fieldValues.put(this.id, valueString);
|
||||
} catch (JsonProcessingException e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
}
|
||||
} /*else if (this.value instanceof Collection) {
|
||||
Collection valueCollection = (Collection) this.value;
|
||||
StringBuilder valueBuilder = new StringBuilder();
|
||||
valueBuilder.append("[");
|
||||
for (int i = 0; i < valueCollection.size(); i++) {
|
||||
valueBuilder.append("\"").append(valueCollection.toArray()[i]).append("\"");
|
||||
if (i < valueCollection.size() - 1) {
|
||||
valueBuilder.append(", ");
|
||||
}
|
||||
}
|
||||
valueBuilder.append("]");
|
||||
fieldValues.put(this.id, valueBuilder.toString());
|
||||
}*/
|
||||
else if ((this.viewStyle != null && this.viewStyle.getFieldType().equals("upload"))) {
|
||||
fieldValues.put(this.id, this.value);
|
||||
}
|
||||
else {
|
||||
fieldValues.put(this.id, this.value.toString());
|
||||
}
|
||||
} else {
|
||||
fieldValues.put(this.id, "");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toMap(Map<String, Object> fieldValues, int index) {
|
||||
fieldValues.put(this.id, this.value);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,222 @@
|
|||
package eu.eudat.file.transformer.entities.user.components.datasetprofile;
|
||||
|
||||
import eu.eudat.file.transformer.entities.descriptiontemplate.FieldEntity;
|
||||
import eu.eudat.file.transformer.entities.descriptiontemplate.FieldSetEntity;
|
||||
import eu.eudat.file.transformer.entities.descriptiontemplate.MultiplicityEntity;
|
||||
import eu.eudat.file.transformer.entities.user.composite.PropertiesModelBuilder;
|
||||
import eu.eudat.file.transformer.model.properties.PropertiesGenerator;
|
||||
import eu.eudat.file.transformer.utils.builders.ModelBuilder;
|
||||
import eu.eudat.file.transformer.utils.interfaces.ViewStyleDefinition;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class FieldSet implements Comparable, PropertiesModelBuilder, ViewStyleDefinition<FieldSetEntity>, PropertiesGenerator {
|
||||
private String id;
|
||||
private Integer ordinal;
|
||||
private String title;
|
||||
private String numbering;
|
||||
private String description;
|
||||
private String extendedDescription;
|
||||
private String additionalInformation;
|
||||
private MultiplicityEntity multiplicity;
|
||||
private List<Field> fields;
|
||||
private List<FieldSet> multiplicityItems;
|
||||
private boolean hasCommentField;
|
||||
private String commentFieldValue;
|
||||
|
||||
public List<Field> getFields() {
|
||||
Collections.sort(this.fields);
|
||||
return fields;
|
||||
}
|
||||
|
||||
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 void setFields(List<Field> fields) {
|
||||
this.fields = fields;
|
||||
}
|
||||
|
||||
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 MultiplicityEntity getMultiplicity() {
|
||||
return multiplicity;
|
||||
}
|
||||
|
||||
public void setMultiplicity(MultiplicityEntity multiplicity) {
|
||||
this.multiplicity = multiplicity;
|
||||
}
|
||||
|
||||
public List<FieldSet> getMultiplicityItems() {
|
||||
if (multiplicityItems != null) Collections.sort(multiplicityItems);
|
||||
return multiplicityItems;
|
||||
}
|
||||
|
||||
public String getNumbering() {
|
||||
return numbering;
|
||||
}
|
||||
|
||||
public void setNumbering(String numbering) {
|
||||
this.numbering = numbering;
|
||||
}
|
||||
|
||||
public void setMultiplicityItems(List<FieldSet> multiplicityItems) {
|
||||
this.multiplicityItems = multiplicityItems;
|
||||
}
|
||||
|
||||
public void setOrdinal(Integer ordinal) {
|
||||
this.ordinal = ordinal;
|
||||
}
|
||||
|
||||
public void setHasCommentField(boolean hasCommentField) {
|
||||
this.hasCommentField = hasCommentField;
|
||||
}
|
||||
|
||||
public boolean getHasCommentField() {
|
||||
return hasCommentField;
|
||||
}
|
||||
|
||||
public String getCommentFieldValue() {
|
||||
return commentFieldValue;
|
||||
}
|
||||
|
||||
public void setCommentFieldValue(String commentFieldValue) {
|
||||
this.commentFieldValue = commentFieldValue;
|
||||
}
|
||||
|
||||
public String getAdditionalInformation() {
|
||||
return additionalInformation;
|
||||
}
|
||||
|
||||
public void setAdditionalInformation(String additionalInformation) {
|
||||
this.additionalInformation = additionalInformation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FieldSetEntity toDatabaseDefinition(FieldSetEntity item) {
|
||||
List<FieldEntity> viewStylefields = new ModelBuilder().toViewStyleDefinition(this.fields, FieldEntity.class);
|
||||
item.setFields(viewStylefields);
|
||||
item.setId(this.id);
|
||||
item.setOrdinal(this.ordinal);
|
||||
item.setHasCommentField(this.hasCommentField);
|
||||
item.setMultiplicity(this.multiplicity);
|
||||
// item.setCommentFieldValue(this.commentFieldValue);
|
||||
return item;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromDatabaseDefinition(FieldSetEntity item) {
|
||||
this.fields = new ModelBuilder().fromViewStyleDefinition(item.getFields(), Field.class);
|
||||
this.id = item.getId();
|
||||
this.ordinal = item.getOrdinal();
|
||||
this.title = item.getTitle();
|
||||
this.description = item.getDescription();
|
||||
this.additionalInformation=item.getAdditionalInformation();
|
||||
this.numbering = item.getNumbering();
|
||||
this.extendedDescription = item.getExtendedDescription();
|
||||
this.hasCommentField = item.getHasCommentField();
|
||||
this.multiplicity = item.getMultiplicity();
|
||||
// this.commentFieldValue = item.getCommentFieldValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromJsonObject(List<eu.eudat.file.transformer.model.descriptionproperties.Field> properties) {
|
||||
this.commentFieldValue = (String) properties.stream().filter(field -> field.getKey().equals("commentFieldValue" + this.id)).map(eu.eudat.file.transformer.model.descriptionproperties.Field::getValue).findFirst().orElse(null);
|
||||
this.multiplicityItems = new LinkedList<>();
|
||||
this.fields.forEach(item -> {
|
||||
item.fromJsonObject(properties);
|
||||
});
|
||||
List<String> compositeKeysFather = properties.stream().map(eu.eudat.file.transformer.model.descriptionproperties.Field::getKey).filter(keys -> keys.startsWith("multiple_" + this.getId())).toList();
|
||||
List<String> Ids=new ArrayList<>();
|
||||
int index = 1;
|
||||
for (String composite : compositeKeysFather) {
|
||||
String[] split = composite.split("_");
|
||||
if (!Ids.contains(split[2])) {
|
||||
Ids.add(split[2]);
|
||||
this.multiplicityItems.add(this.CloneForMultiplicity2(properties.stream().map(eu.eudat.file.transformer.model.descriptionproperties.Field::getKey).filter(keys -> keys.startsWith("multiple_" + this.getId() + "_" + split[2])).collect(Collectors.toList()), properties,split, index));
|
||||
index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private FieldSet CloneForMultiplicity2(List<String> key, List<eu.eudat.file.transformer.model.descriptionproperties.Field> properties, String[] ids, int index){
|
||||
FieldSet newFieldSet = new FieldSet();
|
||||
newFieldSet.id = ids[0]+"_"+ids[1]+"_"+ids[2] + (ids.length > 4 ? "_" + ids[3] : "");
|
||||
newFieldSet.description = this.description;
|
||||
newFieldSet.extendedDescription = this.extendedDescription;
|
||||
newFieldSet.additionalInformation=this.additionalInformation;
|
||||
newFieldSet.title = this.title;
|
||||
newFieldSet.ordinal = ids.length > 4 ? Integer.valueOf(ids[3]) : this.ordinal;
|
||||
newFieldSet.fields = new LinkedList();
|
||||
|
||||
for (Field field: this.fields) {
|
||||
newFieldSet.fields.add(field.cloneForMultiplicity(newFieldSet.id + "_" + field.getId(), properties, index));
|
||||
}
|
||||
return newFieldSet;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public int compareTo(Object o) {
|
||||
return this.ordinal.compareTo(((FieldSet) o).getOrdinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromJsonObject(Map<String, Object> properties, String path) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toMap(Map<String, Object> fieldValues) {
|
||||
fieldValues.put("commentFieldValue" + this.id, this.commentFieldValue);
|
||||
this.fields.forEach(item -> item.toMap(fieldValues));
|
||||
Map<String, Object> multiplicity = new HashMap<String, Object>();
|
||||
if (this.multiplicityItems != null) {
|
||||
this.multiplicityItems.forEach(item -> item.toMap(fieldValues, this.multiplicityItems.indexOf(item)));
|
||||
}
|
||||
//fieldValues.put(this.id,multiplicity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toMap(Map<String, Object> fieldValues, int index) {
|
||||
this.fields.forEach(item -> item.toMap(fieldValues, index));
|
||||
//this.multiplicityItems.forEach(item->item.toMap(fieldValues,index));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,166 @@
|
|||
package eu.eudat.file.transformer.entities.user.components.datasetprofile;
|
||||
|
||||
import eu.eudat.file.transformer.entities.descriptiontemplate.FieldSetEntity;
|
||||
import eu.eudat.file.transformer.entities.descriptiontemplate.SectionEntity;
|
||||
import eu.eudat.file.transformer.entities.user.composite.PropertiesModelBuilder;
|
||||
import eu.eudat.file.transformer.model.descriptionproperties.Field;
|
||||
import eu.eudat.file.transformer.model.properties.PropertiesGenerator;
|
||||
import eu.eudat.file.transformer.utils.builders.ModelBuilder;
|
||||
import eu.eudat.file.transformer.utils.interfaces.ViewStyleDefinition;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class Section implements Comparable, ViewStyleDefinition<SectionEntity>, PropertiesModelBuilder, PropertiesGenerator {
|
||||
private List<Section> sections;
|
||||
private List<FieldSet> compositeFields;
|
||||
private Boolean defaultVisibility;
|
||||
private String numbering;
|
||||
private String page;
|
||||
private Integer ordinal;
|
||||
private String id;
|
||||
private String title;
|
||||
private String description;
|
||||
private Boolean multiplicity;
|
||||
|
||||
public List<Section> getSections() {
|
||||
Collections.sort(sections);
|
||||
return sections;
|
||||
}
|
||||
|
||||
public void setSections(List<Section> sections) {
|
||||
this.sections = sections;
|
||||
}
|
||||
|
||||
public List<FieldSet> getCompositeFields() {
|
||||
Collections.sort(compositeFields);
|
||||
return compositeFields;
|
||||
}
|
||||
|
||||
public void setCompositeFields(List<FieldSet> compositeFields) {
|
||||
this.compositeFields = compositeFields;
|
||||
}
|
||||
|
||||
public Boolean getDefaultVisibility() {
|
||||
return defaultVisibility;
|
||||
}
|
||||
|
||||
public void setDefaultVisibility(Boolean defaultVisibility) {
|
||||
this.defaultVisibility = defaultVisibility;
|
||||
}
|
||||
|
||||
public String getPage() {
|
||||
return page;
|
||||
}
|
||||
|
||||
public void setPage(String page) {
|
||||
this.page = page;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
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 int getOrdinal() {
|
||||
return ordinal;
|
||||
}
|
||||
|
||||
public void setOrdinal(int ordinal) {
|
||||
this.ordinal = ordinal;
|
||||
}
|
||||
|
||||
public String getNumbering() {
|
||||
return numbering;
|
||||
}
|
||||
|
||||
public void setNumbering(String numbering) {
|
||||
this.numbering = numbering;
|
||||
}
|
||||
|
||||
public Boolean getMultiplicity() {
|
||||
return multiplicity;
|
||||
}
|
||||
|
||||
public void setMultiplicity(Boolean multiplicity) {
|
||||
this.multiplicity = multiplicity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SectionEntity toDatabaseDefinition(SectionEntity item) {
|
||||
item.setDefaultVisibility(this.defaultVisibility);
|
||||
item.setDescription(this.description);
|
||||
if (this.compositeFields != null)
|
||||
item.setFieldSets(new ModelBuilder().toViewStyleDefinition(this.compositeFields, FieldSetEntity.class));
|
||||
item.setId(this.id);
|
||||
item.setOrdinal(this.ordinal);
|
||||
item.setPage(this.page);
|
||||
if (this.sections != null)
|
||||
item.setSections(new ModelBuilder().toViewStyleDefinition(this.sections, SectionEntity.class));
|
||||
item.setTitle(this.title);
|
||||
item.setMultiplicity(this.multiplicity);
|
||||
return item;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromDatabaseDefinition(SectionEntity item) {
|
||||
this.defaultVisibility = item.isDefaultVisibility();
|
||||
this.description = item.getDescription();
|
||||
this.compositeFields = new ModelBuilder().fromViewStyleDefinition(item.getFieldSets(), FieldSet.class);
|
||||
this.id = item.getId();
|
||||
this.ordinal = item.getOrdinal();
|
||||
this.numbering = item.getNumbering();
|
||||
this.page = item.getPage();
|
||||
this.sections = new ModelBuilder().fromViewStyleDefinition(item.getSections(), Section.class);
|
||||
this.title = item.getTitle();
|
||||
this.multiplicity = item.getMultiplicity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromJsonObject(List<Field> properties) {
|
||||
this.sections.forEach(item -> item.fromJsonObject(properties));
|
||||
this.compositeFields.forEach(item -> item.fromJsonObject(properties));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(Object o) {
|
||||
return this.ordinal.compareTo(((Section) o).getOrdinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromJsonObject(Map<String, Object> properties, String index) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toMap(Map<String, Object> fieldValues) {
|
||||
this.sections.forEach(item -> item.toMap(fieldValues));
|
||||
this.compositeFields.forEach(item -> item.toMap(fieldValues));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toMap(Map<String, Object> fieldValues, int index) {
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,97 @@
|
|||
package eu.eudat.file.transformer.entities.user.composite;
|
||||
|
||||
import eu.eudat.file.transformer.entities.descriptiontemplate.DefinitionEntity;
|
||||
import eu.eudat.file.transformer.entities.user.components.commons.Rule;
|
||||
import eu.eudat.file.transformer.entities.user.components.datasetprofile.Section;
|
||||
import eu.eudat.file.transformer.model.datasetprofile.Page;
|
||||
import eu.eudat.file.transformer.model.descriptionproperties.Field;
|
||||
import eu.eudat.file.transformer.utils.builders.ModelBuilder;
|
||||
import eu.eudat.file.transformer.utils.helpers.ModelBuilderCollector;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class DatasetProfile implements PropertiesModelBuilder {
|
||||
private String description;
|
||||
private String language;
|
||||
private String type;
|
||||
private List<Section> sections;
|
||||
private List<Rule> rules;
|
||||
private List<Page> pages;
|
||||
private int status;
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getLanguage() {
|
||||
return language;
|
||||
}
|
||||
|
||||
public void setLanguage(String language) {
|
||||
this.language = language;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public List<Section> getSections() {
|
||||
return sections;
|
||||
}
|
||||
|
||||
public void setSections(List<Section> sections) {
|
||||
this.sections = sections;
|
||||
}
|
||||
|
||||
|
||||
public List<Rule> getRules() {
|
||||
return rules;
|
||||
}
|
||||
|
||||
public void setRules(List<Rule> rules) {
|
||||
this.rules = rules;
|
||||
}
|
||||
|
||||
public int getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(int status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public List<Page> getPages() {
|
||||
return pages;
|
||||
}
|
||||
|
||||
public void setPages(List<Page> pages) {
|
||||
this.pages = pages;
|
||||
}
|
||||
|
||||
public void buildProfile(DefinitionEntity viewStyle) {
|
||||
this.sections = new ModelBuilder().fromViewStyleDefinition(viewStyle.getSections(), Section.class);
|
||||
this.pages = new ModelBuilder().fromViewStyleDefinition(viewStyle.getPages(), Page.class);
|
||||
this.rules = ModelBuilderCollector.collectRules(viewStyle.getSections());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromJsonObject(List<Field> properties) {
|
||||
this.sections.forEach(item -> item.fromJsonObject(properties));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromJsonObject(Map<String, Object> properties, String index) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
package eu.eudat.file.transformer.entities.user.composite;
|
||||
|
||||
|
||||
import eu.eudat.file.transformer.entities.user.components.datasetprofile.Section;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class DatasetProfilePage {
|
||||
private Integer ordinal;
|
||||
private String title;
|
||||
private List<Section> sections;
|
||||
|
||||
public Integer getOrdinal() {
|
||||
return ordinal;
|
||||
}
|
||||
|
||||
public void setOrdinal(Integer ordinal) {
|
||||
this.ordinal = ordinal;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public List<Section> getSections() {
|
||||
return sections;
|
||||
}
|
||||
|
||||
public void setSections(List<Section> sections) {
|
||||
this.sections = sections;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
package eu.eudat.file.transformer.entities.user.composite;
|
||||
|
||||
import eu.eudat.file.transformer.entities.user.components.commons.Rule;
|
||||
import eu.eudat.file.transformer.model.datasetprofile.Page;
|
||||
import eu.eudat.file.transformer.model.properties.PropertiesGenerator;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
public class PagedDatasetProfile implements PropertiesGenerator {
|
||||
private List<DatasetProfilePage> pages;
|
||||
private List<Rule> rules;
|
||||
private int status;
|
||||
|
||||
public List<DatasetProfilePage> getPages() {
|
||||
return pages;
|
||||
}
|
||||
|
||||
public void setPages(List<DatasetProfilePage> pages) {
|
||||
this.pages = pages;
|
||||
}
|
||||
|
||||
public List<Rule> getRules() {
|
||||
return rules;
|
||||
}
|
||||
|
||||
public void setRules(List<Rule> rules) {
|
||||
this.rules = rules;
|
||||
}
|
||||
|
||||
public int getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(int status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public PagedDatasetProfile buildPagedDatasetProfile(DatasetProfile profile) {
|
||||
this.status = profile.getStatus();
|
||||
this.rules = profile.getRules();
|
||||
this.pages = new LinkedList<>();
|
||||
List<Page> pages = profile.getPages();
|
||||
for (Page page : pages) {
|
||||
DatasetProfilePage datasetProfilePage = new DatasetProfilePage();
|
||||
datasetProfilePage.setOrdinal(page.getOrdinal());
|
||||
datasetProfilePage.setTitle(page.getTitle());
|
||||
datasetProfilePage.setSections(profile.getSections().stream().filter(item -> item.getPage().equals(page.getId())).collect(Collectors.toList()));
|
||||
this.pages.add(datasetProfilePage);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toMap(Map<String, Object> fieldValues) {
|
||||
this.pages.forEach(item -> item.getSections().forEach(sectionItem -> sectionItem.toMap(fieldValues)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toMap(Map<String, Object> fieldValues, int index) {
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
package eu.eudat.file.transformer.entities.user.composite;
|
||||
|
||||
import eu.eudat.file.transformer.model.descriptionproperties.Field;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface PropertiesModelBuilder {
|
||||
void fromJsonObject(List<Field> properties);
|
||||
|
||||
void fromJsonObject(Map<String, Object> properties, String pathKey);
|
||||
}
|
|
@ -0,0 +1,87 @@
|
|||
package eu.eudat.file.transformer.entities.xml;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import javax.xml.transform.OutputKeys;
|
||||
import javax.xml.transform.Transformer;
|
||||
import javax.xml.transform.TransformerException;
|
||||
import javax.xml.transform.TransformerFactory;
|
||||
import javax.xml.transform.dom.DOMSource;
|
||||
import javax.xml.transform.stream.StreamResult;
|
||||
import java.io.IOException;
|
||||
import java.io.StringReader;
|
||||
import java.io.StringWriter;
|
||||
|
||||
|
||||
public class XmlBuilder {
|
||||
private static final Logger logger = LoggerFactory.getLogger(XmlBuilder.class);
|
||||
|
||||
public static Document getDocument() {
|
||||
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
|
||||
DocumentBuilder docBuilder;
|
||||
try {
|
||||
docBuilder = docFactory.newDocumentBuilder();
|
||||
Document doc = docBuilder.newDocument();
|
||||
return doc;
|
||||
} catch (ParserConfigurationException e) {
|
||||
// TODO Auto-generated catch block
|
||||
logger.error(e.getMessage(), e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static String generateXml(Document doc) {
|
||||
TransformerFactory tFact = TransformerFactory.newInstance();
|
||||
Transformer trans;
|
||||
try {
|
||||
trans = tFact.newTransformer();
|
||||
StringWriter writer = new StringWriter();
|
||||
StreamResult result = new StreamResult(writer);
|
||||
DOMSource source = new DOMSource(doc);
|
||||
trans.setOutputProperty(OutputKeys.INDENT, "yes");
|
||||
trans.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
|
||||
trans.transform(source, result);
|
||||
return writer.toString();
|
||||
} catch (TransformerException e) {
|
||||
// TODO Auto-generated catch block
|
||||
logger.error(e.getMessage(), e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static Document fromXml(String xml) {
|
||||
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
|
||||
DocumentBuilder docBuilder;
|
||||
try {
|
||||
docBuilder = docFactory.newDocumentBuilder();
|
||||
InputSource inputStream = new InputSource(new StringReader(xml));
|
||||
Document doc = docBuilder.parse(inputStream);
|
||||
return doc;
|
||||
} catch (ParserConfigurationException | SAXException | IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
logger.error(e.getMessage(), e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static Element getNodeFromListByTagName(NodeList list, String tagName) {
|
||||
for (int temp = 0; temp < list.getLength(); temp++) {
|
||||
Node element = list.item(temp);
|
||||
if (element.getNodeType() == Node.ELEMENT_NODE) {
|
||||
if (element.getNodeName().equals(tagName)) return (Element) element;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package eu.eudat.file.transformer.entities.xml;
|
||||
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
public interface XmlSerializable<T> {
|
||||
Element toXml(Document doc);
|
||||
|
||||
T fromXml(Element item);
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
package eu.eudat.file.transformer.enums;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public enum ContactInfoType implements DatabaseEnum<Short> {
|
||||
|
||||
Email((short) 0);
|
||||
|
||||
private final Short value;
|
||||
|
||||
ContactInfoType(Short value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public Short getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
private static final Map<Short, ContactInfoType> map = EnumUtils.getEnumValueMap(ContactInfoType.class);
|
||||
|
||||
public static ContactInfoType of(Short i) {
|
||||
return map.get(i);
|
||||
}
|
||||
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue