Add multiplicity field on Sections
This commit is contained in:
parent
1c318ddff5
commit
eaa0c67177
|
@ -18,6 +18,7 @@ public class Section {
|
||||||
private String extendedDescription;
|
private String extendedDescription;
|
||||||
private String title;
|
private String title;
|
||||||
private List<Section> section;
|
private List<Section> section;
|
||||||
|
private Boolean multiplicity;
|
||||||
|
|
||||||
@XmlAttribute(name = "id")
|
@XmlAttribute(name = "id")
|
||||||
public String getId() {
|
public String getId() {
|
||||||
|
@ -134,4 +135,13 @@ public class Section {
|
||||||
public void setSection(List<Section> section) {
|
public void setSection(List<Section> section) {
|
||||||
this.section = section;
|
this.section = section;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@XmlAttribute(name = "multiplicity")
|
||||||
|
public Boolean getMultiplicity() {
|
||||||
|
return multiplicity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMultiplicity(Boolean multiplicity) {
|
||||||
|
this.multiplicity = multiplicity;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ public class Sections {
|
||||||
private String title;
|
private String title;
|
||||||
private List<Section> section;
|
private List<Section> section;
|
||||||
private FieldSets fieldSets;
|
private FieldSets fieldSets;
|
||||||
|
private Boolean multiplicity;
|
||||||
|
|
||||||
@XmlAttribute(name = "id")
|
@XmlAttribute(name = "id")
|
||||||
public String getId() {
|
public String getId() {
|
||||||
|
@ -100,6 +101,15 @@ public class Sections {
|
||||||
this.fieldSets = fieldSets;
|
this.fieldSets = fieldSets;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@XmlAttribute(name = "multiplicity")
|
||||||
|
public Boolean getMultiplicity() {
|
||||||
|
return multiplicity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMultiplicity(Boolean multiplicity) {
|
||||||
|
this.multiplicity = multiplicity;
|
||||||
|
}
|
||||||
|
|
||||||
public eu.eudat.models.data.admin.components.datasetprofile.Section toAdminCompositeModelSection() {
|
public eu.eudat.models.data.admin.components.datasetprofile.Section toAdminCompositeModelSection() {
|
||||||
eu.eudat.models.data.admin.components.datasetprofile.Section sectionEntity = new eu.eudat.models.data.admin.components.datasetprofile.Section();
|
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<>();
|
List<eu.eudat.models.data.admin.components.datasetprofile.Section> sectionsListEntity = new LinkedList<>();
|
||||||
|
@ -118,6 +128,7 @@ public class Sections {
|
||||||
sectionEntity.setDescription(description);
|
sectionEntity.setDescription(description);
|
||||||
sectionEntity.setPage(this.page);
|
sectionEntity.setPage(this.page);
|
||||||
sectionEntity.setFieldSets(toAdminCompositeModelSectionFieldSets());
|
sectionEntity.setFieldSets(toAdminCompositeModelSectionFieldSets());
|
||||||
|
sectionEntity.setMultiplicity(this.multiplicity);
|
||||||
|
|
||||||
|
|
||||||
sectionEntity.setSections(sectionsListEntity);
|
sectionEntity.setSections(sectionsListEntity);
|
||||||
|
|
|
@ -16,6 +16,7 @@ public class Section implements Comparable, ViewStyleDefinition<eu.eudat.models.
|
||||||
private String id;
|
private String id;
|
||||||
private String title;
|
private String title;
|
||||||
private String description;
|
private String description;
|
||||||
|
private Boolean multiplicity;
|
||||||
|
|
||||||
public List<Section> getSections() {
|
public List<Section> getSections() {
|
||||||
return sections;
|
return sections;
|
||||||
|
@ -81,11 +82,20 @@ public class Section implements Comparable, ViewStyleDefinition<eu.eudat.models.
|
||||||
this.ordinal = ordinal;
|
this.ordinal = ordinal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Boolean getMultiplicity() {
|
||||||
|
return multiplicity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMultiplicity(Boolean multiplicity) {
|
||||||
|
this.multiplicity = multiplicity;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition.Section toDatabaseDefinition(eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition.Section item) {
|
public eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition.Section toDatabaseDefinition(eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition.Section item) {
|
||||||
if (this.id == null || this.id.isEmpty()) this.id = "section_" + RandomStringUtils.random(5, true, true);
|
if (this.id == null || this.id.isEmpty()) this.id = "section_" + RandomStringUtils.random(5, true, true);
|
||||||
item.setDefaultVisibility(this.defaultVisibility);
|
item.setDefaultVisibility(this.defaultVisibility);
|
||||||
item.setDescription(this.description);
|
item.setDescription(this.description);
|
||||||
|
item.setMultiplicity(this.multiplicity);
|
||||||
if (this.fieldSets != null)
|
if (this.fieldSets != null)
|
||||||
item.setFieldSets(new ModelBuilder().toViewStyleDefinition(this.fieldSets, eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition.FieldSet.class));
|
item.setFieldSets(new ModelBuilder().toViewStyleDefinition(this.fieldSets, eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition.FieldSet.class));
|
||||||
item.setId(this.id);
|
item.setId(this.id);
|
||||||
|
@ -108,6 +118,7 @@ public class Section implements Comparable, ViewStyleDefinition<eu.eudat.models.
|
||||||
this.page = item.getPage();
|
this.page = item.getPage();
|
||||||
this.sections = new ModelBuilder().fromViewStyleDefinition(item.getSections(), Section.class);
|
this.sections = new ModelBuilder().fromViewStyleDefinition(item.getSections(), Section.class);
|
||||||
this.title = item.getTitle();
|
this.title = item.getTitle();
|
||||||
|
this.multiplicity = item.getMultiplicity();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -134,6 +145,7 @@ public class Section implements Comparable, ViewStyleDefinition<eu.eudat.models.
|
||||||
shortenSection.setId(this.id);
|
shortenSection.setId(this.id);
|
||||||
shortenSection.setTitle(this.title);
|
shortenSection.setTitle(this.title);
|
||||||
shortenSection.setDescription(this.description);
|
shortenSection.setDescription(this.description);
|
||||||
|
shortenSection.setMultiplicity(this.multiplicity);
|
||||||
return shortenSection;
|
return shortenSection;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@ public class Section implements DatabaseViewStyleDefinition, XmlSerializable<Sec
|
||||||
private String extendedDescription;
|
private String extendedDescription;
|
||||||
private List<Section> sections;
|
private List<Section> sections;
|
||||||
private List<FieldSet> fieldSets;
|
private List<FieldSet> fieldSets;
|
||||||
|
private Boolean multiplicity;
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return id;
|
return id;
|
||||||
|
@ -102,6 +103,14 @@ public class Section implements DatabaseViewStyleDefinition, XmlSerializable<Sec
|
||||||
this.numbering = numbering;
|
this.numbering = numbering;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Boolean getMultiplicity() {
|
||||||
|
return multiplicity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMultiplicity(Boolean multiplicity) {
|
||||||
|
this.multiplicity = multiplicity;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Element toXml(Document doc) {
|
public Element toXml(Document doc) {
|
||||||
Element rootElement = doc.createElement("section");
|
Element rootElement = doc.createElement("section");
|
||||||
|
@ -109,6 +118,7 @@ public class Section implements DatabaseViewStyleDefinition, XmlSerializable<Sec
|
||||||
rootElement.setAttribute("ordinal", "" + this.ordinal);
|
rootElement.setAttribute("ordinal", "" + this.ordinal);
|
||||||
rootElement.setAttribute("defaultVisibility", "" + this.defaultVisibility);
|
rootElement.setAttribute("defaultVisibility", "" + this.defaultVisibility);
|
||||||
rootElement.setAttribute("page", "" + this.page);
|
rootElement.setAttribute("page", "" + this.page);
|
||||||
|
rootElement.setAttribute("multiplicity", (this.multiplicity != null ? "" + this.multiplicity : "false"));
|
||||||
|
|
||||||
Element description = doc.createElement("description");
|
Element description = doc.createElement("description");
|
||||||
description.setTextContent(this.description);
|
description.setTextContent(this.description);
|
||||||
|
@ -155,6 +165,7 @@ public class Section implements DatabaseViewStyleDefinition, XmlSerializable<Sec
|
||||||
this.ordinal = Integer.parseInt(element.getAttribute("ordinal"));
|
this.ordinal = Integer.parseInt(element.getAttribute("ordinal"));
|
||||||
this.defaultVisibility = Boolean.valueOf(element.getAttribute("defaultVisibility"));
|
this.defaultVisibility = Boolean.valueOf(element.getAttribute("defaultVisibility"));
|
||||||
this.page = element.getAttribute("page");
|
this.page = element.getAttribute("page");
|
||||||
|
this.multiplicity = element.hasAttribute("multiplicity") ? Boolean.valueOf(element.getAttribute("multiplicity")) : false;
|
||||||
|
|
||||||
Element description = XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "description");
|
Element description = XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "description");
|
||||||
if (description != null) this.description = description.getTextContent();
|
if (description != null) this.description = description.getTextContent();
|
||||||
|
|
|
@ -19,6 +19,7 @@ public class Section implements Comparable, ViewStyleDefinition<eu.eudat.models.
|
||||||
private String id;
|
private String id;
|
||||||
private String title;
|
private String title;
|
||||||
private String description;
|
private String description;
|
||||||
|
private Boolean multiplicity;
|
||||||
|
|
||||||
public List<Section> getSections() {
|
public List<Section> getSections() {
|
||||||
Collections.sort(sections);
|
Collections.sort(sections);
|
||||||
|
@ -94,6 +95,14 @@ public class Section implements Comparable, ViewStyleDefinition<eu.eudat.models.
|
||||||
this.numbering = numbering;
|
this.numbering = numbering;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Boolean getMultiplicity() {
|
||||||
|
return multiplicity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMultiplicity(Boolean multiplicity) {
|
||||||
|
this.multiplicity = multiplicity;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition.Section toDatabaseDefinition(eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition.Section item) {
|
public eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition.Section toDatabaseDefinition(eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition.Section item) {
|
||||||
item.setDefaultVisibility(this.defaultVisibility);
|
item.setDefaultVisibility(this.defaultVisibility);
|
||||||
|
@ -106,6 +115,7 @@ public class Section implements Comparable, ViewStyleDefinition<eu.eudat.models.
|
||||||
if (this.sections != null)
|
if (this.sections != null)
|
||||||
item.setSections(new ModelBuilder().toViewStyleDefinition(this.sections, eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition.Section.class));
|
item.setSections(new ModelBuilder().toViewStyleDefinition(this.sections, eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition.Section.class));
|
||||||
item.setTitle(this.title);
|
item.setTitle(this.title);
|
||||||
|
item.setMultiplicity(this.multiplicity);
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,6 +130,7 @@ public class Section implements Comparable, ViewStyleDefinition<eu.eudat.models.
|
||||||
this.page = item.getPage();
|
this.page = item.getPage();
|
||||||
this.sections = new ModelBuilder().fromViewStyleDefinition(item.getSections(), Section.class);
|
this.sections = new ModelBuilder().fromViewStyleDefinition(item.getSections(), Section.class);
|
||||||
this.title = item.getTitle();
|
this.title = item.getTitle();
|
||||||
|
this.multiplicity = item.getMultiplicity();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue