144 lines
4.0 KiB
Java
144 lines
4.0 KiB
Java
package eu.eudat.commons.types.descriptiontemplate.importmodel;
|
|
|
|
|
|
import eu.eudat.model.persist.descriptiontemplatedefinition.FieldSetPersist;
|
|
import eu.eudat.model.persist.descriptiontemplatedefinition.SectionPersist;
|
|
import eu.eudat.service.fielddatahelper.FieldDataHelperServiceProvider;
|
|
import jakarta.xml.bind.annotation.XmlAttribute;
|
|
import jakarta.xml.bind.annotation.XmlElement;
|
|
import jakarta.xml.bind.annotation.XmlRootElement;
|
|
import java.util.LinkedList;
|
|
import java.util.List;
|
|
|
|
@XmlRootElement(name = "sections")
|
|
public class SectionsImportXml {
|
|
private String id;
|
|
private int ordinal;
|
|
private String page;
|
|
private Boolean defaultVisibility;
|
|
private String numbering;
|
|
private String description;
|
|
private String title;
|
|
private List<SectionImportXml> section;
|
|
private FieldSetsImportXml fieldSets;
|
|
private Boolean multiplicity;
|
|
|
|
@XmlAttribute(name = "id")
|
|
public String getId() {
|
|
return id;
|
|
}
|
|
|
|
public void setId(String id) {
|
|
this.id = id;
|
|
}
|
|
|
|
@XmlAttribute(name = "ordinal")
|
|
public int getOrdinal() {
|
|
return ordinal;
|
|
}
|
|
|
|
public void setOrdinal(int ordinal) {
|
|
this.ordinal = ordinal;
|
|
}
|
|
|
|
@XmlAttribute(name = "page")
|
|
public String getPage() {
|
|
return page;
|
|
}
|
|
|
|
public void setPage(String page) {
|
|
this.page = page;
|
|
}
|
|
|
|
@XmlAttribute(name = "defaultVisibility")
|
|
public Boolean getDefaultVisibility() {
|
|
return defaultVisibility;
|
|
}
|
|
|
|
public void setDefaultVisibility(Boolean defaultVisibility) {
|
|
this.defaultVisibility = defaultVisibility;
|
|
}
|
|
|
|
@XmlElement(name = "numbering")
|
|
public String getNumbering() {
|
|
return numbering;
|
|
}
|
|
|
|
public void setNumbering(String numbering) {
|
|
this.numbering = numbering;
|
|
}
|
|
|
|
@XmlElement(name = "description")
|
|
public String getDescription() {
|
|
return description;
|
|
}
|
|
|
|
public void setDescription(String description) {
|
|
this.description = description;
|
|
}
|
|
|
|
@XmlElement(name = "title")
|
|
public String getTitle() {
|
|
return title;
|
|
}
|
|
|
|
public void setTitle(String title) {
|
|
this.title = title;
|
|
}
|
|
|
|
@XmlElement(name = "section")
|
|
public List<SectionImportXml> getSection() {
|
|
return section;
|
|
}
|
|
|
|
public void setSection(List<SectionImportXml> section) {
|
|
this.section = section;
|
|
}
|
|
|
|
@XmlElement(name = "field-Sets")
|
|
public FieldSetsImportXml getFieldSets() {
|
|
return fieldSets;
|
|
}
|
|
|
|
public void setFieldSets(FieldSetsImportXml fieldSets) {
|
|
this.fieldSets = fieldSets;
|
|
}
|
|
|
|
@XmlAttribute(name = "multiplicity")
|
|
public Boolean getMultiplicity() {
|
|
return multiplicity;
|
|
}
|
|
|
|
public void setMultiplicity(Boolean multiplicity) {
|
|
this.multiplicity = multiplicity;
|
|
}
|
|
|
|
public SectionPersist toPersistModel(FieldDataHelperServiceProvider fieldDataHelperServiceProvider) {
|
|
SectionPersist sectionEntity = new SectionPersist();
|
|
List<SectionPersist> sectionsListEntity = new LinkedList<>();
|
|
|
|
if (this.section != null) {
|
|
for (SectionImportXml xmlsection : this.section) {
|
|
sectionsListEntity.add(xmlsection.toPersistModel(fieldDataHelperServiceProvider));
|
|
}
|
|
}
|
|
sectionEntity.setId(this.id);
|
|
sectionEntity.setOrdinal(this.ordinal);
|
|
sectionEntity.setTitle(this.title);
|
|
sectionEntity.setDefaultVisibility(this.defaultVisibility);
|
|
sectionEntity.setDescription(description);
|
|
sectionEntity.setPage(this.page);
|
|
sectionEntity.setFieldSets(toFieldSetPersistModel(fieldDataHelperServiceProvider));
|
|
sectionEntity.setMultiplicity(this.multiplicity);
|
|
|
|
|
|
sectionEntity.setSections(sectionsListEntity);
|
|
return sectionEntity;
|
|
}
|
|
|
|
public List<FieldSetPersist> toFieldSetPersistModel(FieldDataHelperServiceProvider fieldDataHelperServiceProvider) {
|
|
return fieldSets.toPersistModel(fieldDataHelperServiceProvider);
|
|
}
|
|
}
|
|
|