Fix critical issue with Dataset Template xml import

This commit is contained in:
George Kalampokis 2021-10-06 15:02:21 +03:00
parent 70538850a2
commit ef5e6a92e0
2 changed files with 9 additions and 6 deletions

View File

@ -52,7 +52,9 @@ public class DatasetProfile {
List<eu.eudat.models.data.admin.components.datasetprofile.Section> sectionDatasetEntity = new LinkedList<>();
for (Page xmlPage: page) {
pagesDatasetEntity.add(xmlPage.toAdminCompositeModelPage());
sectionDatasetEntity.add(xmlPage.toAdminCompositeModelSection());
for (int i = 0; i < xmlPage.getSections().size(); i++) {
sectionDatasetEntity.add(xmlPage.toAdminCompositeModelSection(i));
}
}
newDatasetEntityProfile.setPages(pagesDatasetEntity);
newDatasetEntityProfile.setSections(sectionDatasetEntity);

View File

@ -3,13 +3,14 @@ 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.List;
@XmlRootElement(name = "page")
public class Page {
private String id;
private int ordinal;
private String title;
private Sections sections;
private List<Sections> sections;
@XmlAttribute(name = "id")
public String getId() {
@ -39,11 +40,11 @@ public class Page {
}
@XmlElement(name = "sections")
public Sections getSections() {
public List<Sections> getSections() {
return sections;
}
public void setSections(Sections sections) {
public void setSections(List<Sections> sections) {
this.sections = sections;
}
@ -55,7 +56,7 @@ public class Page {
return pageEntity;
}
public eu.eudat.models.data.admin.components.datasetprofile.Section toAdminCompositeModelSection(){
public eu.eudat.models.data.admin.components.datasetprofile.Section toAdminCompositeModelSection(int i){
/* 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<>();
// for (Section xmlsection:this.sections.section) {
@ -68,6 +69,6 @@ public class Page {
sectionEntity.setId(this.id);
sectionEntity.setOrdinal(this.ordinal);
sectionEntity.setTitle(this.title);*/
return sections.toAdminCompositeModelSection();
return sections.get(i).toAdminCompositeModelSection();
}
}