Add support for nested sections

This commit is contained in:
George Kalampokis 2021-05-18 13:45:41 +03:00
parent ca91c14114
commit 8a5f9d3536
1 changed files with 21 additions and 0 deletions

View File

@ -3,6 +3,8 @@ package eu.eudat.logic.utilities.documents.xml.datasetProfileXml.datasetProfileM
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.LinkedList;
import java.util.List;
@XmlRootElement(name = "section")
public class Section {
@ -15,6 +17,7 @@ public class Section {
private String description;
private String extendedDescription;
private String title;
private List<Section> section;
@XmlAttribute(name = "id")
public String getId() {
@ -99,6 +102,13 @@ public class Section {
public eu.eudat.models.data.admin.components.datasetprofile.Section toAdminCompositeModelSection() {
eu.eudat.models.data.admin.components.datasetprofile.Section sectionEntity = new eu.eudat.models.data.admin.components.datasetprofile.Section();
List<eu.eudat.models.data.admin.components.datasetprofile.Section> sectionsListEntity = new LinkedList<>();
if (this.section != null) {
for (Section xmlsection : this.section) {
sectionsListEntity.add(xmlsection.toAdminCompositeModelSection());
}
}
sectionEntity.setId(this.id);
sectionEntity.setOrdinal(this.ordinal);
sectionEntity.setTitle(this.title);
@ -110,7 +120,18 @@ public class Section {
// fieldSetsEntity.add(xmpFieldSets.toAdminCompositeModelSection());
// }
sectionEntity.setFieldSets(this.fieldSets.toAdminCompositeModelSection());
sectionEntity.setSections(sectionsListEntity);
sectionEntity.setDefaultVisibility(this.defaultVisibility);
return sectionEntity;
}
@XmlElement(name = "section")
public List<Section> getSection() {
return section;
}
public void setSection(List<Section> section) {
this.section = section;
}
}