DmpBlueprint feractor
This commit is contained in:
parent
c3808b5548
commit
732dfd9bfb
|
@ -0,0 +1,22 @@
|
|||
package eu.eudat.commons.types.dmpblueprint.importexport;
|
||||
|
||||
import jakarta.xml.bind.annotation.XmlAccessType;
|
||||
import jakarta.xml.bind.annotation.XmlAccessorType;
|
||||
import jakarta.xml.bind.annotation.XmlElement;
|
||||
import jakarta.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
@XmlRootElement(name = "root")
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class BlueprintImportExport {
|
||||
|
||||
@XmlElement(name = "definition")
|
||||
private DefinitionImportExport dmpBlueprintDefinition;
|
||||
|
||||
public DefinitionImportExport getDmpBlueprintDefinition() {
|
||||
return dmpBlueprintDefinition;
|
||||
}
|
||||
|
||||
public void setDmpBlueprintDefinition(DefinitionImportExport dmpBlueprintDefinition) {
|
||||
this.dmpBlueprintDefinition = dmpBlueprintDefinition;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package eu.eudat.commons.types.dmpblueprint.importexport;
|
||||
|
||||
import jakarta.xml.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class DefinitionImportExport {
|
||||
|
||||
@XmlElementWrapper(name = "sections")
|
||||
@XmlElement(name = "section")
|
||||
private List<SectionImportExport> sections;
|
||||
|
||||
public List<SectionImportExport> getSections() {
|
||||
return sections;
|
||||
}
|
||||
|
||||
public void setSections(List<SectionImportExport> sections) {
|
||||
this.sections = sections;
|
||||
}
|
||||
}
|
|
@ -1,21 +1,23 @@
|
|||
package eu.eudat.commons.types.dmpblueprint.importmodel;
|
||||
package eu.eudat.commons.types.dmpblueprint.importexport;
|
||||
|
||||
import eu.eudat.commons.types.dmpblueprint.DescriptionTemplateEntity;
|
||||
import jakarta.xml.bind.annotation.XmlAccessType;
|
||||
import jakarta.xml.bind.annotation.XmlAccessorType;
|
||||
import jakarta.xml.bind.annotation.XmlAttribute;
|
||||
import jakarta.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@XmlRootElement(name = "descriptionTemplate")
|
||||
public class DescriptionTemplate {
|
||||
|
||||
private String id;
|
||||
private String descriptionTemplateId;
|
||||
private String label;
|
||||
private int minMultiplicity;
|
||||
private int maxMultiplicity;
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class DescriptionTemplateImportExport {
|
||||
|
||||
@XmlAttribute(name = "id")
|
||||
private String id;
|
||||
@XmlAttribute(name = "descriptionTemplateId")
|
||||
private String descriptionTemplateId;
|
||||
@XmlAttribute(name = "label")
|
||||
private String label;
|
||||
@XmlAttribute(name = "minMultiplicity")
|
||||
private int minMultiplicity;
|
||||
@XmlAttribute(name = "maxMultiplicity")
|
||||
private int maxMultiplicity;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
@ -24,7 +26,6 @@ public class DescriptionTemplate {
|
|||
this.id = id;
|
||||
}
|
||||
|
||||
@XmlAttribute(name = "descriptionTemplateId")
|
||||
public String getDescriptionTemplateId() {
|
||||
return descriptionTemplateId;
|
||||
}
|
||||
|
@ -33,7 +34,6 @@ public class DescriptionTemplate {
|
|||
this.descriptionTemplateId = descriptionTemplateId;
|
||||
}
|
||||
|
||||
@XmlAttribute(name = "label")
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
@ -42,7 +42,6 @@ public class DescriptionTemplate {
|
|||
this.label = label;
|
||||
}
|
||||
|
||||
@XmlAttribute(name = "minMultiplicity")
|
||||
public int getMinMultiplicity() {
|
||||
return minMultiplicity;
|
||||
}
|
||||
|
@ -51,7 +50,6 @@ public class DescriptionTemplate {
|
|||
this.minMultiplicity = minMultiplicity;
|
||||
}
|
||||
|
||||
@XmlAttribute(name = "maxMultiplicity")
|
||||
public int getMaxMultiplicity() {
|
||||
return maxMultiplicity;
|
||||
}
|
||||
|
@ -60,14 +58,5 @@ public class DescriptionTemplate {
|
|||
this.maxMultiplicity = maxMultiplicity;
|
||||
}
|
||||
|
||||
public DescriptionTemplateEntity toEntity() {
|
||||
DescriptionTemplateEntity descriptionTemplate = new DescriptionTemplateEntity();
|
||||
descriptionTemplate.setId(UUID.fromString(this.id));
|
||||
descriptionTemplate.setDescriptionTemplateId(UUID.fromString(this.descriptionTemplateId));
|
||||
descriptionTemplate.setLabel(this.label);
|
||||
descriptionTemplate.setMinMultiplicity(this.minMultiplicity);
|
||||
descriptionTemplate.setMaxMultiplicity(this.maxMultiplicity);
|
||||
return descriptionTemplate;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,26 +1,27 @@
|
|||
package eu.eudat.commons.types.dmpblueprint.importmodel;
|
||||
package eu.eudat.commons.types.dmpblueprint.importexport;
|
||||
|
||||
import eu.eudat.commons.enums.DmpBlueprintExtraFieldDataType;
|
||||
import eu.eudat.commons.enums.DmpBlueprintFieldCategory;
|
||||
import eu.eudat.commons.types.dmpblueprint.ExtraFieldEntity;
|
||||
import eu.eudat.commons.types.dmpblueprint.FieldEntity;
|
||||
import jakarta.xml.bind.annotation.XmlAccessType;
|
||||
import jakarta.xml.bind.annotation.XmlAccessorType;
|
||||
import jakarta.xml.bind.annotation.XmlAttribute;
|
||||
import jakarta.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@XmlRootElement(name = "extraField")
|
||||
public class ExtraField {
|
||||
|
||||
private String id;
|
||||
private short type;
|
||||
private String label;
|
||||
private String placeholder;
|
||||
private String description;
|
||||
private int ordinal;
|
||||
private boolean required;
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class ExtraFieldImportExport {
|
||||
|
||||
@XmlAttribute(name = "id")
|
||||
private String id;
|
||||
@XmlAttribute(name = "type")
|
||||
private short type;
|
||||
@XmlAttribute(name = "label")
|
||||
private String label;
|
||||
@XmlAttribute(name = "placeholder")
|
||||
private String placeholder;
|
||||
@XmlAttribute(name = "description")
|
||||
private String description;
|
||||
@XmlAttribute(name = "ordinal")
|
||||
private int ordinal;
|
||||
@XmlAttribute(name = "required")
|
||||
private boolean required;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
@ -29,7 +30,6 @@ public class ExtraField {
|
|||
this.id = id;
|
||||
}
|
||||
|
||||
@XmlAttribute(name = "type")
|
||||
public short getType() {
|
||||
return type;
|
||||
}
|
||||
|
@ -38,7 +38,6 @@ public class ExtraField {
|
|||
this.type = type;
|
||||
}
|
||||
|
||||
@XmlAttribute(name = "label")
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
@ -47,7 +46,6 @@ public class ExtraField {
|
|||
this.label = label;
|
||||
}
|
||||
|
||||
@XmlAttribute(name = "placeholder")
|
||||
public String getPlaceholder() {
|
||||
return placeholder;
|
||||
}
|
||||
|
@ -56,7 +54,6 @@ public class ExtraField {
|
|||
this.placeholder = placeholder;
|
||||
}
|
||||
|
||||
@XmlAttribute(name = "description")
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
@ -65,7 +62,6 @@ public class ExtraField {
|
|||
this.description = description;
|
||||
}
|
||||
|
||||
@XmlAttribute(name = "ordinal")
|
||||
public int getOrdinal() {
|
||||
return ordinal;
|
||||
}
|
||||
|
@ -74,7 +70,6 @@ public class ExtraField {
|
|||
this.ordinal = ordinal;
|
||||
}
|
||||
|
||||
@XmlAttribute(name = "required")
|
||||
public boolean isRequired() {
|
||||
return required;
|
||||
}
|
||||
|
@ -83,17 +78,5 @@ public class ExtraField {
|
|||
this.required = required;
|
||||
}
|
||||
|
||||
public FieldEntity toEntity() {
|
||||
ExtraFieldEntity systemField = new ExtraFieldEntity();
|
||||
systemField.setId(UUID.fromString(this.id));
|
||||
systemField.setCategory(DmpBlueprintFieldCategory.Extra);
|
||||
systemField.setType(DmpBlueprintExtraFieldDataType.of(this.type));
|
||||
systemField.setLabel(this.label);
|
||||
systemField.setPlaceholder(this.placeholder);
|
||||
systemField.setDescription(this.description);
|
||||
systemField.setOrdinal(this.ordinal);
|
||||
systemField.setRequired(this.required);
|
||||
return systemField;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,94 @@
|
|||
package eu.eudat.commons.types.dmpblueprint.importexport;
|
||||
|
||||
import jakarta.xml.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class SectionImportExport {
|
||||
|
||||
@XmlAttribute(name = "id")
|
||||
private String id;
|
||||
@XmlAttribute(name = "label")
|
||||
private String label;
|
||||
@XmlAttribute(name = "description")
|
||||
private String description;
|
||||
@XmlAttribute(name = "ordinal")
|
||||
private int ordinal;
|
||||
@XmlElementWrapper(name = "systemFields")
|
||||
@XmlElement(name = "systemField")
|
||||
private List<SystemFieldImportExport> systemFields;
|
||||
@XmlElementWrapper(name = "extraFields")
|
||||
@XmlElement(name = "extraField")
|
||||
private List<ExtraFieldImportExport> extraFields;
|
||||
@XmlAttribute(name = "hasTemplates")
|
||||
private boolean hasTemplates;
|
||||
@XmlElementWrapper(name = "descriptionTemplates")
|
||||
@XmlElement(name = "descriptionTemplate")
|
||||
private List<DescriptionTemplateImportExport> descriptionTemplates;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
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 int getOrdinal() {
|
||||
return ordinal;
|
||||
}
|
||||
|
||||
public void setOrdinal(int ordinal) {
|
||||
this.ordinal = ordinal;
|
||||
}
|
||||
|
||||
public List<SystemFieldImportExport> getSystemFields() {
|
||||
return systemFields;
|
||||
}
|
||||
|
||||
public void setSystemFields(List<SystemFieldImportExport> systemFields) {
|
||||
this.systemFields = systemFields;
|
||||
}
|
||||
|
||||
public List<ExtraFieldImportExport> getExtraFields() {
|
||||
return extraFields;
|
||||
}
|
||||
|
||||
public void setExtraFields(List<ExtraFieldImportExport> extraFields) {
|
||||
this.extraFields = extraFields;
|
||||
}
|
||||
|
||||
public boolean isHasTemplates() {
|
||||
return hasTemplates;
|
||||
}
|
||||
|
||||
public void setHasTemplates(boolean hasTemplates) {
|
||||
this.hasTemplates = hasTemplates;
|
||||
}
|
||||
|
||||
public List<DescriptionTemplateImportExport> getDescriptionTemplates() {
|
||||
return descriptionTemplates;
|
||||
}
|
||||
|
||||
public void setDescriptionTemplates(List<DescriptionTemplateImportExport> descriptionTemplates) {
|
||||
this.descriptionTemplates = descriptionTemplates;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,26 +1,27 @@
|
|||
package eu.eudat.commons.types.dmpblueprint.importmodel;
|
||||
package eu.eudat.commons.types.dmpblueprint.importexport;
|
||||
|
||||
import eu.eudat.commons.enums.DmpBlueprintFieldCategory;
|
||||
import eu.eudat.commons.enums.DmpBlueprintSystemFieldType;
|
||||
import eu.eudat.commons.types.dmpblueprint.FieldEntity;
|
||||
import eu.eudat.commons.types.dmpblueprint.SystemFieldEntity;
|
||||
import jakarta.xml.bind.annotation.XmlAccessType;
|
||||
import jakarta.xml.bind.annotation.XmlAccessorType;
|
||||
import jakarta.xml.bind.annotation.XmlAttribute;
|
||||
import jakarta.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@XmlRootElement(name = "systemField")
|
||||
public class SystemField {
|
||||
|
||||
private String id;
|
||||
private short type;
|
||||
private String label;
|
||||
private String placeholder;
|
||||
private String description;
|
||||
private int ordinal;
|
||||
private boolean required;
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class SystemFieldImportExport {
|
||||
|
||||
@XmlAttribute(name = "id")
|
||||
private String id;
|
||||
@XmlAttribute(name = "type")
|
||||
private short type;
|
||||
@XmlAttribute(name = "label")
|
||||
private String label;
|
||||
@XmlAttribute(name = "placeholder")
|
||||
private String placeholder;
|
||||
@XmlAttribute(name = "description")
|
||||
private String description;
|
||||
@XmlAttribute(name = "ordinal")
|
||||
private int ordinal;
|
||||
@XmlAttribute(name = "required")
|
||||
private boolean required;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
@ -29,7 +30,6 @@ public class SystemField {
|
|||
this.id = id;
|
||||
}
|
||||
|
||||
@XmlAttribute(name = "type")
|
||||
public short getType() {
|
||||
return type;
|
||||
}
|
||||
|
@ -38,7 +38,6 @@ public class SystemField {
|
|||
this.type = type;
|
||||
}
|
||||
|
||||
@XmlAttribute(name = "label")
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
@ -47,7 +46,6 @@ public class SystemField {
|
|||
this.label = label;
|
||||
}
|
||||
|
||||
@XmlAttribute(name = "placeholder")
|
||||
public String getPlaceholder() {
|
||||
return placeholder;
|
||||
}
|
||||
|
@ -56,7 +54,6 @@ public class SystemField {
|
|||
this.placeholder = placeholder;
|
||||
}
|
||||
|
||||
@XmlAttribute(name = "description")
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
@ -65,7 +62,6 @@ public class SystemField {
|
|||
this.description = description;
|
||||
}
|
||||
|
||||
@XmlAttribute(name = "ordinal")
|
||||
public int getOrdinal() {
|
||||
return ordinal;
|
||||
}
|
||||
|
@ -74,7 +70,6 @@ public class SystemField {
|
|||
this.ordinal = ordinal;
|
||||
}
|
||||
|
||||
@XmlAttribute(name = "required")
|
||||
public boolean isRequired() {
|
||||
return required;
|
||||
}
|
||||
|
@ -82,18 +77,4 @@ public class SystemField {
|
|||
public void setRequired(boolean required) {
|
||||
this.required = required;
|
||||
}
|
||||
|
||||
public FieldEntity toEntity() {
|
||||
SystemFieldEntity systemField = new SystemFieldEntity();
|
||||
systemField.setId(UUID.fromString(this.id));
|
||||
systemField.setCategory(DmpBlueprintFieldCategory.System);
|
||||
systemField.setType(DmpBlueprintSystemFieldType.of(this.type));
|
||||
systemField.setLabel(this.label);
|
||||
systemField.setPlaceholder(this.placeholder);
|
||||
systemField.setDescription(this.description);
|
||||
systemField.setOrdinal(this.ordinal);
|
||||
systemField.setRequired(this.required);
|
||||
return systemField;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
package eu.eudat.commons.types.dmpblueprint.importmodel;
|
||||
|
||||
import jakarta.xml.bind.annotation.XmlElement;
|
||||
import jakarta.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@XmlRootElement(name = "descriptionTemplates")
|
||||
public class DescriptionTemplates {
|
||||
|
||||
private List<DescriptionTemplate> descriptionTemplates;
|
||||
|
||||
@XmlElement(name = "descriptionTemplate")
|
||||
public List<DescriptionTemplate> getDescriptionTemplates() {
|
||||
return descriptionTemplates;
|
||||
}
|
||||
public void setDescriptionTemplates(List<DescriptionTemplate> descriptionTemplates) {
|
||||
this.descriptionTemplates = descriptionTemplates;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
package eu.eudat.commons.types.dmpblueprint.importmodel;
|
||||
|
||||
import eu.eudat.commons.types.dmpblueprint.DefinitionEntity;
|
||||
import jakarta.xml.bind.annotation.XmlElement;
|
||||
import jakarta.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
@XmlRootElement(name = "root")
|
||||
public class DmpBlueprint {
|
||||
|
||||
private DmpBlueprintDefinition dmpBlueprintDefinition;
|
||||
|
||||
@XmlElement(name = "definition")
|
||||
public DmpBlueprintDefinition getDmpBlueprintDefinition() {
|
||||
return dmpBlueprintDefinition;
|
||||
}
|
||||
|
||||
public void setDmpBlueprintDefinition(DmpBlueprintDefinition dmpBlueprintDefinition) {
|
||||
this.dmpBlueprintDefinition = dmpBlueprintDefinition;
|
||||
}
|
||||
|
||||
public DefinitionEntity toDefinitionEntity() {
|
||||
return this.dmpBlueprintDefinition.toEntity();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,37 +0,0 @@
|
|||
package eu.eudat.commons.types.dmpblueprint.importmodel;
|
||||
|
||||
import eu.eudat.commons.types.dmpblueprint.DefinitionEntity;
|
||||
import eu.eudat.commons.types.dmpblueprint.SectionEntity;
|
||||
import jakarta.xml.bind.annotation.XmlElement;
|
||||
import jakarta.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
@XmlRootElement(name = "definition")
|
||||
public class DmpBlueprintDefinition {
|
||||
|
||||
private Sections sections;
|
||||
|
||||
@XmlElement(name = "sections")
|
||||
public Sections getSections() {
|
||||
return sections;
|
||||
}
|
||||
public void setSections(Sections sections) {
|
||||
this.sections = sections;
|
||||
}
|
||||
|
||||
|
||||
public DefinitionEntity toEntity() {
|
||||
DefinitionEntity dmpBlueprint = new DefinitionEntity();
|
||||
List<SectionEntity> dmpBlueprintSections = new LinkedList<>();
|
||||
if (this.sections != null && this.sections.getSections() != null) {
|
||||
for (Section section : this.sections.getSections()) {
|
||||
dmpBlueprintSections.add(section.toEntity());
|
||||
}
|
||||
}
|
||||
dmpBlueprint.setSections(dmpBlueprintSections);
|
||||
return dmpBlueprint;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
package eu.eudat.commons.types.dmpblueprint.importmodel;
|
||||
|
||||
import jakarta.xml.bind.annotation.XmlElement;
|
||||
import jakarta.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@XmlRootElement(name = "extraFields")
|
||||
public class ExtraFields {
|
||||
|
||||
private List<ExtraField> extraFields;
|
||||
|
||||
@XmlElement(name = "extraField")
|
||||
public List<ExtraField> getExtraFields() {
|
||||
return extraFields;
|
||||
}
|
||||
public void setExtraFields(List<ExtraField> extraFields) {
|
||||
this.extraFields = extraFields;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,127 +0,0 @@
|
|||
package eu.eudat.commons.types.dmpblueprint.importmodel;
|
||||
|
||||
import eu.eudat.commons.types.dmpblueprint.DescriptionTemplateEntity;
|
||||
import eu.eudat.commons.types.dmpblueprint.FieldEntity;
|
||||
import eu.eudat.commons.types.dmpblueprint.SectionEntity;
|
||||
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;
|
||||
import java.util.UUID;
|
||||
|
||||
@XmlRootElement(name = "section")
|
||||
public class Section {
|
||||
|
||||
private String id;
|
||||
private String label;
|
||||
private String description;
|
||||
private int ordinal;
|
||||
private SystemFields systemFields;
|
||||
private ExtraFields extraFields;
|
||||
private boolean hasTemplates;
|
||||
private DescriptionTemplates descriptionTemplates;
|
||||
|
||||
@XmlAttribute(name = "id")
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@XmlAttribute(name = "label")
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
@XmlAttribute(name = "description")
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
@XmlAttribute(name = "ordinal")
|
||||
public int getOrdinal() {
|
||||
return ordinal;
|
||||
}
|
||||
|
||||
public void setOrdinal(int ordinal) {
|
||||
this.ordinal = ordinal;
|
||||
}
|
||||
|
||||
@XmlElement(name = "systemFields")
|
||||
public SystemFields getSystemFields() {
|
||||
return systemFields;
|
||||
}
|
||||
|
||||
public void setSystemFields(SystemFields systemFields) {
|
||||
this.systemFields = systemFields;
|
||||
}
|
||||
|
||||
@XmlElement(name = "extraFields")
|
||||
public ExtraFields getExtraFields() {
|
||||
return extraFields;
|
||||
}
|
||||
|
||||
public void setExtraFields(ExtraFields extraFields) {
|
||||
this.extraFields = extraFields;
|
||||
}
|
||||
|
||||
@XmlAttribute(name = "hasTemplates")
|
||||
public boolean isHasTemplates() {
|
||||
return hasTemplates;
|
||||
}
|
||||
|
||||
public void setHasTemplates(boolean hasTemplates) {
|
||||
this.hasTemplates = hasTemplates;
|
||||
}
|
||||
|
||||
@XmlElement(name = "descriptionTemplates")
|
||||
public DescriptionTemplates getDescriptionTemplates() {
|
||||
return descriptionTemplates;
|
||||
}
|
||||
|
||||
public void setDescriptionTemplates(DescriptionTemplates descriptionTemplates) {
|
||||
this.descriptionTemplates = descriptionTemplates;
|
||||
}
|
||||
|
||||
public SectionEntity toEntity() {
|
||||
SectionEntity section = new SectionEntity();
|
||||
section.setId(UUID.fromString(this.id));
|
||||
section.setLabel(this.label);
|
||||
section.setDescription(this.description);
|
||||
section.setOrdinal(this.ordinal);
|
||||
section.setHasTemplates(this.hasTemplates);
|
||||
List<FieldEntity> dmpBlueprintFieldModels = new LinkedList<>();
|
||||
if (this.systemFields != null && this.systemFields.getSystemFields() != null) {
|
||||
for (SystemField systemField : this.systemFields.getSystemFields()) {
|
||||
dmpBlueprintFieldModels.add(systemField.toEntity());
|
||||
}
|
||||
}
|
||||
if (this.extraFields != null&& this.extraFields.getExtraFields() != null) {
|
||||
for (ExtraField extraField : this.extraFields.getExtraFields()) {
|
||||
dmpBlueprintFieldModels.add(extraField.toEntity());
|
||||
}
|
||||
}
|
||||
section.setFields(dmpBlueprintFieldModels);
|
||||
List<DescriptionTemplateEntity> dmpBlueprintDescriptionTemplates = new LinkedList<>();
|
||||
if (this.descriptionTemplates != null && this.descriptionTemplates.getDescriptionTemplates() != null) {
|
||||
for (DescriptionTemplate descriptionTemplate : this.descriptionTemplates.getDescriptionTemplates()) {
|
||||
dmpBlueprintDescriptionTemplates.add(descriptionTemplate.toEntity());
|
||||
}
|
||||
}
|
||||
section.setDescriptionTemplates(dmpBlueprintDescriptionTemplates);
|
||||
return section;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
package eu.eudat.commons.types.dmpblueprint.importmodel;
|
||||
|
||||
import jakarta.xml.bind.annotation.XmlElement;
|
||||
import jakarta.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@XmlRootElement(name = "sections")
|
||||
public class Sections {
|
||||
|
||||
private List<Section> sections;
|
||||
|
||||
@XmlElement(name = "section")
|
||||
public List<Section> getSections() {
|
||||
return sections;
|
||||
}
|
||||
public void setSections(List<Section> sections) {
|
||||
this.sections = sections;
|
||||
}
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
package eu.eudat.commons.types.dmpblueprint.importmodel;
|
||||
|
||||
import jakarta.xml.bind.annotation.XmlElement;
|
||||
import jakarta.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@XmlRootElement(name = "systemFields")
|
||||
public class SystemFields {
|
||||
|
||||
private List<SystemField> systemFields;
|
||||
|
||||
@XmlElement(name = "systemField")
|
||||
public List<SystemField> getSystemFields() {
|
||||
return systemFields;
|
||||
}
|
||||
public void setSystemFields(List<SystemField> systemFields) {
|
||||
this.systemFields = systemFields;
|
||||
}
|
||||
|
||||
}
|
|
@ -31,6 +31,6 @@ public interface DmpBlueprintService {
|
|||
|
||||
DmpBlueprint buildClone(UUID id, FieldSet fields) throws MyForbiddenException, MyValidationException, MyApplicationException, MyNotFoundException;
|
||||
|
||||
ResponseEntity<byte[]> exportXml(UUID id) throws MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, IOException, InstantiationException, IllegalAccessException, SAXException, TransformerException;
|
||||
ResponseEntity<byte[]> exportXml(UUID id) throws MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, IOException, InstantiationException, IllegalAccessException, SAXException, TransformerException, InvalidApplicationException;
|
||||
DmpBlueprint importXml(byte[] bytes, String label, FieldSet fields) throws MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, TransformerException, InvalidApplicationException, IOException, InstantiationException, IllegalAccessException, SAXException;
|
||||
}
|
||||
|
|
|
@ -4,11 +4,9 @@ import com.fasterxml.jackson.core.JsonProcessingException;
|
|||
import eu.eudat.authorization.AuthorizationFlags;
|
||||
import eu.eudat.authorization.Permission;
|
||||
import eu.eudat.commons.XmlHandlingService;
|
||||
import eu.eudat.commons.enums.DmpBlueprintFieldCategory;
|
||||
import eu.eudat.commons.enums.DmpBlueprintStatus;
|
||||
import eu.eudat.commons.enums.DmpBlueprintSystemFieldType;
|
||||
import eu.eudat.commons.enums.IsActive;
|
||||
import eu.eudat.commons.enums.*;
|
||||
import eu.eudat.commons.types.dmpblueprint.*;
|
||||
import eu.eudat.commons.types.dmpblueprint.importexport.*;
|
||||
import eu.eudat.convention.ConventionService;
|
||||
import eu.eudat.data.DmpBlueprintEntity;
|
||||
import eu.eudat.errorcode.ErrorThesaurusProperties;
|
||||
|
@ -35,6 +33,7 @@ import gr.cite.tools.fieldset.BaseFieldSet;
|
|||
import gr.cite.tools.fieldset.FieldSet;
|
||||
import gr.cite.tools.logging.LoggerService;
|
||||
import gr.cite.tools.logging.MapLogEntry;
|
||||
import gr.cite.tools.validation.ValidationService;
|
||||
import jakarta.persistence.EntityManager;
|
||||
import jakarta.xml.bind.JAXBException;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
@ -44,8 +43,6 @@ import org.springframework.context.MessageSource;
|
|||
import org.springframework.context.i18n.LocaleContextHolder;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
import javax.management.InvalidApplicationException;
|
||||
|
@ -55,6 +52,7 @@ import java.io.IOException;
|
|||
import java.nio.charset.StandardCharsets;
|
||||
import java.time.Instant;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -77,6 +75,7 @@ public class DmpBlueprintServiceImpl implements DmpBlueprintService {
|
|||
private final ResponseUtilsService responseUtilsService;
|
||||
private final XmlHandlingService xmlHandlingService;
|
||||
private final ErrorThesaurusProperties errors;
|
||||
private final ValidationService validationService;
|
||||
|
||||
@Autowired
|
||||
public DmpBlueprintServiceImpl(
|
||||
|
@ -86,7 +85,10 @@ public class DmpBlueprintServiceImpl implements DmpBlueprintService {
|
|||
BuilderFactory builderFactory,
|
||||
ConventionService conventionService,
|
||||
MessageSource messageSource, QueryFactory queryFactory,
|
||||
ResponseUtilsService responseUtilsService, XmlHandlingService xmlHandlingService, ErrorThesaurusProperties errors) {
|
||||
ResponseUtilsService responseUtilsService,
|
||||
XmlHandlingService xmlHandlingService,
|
||||
ErrorThesaurusProperties errors,
|
||||
ValidationService validationService) {
|
||||
this.entityManager = entityManager;
|
||||
this.authorizationService = authorizationService;
|
||||
this.deleterFactory = deleterFactory;
|
||||
|
@ -97,8 +99,11 @@ public class DmpBlueprintServiceImpl implements DmpBlueprintService {
|
|||
this.responseUtilsService = responseUtilsService;
|
||||
this.xmlHandlingService = xmlHandlingService;
|
||||
this.errors = errors;
|
||||
this.validationService = validationService;
|
||||
}
|
||||
|
||||
//region Persist
|
||||
|
||||
public DmpBlueprint persist(DmpBlueprintPersist model, FieldSet fields) throws MyForbiddenException, MyValidationException, MyApplicationException, MyNotFoundException, InvalidApplicationException, JAXBException, JsonProcessingException, TransformerException, ParserConfigurationException {
|
||||
logger.debug(new MapLogEntry("persisting data").And("model", model).And("fields", fields));
|
||||
|
||||
|
@ -143,7 +148,6 @@ public class DmpBlueprintServiceImpl implements DmpBlueprintService {
|
|||
|
||||
return data;
|
||||
}
|
||||
|
||||
private @NotNull SectionEntity buildSectionEntity(SectionPersist persist){
|
||||
SectionEntity data = new SectionEntity();
|
||||
if (persist == null) return data;
|
||||
|
@ -206,6 +210,10 @@ public class DmpBlueprintServiceImpl implements DmpBlueprintService {
|
|||
return data;
|
||||
}
|
||||
|
||||
//endregion
|
||||
|
||||
//region Delete
|
||||
|
||||
public void deleteAndSave(UUID id) throws MyForbiddenException, InvalidApplicationException {
|
||||
logger.debug("deleting : {}", id);
|
||||
|
||||
|
@ -214,6 +222,10 @@ public class DmpBlueprintServiceImpl implements DmpBlueprintService {
|
|||
this.deleterFactory.deleter(DmpBlueprintDeleter.class).deleteAndSaveByIds(List.of(id));
|
||||
}
|
||||
|
||||
//endregion
|
||||
|
||||
//region FieldInBlueprint
|
||||
|
||||
public boolean fieldInBlueprint(DmpBlueprintEntity dmpBlueprintEntity, DmpBlueprintSystemFieldType type) {
|
||||
|
||||
DefinitionEntity definition = this.xmlHandlingService.fromXmlSafe(DefinitionEntity.class, dmpBlueprintEntity.getDefinition());
|
||||
|
@ -239,6 +251,10 @@ public class DmpBlueprintServiceImpl implements DmpBlueprintService {
|
|||
return this.fieldInBlueprint(data, type);
|
||||
}
|
||||
|
||||
//endregion
|
||||
|
||||
//region Clone
|
||||
|
||||
public DmpBlueprint buildClone(UUID id, FieldSet fields) throws MyForbiddenException, MyValidationException, MyApplicationException, MyNotFoundException {
|
||||
logger.debug(new MapLogEntry("persisting data").And("id", id).And("fields", fields));
|
||||
|
||||
|
@ -293,7 +309,11 @@ public class DmpBlueprintServiceImpl implements DmpBlueprintService {
|
|||
model.setId(UUID.randomUUID());
|
||||
}
|
||||
|
||||
public ResponseEntity<byte[]> exportXml(UUID id) throws MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, IOException, InstantiationException, IllegalAccessException, SAXException, TransformerException {
|
||||
//endregion
|
||||
|
||||
//region Export
|
||||
|
||||
public ResponseEntity<byte[]> exportXml(UUID id) throws MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, IOException, InstantiationException, IllegalAccessException, SAXException, TransformerException, InvalidApplicationException {
|
||||
logger.debug(new MapLogEntry("persisting data").And("id", id));
|
||||
|
||||
this.authorizationService.authorizeForce(Permission.ExportDmpBlueprint);
|
||||
|
@ -301,45 +321,189 @@ public class DmpBlueprintServiceImpl implements DmpBlueprintService {
|
|||
if (data == null) throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{id, DmpBlueprint.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||
|
||||
DefinitionEntity dmpDefinition = this.xmlHandlingService.fromXml(DefinitionEntity.class, data.getDefinition());
|
||||
String xml = this.buildExportXml(dmpDefinition);
|
||||
String xml = this.xmlHandlingService.toXml(this.definitionXmlToExport(dmpDefinition));
|
||||
return this.responseUtilsService.buildResponseFileFromText(xml, data.getLabel() + ".xml");
|
||||
}
|
||||
|
||||
private String buildExportXml(DefinitionEntity dmpDefinition) throws TransformerException, ParserConfigurationException {
|
||||
Document xmlDoc = this.xmlHandlingService.getDocument();
|
||||
Element root = xmlDoc.createElement("root");
|
||||
Element definition = xmlDoc.createElement("definition");
|
||||
Element sections = xmlDoc.createElement("sections");
|
||||
for (SectionEntity section : dmpDefinition.getSections()) {
|
||||
sections.appendChild(section.toXml(xmlDoc));
|
||||
private DefinitionImportExport definitionXmlToExport(DefinitionEntity entity){
|
||||
if (entity == null) return null;
|
||||
DefinitionImportExport xml = new DefinitionImportExport();
|
||||
List<SectionImportExport> dmpBlueprintSections = new ArrayList<>();
|
||||
if (!this.conventionService.isListNullOrEmpty(entity.getSections())) {
|
||||
for (SectionEntity section : entity.getSections()) {
|
||||
dmpBlueprintSections.add(this.sectionXmlToExport(section));
|
||||
}
|
||||
}
|
||||
definition.appendChild(sections);
|
||||
root.appendChild(definition);
|
||||
xmlDoc.appendChild(root);
|
||||
return this.xmlHandlingService.generateXml(xmlDoc);
|
||||
xml.setSections(dmpBlueprintSections);
|
||||
return xml;
|
||||
}
|
||||
|
||||
private SectionImportExport sectionXmlToExport(SectionEntity entity) {
|
||||
SectionImportExport xml = new SectionImportExport();
|
||||
xml.setId(entity.getId().toString());
|
||||
xml.setLabel(entity.getLabel());
|
||||
xml.setDescription(entity.getDescription());
|
||||
xml.setOrdinal(entity.getOrdinal());
|
||||
xml.setHasTemplates(entity.getHasTemplates());
|
||||
List<SystemFieldImportExport> dmpBlueprintSystemFieldModels = new LinkedList<>();
|
||||
if (!this.conventionService.isListNullOrEmpty(entity.getFields())) {
|
||||
for (SystemFieldEntity systemField : entity.getFields().stream().filter(x-> x.getCategory() == DmpBlueprintFieldCategory.System).map(x-> (SystemFieldEntity)x).toList()) {
|
||||
dmpBlueprintSystemFieldModels.add(this.systemFieldXmlToExport(systemField));
|
||||
}
|
||||
}
|
||||
xml.setSystemFields(dmpBlueprintSystemFieldModels);
|
||||
List<ExtraFieldImportExport> dmpBlueprintExtraFieldModels = new LinkedList<>();
|
||||
if (!this.conventionService.isListNullOrEmpty(entity.getFields())) {
|
||||
for (ExtraFieldEntity systemField : entity.getFields().stream().filter(x-> x.getCategory() == DmpBlueprintFieldCategory.Extra).map(x-> (ExtraFieldEntity)x).toList()) {
|
||||
dmpBlueprintExtraFieldModels.add(this.extraFieldXmlToExport(systemField));
|
||||
}
|
||||
}
|
||||
xml.setExtraFields(dmpBlueprintExtraFieldModels);
|
||||
|
||||
List<DescriptionTemplateImportExport> dmpBlueprintDescriptionTemplates = new LinkedList<>();
|
||||
if (!this.conventionService.isListNullOrEmpty(entity.getDescriptionTemplates())) {
|
||||
for (DescriptionTemplateEntity descriptionTemplate : entity.getDescriptionTemplates()) {
|
||||
dmpBlueprintDescriptionTemplates.add(this.descriptionTemplateXmlToExport(descriptionTemplate));
|
||||
}
|
||||
}
|
||||
xml.setDescriptionTemplates(dmpBlueprintDescriptionTemplates);
|
||||
return xml;
|
||||
}
|
||||
|
||||
private DescriptionTemplateImportExport descriptionTemplateXmlToExport(DescriptionTemplateEntity entity) {
|
||||
DescriptionTemplateImportExport xml = new DescriptionTemplateImportExport();
|
||||
xml.setId(entity.getId().toString());
|
||||
xml.setDescriptionTemplateId(entity.getDescriptionTemplateId().toString());
|
||||
xml.setLabel(entity.getLabel());
|
||||
xml.setMinMultiplicity(entity.getMinMultiplicity());
|
||||
xml.setMaxMultiplicity(entity.getMaxMultiplicity());
|
||||
return xml;
|
||||
}
|
||||
|
||||
private ExtraFieldImportExport extraFieldXmlToExport(ExtraFieldEntity entity) {
|
||||
ExtraFieldImportExport xml = new ExtraFieldImportExport();
|
||||
xml.setId(entity.getId().toString());
|
||||
xml.setType(entity.getType().getValue());
|
||||
xml.setLabel(entity.getLabel());
|
||||
xml.setPlaceholder(entity.getPlaceholder());
|
||||
xml.setDescription(entity.getDescription());
|
||||
xml.setOrdinal(entity.getOrdinal());
|
||||
xml.setRequired(entity.isRequired());
|
||||
return xml;
|
||||
}
|
||||
|
||||
private SystemFieldImportExport systemFieldXmlToExport(SystemFieldEntity entity) {
|
||||
SystemFieldImportExport xml = new SystemFieldImportExport();
|
||||
xml.setId(entity.getId().toString());
|
||||
xml.setType(entity.getType().getValue());
|
||||
xml.setLabel(entity.getLabel());
|
||||
xml.setPlaceholder(entity.getPlaceholder());
|
||||
xml.setDescription(entity.getDescription());
|
||||
xml.setOrdinal(entity.getOrdinal());
|
||||
xml.setRequired(entity.isRequired());
|
||||
return xml;
|
||||
}
|
||||
|
||||
|
||||
//endregion
|
||||
|
||||
//region Import
|
||||
|
||||
public DmpBlueprint importXml(byte[] bytes, String label, FieldSet fields) throws MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, TransformerException, InvalidApplicationException, IOException, InstantiationException, IllegalAccessException, SAXException {
|
||||
logger.debug(new MapLogEntry("import data").And("bytes", bytes).And("label", label).And("fields", fields));
|
||||
|
||||
this.authorizationService.authorizeForce(Permission.ImportDmpBlueprint);
|
||||
|
||||
eu.eudat.commons.types.dmpblueprint.importmodel.DmpBlueprint dmpDefinition = this.xmlHandlingService.fromXml(eu.eudat.commons.types.dmpblueprint.importmodel.DmpBlueprint.class, new String(bytes, StandardCharsets.UTF_8));
|
||||
DmpBlueprintEntity data = new DmpBlueprintEntity();
|
||||
data.setId(UUID.randomUUID());
|
||||
data.setIsActive(IsActive.Active);
|
||||
data.setCreatedAt(Instant.now());
|
||||
DmpBlueprintPersist persist = new DmpBlueprintPersist();
|
||||
|
||||
data.setLabel(label);
|
||||
data.setStatus(DmpBlueprintStatus.Draft);
|
||||
data.setUpdatedAt(Instant.now());
|
||||
data.setDefinition(this.xmlHandlingService.toXml(dmpDefinition.toDefinitionEntity()));
|
||||
persist.setLabel(label);
|
||||
persist.setStatus(DmpBlueprintStatus.Draft);
|
||||
|
||||
this.entityManager.persist(data);
|
||||
BlueprintImportExport dmpDefinition = this.xmlHandlingService.fromXml(BlueprintImportExport.class, new String(bytes, StandardCharsets.UTF_8));
|
||||
if(dmpDefinition != null) persist.setDefinition(this.xmlDefinitionToPersist(dmpDefinition.getDmpBlueprintDefinition()));
|
||||
|
||||
this.entityManager.flush();
|
||||
|
||||
return this.builderFactory.builder(DmpBlueprintBuilder.class).authorize(AuthorizationFlags.OwnerOrPermission).build(BaseFieldSet.build(fields, DmpBlueprint._id), data);
|
||||
this.validationService.validateForce(persist);
|
||||
return this.persist(persist, fields);
|
||||
}
|
||||
|
||||
private DefinitionPersist xmlDefinitionToPersist(DefinitionImportExport importXml){
|
||||
if (importXml == null) return null;
|
||||
DefinitionPersist persist = new DefinitionPersist();
|
||||
List<SectionPersist> dmpBlueprintSections = new ArrayList<>();
|
||||
if (!this.conventionService.isListNullOrEmpty(importXml.getSections())) {
|
||||
for (SectionImportExport section : importXml.getSections()) {
|
||||
dmpBlueprintSections.add(this.xmlSectionToPersist(section));
|
||||
}
|
||||
}
|
||||
persist.setSections(dmpBlueprintSections);
|
||||
return persist;
|
||||
}
|
||||
|
||||
private SectionPersist xmlSectionToPersist(SectionImportExport importXml) {
|
||||
SectionPersist persist = new SectionPersist();
|
||||
persist.setId(UUID.fromString(importXml.getId()));
|
||||
persist.setLabel(importXml.getLabel());
|
||||
persist.setDescription(importXml.getDescription());
|
||||
persist.setOrdinal(importXml.getOrdinal());
|
||||
persist.setHasTemplates(importXml.isHasTemplates());
|
||||
List<FieldPersist> dmpBlueprintFieldModels = new LinkedList<>();
|
||||
if (!this.conventionService.isListNullOrEmpty(importXml.getSystemFields())) {
|
||||
for (SystemFieldImportExport systemField : importXml.getSystemFields()) {
|
||||
dmpBlueprintFieldModels.add(this.xmlSystemFieldToPersist(systemField));
|
||||
}
|
||||
}
|
||||
if (!this.conventionService.isListNullOrEmpty(importXml.getExtraFields())) {
|
||||
for (ExtraFieldImportExport extraField : importXml.getExtraFields()) {
|
||||
dmpBlueprintFieldModels.add(this.xmlExtraFieldToPersist(extraField));
|
||||
}
|
||||
}
|
||||
persist.setFields(dmpBlueprintFieldModels);
|
||||
List<DescriptionTemplatePersist> dmpBlueprintDescriptionTemplates = new LinkedList<>();
|
||||
if (!this.conventionService.isListNullOrEmpty(importXml.getDescriptionTemplates())) {
|
||||
for (DescriptionTemplateImportExport descriptionTemplate : importXml.getDescriptionTemplates()) {
|
||||
dmpBlueprintDescriptionTemplates.add(this.xmlDescriptionTemplateToPersist(descriptionTemplate));
|
||||
}
|
||||
}
|
||||
persist.setDescriptionTemplates(dmpBlueprintDescriptionTemplates);
|
||||
return persist;
|
||||
}
|
||||
|
||||
private DescriptionTemplatePersist xmlDescriptionTemplateToPersist(DescriptionTemplateImportExport importXml) {
|
||||
DescriptionTemplatePersist persist = new DescriptionTemplatePersist();
|
||||
persist.setId(UUID.fromString(importXml.getId()));
|
||||
persist.setDescriptionTemplateId(UUID.fromString(importXml.getDescriptionTemplateId()));
|
||||
persist.setLabel(importXml.getLabel());
|
||||
persist.setMinMultiplicity(importXml.getMinMultiplicity());
|
||||
persist.setMaxMultiplicity(importXml.getMaxMultiplicity());
|
||||
return persist;
|
||||
}
|
||||
|
||||
private FieldPersist xmlExtraFieldToPersist(ExtraFieldImportExport importXml) {
|
||||
ExtraFieldPersist persist = new ExtraFieldPersist();
|
||||
persist.setId(UUID.fromString(importXml.getId()));
|
||||
persist.setCategory(DmpBlueprintFieldCategory.Extra);
|
||||
persist.setDataType(DmpBlueprintExtraFieldDataType.of(importXml.getType()));
|
||||
persist.setLabel(importXml.getLabel());
|
||||
persist.setPlaceholder(importXml.getPlaceholder());
|
||||
persist.setDescription(importXml.getDescription());
|
||||
persist.setOrdinal(importXml.getOrdinal());
|
||||
persist.setRequired(importXml.isRequired());
|
||||
return persist;
|
||||
}
|
||||
|
||||
private FieldPersist xmlSystemFieldToPersist(SystemFieldImportExport importXml) {
|
||||
SystemFieldPersist persist = new SystemFieldPersist();
|
||||
persist.setId(UUID.fromString(importXml.getId()));
|
||||
persist.setCategory(DmpBlueprintFieldCategory.System);
|
||||
persist.setSystemFieldType(DmpBlueprintSystemFieldType.of(importXml.getType()));
|
||||
persist.setLabel(importXml.getLabel());
|
||||
persist.setPlaceholder(importXml.getPlaceholder());
|
||||
persist.setDescription(importXml.getDescription());
|
||||
persist.setOrdinal(importXml.getOrdinal());
|
||||
persist.setRequired(importXml.isRequired());
|
||||
return persist;
|
||||
}
|
||||
|
||||
//endregion
|
||||
}
|
||||
|
||||
|
|
|
@ -159,7 +159,7 @@ public class DmpBlueprintController {
|
|||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = {"/xml/export/{id}"}, produces = "application/xml")
|
||||
public @ResponseBody ResponseEntity getXml(@PathVariable UUID id) throws JAXBException, ParserConfigurationException, IOException, TransformerException, InstantiationException, IllegalAccessException, SAXException {
|
||||
public @ResponseBody ResponseEntity getXml(@PathVariable UUID id) throws JAXBException, ParserConfigurationException, IOException, TransformerException, InstantiationException, IllegalAccessException, SAXException, InvalidApplicationException {
|
||||
logger.debug(new MapLogEntry("persisting" + DmpBlueprint.class.getSimpleName()).And("id", id));
|
||||
|
||||
ResponseEntity response = this.dmpBlueprintService.exportXml(id);
|
||||
|
|
Loading…
Reference in New Issue