2018-06-27 12:29:21 +02:00
|
|
|
package eu.eudat.models.data.admin.composite;
|
2017-11-27 14:40:16 +01:00
|
|
|
|
2018-06-27 12:29:21 +02:00
|
|
|
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;
|
2017-11-30 11:10:42 +01:00
|
|
|
|
2019-02-25 17:46:16 +01:00
|
|
|
import java.util.Collections;
|
|
|
|
import java.util.LinkedList;
|
2017-11-27 14:40:16 +01:00
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
public class DatasetProfile {
|
2018-02-16 11:34:02 +01:00
|
|
|
private String label;
|
|
|
|
private List<Section> sections;
|
|
|
|
private List<Page> pages;
|
2019-02-11 13:04:45 +01:00
|
|
|
private Short status;
|
2019-03-26 15:30:33 +01:00
|
|
|
private Short version;
|
2018-02-16 11:34:02 +01:00
|
|
|
|
|
|
|
public List<Section> getSections() {
|
|
|
|
return sections;
|
|
|
|
}
|
2019-03-26 15:30:33 +01:00
|
|
|
public void setSections(List<Section> sections) { this.sections = sections; }
|
2018-02-16 11:34:02 +01:00
|
|
|
|
|
|
|
public String getLabel() {
|
|
|
|
return label;
|
|
|
|
}
|
|
|
|
public void setLabel(String label) {
|
|
|
|
this.label = label;
|
|
|
|
}
|
|
|
|
|
|
|
|
public List<Page> getPages() {
|
|
|
|
return pages;
|
|
|
|
}
|
|
|
|
public void setPages(List<Page> pages) {
|
|
|
|
this.pages = pages;
|
|
|
|
}
|
|
|
|
|
2019-02-11 13:04:45 +01:00
|
|
|
public Short getStatus() {
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
public void setStatus(Short status) {
|
|
|
|
this.status = status;
|
|
|
|
}
|
|
|
|
|
2019-03-26 15:30:33 +01:00
|
|
|
public Short getVersion() { return version; }
|
|
|
|
public void setVersion(Short version) { this.version = version; }
|
|
|
|
|
2018-06-27 12:29:21 +02:00
|
|
|
public void buildProfile(eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition.ViewStyleModel viewStyle) {
|
2018-02-16 11:34:02 +01:00
|
|
|
this.sections = new ModelBuilder().fromViewStyleDefinition(viewStyle.getSections(), Section.class);
|
|
|
|
this.pages = new ModelBuilder().fromViewStyleDefinition(viewStyle.getPages(), Page.class);
|
|
|
|
}
|
2019-02-25 17:46:16 +01:00
|
|
|
|
|
|
|
public DatasetProfile toShort() {
|
|
|
|
DatasetProfile shortProfile = new DatasetProfile();
|
|
|
|
shortProfile.setLabel(this.label);
|
|
|
|
List<Section> 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);
|
2019-03-26 15:30:33 +01:00
|
|
|
shortProfile.setVersion(this.version);
|
2019-02-25 17:46:16 +01:00
|
|
|
return shortProfile;
|
|
|
|
}
|
2017-11-27 14:40:16 +01:00
|
|
|
}
|