Merge remote-tracking branch 'origin/dmp-refactoring' into dmp-refactoring
This commit is contained in:
commit
ac932ffb05
|
@ -9,6 +9,11 @@ public enum DmpBlueprintFieldCategory implements DatabaseEnum<Short> {
|
|||
System((short) 0),
|
||||
Extra((short) 1);
|
||||
|
||||
public static class Names {
|
||||
public static final String System = "system";
|
||||
public static final String Extra = "extra";
|
||||
}
|
||||
|
||||
private final Short value;
|
||||
|
||||
DmpBlueprintFieldCategory(Short value) {
|
||||
|
|
|
@ -13,7 +13,7 @@ import java.util.List;
|
|||
|
||||
@XmlRootElement(name = "root")
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class DefinitionEntity implements XmlSerializable<DefinitionEntity> {
|
||||
public class DefinitionEntity {
|
||||
@XmlElementWrapper(name = "sections")
|
||||
@XmlElement(name = "section")
|
||||
private List<SectionEntity> sections;
|
||||
|
@ -24,32 +24,4 @@ public class DefinitionEntity implements XmlSerializable<DefinitionEntity> {
|
|||
public void setSections(List<SectionEntity> sections) {
|
||||
this.sections = sections;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Element toXml(Document doc) {
|
||||
Element root = doc.createElement("root");
|
||||
Element sections = doc.createElement("sections");
|
||||
for (SectionEntity section : this.sections) {
|
||||
sections.appendChild(section.toXml(doc));
|
||||
}
|
||||
root.appendChild(sections);
|
||||
return root;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DefinitionEntity fromXml(Element item) {
|
||||
this.sections = new LinkedList<>();
|
||||
Element sections = (Element) XmlBuilder.getNodeFromListByTagName(item.getChildNodes(), "sections");
|
||||
if (sections != null) {
|
||||
NodeList sectionElements = sections.getChildNodes();
|
||||
for (int temp = 0; temp < sectionElements.getLength(); temp++) {
|
||||
Node sectionElement = sectionElements.item(temp);
|
||||
if (sectionElement.getNodeType() == Node.ELEMENT_NODE) {
|
||||
this.sections.add(new SectionEntity().fromXml((Element) sectionElement));
|
||||
}
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -10,12 +10,10 @@ import org.w3c.dom.Element;
|
|||
import java.util.UUID;
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class DescriptionTemplateEntity implements XmlSerializable<DescriptionTemplateEntity> {
|
||||
public class DescriptionTemplateEntity {
|
||||
|
||||
@XmlAttribute(name="id")
|
||||
private UUID id;
|
||||
@XmlAttribute(name="descriptionTemplateId")
|
||||
private UUID descriptionTemplateId;
|
||||
@XmlAttribute(name="descriptionTemplateGroupId")
|
||||
private UUID descriptionTemplateGroupId;
|
||||
@XmlAttribute(name="label")
|
||||
private String label;
|
||||
@XmlAttribute(name="minMultiplicity")
|
||||
|
@ -23,18 +21,12 @@ public class DescriptionTemplateEntity implements XmlSerializable<DescriptionTem
|
|||
@XmlAttribute(name="maxMultiplicity")
|
||||
private Integer maxMultiplicity;
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
public UUID getDescriptionTemplateGroupId() {
|
||||
return descriptionTemplateGroupId;
|
||||
}
|
||||
|
||||
public UUID getDescriptionTemplateId() {
|
||||
return descriptionTemplateId;
|
||||
}
|
||||
public void setDescriptionTemplateId(UUID descriptionTemplateId) {
|
||||
this.descriptionTemplateId = descriptionTemplateId;
|
||||
public void setDescriptionTemplateGroupId(UUID descriptionTemplateGroupId) {
|
||||
this.descriptionTemplateGroupId = descriptionTemplateGroupId;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
|
@ -58,24 +50,4 @@ public class DescriptionTemplateEntity implements XmlSerializable<DescriptionTem
|
|||
this.maxMultiplicity = maxMultiplicity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Element toXml(Document doc) {
|
||||
Element rootElement = doc.createElement("descriptionTemplate");
|
||||
rootElement.setAttribute("id", this.getId().toString());
|
||||
rootElement.setAttribute("descriptionTemplateId", this.getDescriptionTemplateId().toString());
|
||||
rootElement.setAttribute("label", this.label);
|
||||
rootElement.setAttribute("minMultiplicity", String.valueOf(this.minMultiplicity));
|
||||
rootElement.setAttribute("maxMultiplicity", String.valueOf(this.maxMultiplicity));
|
||||
return rootElement;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DescriptionTemplateEntity fromXml(Element item) {
|
||||
this.id = UUID.fromString(item.getAttribute("id"));
|
||||
this.descriptionTemplateId = UUID.fromString(item.getAttribute("descriptionTemplateId"));
|
||||
this.label = item.getAttribute("label");
|
||||
this.minMultiplicity = item.hasAttribute("minMultiplicity") && !item.getAttribute("minMultiplicity").equals("null") ? Integer.parseInt(item.getAttribute("minMultiplicity")) : null;
|
||||
this.maxMultiplicity = item.hasAttribute("maxMultiplicity") && !item.getAttribute("minMultiplicity").equals("null") ? Integer.parseInt(item.getAttribute("maxMultiplicity")) : null;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,16 +20,4 @@ public class ExtraFieldEntity extends FieldEntity {
|
|||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Element appendXmlChild(Element rootElement) {
|
||||
rootElement.setAttribute("type", String.valueOf(this.type.getValue()));
|
||||
return rootElement;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExtraFieldEntity fromXmlChild(Element item) {
|
||||
this.type = DmpBlueprintExtraFieldDataType.of(Short.parseShort(item.getAttribute("type")));
|
||||
this.setCategory(DmpBlueprintFieldCategory.Extra);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,11 +13,11 @@ import org.w3c.dom.Element;
|
|||
import java.util.UUID;
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public abstract class FieldEntity implements XmlSerializable<FieldEntity> {
|
||||
public abstract class FieldEntity {
|
||||
@XmlAttribute(name="id")
|
||||
private UUID id;
|
||||
|
||||
@XmlTransient
|
||||
@XmlAttribute(name="category")
|
||||
private DmpBlueprintFieldCategory category;
|
||||
|
||||
@XmlAttribute(name="label")
|
||||
|
@ -83,30 +83,5 @@ public abstract class FieldEntity implements XmlSerializable<FieldEntity> {
|
|||
public void setRequired(boolean required) {
|
||||
this.required = required;
|
||||
}
|
||||
protected abstract Element appendXmlChild(Element rootElement);
|
||||
protected abstract FieldEntity fromXmlChild(Element item);
|
||||
@Override
|
||||
public Element toXml(Document doc) {
|
||||
Element rootElement = doc.createElement("extraField");
|
||||
rootElement.setAttribute("id", this.getId().toString());
|
||||
rootElement.setAttribute("label", this.label);
|
||||
rootElement.setAttribute("description", this.description);
|
||||
rootElement.setAttribute("placeholder", this.placeholder);
|
||||
rootElement.setAttribute("required", String.valueOf(this.required));
|
||||
rootElement.setAttribute("ordinal", String.valueOf(this.ordinal));
|
||||
this.appendXmlChild(rootElement);
|
||||
return rootElement;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FieldEntity fromXml(Element item) {
|
||||
this.id = UUID.fromString(item.getAttribute("id"));
|
||||
this.label = item.getAttribute("label");
|
||||
this.description = item.getAttribute("description");
|
||||
this.placeholder = item.getAttribute("placeholder");
|
||||
this.required = Boolean.parseBoolean(item.getAttribute("required"));
|
||||
this.ordinal = Integer.valueOf(item.getAttribute("ordinal"));
|
||||
this.fromXmlChild(item);
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
package eu.eudat.commons.types.dmpblueprint;
|
||||
|
||||
import eu.eudat.commons.enums.DmpBlueprintFieldCategory;
|
||||
import eu.eudat.commons.enums.ReferenceTypeSourceType;
|
||||
import eu.eudat.commons.types.referencetype.ReferenceTypeSourceBaseConfigurationEntity;
|
||||
import eu.eudat.commons.types.referencetype.ReferenceTypeSourceExternalApiConfigurationEntity;
|
||||
import eu.eudat.commons.types.referencetype.ReferenceTypeSourceStaticOptionConfigurationEntity;
|
||||
import eu.eudat.commons.types.xml.XmlBuilder;
|
||||
import eu.eudat.commons.types.xml.XmlSerializable;
|
||||
import jakarta.xml.bind.annotation.*;
|
||||
|
@ -15,7 +19,7 @@ import java.util.UUID;
|
|||
import java.util.stream.Collectors;
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class SectionEntity implements XmlSerializable<SectionEntity> {
|
||||
public class SectionEntity {
|
||||
|
||||
@XmlAttribute(name="id")
|
||||
private UUID id;
|
||||
|
@ -29,9 +33,13 @@ public class SectionEntity implements XmlSerializable<SectionEntity> {
|
|||
@XmlAttribute(name="ordinal")
|
||||
private Integer ordinal;
|
||||
|
||||
@XmlTransient
|
||||
@XmlElementWrapper(name = "fields")
|
||||
@XmlElements({
|
||||
@XmlElement(name = DmpBlueprintFieldCategory.Names.Extra, type = ExtraFieldEntity.class),
|
||||
@XmlElement(name = DmpBlueprintFieldCategory.Names.System, type = SystemFieldEntity.class),
|
||||
})
|
||||
private List<FieldEntity> fields;
|
||||
|
||||
|
||||
@XmlAttribute(name="hasTemplates")
|
||||
private Boolean hasTemplates;
|
||||
|
||||
|
@ -88,78 +96,4 @@ public class SectionEntity implements XmlSerializable<SectionEntity> {
|
|||
this.descriptionTemplates = descriptionTemplates;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Element toXml(Document doc) {
|
||||
Element rootElement = doc.createElement("section");
|
||||
rootElement.setAttribute("id", this.getId().toString());
|
||||
rootElement.setAttribute("label", this.label);
|
||||
rootElement.setAttribute("description", this.description);
|
||||
rootElement.setAttribute("ordinal", String.valueOf(this.ordinal));
|
||||
rootElement.setAttribute("hasTemplates", String.valueOf(this.hasTemplates));
|
||||
List<FieldEntity> temp = this.fields.stream().filter(f -> f.getCategory().equals(DmpBlueprintFieldCategory.System)).collect(Collectors.toList());
|
||||
List<SystemFieldEntity> systemFieldsList = temp.stream().map(x-> (SystemFieldEntity)x).collect(Collectors.toList());
|
||||
Element systemFields = doc.createElement("systemFields");
|
||||
for (SystemFieldEntity systemField : systemFieldsList) {
|
||||
systemFields.appendChild(systemField.toXml(doc));
|
||||
}
|
||||
rootElement.appendChild(systemFields);
|
||||
if (this.descriptionTemplates != null) {
|
||||
Element descriptionTemplates = doc.createElement("descriptionTemplates");
|
||||
for (DescriptionTemplateEntity descriptionTemplate : this.descriptionTemplates) {
|
||||
descriptionTemplates.appendChild(descriptionTemplate.toXml(doc));
|
||||
}
|
||||
rootElement.appendChild(descriptionTemplates);
|
||||
}
|
||||
temp = this.fields.stream().filter(f -> f.getCategory().equals(DmpBlueprintFieldCategory.Extra)).collect(Collectors.toList());
|
||||
List<ExtraFieldEntity> extraFieldList = temp.stream().map(x-> (ExtraFieldEntity)x).collect(Collectors.toList());
|
||||
Element extraFields = doc.createElement("extraFields");
|
||||
for (ExtraFieldEntity extraField : extraFieldList) {
|
||||
extraFields.appendChild(extraField.toXml(doc));
|
||||
}
|
||||
rootElement.appendChild(extraFields);
|
||||
|
||||
return rootElement;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SectionEntity fromXml(Element item) {
|
||||
this.id = UUID.fromString(item.getAttribute("id"));
|
||||
this.label = item.getAttribute("label");
|
||||
this.description = item.getAttribute("description");
|
||||
this.ordinal = Integer.valueOf(item.getAttribute("ordinal"));
|
||||
this.hasTemplates = Boolean.valueOf(item.getAttribute("hasTemplates"));
|
||||
this.fields = new LinkedList<>();
|
||||
Element systemFields = (Element) XmlBuilder.getNodeFromListByTagName(item.getChildNodes(), "systemFields");
|
||||
if (systemFields != null) {
|
||||
NodeList systemFieldElements = systemFields.getChildNodes();
|
||||
for (int temp = 0; temp < systemFieldElements.getLength(); temp++) {
|
||||
Node systemFieldElement = systemFieldElements.item(temp);
|
||||
if (systemFieldElement.getNodeType() == Node.ELEMENT_NODE) {
|
||||
this.fields.add(new SystemFieldEntity().fromXml((Element) systemFieldElement));
|
||||
}
|
||||
}
|
||||
}
|
||||
this.descriptionTemplates = new LinkedList<>();
|
||||
Element descriptionTemplates = (Element) XmlBuilder.getNodeFromListByTagName(item.getChildNodes(), "descriptionTemplates");
|
||||
if (descriptionTemplates != null) {
|
||||
NodeList descriptionTemplateElements = descriptionTemplates.getChildNodes();
|
||||
for (int temp = 0; temp < descriptionTemplateElements.getLength(); temp++) {
|
||||
Node descriptionTemplateElement = descriptionTemplateElements.item(temp);
|
||||
if (descriptionTemplateElement.getNodeType() == Node.ELEMENT_NODE) {
|
||||
this.descriptionTemplates.add(new DescriptionTemplateEntity().fromXml((Element) descriptionTemplateElement));
|
||||
}
|
||||
}
|
||||
}
|
||||
Element extraFields = (Element) XmlBuilder.getNodeFromListByTagName(item.getChildNodes(), "extraFields");
|
||||
if (extraFields != null) {
|
||||
NodeList extraFieldElements = extraFields.getChildNodes();
|
||||
for (int temp = 0; temp < extraFieldElements.getLength(); temp++) {
|
||||
Node extraFieldElement = extraFieldElements.item(temp);
|
||||
if (extraFieldElement.getNodeType() == Node.ELEMENT_NODE) {
|
||||
this.fields.add(new ExtraFieldEntity().fromXml((Element) extraFieldElement));
|
||||
}
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,17 +23,4 @@ public class SystemFieldEntity extends FieldEntity {
|
|||
public void setType(DmpBlueprintSystemFieldType type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Element appendXmlChild(Element rootElement) {
|
||||
rootElement.setAttribute("type", String.valueOf(this.type.getValue()));
|
||||
return rootElement;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SystemFieldEntity fromXmlChild(Element item) {
|
||||
this.type = DmpBlueprintSystemFieldType.of(Short.parseShort(item.getAttribute("type")));
|
||||
this.setCategory(DmpBlueprintFieldCategory.System);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,10 +9,8 @@ import java.util.UUID;
|
|||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class DescriptionTemplateImportExport {
|
||||
|
||||
@XmlAttribute(name = "id")
|
||||
private UUID id;
|
||||
@XmlAttribute(name = "descriptionTemplateId")
|
||||
private UUID descriptionTemplateId;
|
||||
@XmlAttribute(name = "descriptionTemplateGroupId")
|
||||
private UUID descriptionTemplateGroupId;
|
||||
@XmlAttribute(name = "label")
|
||||
private String label;
|
||||
@XmlAttribute(name = "minMultiplicity")
|
||||
|
@ -20,20 +18,12 @@ public class DescriptionTemplateImportExport {
|
|||
@XmlAttribute(name = "maxMultiplicity")
|
||||
private int maxMultiplicity;
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
public UUID getDescriptionTemplateGroupId() {
|
||||
return descriptionTemplateGroupId;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public UUID getDescriptionTemplateId() {
|
||||
return descriptionTemplateId;
|
||||
}
|
||||
|
||||
public void setDescriptionTemplateId(UUID descriptionTemplateId) {
|
||||
this.descriptionTemplateId = descriptionTemplateId;
|
||||
public void setDescriptionTemplateGroupId(UUID descriptionTemplateGroupId) {
|
||||
this.descriptionTemplateGroupId = descriptionTemplateGroupId;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
|
|
|
@ -45,8 +45,7 @@ public class DescriptionTemplateBuilder extends BaseBuilder<DescriptionTemplate,
|
|||
for (DescriptionTemplateEntity d : data) {
|
||||
DescriptionTemplate m = new DescriptionTemplate();
|
||||
if (fields.hasField(this.asIndexer(DescriptionTemplate._label))) m.setLabel(d.getLabel());
|
||||
if (fields.hasField(this.asIndexer(DescriptionTemplate._descriptionTemplateId))) m.setDescriptionTemplateId(d.getDescriptionTemplateId());
|
||||
if (fields.hasField(this.asIndexer(DescriptionTemplate._id))) m.setId(d.getId());
|
||||
if (fields.hasField(this.asIndexer(DescriptionTemplate._descriptionTemplateGroupId))) m.setDescriptionTemplateGroupId(d.getDescriptionTemplateGroupId());
|
||||
if (fields.hasField(this.asIndexer(DescriptionTemplate._maxMultiplicity))) m.setMaxMultiplicity(d.getMaxMultiplicity());
|
||||
if (fields.hasField(this.asIndexer(DescriptionTemplate._minMultiplicity))) m.setMinMultiplicity(d.getMinMultiplicity());
|
||||
models.add(m);
|
||||
|
|
|
@ -4,11 +4,9 @@ import java.util.UUID;
|
|||
|
||||
public class DescriptionTemplate {
|
||||
|
||||
public final static String _id = "id";
|
||||
private UUID id;
|
||||
|
||||
public final static String _descriptionTemplateId = "descriptionTemplateId";
|
||||
private UUID descriptionTemplateId;
|
||||
public final static String _descriptionTemplateGroupId = "descriptionTemplateGroupId";
|
||||
private UUID descriptionTemplateGroupId;
|
||||
|
||||
public final static String _label = "label";
|
||||
private String label;
|
||||
|
@ -19,20 +17,12 @@ public class DescriptionTemplate {
|
|||
public final static String _maxMultiplicity = "maxMultiplicity";
|
||||
private Integer maxMultiplicity;
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
public UUID getDescriptionTemplateGroupId() {
|
||||
return descriptionTemplateGroupId;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public UUID getDescriptionTemplateId() {
|
||||
return descriptionTemplateId;
|
||||
}
|
||||
|
||||
public void setDescriptionTemplateId(UUID descriptionTemplateId) {
|
||||
this.descriptionTemplateId = descriptionTemplateId;
|
||||
public void setDescriptionTemplateGroupId(UUID descriptionTemplateGroupId) {
|
||||
this.descriptionTemplateGroupId = descriptionTemplateGroupId;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
|
|
|
@ -16,13 +16,9 @@ import java.util.UUID;
|
|||
|
||||
public class DescriptionTemplatePersist {
|
||||
|
||||
private UUID id = null;
|
||||
private UUID descriptionTemplateGroupId = null;
|
||||
|
||||
public static final String _id = "id";
|
||||
|
||||
private UUID descriptionTemplateId = null;
|
||||
|
||||
public static final String _descriptionTemplateId = "descriptionTemplateId";
|
||||
public static final String _descriptionTemplateGroupId = "descriptionTemplateGroupId";
|
||||
|
||||
private String label = null;
|
||||
|
||||
|
@ -36,20 +32,12 @@ public class DescriptionTemplatePersist {
|
|||
|
||||
public static final String _maxMultiplicity = "maxMultiplicity";
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
public UUID getDescriptionTemplateGroupId() {
|
||||
return descriptionTemplateGroupId;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public UUID getDescriptionTemplateId() {
|
||||
return descriptionTemplateId;
|
||||
}
|
||||
|
||||
public void setDescriptionTemplateId(UUID descriptionTemplateId) {
|
||||
this.descriptionTemplateId = descriptionTemplateId;
|
||||
public void setDescriptionTemplateGroupId(UUID descriptionTemplateGroupId) {
|
||||
this.descriptionTemplateGroupId = descriptionTemplateGroupId;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
|
@ -98,11 +86,8 @@ public class DescriptionTemplatePersist {
|
|||
protected List<Specification> specifications(DescriptionTemplatePersist item) {
|
||||
return Arrays.asList(
|
||||
this.spec()
|
||||
.must(() -> this.isValidGuid(item.getId()))
|
||||
.failOn(DescriptionTemplatePersist._id).failWith(messageSource.getMessage("Validation_Required", new Object[]{DescriptionTemplatePersist._id}, LocaleContextHolder.getLocale())),
|
||||
this.spec()
|
||||
.must(() -> this.isValidGuid(item.getDescriptionTemplateId()))
|
||||
.failOn(DescriptionTemplatePersist._descriptionTemplateId).failWith(messageSource.getMessage("Validation_Required", new Object[]{DescriptionTemplatePersist._descriptionTemplateId}, LocaleContextHolder.getLocale()))
|
||||
.must(() -> this.isValidGuid(item.getDescriptionTemplateGroupId()))
|
||||
.failOn(DescriptionTemplatePersist._descriptionTemplateGroupId).failWith(messageSource.getMessage("Validation_Required", new Object[]{DescriptionTemplatePersist._descriptionTemplateGroupId}, LocaleContextHolder.getLocale()))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -199,8 +199,7 @@ public class DmpBlueprintServiceImpl implements DmpBlueprintService {
|
|||
if (persist == null)
|
||||
return data;
|
||||
|
||||
data.setId(persist.getId());
|
||||
data.setDescriptionTemplateId(persist.getDescriptionTemplateId());
|
||||
data.setDescriptionTemplateGroupId(persist.getDescriptionTemplateGroupId());
|
||||
data.setLabel(persist.getLabel());
|
||||
data.setMaxMultiplicity(persist.getMaxMultiplicity());
|
||||
data.setMinMultiplicity(persist.getMinMultiplicity());
|
||||
|
@ -320,11 +319,6 @@ public class DmpBlueprintServiceImpl implements DmpBlueprintService {
|
|||
this.reassignField(field);
|
||||
}
|
||||
}
|
||||
if (model.getDescriptionTemplates() != null) {
|
||||
for (DescriptionTemplate descriptionTemplate : model.getDescriptionTemplates()) {
|
||||
this.reassignDescriptionTemplate(descriptionTemplate);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void reassignField(Field model) {
|
||||
|
@ -333,11 +327,6 @@ public class DmpBlueprintServiceImpl implements DmpBlueprintService {
|
|||
model.setId(UUID.randomUUID());
|
||||
}
|
||||
|
||||
private void reassignDescriptionTemplate(DescriptionTemplate model) {
|
||||
if (model == null)
|
||||
return;
|
||||
model.setId(UUID.randomUUID());
|
||||
}
|
||||
|
||||
//endregion
|
||||
|
||||
|
@ -404,8 +393,7 @@ public class DmpBlueprintServiceImpl implements DmpBlueprintService {
|
|||
|
||||
private DescriptionTemplateImportExport descriptionTemplateXmlToExport(DescriptionTemplateEntity entity) {
|
||||
DescriptionTemplateImportExport xml = new DescriptionTemplateImportExport();
|
||||
xml.setId(entity.getId());
|
||||
xml.setDescriptionTemplateId(entity.getDescriptionTemplateId());
|
||||
xml.setDescriptionTemplateGroupId(entity.getDescriptionTemplateGroupId());
|
||||
xml.setLabel(entity.getLabel());
|
||||
xml.setMinMultiplicity(entity.getMinMultiplicity());
|
||||
xml.setMaxMultiplicity(entity.getMaxMultiplicity());
|
||||
|
@ -503,8 +491,7 @@ public class DmpBlueprintServiceImpl implements DmpBlueprintService {
|
|||
|
||||
private DescriptionTemplatePersist xmlDescriptionTemplateToPersist(DescriptionTemplateImportExport importXml) {
|
||||
DescriptionTemplatePersist persist = new DescriptionTemplatePersist();
|
||||
persist.setId(importXml.getId());
|
||||
persist.setDescriptionTemplateId(importXml.getDescriptionTemplateId());
|
||||
persist.setDescriptionTemplateGroupId(importXml.getDescriptionTemplateGroupId());
|
||||
persist.setLabel(importXml.getLabel());
|
||||
persist.setMinMultiplicity(importXml.getMinMultiplicity());
|
||||
persist.setMaxMultiplicity(importXml.getMaxMultiplicity());
|
||||
|
|
|
@ -1928,7 +1928,7 @@ public class DataManagementPlanManager {
|
|||
Element extraFields = xmlDoc.createElement("extraFields");
|
||||
Map<String, Object> dmpProperties = new ObjectMapper().readValue(dmp.getProperties(), new TypeReference<Map<String, Object>>() {});
|
||||
|
||||
DefinitionEntity blueprint = new DefinitionEntity().fromXml(XmlBuilder.fromXml(this.queryFactory.query(DmpBlueprintQuery.class).ids(dmp.getBlueprintId()).first().getDefinition()).getDocumentElement());
|
||||
DefinitionEntity blueprint = new DefinitionEntity(); //new DefinitionEntity().fromXml(XmlBuilder.fromXml(this.queryFactory.query(DmpBlueprintQuery.class).ids(dmp.getBlueprintId()).first().getDefinition()).getDocumentElement());
|
||||
|
||||
blueprint.getSections().forEach(section -> {
|
||||
section.getFields().forEach(fieldModel -> {
|
||||
|
|
|
@ -29,8 +29,7 @@ export interface DmpBlueprintDefinitionSection {
|
|||
}
|
||||
|
||||
export interface DescriptionTemplatesInSection {
|
||||
id: Guid;
|
||||
descriptionTemplateId: Guid;
|
||||
descriptionTemplateGroupId: Guid;
|
||||
label: string;
|
||||
minMultiplicity: number;
|
||||
maxMultiplicity: number;
|
||||
|
@ -73,8 +72,7 @@ export interface DmpBlueprintDefinitionSectionPersist {
|
|||
}
|
||||
|
||||
export interface DescriptionTemplatesInSectionPersist {
|
||||
id: Guid;
|
||||
descriptionTemplateId: Guid;
|
||||
descriptionTemplateGroupId: Guid;
|
||||
label: string;
|
||||
minMultiplicity: number;
|
||||
maxMultiplicity: number;
|
||||
|
|
|
@ -88,8 +88,8 @@ export class DmpBlueprintEditorModel extends BaseEditorModel implements DmpBluep
|
|||
|
||||
createChildDescriptionTemplate(item: any, sectionIndex: number, index: number): UntypedFormGroup {
|
||||
const descriptionTemplate: DescriptionTemplatesInSectionEditorModel = new DescriptionTemplatesInSectionEditorModel(this.validationErrorModel);
|
||||
descriptionTemplate.id = Guid.create();
|
||||
descriptionTemplate.descriptionTemplateId = item.id;
|
||||
// descriptionTemplate.id = Guid.create();
|
||||
descriptionTemplate.descriptionTemplateGroupId = item.descriptionTemplateGroupId;
|
||||
descriptionTemplate.label = item.label;
|
||||
return descriptionTemplate.buildForm({ rootPath: 'definition.sections[' + sectionIndex + '].descriptionTemplates[' + index + '].' });
|
||||
}
|
||||
|
@ -419,8 +419,7 @@ export class FieldInSectionEditorModel implements FieldInSectionPersist {
|
|||
}
|
||||
|
||||
export class DescriptionTemplatesInSectionEditorModel implements DescriptionTemplatesInSectionPersist {
|
||||
id: Guid;
|
||||
descriptionTemplateId: Guid;
|
||||
descriptionTemplateGroupId: Guid;
|
||||
label: string;
|
||||
minMultiplicity: number;
|
||||
maxMultiplicity: number;
|
||||
|
@ -432,8 +431,7 @@ export class DescriptionTemplatesInSectionEditorModel implements DescriptionTemp
|
|||
) { }
|
||||
|
||||
fromModel(item: DescriptionTemplatesInSection): DescriptionTemplatesInSectionEditorModel {
|
||||
this.id = item.id;
|
||||
this.descriptionTemplateId = item.descriptionTemplateId;
|
||||
this.descriptionTemplateGroupId = item.descriptionTemplateGroupId;
|
||||
this.label = item.label;
|
||||
this.minMultiplicity = item.minMultiplicity;
|
||||
this.maxMultiplicity = item.maxMultiplicity;
|
||||
|
@ -454,8 +452,7 @@ export class DescriptionTemplatesInSectionEditorModel implements DescriptionTemp
|
|||
}
|
||||
|
||||
return this.formBuilder.group({
|
||||
id: [{ value: this.id, disabled: disabled }, context.getValidation('id').validators],
|
||||
descriptionTemplateId: [{ value: this.descriptionTemplateId, disabled: disabled }, context.getValidation('descriptionTemplateId').validators],
|
||||
descriptionTemplateGroupId: [{ value: this.descriptionTemplateGroupId, disabled: disabled }, context.getValidation('descriptionTemplateGroupId').validators],
|
||||
label: [{ value: this.label, disabled: disabled }, context.getValidation('label').validators],
|
||||
minMultiplicity: [{ value: this.minMultiplicity, disabled: disabled }, context.getValidation('minMultiplicity').validators],
|
||||
maxMultiplicity: [{ value: this.maxMultiplicity, disabled: disabled }, context.getValidation('maxMultiplicity').validators],
|
||||
|
@ -470,8 +467,7 @@ export class DescriptionTemplatesInSectionEditorModel implements DescriptionTemp
|
|||
|
||||
const baseContext: ValidationContext = new ValidationContext();
|
||||
const baseValidationArray: Validation[] = new Array<Validation>();
|
||||
baseValidationArray.push({ key: 'id', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}id`)] });
|
||||
baseValidationArray.push({ key: 'descriptionTemplateId', validators: [Validators.required, BackendErrorValidator(validationErrorModel, `${rootPath}descriptionTemplateId`)] });
|
||||
baseValidationArray.push({ key: 'descriptionTemplateGroupId', validators: [Validators.required, BackendErrorValidator(validationErrorModel, `${rootPath}descriptionTemplateGroupId`)] });
|
||||
baseValidationArray.push({ key: 'label', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}label`)] });
|
||||
baseValidationArray.push({ key: 'minMultiplicity', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}minMultiplicity`)] });
|
||||
baseValidationArray.push({ key: 'maxMultiplicity', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}maxMultiplicity`)] });
|
||||
|
|
|
@ -39,8 +39,7 @@ export class DmpBlueprintEditorResolver extends BaseEditorResolver {
|
|||
[nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.fields), nameof<FieldInSection>(x => x.required)].join('.'),
|
||||
[nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.fields), nameof<FieldInSection>(x => x.ordinal)].join('.'),
|
||||
|
||||
[nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.descriptionTemplates), nameof<DescriptionTemplatesInSection>(x => x.id)].join('.'),
|
||||
[nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.descriptionTemplates), nameof<DescriptionTemplatesInSection>(x => x.descriptionTemplateId)].join('.'),
|
||||
[nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.descriptionTemplates), nameof<DescriptionTemplatesInSection>(x => x.descriptionTemplateGroupId)].join('.'),
|
||||
[nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.descriptionTemplates), nameof<DescriptionTemplatesInSection>(x => x.label)].join('.'),
|
||||
[nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.descriptionTemplates), nameof<DescriptionTemplatesInSection>(x => x.minMultiplicity)].join('.'),
|
||||
[nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.descriptionTemplates), nameof<DescriptionTemplatesInSection>(x => x.maxMultiplicity)].join('.'),
|
||||
|
|
|
@ -37,8 +37,8 @@ export class DescriptionEditorResolver extends BaseEditorResolver {
|
|||
[nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.blueprint), nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.label)].join('.'),
|
||||
[nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.blueprint), nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.ordinal)].join('.'),
|
||||
[nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.blueprint), nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.hasTemplates)].join('.'),
|
||||
[nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.blueprint), nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.descriptionTemplates), nameof<DescriptionTemplatesInSection>(x => x.id)].join('.'),
|
||||
[nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.blueprint), nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.descriptionTemplates), nameof<DescriptionTemplatesInSection>(x => x.descriptionTemplateId)].join('.'),
|
||||
// [nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.blueprint), nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.descriptionTemplates), nameof<DescriptionTemplatesInSection>(x => x.id)].join('.'),
|
||||
[nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.blueprint), nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.descriptionTemplates), nameof<DescriptionTemplatesInSection>(x => x.descriptionTemplateGroupId)].join('.'),
|
||||
// [nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.blueprint), nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.descriptionTemplates), nameof<DescriptionTemplatesInSection>(x => x.label)].join('.'),
|
||||
// [nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.blueprint), nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.descriptionTemplates), nameof<DescriptionTemplatesInSection>(x => x.minMultiplicity)].join('.'),
|
||||
// [nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.blueprint), nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.descriptionTemplates), nameof<DescriptionTemplatesInSection>(x => x.maxMultiplicity)].join('.'),
|
||||
|
|
|
@ -56,7 +56,7 @@ export class DmpEditorModel extends BaseEditorModel implements DmpPersist {
|
|||
this.descriptionTemplates.push(new DmpDescriptionTemplateEditorModel(this.validationErrorModel).fromModel(
|
||||
{
|
||||
sectionId: section.id,
|
||||
descriptionTemplateGroupId: blueprintDefinedDescriptionTemplate?.descriptionTemplateId,
|
||||
descriptionTemplateGroupId: blueprintDefinedDescriptionTemplate?.descriptionTemplateGroupId,
|
||||
}));
|
||||
});
|
||||
} else {
|
||||
|
|
|
@ -89,8 +89,7 @@ export class DmpEditorResolver extends BaseEditorResolver {
|
|||
(prefix ? prefix + '.' : '') + [nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.label)].join('.'),
|
||||
(prefix ? prefix + '.' : '') + [nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.ordinal)].join('.'),
|
||||
(prefix ? prefix + '.' : '') + [nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.hasTemplates)].join('.'),
|
||||
(prefix ? prefix + '.' : '') + [nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.descriptionTemplates), nameof<DescriptionTemplatesInSection>(x => x.id)].join('.'),
|
||||
(prefix ? prefix + '.' : '') + [nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.descriptionTemplates), nameof<DescriptionTemplatesInSection>(x => x.descriptionTemplateId)].join('.'),
|
||||
(prefix ? prefix + '.' : '') + [nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.descriptionTemplates), nameof<DescriptionTemplatesInSection>(x => x.descriptionTemplateGroupId)].join('.'),
|
||||
(prefix ? prefix + '.' : '') + [nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.fields), nameof<FieldInSection>(x => x.id)].join('.'),
|
||||
(prefix ? prefix + '.' : '') + [nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.fields), nameof<FieldInSection>(x => x.category)].join('.'),
|
||||
(prefix ? prefix + '.' : '') + [nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.fields), nameof<FieldInSection>(x => x.dataType)].join('.'),
|
||||
|
|
Loading…
Reference in New Issue