package eu.eudat.models.data.admin.composite; import eu.eudat.models.data.admin.components.datasetprofile.Page; import eu.eudat.models.data.admin.components.datasetprofile.Section; import eu.eudat.logic.utilities.builders.ModelBuilder; import java.util.Collections; import java.util.LinkedList; import java.util.List; public class DatasetProfile { private String label; private String description; private List pages; private List
sections; private Short status; private Short version; private String language; public String getLabel() { return label; } public void setLabel(String label) { this.label = label; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public List getPages() { return pages; } public void setPages(List pages) { this.pages = pages; } public List
getSections() { return sections; } public void setSections(List
sections) { this.sections = sections; } public Short getStatus() { return status; } public void setStatus(Short status) { this.status = status; } public Short getVersion() { return version; } public void setVersion(Short version) { this.version = version; } public String getLanguage() { return language; } public void setLanguage(String language) { this.language = language; } public void buildProfile(eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition.ViewStyleModel viewStyle) { this.sections = new ModelBuilder().fromViewStyleDefinition(viewStyle.getSections(), Section.class); this.pages = new ModelBuilder().fromViewStyleDefinition(viewStyle.getPages(), Page.class); } public DatasetProfile toShort() { DatasetProfile shortProfile = new DatasetProfile(); shortProfile.setLabel(this.label); shortProfile.setDescription(this.description); List
shortSection = new LinkedList<>(); for (Section toshortSection : this.getSections()) { shortSection.add(toshortSection.toShort()); } Collections.sort(shortSection); shortProfile.setSections(shortSection); shortProfile.setPages(this.pages); shortProfile.setStatus(this.status); shortProfile.setVersion(this.version); shortProfile.setLanguage(this.language); return shortProfile; } }