2023-10-27 17:46:34 +02:00
|
|
|
package eu.eudat.commons.types.descriptiontemplate;
|
2017-11-30 11:10:42 +01:00
|
|
|
|
2024-01-30 15:31:03 +01:00
|
|
|
import jakarta.xml.bind.annotation.*;
|
2017-11-30 11:10:42 +01:00
|
|
|
|
2023-11-03 13:53:10 +01:00
|
|
|
import java.util.ArrayList;
|
2018-02-16 11:34:02 +01:00
|
|
|
import java.util.List;
|
2017-11-30 11:10:42 +01:00
|
|
|
|
2024-01-30 15:31:03 +01:00
|
|
|
@XmlRootElement(name = "root")
|
|
|
|
@XmlAccessorType(XmlAccessType.FIELD)
|
|
|
|
public class DefinitionEntity {
|
|
|
|
@XmlElementWrapper(name = "pages")
|
|
|
|
@XmlElement(name = "page")
|
2023-10-27 17:46:34 +02:00
|
|
|
private List<PageEntity> pages;
|
2018-01-19 10:31:05 +01:00
|
|
|
|
2023-10-27 17:46:34 +02:00
|
|
|
public List<PageEntity> getPages() {
|
2018-01-19 10:31:05 +01:00
|
|
|
return pages;
|
|
|
|
}
|
|
|
|
|
2023-10-27 17:46:34 +02:00
|
|
|
public void setPages(List<PageEntity> pageEntities) {
|
|
|
|
this.pages = pageEntities;
|
2018-01-19 10:31:05 +01:00
|
|
|
}
|
|
|
|
|
2024-01-05 17:32:24 +01:00
|
|
|
public List<FieldEntity> getAllField(){
|
2023-11-03 13:53:10 +01:00
|
|
|
List<FieldEntity> fieldEntities = new ArrayList<>();
|
2024-01-31 13:33:24 +01:00
|
|
|
if (this.getPages() != null){
|
|
|
|
for (PageEntity sectionEntity: this.getPages()) {
|
2024-01-05 17:32:24 +01:00
|
|
|
fieldEntities.addAll(sectionEntity.getAllField());
|
2023-11-03 13:53:10 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return fieldEntities;
|
|
|
|
}
|
2018-01-19 10:31:05 +01:00
|
|
|
|
2024-02-01 15:40:11 +01:00
|
|
|
public List<FieldSetEntity> getAllFieldSets(){
|
|
|
|
List<FieldSetEntity> fieldSetsEntities = new ArrayList<>();
|
|
|
|
if (this.getPages() != null){
|
|
|
|
for (PageEntity sectionEntity: this.getPages()) {
|
|
|
|
fieldSetsEntities.addAll(sectionEntity.getAllFieldSets());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return fieldSetsEntities;
|
|
|
|
}
|
2024-02-06 11:27:47 +01:00
|
|
|
|
|
|
|
public List<FieldSetEntity> getFieldSetById(String id) {
|
|
|
|
return this.getAllFieldSets().stream().filter(x-> id.equals(x.getId())).toList();
|
|
|
|
}
|
|
|
|
|
2024-01-05 17:32:24 +01:00
|
|
|
public List<FieldEntity> getFieldById(String id) {
|
|
|
|
return this.getAllField().stream().filter(x-> id.equals(x.getId())).toList();
|
|
|
|
}
|
|
|
|
|
2017-11-30 11:10:42 +01:00
|
|
|
}
|