DmpBlueprint refactor
This commit is contained in:
parent
0b3178177a
commit
88088d64fd
|
@ -28,6 +28,11 @@ public final class Permission {
|
||||||
public static String EditDescriptionTemplateType = "EditDescriptionTemplateType";
|
public static String EditDescriptionTemplateType = "EditDescriptionTemplateType";
|
||||||
public static String DeleteDescriptionTemplateType = "DeleteDescriptionTemplateType";
|
public static String DeleteDescriptionTemplateType = "DeleteDescriptionTemplateType";
|
||||||
|
|
||||||
|
//DmpBlueprint
|
||||||
|
public static String BrowseDmpBlueprint = "BrowseDmpBlueprint";
|
||||||
|
public static String EditDmpBlueprint = "EditDmpBlueprint";
|
||||||
|
public static String DeleteDmpBlueprint = "DeleteDmpBlueprint";
|
||||||
|
|
||||||
//DescriptionTemplateType
|
//DescriptionTemplateType
|
||||||
public static String BrowseEntityDoi = "BrowseEntityDoi";
|
public static String BrowseEntityDoi = "BrowseEntityDoi";
|
||||||
public static String EditEntityDoi = "EditEntityDoi";
|
public static String EditEntityDoi = "EditEntityDoi";
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
package eu.eudat.commons.enums;
|
||||||
|
|
||||||
|
import eu.eudat.data.converters.enums.DatabaseEnum;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public enum DmpBlueprintExtraFieldType implements DatabaseEnum<Short> {
|
||||||
|
|
||||||
|
Text((short) 0),
|
||||||
|
RichTex((short) 1),
|
||||||
|
Date((short) 2),
|
||||||
|
Number((short) 3),
|
||||||
|
;
|
||||||
|
|
||||||
|
private final Short value;
|
||||||
|
|
||||||
|
DmpBlueprintExtraFieldType(Short value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Short getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final Map<Short, DmpBlueprintExtraFieldType> map = EnumUtils.getEnumValueMap(DmpBlueprintExtraFieldType.class);
|
||||||
|
|
||||||
|
public static DmpBlueprintExtraFieldType of(Short i) {
|
||||||
|
return map.get(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
package eu.eudat.commons.enums;
|
||||||
|
|
||||||
|
import eu.eudat.data.converters.enums.DatabaseEnum;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public enum DmpBlueprintFieldCategory implements DatabaseEnum<Short> {
|
||||||
|
System((short)0),
|
||||||
|
Extra((short)1);
|
||||||
|
|
||||||
|
private final Short value;
|
||||||
|
|
||||||
|
DmpBlueprintFieldCategory(Short value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Short getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final Map<Short, DmpBlueprintFieldCategory> map = EnumUtils.getEnumValueMap(DmpBlueprintFieldCategory.class);
|
||||||
|
|
||||||
|
public static DmpBlueprintFieldCategory of(Short i) {
|
||||||
|
return map.get(i);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
package eu.eudat.commons.enums;
|
||||||
|
|
||||||
|
import eu.eudat.data.converters.enums.DatabaseEnum;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public enum DmpBlueprintStatus implements DatabaseEnum<Short> {
|
||||||
|
|
||||||
|
Draft((short) 0),
|
||||||
|
Finalized((short) 1);
|
||||||
|
|
||||||
|
private final Short value;
|
||||||
|
|
||||||
|
DmpBlueprintStatus(Short value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Short getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final Map<Short, DmpBlueprintStatus> map = EnumUtils.getEnumValueMap(DmpBlueprintStatus.class);
|
||||||
|
|
||||||
|
public static DmpBlueprintStatus of(Short i) {
|
||||||
|
return map.get(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,35 @@
|
||||||
|
package eu.eudat.commons.enums;
|
||||||
|
|
||||||
|
import eu.eudat.data.converters.enums.DatabaseEnum;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public enum DmpBlueprintSystemFieldType implements DatabaseEnum<Short> {
|
||||||
|
|
||||||
|
Text((short)0),
|
||||||
|
HtmlText((short)1),
|
||||||
|
Researchers((short)2),
|
||||||
|
Organizations((short)3),
|
||||||
|
Language((short)4),
|
||||||
|
Contact((short)5),
|
||||||
|
Funder((short)6),
|
||||||
|
Grant((short)7),
|
||||||
|
Project((short)8),
|
||||||
|
License((short)9),
|
||||||
|
AccessRights((short)10);
|
||||||
|
private final Short value;
|
||||||
|
|
||||||
|
DmpBlueprintSystemFieldType(Short value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Short getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final Map<Short, DmpBlueprintSystemFieldType> map = EnumUtils.getEnumValueMap(DmpBlueprintSystemFieldType.class);
|
||||||
|
|
||||||
|
public static DmpBlueprintSystemFieldType of(Short i) {
|
||||||
|
return map.get(i);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,8 +1,10 @@
|
||||||
package eu.eudat.commons.enums;
|
package eu.eudat.commons.enums;
|
||||||
|
|
||||||
|
import eu.eudat.data.converters.enums.DatabaseEnum;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public enum ExternalReferencesType {
|
public enum ExternalReferencesType implements DatabaseEnum<Short> {
|
||||||
Taxonomies((short) 0),
|
Taxonomies((short) 0),
|
||||||
Licenses((short) 1),
|
Licenses((short) 1),
|
||||||
Publications((short) 2),
|
Publications((short) 2),
|
||||||
|
@ -12,13 +14,11 @@ public enum ExternalReferencesType {
|
||||||
Registries((short) 6),
|
Registries((short) 6),
|
||||||
Services((short) 7),
|
Services((short) 7),
|
||||||
Project((short) 8),
|
Project((short) 8),
|
||||||
Founder((short) 8),
|
Funder((short) 9),
|
||||||
Datasets((short) 9),
|
Datasets((short) 10),
|
||||||
Organizations((short) 10),
|
Organizations((short) 11),
|
||||||
Grants((short) 11),
|
Grants((short) 12),
|
||||||
Prefillings((short) 12),
|
Researcher((short) 13);
|
||||||
Validators((short) 13),
|
|
||||||
Researcher((short) 14);
|
|
||||||
private final Short value;
|
private final Short value;
|
||||||
|
|
||||||
ExternalReferencesType(Short value) {
|
ExternalReferencesType(Short value) {
|
||||||
|
@ -29,9 +29,9 @@ public enum ExternalReferencesType {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Map<Short, IsActive> map = EnumUtils.getEnumValueMap(IsActive.class);
|
private static final Map<Short, ExternalReferencesType> map = EnumUtils.getEnumValueMap(ExternalReferencesType.class);
|
||||||
|
|
||||||
public static IsActive of(Short i) {
|
public static ExternalReferencesType of(Short i) {
|
||||||
return map.get(i);
|
return map.get(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,50 @@
|
||||||
|
package eu.eudat.commons.types.dmpblueprint;
|
||||||
|
|
||||||
|
import eu.eudat.commons.types.xml.XmlBuilder;
|
||||||
|
import eu.eudat.commons.types.xml.XmlSerializable;
|
||||||
|
import org.w3c.dom.Document;
|
||||||
|
import org.w3c.dom.Element;
|
||||||
|
import org.w3c.dom.Node;
|
||||||
|
import org.w3c.dom.NodeList;
|
||||||
|
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class DefinitionEntity implements XmlSerializable<DefinitionEntity> {
|
||||||
|
private List<SectionEntity> sections;
|
||||||
|
|
||||||
|
public List<SectionEntity> getSections() {
|
||||||
|
return sections;
|
||||||
|
}
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,12 +1,12 @@
|
||||||
package eu.eudat.models.data.entities.xmlmodels.dmpprofiledefinition;
|
package eu.eudat.commons.types.dmpblueprint;
|
||||||
|
|
||||||
import eu.eudat.logic.utilities.interfaces.XmlSerializable;
|
import eu.eudat.commons.types.xml.XmlSerializable;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class DescriptionTemplate implements XmlSerializable<DescriptionTemplate> {
|
public class DescriptionTemplateEntity implements XmlSerializable<DescriptionTemplateEntity> {
|
||||||
|
|
||||||
private UUID id;
|
private UUID id;
|
||||||
private UUID descriptionTemplateId;
|
private UUID descriptionTemplateId;
|
||||||
|
@ -61,7 +61,7 @@ public class DescriptionTemplate implements XmlSerializable<DescriptionTemplate>
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DescriptionTemplate fromXml(Element item) {
|
public DescriptionTemplateEntity fromXml(Element item) {
|
||||||
this.id = UUID.fromString(item.getAttribute("id"));
|
this.id = UUID.fromString(item.getAttribute("id"));
|
||||||
this.descriptionTemplateId = UUID.fromString(item.getAttribute("descriptionTemplateId"));
|
this.descriptionTemplateId = UUID.fromString(item.getAttribute("descriptionTemplateId"));
|
||||||
this.label = item.getAttribute("label");
|
this.label = item.getAttribute("label");
|
|
@ -1,10 +1,10 @@
|
||||||
package eu.eudat.models.data.entities.xmlmodels.dmpprofiledefinition;
|
package eu.eudat.commons.types.dmpblueprint;
|
||||||
|
|
||||||
import eu.eudat.logic.utilities.interfaces.XmlSerializable;
|
import eu.eudat.commons.types.xml.XmlSerializable;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
|
|
||||||
public class DmpProfileExternalAutoComplete implements XmlSerializable<DmpProfileExternalAutoComplete> {
|
public class ExternalAutoCompleteEntity implements XmlSerializable<ExternalAutoCompleteEntity> {
|
||||||
private String url;
|
private String url;
|
||||||
private String optionsRoot;
|
private String optionsRoot;
|
||||||
private Boolean multiAutoComplete;
|
private Boolean multiAutoComplete;
|
||||||
|
@ -56,7 +56,7 @@ public class DmpProfileExternalAutoComplete implements XmlSerializable<DmpProfil
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DmpProfileExternalAutoComplete fromXml(Element item) {
|
public ExternalAutoCompleteEntity fromXml(Element item) {
|
||||||
this.url = item.getAttribute("url");
|
this.url = item.getAttribute("url");
|
||||||
this.optionsRoot = item.getAttribute("optionsRoot");
|
this.optionsRoot = item.getAttribute("optionsRoot");
|
||||||
this.multiAutoComplete = Boolean.valueOf(item.getAttribute("multiAutoComplete"));
|
this.multiAutoComplete = Boolean.valueOf(item.getAttribute("multiAutoComplete"));
|
|
@ -0,0 +1,31 @@
|
||||||
|
package eu.eudat.commons.types.dmpblueprint;
|
||||||
|
|
||||||
|
import eu.eudat.commons.enums.DmpBlueprintExtraFieldType;
|
||||||
|
import org.w3c.dom.Document;
|
||||||
|
import org.w3c.dom.Element;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public class ExtraFieldEntity extends FieldEntity {
|
||||||
|
|
||||||
|
private DmpBlueprintExtraFieldType type;
|
||||||
|
|
||||||
|
public DmpBlueprintExtraFieldType getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
public void setType(DmpBlueprintExtraFieldType type) {
|
||||||
|
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 = DmpBlueprintExtraFieldType.of(Short.parseShort(item.getAttribute("type")));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,95 @@
|
||||||
|
package eu.eudat.commons.types.dmpblueprint;
|
||||||
|
|
||||||
|
import eu.eudat.commons.enums.DmpBlueprintExtraFieldType;
|
||||||
|
import eu.eudat.commons.enums.DmpBlueprintFieldCategory;
|
||||||
|
import eu.eudat.commons.enums.DmpBlueprintSystemFieldType;
|
||||||
|
import eu.eudat.commons.types.xml.XmlSerializable;
|
||||||
|
import org.w3c.dom.Document;
|
||||||
|
import org.w3c.dom.Element;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public abstract class FieldEntity implements XmlSerializable<FieldEntity> {
|
||||||
|
private UUID id;
|
||||||
|
private DmpBlueprintFieldCategory category;
|
||||||
|
private String label;
|
||||||
|
private String placeholder;
|
||||||
|
private String description;
|
||||||
|
private Integer ordinal;
|
||||||
|
private boolean required;
|
||||||
|
|
||||||
|
public UUID getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
public void setId(UUID id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DmpBlueprintFieldCategory getCategory() {
|
||||||
|
return category;
|
||||||
|
}
|
||||||
|
public void setCategory(DmpBlueprintFieldCategory category) {
|
||||||
|
this.category = category;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLabel() {
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
public void setLabel(String label) {
|
||||||
|
this.label = label;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPlaceholder() {
|
||||||
|
return placeholder;
|
||||||
|
}
|
||||||
|
public void setPlaceholder(String placeholder) {
|
||||||
|
this.placeholder = placeholder;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getOrdinal() {
|
||||||
|
return ordinal;
|
||||||
|
}
|
||||||
|
public void setOrdinal(Integer ordinal) {
|
||||||
|
this.ordinal = ordinal;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isRequired() {
|
||||||
|
return required;
|
||||||
|
}
|
||||||
|
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,8 +1,8 @@
|
||||||
package eu.eudat.models.data.entities.xmlmodels.dmpprofiledefinition;
|
package eu.eudat.commons.types.dmpblueprint;
|
||||||
|
|
||||||
import eu.eudat.logic.utilities.builders.XmlBuilder;
|
import eu.eudat.commons.enums.DmpBlueprintFieldCategory;
|
||||||
import eu.eudat.logic.utilities.interfaces.XmlSerializable;
|
import eu.eudat.commons.types.xml.XmlBuilder;
|
||||||
import eu.eudat.models.data.entities.xmlmodels.dmpprofiledefinition.types.FieldCategory;
|
import eu.eudat.commons.types.xml.XmlSerializable;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
import org.w3c.dom.Node;
|
import org.w3c.dom.Node;
|
||||||
|
@ -13,15 +13,15 @@ import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class Section implements XmlSerializable<Section> {
|
public class SectionEntity implements XmlSerializable<SectionEntity> {
|
||||||
|
|
||||||
private UUID id;
|
private UUID id;
|
||||||
private String label;
|
private String label;
|
||||||
private String description;
|
private String description;
|
||||||
private Integer ordinal;
|
private Integer ordinal;
|
||||||
private List<FieldModel> fields;
|
private List<FieldEntity> fields;
|
||||||
private Boolean hasTemplates;
|
private Boolean hasTemplates;
|
||||||
private List<DescriptionTemplate> descriptionTemplates;
|
private List<DescriptionTemplateEntity> descriptionTemplates;
|
||||||
|
|
||||||
public UUID getId() {
|
public UUID getId() {
|
||||||
return id;
|
return id;
|
||||||
|
@ -51,10 +51,10 @@ public class Section implements XmlSerializable<Section> {
|
||||||
this.ordinal = ordinal;
|
this.ordinal = ordinal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<FieldModel> getFields() {
|
public List<FieldEntity> getFields() {
|
||||||
return fields;
|
return fields;
|
||||||
}
|
}
|
||||||
public void setFields(List<FieldModel> fields) {
|
public void setFields(List<FieldEntity> fields) {
|
||||||
this.fields = fields;
|
this.fields = fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,10 +65,10 @@ public class Section implements XmlSerializable<Section> {
|
||||||
this.hasTemplates = hasTemplates;
|
this.hasTemplates = hasTemplates;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<DescriptionTemplate> getDescriptionTemplates() {
|
public List<DescriptionTemplateEntity> getDescriptionTemplates() {
|
||||||
return descriptionTemplates;
|
return descriptionTemplates;
|
||||||
}
|
}
|
||||||
public void setDescriptionTemplates(List<DescriptionTemplate> descriptionTemplates) {
|
public void setDescriptionTemplates(List<DescriptionTemplateEntity> descriptionTemplates) {
|
||||||
this.descriptionTemplates = descriptionTemplates;
|
this.descriptionTemplates = descriptionTemplates;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,22 +80,22 @@ public class Section implements XmlSerializable<Section> {
|
||||||
rootElement.setAttribute("description", this.description);
|
rootElement.setAttribute("description", this.description);
|
||||||
rootElement.setAttribute("ordinal", String.valueOf(this.ordinal));
|
rootElement.setAttribute("ordinal", String.valueOf(this.ordinal));
|
||||||
rootElement.setAttribute("hasTemplates", String.valueOf(this.hasTemplates));
|
rootElement.setAttribute("hasTemplates", String.valueOf(this.hasTemplates));
|
||||||
List<FieldModel> temp = this.fields.stream().filter(f -> f.getCategory().equals(FieldCategory.SYSTEM)).collect(Collectors.toList());
|
List<FieldEntity> temp = this.fields.stream().filter(f -> f.getCategory().equals(DmpBlueprintFieldCategory.System)).collect(Collectors.toList());
|
||||||
List<SystemField> systemFieldsList = temp.stream().map(FieldModel::toSystemField).collect(Collectors.toList());
|
List<SystemFieldEntity> systemFieldsList = temp.stream().map(x-> (SystemFieldEntity)x).collect(Collectors.toList());
|
||||||
Element systemFields = doc.createElement("systemFields");
|
Element systemFields = doc.createElement("systemFields");
|
||||||
for (SystemField systemField : systemFieldsList) {
|
for (SystemFieldEntity systemField : systemFieldsList) {
|
||||||
systemFields.appendChild(systemField.toXml(doc));
|
systemFields.appendChild(systemField.toXml(doc));
|
||||||
}
|
}
|
||||||
rootElement.appendChild(systemFields);
|
rootElement.appendChild(systemFields);
|
||||||
Element descriptionTemplates = doc.createElement("descriptionTemplates");
|
Element descriptionTemplates = doc.createElement("descriptionTemplates");
|
||||||
for (DescriptionTemplate descriptionTemplate : this.descriptionTemplates) {
|
for (DescriptionTemplateEntity descriptionTemplate : this.descriptionTemplates) {
|
||||||
descriptionTemplates.appendChild(descriptionTemplate.toXml(doc));
|
descriptionTemplates.appendChild(descriptionTemplate.toXml(doc));
|
||||||
}
|
}
|
||||||
rootElement.appendChild(descriptionTemplates);
|
rootElement.appendChild(descriptionTemplates);
|
||||||
temp = this.fields.stream().filter(f -> f.getCategory().equals(FieldCategory.EXTRA)).collect(Collectors.toList());
|
temp = this.fields.stream().filter(f -> f.getCategory().equals(DmpBlueprintFieldCategory.Extra)).collect(Collectors.toList());
|
||||||
List<ExtraField> extraFieldList = temp.stream().map(FieldModel::toExtraField).collect(Collectors.toList());
|
List<ExtraFieldEntity> extraFieldList = temp.stream().map(x-> (ExtraFieldEntity)x).collect(Collectors.toList());
|
||||||
Element extraFields = doc.createElement("extraFields");
|
Element extraFields = doc.createElement("extraFields");
|
||||||
for (ExtraField extraField : extraFieldList) {
|
for (ExtraFieldEntity extraField : extraFieldList) {
|
||||||
extraFields.appendChild(extraField.toXml(doc));
|
extraFields.appendChild(extraField.toXml(doc));
|
||||||
}
|
}
|
||||||
rootElement.appendChild(extraFields);
|
rootElement.appendChild(extraFields);
|
||||||
|
@ -104,7 +104,7 @@ public class Section implements XmlSerializable<Section> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Section fromXml(Element item) {
|
public SectionEntity fromXml(Element item) {
|
||||||
this.id = UUID.fromString(item.getAttribute("id"));
|
this.id = UUID.fromString(item.getAttribute("id"));
|
||||||
this.label = item.getAttribute("label");
|
this.label = item.getAttribute("label");
|
||||||
this.description = item.getAttribute("description");
|
this.description = item.getAttribute("description");
|
||||||
|
@ -117,8 +117,7 @@ public class Section implements XmlSerializable<Section> {
|
||||||
for (int temp = 0; temp < systemFieldElements.getLength(); temp++) {
|
for (int temp = 0; temp < systemFieldElements.getLength(); temp++) {
|
||||||
Node systemFieldElement = systemFieldElements.item(temp);
|
Node systemFieldElement = systemFieldElements.item(temp);
|
||||||
if (systemFieldElement.getNodeType() == Node.ELEMENT_NODE) {
|
if (systemFieldElement.getNodeType() == Node.ELEMENT_NODE) {
|
||||||
SystemField systemField = new SystemField().fromXml((Element) systemFieldElement);
|
this.fields.add(new SystemFieldEntity().fromXml((Element) systemFieldElement));
|
||||||
this.fields.add(new FieldModel().fromSystemField(systemField));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -129,7 +128,7 @@ public class Section implements XmlSerializable<Section> {
|
||||||
for (int temp = 0; temp < descriptionTemplateElements.getLength(); temp++) {
|
for (int temp = 0; temp < descriptionTemplateElements.getLength(); temp++) {
|
||||||
Node descriptionTemplateElement = descriptionTemplateElements.item(temp);
|
Node descriptionTemplateElement = descriptionTemplateElements.item(temp);
|
||||||
if (descriptionTemplateElement.getNodeType() == Node.ELEMENT_NODE) {
|
if (descriptionTemplateElement.getNodeType() == Node.ELEMENT_NODE) {
|
||||||
this.descriptionTemplates.add(new DescriptionTemplate().fromXml((Element) descriptionTemplateElement));
|
this.descriptionTemplates.add(new DescriptionTemplateEntity().fromXml((Element) descriptionTemplateElement));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -139,8 +138,7 @@ public class Section implements XmlSerializable<Section> {
|
||||||
for (int temp = 0; temp < extraFieldElements.getLength(); temp++) {
|
for (int temp = 0; temp < extraFieldElements.getLength(); temp++) {
|
||||||
Node extraFieldElement = extraFieldElements.item(temp);
|
Node extraFieldElement = extraFieldElements.item(temp);
|
||||||
if (extraFieldElement.getNodeType() == Node.ELEMENT_NODE) {
|
if (extraFieldElement.getNodeType() == Node.ELEMENT_NODE) {
|
||||||
ExtraField extraField = new ExtraField().fromXml((Element) extraFieldElement);
|
this.fields.add(new ExtraFieldEntity().fromXml((Element) extraFieldElement));
|
||||||
this.fields.add(new FieldModel().fromExtraField(extraField));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
package eu.eudat.commons.types.dmpblueprint;
|
||||||
|
|
||||||
|
import eu.eudat.commons.enums.DmpBlueprintSystemFieldType;
|
||||||
|
import eu.eudat.commons.types.xml.XmlSerializable;
|
||||||
|
import org.w3c.dom.Document;
|
||||||
|
import org.w3c.dom.Element;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public class SystemFieldEntity extends FieldEntity {
|
||||||
|
|
||||||
|
private DmpBlueprintSystemFieldType type;
|
||||||
|
|
||||||
|
public DmpBlueprintSystemFieldType getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
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")));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.eudat.logic.utilities.builders;
|
package eu.eudat.commons.types.xml;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.eudat.logic.utilities.interfaces;
|
package eu.eudat.commons.types.xml;
|
||||||
|
|
||||||
|
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
|
@ -0,0 +1,137 @@
|
||||||
|
package eu.eudat.data;
|
||||||
|
|
||||||
|
|
||||||
|
import eu.eudat.commons.enums.DmpBlueprintStatus;
|
||||||
|
import eu.eudat.commons.enums.IsActive;
|
||||||
|
import eu.eudat.data.converters.DateToUTCConverter;
|
||||||
|
import eu.eudat.data.converters.enums.DescriptionTemplateTypeStatusConverter;
|
||||||
|
import eu.eudat.data.converters.enums.DmpBlueprintStatusConverter;
|
||||||
|
import eu.eudat.data.converters.enums.IsActiveConverter;
|
||||||
|
import eu.eudat.data.old.DMP;
|
||||||
|
import eu.eudat.data.old.helpers.EntityBinder;
|
||||||
|
import eu.eudat.queryable.queryableentity.DataEntity;
|
||||||
|
import org.hibernate.annotations.GenericGenerator;
|
||||||
|
import org.hibernate.annotations.Type;
|
||||||
|
|
||||||
|
import jakarta.persistence.*;
|
||||||
|
|
||||||
|
import java.time.Instant;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Table(name = "\"DmpBlueprint\"")
|
||||||
|
public class DmpBlueprintEntity implements DataEntity<DmpBlueprintEntity, UUID> {
|
||||||
|
@Id
|
||||||
|
@Column(name = "id", columnDefinition = "uuid", updatable = false, nullable = false)
|
||||||
|
private UUID id;
|
||||||
|
public static final String _id = "id";
|
||||||
|
|
||||||
|
@Column(name = "\"label\"")
|
||||||
|
private String label;
|
||||||
|
public static final String _label = "label";
|
||||||
|
|
||||||
|
@Type(eu.eudat.configurations.typedefinition.XMLType.class)
|
||||||
|
@Column(name = "\"definition\"", columnDefinition = "xml", nullable = true)
|
||||||
|
private String definition;
|
||||||
|
public static final String _definition = "definition";
|
||||||
|
|
||||||
|
|
||||||
|
@Column(name = "\"status\"", nullable = false)
|
||||||
|
@Convert(converter = DmpBlueprintStatusConverter.class)
|
||||||
|
private DmpBlueprintStatus status;
|
||||||
|
public static final String _status = "status";
|
||||||
|
|
||||||
|
@Column(name = "is_active", nullable = false)
|
||||||
|
@Convert(converter = IsActiveConverter.class)
|
||||||
|
private IsActive isActive;
|
||||||
|
public static final String _isActive = "isActive";
|
||||||
|
|
||||||
|
|
||||||
|
@Column(name = "\"created_at\"", nullable = false)
|
||||||
|
private Instant createdAt = null;
|
||||||
|
public static final String _createdAt = "createdAt";
|
||||||
|
|
||||||
|
@Column(name = "\"updated_at\"", nullable = false)
|
||||||
|
private Instant updatedAt;
|
||||||
|
public static final String _updatedAt = "updatedAt";
|
||||||
|
|
||||||
|
public UUID getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(UUID id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLabel() {
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLabel(String label) {
|
||||||
|
this.label = label;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDefinition() {
|
||||||
|
return definition;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDefinition(String definition) {
|
||||||
|
this.definition = definition;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DmpBlueprintStatus getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(DmpBlueprintStatus status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IsActive getIsActive() {
|
||||||
|
return isActive;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsActive(IsActive isActive) {
|
||||||
|
this.isActive = isActive;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Instant getCreatedAt() {
|
||||||
|
return createdAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreatedAt(Instant createdAt) {
|
||||||
|
this.createdAt = createdAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Instant getUpdatedAt() {
|
||||||
|
return updatedAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUpdatedAt(Instant updatedAt) {
|
||||||
|
this.updatedAt = updatedAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void update(DmpBlueprintEntity entity) {
|
||||||
|
this.updatedAt = Instant.now();
|
||||||
|
this.definition = entity.getDefinition();
|
||||||
|
this.label = entity.getLabel();
|
||||||
|
this.status= entity.getStatus();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UUID getKeys() {
|
||||||
|
return this.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DmpBlueprintEntity buildFromTuple(List<Tuple> tuple, List<String> fields, String base) {
|
||||||
|
String currentBase = base.isEmpty() ? "" : base + ".";
|
||||||
|
if (fields.contains(currentBase + "id")) this.id = EntityBinder.fromTuple(tuple, currentBase + "id");
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
package eu.eudat.data.converters.enums;
|
||||||
|
|
||||||
|
import eu.eudat.commons.enums.DescriptionTemplateTypeStatus;
|
||||||
|
import eu.eudat.commons.enums.DmpBlueprintStatus;
|
||||||
|
import jakarta.persistence.Converter;
|
||||||
|
|
||||||
|
@Converter
|
||||||
|
public class DmpBlueprintStatusConverter extends DatabaseEnumConverter<DmpBlueprintStatus, Short> {
|
||||||
|
public DmpBlueprintStatus of(Short i) {
|
||||||
|
return DmpBlueprintStatus.of(i);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,6 +1,7 @@
|
||||||
package eu.eudat.data.old;
|
package eu.eudat.data.old;
|
||||||
|
|
||||||
|
|
||||||
|
import eu.eudat.data.DmpBlueprintEntity;
|
||||||
import eu.eudat.data.EntityDoiEntity;
|
import eu.eudat.data.EntityDoiEntity;
|
||||||
import eu.eudat.data.converters.DateToUTCConverter;
|
import eu.eudat.data.converters.DateToUTCConverter;
|
||||||
import eu.eudat.queryable.queryableentity.DataEntity;
|
import eu.eudat.queryable.queryableentity.DataEntity;
|
||||||
|
@ -119,7 +120,7 @@ public class DMP implements DataEntity<DMP, UUID> {
|
||||||
|
|
||||||
@ManyToOne(fetch = FetchType.LAZY)
|
@ManyToOne(fetch = FetchType.LAZY)
|
||||||
@JoinColumn(name = "\"Profile\"")
|
@JoinColumn(name = "\"Profile\"")
|
||||||
private DMPProfile profile;
|
private DmpBlueprintEntity profile;
|
||||||
|
|
||||||
|
|
||||||
@ManyToOne(fetch = FetchType.LAZY)
|
@ManyToOne(fetch = FetchType.LAZY)
|
||||||
|
@ -278,10 +279,10 @@ public class DMP implements DataEntity<DMP, UUID> {
|
||||||
this.associatedDmps = associatedDmps;
|
this.associatedDmps = associatedDmps;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DMPProfile getProfile() {
|
public DmpBlueprintEntity getProfile() {
|
||||||
return profile;
|
return profile;
|
||||||
}
|
}
|
||||||
public void setProfile(DMPProfile profile) {
|
public void setProfile(DmpBlueprintEntity profile) {
|
||||||
this.profile = profile;
|
this.profile = profile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,154 +0,0 @@
|
||||||
package eu.eudat.data.old;
|
|
||||||
|
|
||||||
|
|
||||||
import eu.eudat.data.converters.DateToUTCConverter;
|
|
||||||
import eu.eudat.data.old.helpers.EntityBinder;
|
|
||||||
import eu.eudat.queryable.queryableentity.DataEntity;
|
|
||||||
import org.hibernate.annotations.GenericGenerator;
|
|
||||||
import org.hibernate.annotations.Type;
|
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
|
|
||||||
@Entity
|
|
||||||
@Table(name = "\"DMPProfile\"")
|
|
||||||
public class DMPProfile implements DataEntity<DMPProfile, UUID> {
|
|
||||||
|
|
||||||
public enum Status {
|
|
||||||
SAVED((short) 0), FINALIZED((short) 1), DELETED((short) 99);
|
|
||||||
|
|
||||||
private short value;
|
|
||||||
|
|
||||||
private Status(short value) {
|
|
||||||
this.value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public short getValue() {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Status fromInteger(int value) {
|
|
||||||
switch (value) {
|
|
||||||
case 0:
|
|
||||||
return SAVED;
|
|
||||||
case 1:
|
|
||||||
return FINALIZED;
|
|
||||||
case 99:
|
|
||||||
return DELETED;
|
|
||||||
default:
|
|
||||||
throw new RuntimeException("Unsupported Dmp Profile Status");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Id
|
|
||||||
@GeneratedValue
|
|
||||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
|
||||||
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
|
||||||
private UUID id;
|
|
||||||
|
|
||||||
|
|
||||||
@OneToMany(fetch = FetchType.LAZY, mappedBy = "profile")
|
|
||||||
private Set<DMP> dmps;
|
|
||||||
|
|
||||||
|
|
||||||
@Column(name = "\"Label\"")
|
|
||||||
private String label;
|
|
||||||
|
|
||||||
@Type(eu.eudat.configurations.typedefinition.XMLType.class)
|
|
||||||
@Column(name = "\"Definition\"", columnDefinition = "xml", nullable = true)
|
|
||||||
private String definition;
|
|
||||||
|
|
||||||
|
|
||||||
@Column(name = "\"Status\"", nullable = false)
|
|
||||||
private int status;
|
|
||||||
|
|
||||||
|
|
||||||
@Column(name = "\"Created\"")
|
|
||||||
@Convert(converter = DateToUTCConverter.class)
|
|
||||||
private Date created = null;
|
|
||||||
|
|
||||||
@Column(name = "\"Modified\"")
|
|
||||||
@Convert(converter = DateToUTCConverter.class)
|
|
||||||
private Date modified = new Date();
|
|
||||||
|
|
||||||
public int getStatus() {
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStatus(int status) {
|
|
||||||
this.status = status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getCreated() {
|
|
||||||
return created;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCreated(Date created) {
|
|
||||||
this.created = created;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getModified() {
|
|
||||||
return modified;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setModified(Date modified) {
|
|
||||||
this.modified = modified;
|
|
||||||
}
|
|
||||||
|
|
||||||
public UUID getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(UUID id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getLabel() {
|
|
||||||
return label;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLabel(String label) {
|
|
||||||
this.label = label;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDefinition() {
|
|
||||||
return definition;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDefinition(String definition) {
|
|
||||||
this.definition = definition;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Set<DMP> getDmps() {
|
|
||||||
return dmps;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDmps(Set<DMP> dmps) {
|
|
||||||
this.dmps = dmps;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void update(DMPProfile entity) {
|
|
||||||
this.modified = new Date();
|
|
||||||
this.definition = entity.getDefinition();
|
|
||||||
this.label = entity.getLabel();
|
|
||||||
this.status= entity.getStatus();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public UUID getKeys() {
|
|
||||||
return this.id;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public DMPProfile buildFromTuple(List<Tuple> tuple,List<String> fields, String base) {
|
|
||||||
String currentBase = base.isEmpty() ? "" : base + ".";
|
|
||||||
if (fields.contains(currentBase + "id")) this.id = EntityBinder.fromTuple(tuple, currentBase + "id");
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,102 @@
|
||||||
|
package eu.eudat.model;
|
||||||
|
|
||||||
|
import eu.eudat.commons.enums.DmpBlueprintStatus;
|
||||||
|
import eu.eudat.commons.enums.IsActive;
|
||||||
|
import eu.eudat.model.dmpblueprintdefinition.Definition;
|
||||||
|
|
||||||
|
import java.time.Instant;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public class DmpBlueprint {
|
||||||
|
|
||||||
|
public final static String _id = "id";
|
||||||
|
private UUID id;
|
||||||
|
|
||||||
|
public final static String _label= "label";
|
||||||
|
private String label;
|
||||||
|
|
||||||
|
public final static String _createdAt = "createdAt";
|
||||||
|
private Definition definition;
|
||||||
|
|
||||||
|
public final static String _definition = "definition";
|
||||||
|
private Instant createdAt;
|
||||||
|
|
||||||
|
public final static String _updatedAt = "updatedAt";
|
||||||
|
private Instant updatedAt;
|
||||||
|
|
||||||
|
public final static String _isActive = "isActive";
|
||||||
|
private IsActive isActive;
|
||||||
|
|
||||||
|
public final static String _status = "status";
|
||||||
|
private DmpBlueprintStatus status;
|
||||||
|
|
||||||
|
public final static String _hash = "hash";
|
||||||
|
private String hash;
|
||||||
|
|
||||||
|
public UUID getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(UUID id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLabel() {
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLabel(String label) {
|
||||||
|
this.label = label;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Instant getCreatedAt() {
|
||||||
|
return createdAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreatedAt(Instant createdAt) {
|
||||||
|
this.createdAt = createdAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Instant getUpdatedAt() {
|
||||||
|
return updatedAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUpdatedAt(Instant updatedAt) {
|
||||||
|
this.updatedAt = updatedAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IsActive getIsActive() {
|
||||||
|
return isActive;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsActive(IsActive isActive) {
|
||||||
|
this.isActive = isActive;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DmpBlueprintStatus getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(DmpBlueprintStatus status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getHash() {
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHash(String hash) {
|
||||||
|
this.hash = hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Definition getDefinition() {
|
||||||
|
return definition;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDefinition(Definition definition) {
|
||||||
|
this.definition = definition;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,63 @@
|
||||||
|
package eu.eudat.model.builder;
|
||||||
|
|
||||||
|
import eu.eudat.authorization.AuthorizationFlags;
|
||||||
|
import eu.eudat.commons.types.dmpblueprint.DefinitionEntity;
|
||||||
|
import eu.eudat.commons.types.xml.XmlBuilder;
|
||||||
|
import eu.eudat.convention.ConventionService;
|
||||||
|
import eu.eudat.data.DmpBlueprintEntity;
|
||||||
|
import eu.eudat.model.DmpBlueprint;
|
||||||
|
import eu.eudat.model.dmpblueprintdefinition.Definition;
|
||||||
|
import gr.cite.tools.exception.MyApplicationException;
|
||||||
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
|
import gr.cite.tools.logging.DataLogEntry;
|
||||||
|
import gr.cite.tools.logging.LoggerService;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public class DmpBlueprintBuilder extends BaseBuilder<DmpBlueprint, DmpBlueprintEntity> {
|
||||||
|
|
||||||
|
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public DmpBlueprintBuilder(
|
||||||
|
ConventionService conventionService
|
||||||
|
) {
|
||||||
|
super(conventionService, new LoggerService(LoggerFactory.getLogger(DmpBlueprintBuilder.class)));
|
||||||
|
}
|
||||||
|
|
||||||
|
public DmpBlueprintBuilder authorize(EnumSet<AuthorizationFlags> values) {
|
||||||
|
this.authorize = values;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<DmpBlueprint> build(FieldSet fields, List<DmpBlueprintEntity> data) throws MyApplicationException {
|
||||||
|
this.logger.debug("building for {} items requesting {} fields", Optional.ofNullable(data).map(List::size).orElse(0), Optional.ofNullable(fields).map(FieldSet::getFields).map(Set::size).orElse(0));
|
||||||
|
this.logger.trace(new DataLogEntry("requested fields", fields));
|
||||||
|
if (fields == null || data == null || fields.isEmpty())
|
||||||
|
return new ArrayList<>();
|
||||||
|
FieldSet definitionFields = fields.extractPrefixed(this.asPrefix(DmpBlueprint._definition));
|
||||||
|
// new DefinitionEntity().fromXml(XmlBuilder.fromXml(entity.getDefinition()).getDocumentElement());
|
||||||
|
List<DmpBlueprint> models = new ArrayList<>();
|
||||||
|
for (DmpBlueprintEntity d : data) {
|
||||||
|
DmpBlueprint m = new DmpBlueprint();
|
||||||
|
if (fields.hasField(this.asIndexer(DmpBlueprint._id))) m.setId(d.getId());
|
||||||
|
if (fields.hasField(this.asIndexer(DmpBlueprint._label))) m.setLabel(d.getLabel());
|
||||||
|
if (fields.hasField(this.asIndexer(DmpBlueprint._createdAt))) m.setCreatedAt(d.getCreatedAt());
|
||||||
|
if (fields.hasField(this.asIndexer(DmpBlueprint._updatedAt))) m.setUpdatedAt(d.getUpdatedAt());
|
||||||
|
if (fields.hasField(this.asIndexer(DmpBlueprint._isActive))) m.setIsActive(d.getIsActive());
|
||||||
|
if (fields.hasField(this.asIndexer(DmpBlueprint._status))) m.setStatus(d.getStatus());
|
||||||
|
if (fields.hasField(this.asIndexer(DmpBlueprint._hash))) m.setHash(this.hashValue(d.getUpdatedAt()));
|
||||||
|
models.add(m);
|
||||||
|
}
|
||||||
|
this.logger.debug("build {} items", Optional.of(models).map(List::size).orElse(0));
|
||||||
|
return models;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,59 @@
|
||||||
|
package eu.eudat.model.builder.dmpblueprintdefinition;
|
||||||
|
|
||||||
|
import eu.eudat.authorization.AuthorizationFlags;
|
||||||
|
import eu.eudat.commons.types.dmpblueprint.DefinitionEntity;
|
||||||
|
import eu.eudat.convention.ConventionService;
|
||||||
|
import eu.eudat.model.builder.BaseBuilder;
|
||||||
|
import eu.eudat.model.dmpblueprintdefinition.Definition;
|
||||||
|
import gr.cite.tools.data.builder.BuilderFactory;
|
||||||
|
import gr.cite.tools.exception.MyApplicationException;
|
||||||
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
|
import gr.cite.tools.logging.DataLogEntry;
|
||||||
|
import gr.cite.tools.logging.LoggerService;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public class DefinitionBuilder extends BaseBuilder<Definition, DefinitionEntity> {
|
||||||
|
|
||||||
|
private final BuilderFactory builderFactory;
|
||||||
|
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public DefinitionBuilder(
|
||||||
|
ConventionService conventionService, BuilderFactory builderFactory) {
|
||||||
|
super(conventionService, new LoggerService(LoggerFactory.getLogger(DefinitionBuilder.class)));
|
||||||
|
this.builderFactory = builderFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DefinitionBuilder authorize(EnumSet<AuthorizationFlags> values) {
|
||||||
|
this.authorize = values;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Definition> build(FieldSet fields, List<DefinitionEntity> data) throws MyApplicationException {
|
||||||
|
this.logger.debug("building for {} items requesting {} fields", Optional.ofNullable(data).map(List::size).orElse(0), Optional.ofNullable(fields).map(FieldSet::getFields).map(Set::size).orElse(0));
|
||||||
|
this.logger.trace(new DataLogEntry("requested fields", fields));
|
||||||
|
if (fields == null || data == null || fields.isEmpty())
|
||||||
|
return new ArrayList<>();
|
||||||
|
|
||||||
|
//Not Bulk Build because is XML no interaction with db
|
||||||
|
FieldSet sectionsFields = fields.extractPrefixed(this.asPrefix(Definition._sections));
|
||||||
|
|
||||||
|
List<Definition> models = new ArrayList<>();
|
||||||
|
for (DefinitionEntity d : data) {
|
||||||
|
Definition m = new Definition();
|
||||||
|
if (!sectionsFields.isEmpty() && d.getSections() != null) m.setSections(this.builderFactory.builder(SectionBuilder.class).authorize(this.authorize).build(sectionsFields, d.getSections()));
|
||||||
|
models.add(m);
|
||||||
|
}
|
||||||
|
this.logger.debug("build {} items", Optional.of(models).map(List::size).orElse(0));
|
||||||
|
return models;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,57 @@
|
||||||
|
package eu.eudat.model.builder.dmpblueprintdefinition;
|
||||||
|
|
||||||
|
import eu.eudat.authorization.AuthorizationFlags;
|
||||||
|
import eu.eudat.commons.types.dmpblueprint.DescriptionTemplateEntity;
|
||||||
|
import eu.eudat.convention.ConventionService;
|
||||||
|
import eu.eudat.model.builder.BaseBuilder;
|
||||||
|
import eu.eudat.model.dmpblueprintdefinition.DescriptionTemplate;
|
||||||
|
import gr.cite.tools.exception.MyApplicationException;
|
||||||
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
|
import gr.cite.tools.logging.DataLogEntry;
|
||||||
|
import gr.cite.tools.logging.LoggerService;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public class DescriptionTemplateBuilder extends BaseBuilder<DescriptionTemplate, DescriptionTemplateEntity> {
|
||||||
|
|
||||||
|
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public DescriptionTemplateBuilder(
|
||||||
|
ConventionService conventionService) {
|
||||||
|
super(conventionService, new LoggerService(LoggerFactory.getLogger(DescriptionTemplateBuilder.class)));
|
||||||
|
}
|
||||||
|
|
||||||
|
public DescriptionTemplateBuilder authorize(EnumSet<AuthorizationFlags> values) {
|
||||||
|
this.authorize = values;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<DescriptionTemplate> build(FieldSet fields, List<DescriptionTemplateEntity> data) throws MyApplicationException {
|
||||||
|
this.logger.debug("building for {} items requesting {} fields", Optional.ofNullable(data).map(List::size).orElse(0), Optional.ofNullable(fields).map(FieldSet::getFields).map(Set::size).orElse(0));
|
||||||
|
this.logger.trace(new DataLogEntry("requested fields", fields));
|
||||||
|
if (fields == null || data == null || fields.isEmpty())
|
||||||
|
return new ArrayList<>();
|
||||||
|
|
||||||
|
List<DescriptionTemplate> models = new ArrayList<>();
|
||||||
|
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._maxMultiplicity))) m.setMaxMultiplicity(d.getMaxMultiplicity());
|
||||||
|
if (fields.hasField(this.asIndexer(DescriptionTemplate._minMultiplicity))) m.setMinMultiplicity(d.getMinMultiplicity());
|
||||||
|
models.add(m);
|
||||||
|
}
|
||||||
|
this.logger.debug("build {} items", Optional.of(models).map(List::size).orElse(0));
|
||||||
|
return models;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
package eu.eudat.model.builder.dmpblueprintdefinition;
|
||||||
|
|
||||||
|
import eu.eudat.commons.types.dmpblueprint.ExtraFieldEntity;
|
||||||
|
import eu.eudat.convention.ConventionService;
|
||||||
|
import eu.eudat.model.dmpblueprintdefinition.ExtraField;
|
||||||
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
|
import gr.cite.tools.logging.LoggerService;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public class ExtraFieldBuilder extends FieldBuilder<ExtraField, ExtraFieldEntity> {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public ExtraFieldBuilder(
|
||||||
|
ConventionService conventionService) {
|
||||||
|
super(conventionService, new LoggerService(LoggerFactory.getLogger(ExtraFieldBuilder.class)));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected ExtraField getInstance() {
|
||||||
|
return new ExtraField();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected ExtraField buildChild(FieldSet fields, ExtraFieldEntity data, ExtraField model) {
|
||||||
|
if (fields.hasField(this.asIndexer(ExtraField._type))) model.setType(data.getType());
|
||||||
|
return model;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,68 @@
|
||||||
|
package eu.eudat.model.builder.dmpblueprintdefinition;
|
||||||
|
|
||||||
|
import eu.eudat.authorization.AuthorizationFlags;
|
||||||
|
import eu.eudat.commons.types.dmpblueprint.DescriptionTemplateEntity;
|
||||||
|
import eu.eudat.commons.types.dmpblueprint.ExtraFieldEntity;
|
||||||
|
import eu.eudat.commons.types.dmpblueprint.FieldEntity;
|
||||||
|
import eu.eudat.convention.ConventionService;
|
||||||
|
import eu.eudat.model.builder.BaseBuilder;
|
||||||
|
import eu.eudat.model.dmpblueprintdefinition.DescriptionTemplate;
|
||||||
|
import eu.eudat.model.dmpblueprintdefinition.ExtraField;
|
||||||
|
import eu.eudat.model.dmpblueprintdefinition.Field;
|
||||||
|
import gr.cite.tools.exception.MyApplicationException;
|
||||||
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
|
import gr.cite.tools.logging.DataLogEntry;
|
||||||
|
import gr.cite.tools.logging.LoggerService;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public abstract class FieldBuilder<Model extends Field, Entity extends FieldEntity> extends BaseBuilder<Model, Entity> {
|
||||||
|
|
||||||
|
protected EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public FieldBuilder(
|
||||||
|
ConventionService conventionService,
|
||||||
|
LoggerService logger) {
|
||||||
|
super(conventionService, logger);
|
||||||
|
}
|
||||||
|
|
||||||
|
public FieldBuilder authorize(EnumSet<AuthorizationFlags> values) {
|
||||||
|
this.authorize = values;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract Model getInstance();
|
||||||
|
|
||||||
|
protected abstract Model buildChild(FieldSet fields, Entity data, Model model);
|
||||||
|
@Override
|
||||||
|
public List<Model> build(FieldSet fields, List<Entity> data) throws MyApplicationException {
|
||||||
|
this.logger.debug("building for {} items requesting {} fields", Optional.ofNullable(data).map(List::size).orElse(0), Optional.ofNullable(fields).map(FieldSet::getFields).map(Set::size).orElse(0));
|
||||||
|
this.logger.trace(new DataLogEntry("requested fields", fields));
|
||||||
|
if (fields == null || data == null || fields.isEmpty())
|
||||||
|
return new ArrayList<>();
|
||||||
|
|
||||||
|
List<Model> models = new ArrayList<>();
|
||||||
|
for (Entity d : data) {
|
||||||
|
Model m = this.getInstance();
|
||||||
|
if (fields.hasField(this.asIndexer(Model._label))) m.setLabel(d.getLabel());
|
||||||
|
if (fields.hasField(this.asIndexer(Model._id))) m.setId(d.getId());
|
||||||
|
if (fields.hasField(this.asIndexer(Model._category))) m.setCategory(d.getCategory());
|
||||||
|
if (fields.hasField(this.asIndexer(Model._description))) m.setDescription(d.getDescription());
|
||||||
|
if (fields.hasField(this.asIndexer(Model._placeholder))) m.setPlaceholder(d.getPlaceholder());
|
||||||
|
if (fields.hasField(this.asIndexer(Model._ordinal))) m.setOrdinal(d.getOrdinal());
|
||||||
|
if (fields.hasField(this.asIndexer(Model._required))) m.setRequired(d.isRequired());
|
||||||
|
models.add(m);
|
||||||
|
}
|
||||||
|
this.logger.debug("build {} items", Optional.of(models).map(List::size).orElse(0));
|
||||||
|
return models;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,77 @@
|
||||||
|
package eu.eudat.model.builder.dmpblueprintdefinition;
|
||||||
|
|
||||||
|
import eu.eudat.authorization.AuthorizationFlags;
|
||||||
|
import eu.eudat.commons.enums.DmpBlueprintFieldCategory;
|
||||||
|
import eu.eudat.commons.types.dmpblueprint.ExtraFieldEntity;
|
||||||
|
import eu.eudat.commons.types.dmpblueprint.FieldEntity;
|
||||||
|
import eu.eudat.commons.types.dmpblueprint.SectionEntity;
|
||||||
|
import eu.eudat.commons.types.dmpblueprint.SystemFieldEntity;
|
||||||
|
import eu.eudat.convention.ConventionService;
|
||||||
|
import eu.eudat.model.builder.BaseBuilder;
|
||||||
|
import eu.eudat.model.dmpblueprintdefinition.Section;
|
||||||
|
import gr.cite.tools.data.builder.BuilderFactory;
|
||||||
|
import gr.cite.tools.exception.MyApplicationException;
|
||||||
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
|
import gr.cite.tools.logging.DataLogEntry;
|
||||||
|
import gr.cite.tools.logging.LoggerService;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public class SectionBuilder extends BaseBuilder<Section, SectionEntity> {
|
||||||
|
|
||||||
|
private final BuilderFactory builderFactory;
|
||||||
|
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public SectionBuilder(
|
||||||
|
ConventionService conventionService, BuilderFactory builderFactory) {
|
||||||
|
super(conventionService, new LoggerService(LoggerFactory.getLogger(SectionBuilder.class)));
|
||||||
|
this.builderFactory = builderFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SectionBuilder authorize(EnumSet<AuthorizationFlags> values) {
|
||||||
|
this.authorize = values;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Section> build(FieldSet fields, List<SectionEntity> data) throws MyApplicationException {
|
||||||
|
this.logger.debug("building for {} items requesting {} fields", Optional.ofNullable(data).map(List::size).orElse(0), Optional.ofNullable(fields).map(FieldSet::getFields).map(Set::size).orElse(0));
|
||||||
|
this.logger.trace(new DataLogEntry("requested fields", fields));
|
||||||
|
if (fields == null || data == null || fields.isEmpty())
|
||||||
|
return new ArrayList<>();
|
||||||
|
|
||||||
|
//Not Bulk Build because is XML no interaction with db
|
||||||
|
FieldSet descriptionTemplatesFields = fields.extractPrefixed(this.asPrefix(Section._descriptionTemplates));
|
||||||
|
FieldSet fieldsFields = fields.extractPrefixed(this.asPrefix(Section._fields));
|
||||||
|
|
||||||
|
List<Section> models = new ArrayList<>();
|
||||||
|
for (SectionEntity d : data) {
|
||||||
|
Section m = new Section();
|
||||||
|
if (fields.hasField(this.asIndexer(Section._id))) m.setId(d.getId());
|
||||||
|
if (fields.hasField(this.asIndexer(Section._label))) m.setLabel(d.getLabel());
|
||||||
|
if (fields.hasField(this.asIndexer(Section._description))) m.setDescription(d.getDescription());
|
||||||
|
if (fields.hasField(this.asIndexer(Section._ordinal))) m.setOrdinal(d.getOrdinal());
|
||||||
|
if (fields.hasField(this.asIndexer(Section._hasTemplates))) m.setHasTemplates(d.getHasTemplates());
|
||||||
|
if (!descriptionTemplatesFields.isEmpty() && d.getDescriptionTemplates() != null) m.setDescriptionTemplates(this.builderFactory.builder(DescriptionTemplateBuilder.class).authorize(this.authorize).build(descriptionTemplatesFields, d.getDescriptionTemplates()));
|
||||||
|
if (!fieldsFields.isEmpty() && d.getFields() != null) {
|
||||||
|
List<SystemFieldEntity> systemFieldEntities = d.getFields().stream().filter(x-> DmpBlueprintFieldCategory.System.equals(x.getCategory())).map(x-> (SystemFieldEntity)x).toList();
|
||||||
|
List<ExtraFieldEntity> extraFieldEntities = d.getFields().stream().filter(x-> DmpBlueprintFieldCategory.Extra.equals(x.getCategory())).map(x-> (ExtraFieldEntity)x).toList();
|
||||||
|
m.setFields(new ArrayList<>());
|
||||||
|
m.getFields().addAll(this.builderFactory.builder(SystemFieldBuilder.class).authorize(this.authorize).build(fieldsFields, systemFieldEntities));
|
||||||
|
m.getFields().addAll(this.builderFactory.builder(ExtraFieldBuilder.class).authorize(this.authorize).build(fieldsFields, extraFieldEntities));
|
||||||
|
}
|
||||||
|
models.add(m);
|
||||||
|
}
|
||||||
|
this.logger.debug("build {} items", Optional.of(models).map(List::size).orElse(0));
|
||||||
|
return models;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
package eu.eudat.model.builder.dmpblueprintdefinition;
|
||||||
|
|
||||||
|
import eu.eudat.commons.types.dmpblueprint.ExtraFieldEntity;
|
||||||
|
import eu.eudat.convention.ConventionService;
|
||||||
|
import eu.eudat.model.dmpblueprintdefinition.ExtraField;
|
||||||
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
|
import gr.cite.tools.logging.LoggerService;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public class SystemFieldBuilder extends FieldBuilder<ExtraField, ExtraFieldEntity> {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public SystemFieldBuilder(
|
||||||
|
ConventionService conventionService) {
|
||||||
|
super(conventionService, new LoggerService(LoggerFactory.getLogger(SystemFieldBuilder.class)));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected ExtraField getInstance() {
|
||||||
|
return new ExtraField();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected ExtraField buildChild(FieldSet fields, ExtraFieldEntity data, ExtraField model) {
|
||||||
|
if (fields.hasField(this.asIndexer(ExtraField._type))) model.setType(data.getType());
|
||||||
|
return model;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,46 @@
|
||||||
|
package eu.eudat.model.censorship;
|
||||||
|
|
||||||
|
import eu.eudat.authorization.Permission;
|
||||||
|
import eu.eudat.convention.ConventionService;
|
||||||
|
import eu.eudat.model.DmpBlueprint;
|
||||||
|
import eu.eudat.model.censorship.dmpblueprintdefinition.DefinitionCensor;
|
||||||
|
import gr.cite.commons.web.authz.service.AuthorizationService;
|
||||||
|
import gr.cite.tools.data.censor.CensorFactory;
|
||||||
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
|
import gr.cite.tools.logging.DataLogEntry;
|
||||||
|
import gr.cite.tools.logging.LoggerService;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public class DmpBlueprintCensor extends BaseCensor {
|
||||||
|
|
||||||
|
private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(DmpBlueprintCensor.class));
|
||||||
|
|
||||||
|
protected final AuthorizationService authService;
|
||||||
|
protected final CensorFactory censorFactory;
|
||||||
|
|
||||||
|
public DmpBlueprintCensor(ConventionService conventionService,
|
||||||
|
AuthorizationService authService,
|
||||||
|
CensorFactory censorFactory) {
|
||||||
|
super(conventionService);
|
||||||
|
this.authService = authService;
|
||||||
|
this.censorFactory = censorFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void censor(FieldSet fields, UUID userId) {
|
||||||
|
logger.debug(new DataLogEntry("censoring fields", fields));
|
||||||
|
if (fields.isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
this.authService.authorizeForce(Permission.BrowseDmpBlueprint);
|
||||||
|
FieldSet definitionFields = fields.extractPrefixed(this.asIndexerPrefix(DmpBlueprint._definition));
|
||||||
|
this.censorFactory.censor(DefinitionCensor.class).censor(definitionFields, userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,46 @@
|
||||||
|
package eu.eudat.model.censorship.dmpblueprintdefinition;
|
||||||
|
|
||||||
|
import eu.eudat.authorization.Permission;
|
||||||
|
import eu.eudat.convention.ConventionService;
|
||||||
|
import eu.eudat.model.censorship.BaseCensor;
|
||||||
|
import eu.eudat.model.dmpblueprintdefinition.Definition;
|
||||||
|
import gr.cite.commons.web.authz.service.AuthorizationService;
|
||||||
|
import gr.cite.tools.data.censor.CensorFactory;
|
||||||
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
|
import gr.cite.tools.logging.DataLogEntry;
|
||||||
|
import gr.cite.tools.logging.LoggerService;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public class DefinitionCensor extends BaseCensor {
|
||||||
|
|
||||||
|
private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(DefinitionCensor.class));
|
||||||
|
|
||||||
|
protected final AuthorizationService authService;
|
||||||
|
protected final CensorFactory censorFactory;
|
||||||
|
|
||||||
|
public DefinitionCensor(ConventionService conventionService,
|
||||||
|
AuthorizationService authService,
|
||||||
|
CensorFactory censorFactory) {
|
||||||
|
super(conventionService);
|
||||||
|
this.authService = authService;
|
||||||
|
this.censorFactory = censorFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void censor(FieldSet fields, UUID userId) {
|
||||||
|
logger.debug(new DataLogEntry("censoring fields", fields));
|
||||||
|
if (fields.isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
this.authService.authorizeForce(Permission.BrowseDmpBlueprint);
|
||||||
|
FieldSet sectionsFields = fields.extractPrefixed(this.asIndexerPrefix(Definition._sections));
|
||||||
|
this.censorFactory.censor(SectionCensor.class).censor(sectionsFields, userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,39 @@
|
||||||
|
package eu.eudat.model.censorship.dmpblueprintdefinition;
|
||||||
|
|
||||||
|
import eu.eudat.authorization.Permission;
|
||||||
|
import eu.eudat.convention.ConventionService;
|
||||||
|
import eu.eudat.model.censorship.BaseCensor;
|
||||||
|
import gr.cite.commons.web.authz.service.AuthorizationService;
|
||||||
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
|
import gr.cite.tools.logging.DataLogEntry;
|
||||||
|
import gr.cite.tools.logging.LoggerService;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public class DescriptionTemplatesCensor extends BaseCensor {
|
||||||
|
|
||||||
|
private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(DescriptionTemplatesCensor.class));
|
||||||
|
|
||||||
|
protected final AuthorizationService authService;
|
||||||
|
|
||||||
|
public DescriptionTemplatesCensor(ConventionService conventionService,
|
||||||
|
AuthorizationService authService) {
|
||||||
|
super(conventionService);
|
||||||
|
this.authService = authService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void censor(FieldSet fields, UUID userId) {
|
||||||
|
logger.debug(new DataLogEntry("censoring fields", fields));
|
||||||
|
if (fields.isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
this.authService.authorizeForce(Permission.BrowseDmpBlueprint);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,39 @@
|
||||||
|
package eu.eudat.model.censorship.dmpblueprintdefinition;
|
||||||
|
|
||||||
|
import eu.eudat.authorization.Permission;
|
||||||
|
import eu.eudat.convention.ConventionService;
|
||||||
|
import eu.eudat.model.censorship.BaseCensor;
|
||||||
|
import gr.cite.commons.web.authz.service.AuthorizationService;
|
||||||
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
|
import gr.cite.tools.logging.DataLogEntry;
|
||||||
|
import gr.cite.tools.logging.LoggerService;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public class FieldCensor extends BaseCensor {
|
||||||
|
|
||||||
|
private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(FieldCensor.class));
|
||||||
|
|
||||||
|
protected final AuthorizationService authService;
|
||||||
|
|
||||||
|
public FieldCensor(ConventionService conventionService,
|
||||||
|
AuthorizationService authService) {
|
||||||
|
super(conventionService);
|
||||||
|
this.authService = authService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void censor(FieldSet fields, UUID userId) {
|
||||||
|
logger.debug(new DataLogEntry("censoring fields", fields));
|
||||||
|
if (fields.isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
this.authService.authorizeForce(Permission.BrowseDmpBlueprint);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,48 @@
|
||||||
|
package eu.eudat.model.censorship.dmpblueprintdefinition;
|
||||||
|
|
||||||
|
import eu.eudat.authorization.Permission;
|
||||||
|
import eu.eudat.convention.ConventionService;
|
||||||
|
import eu.eudat.model.censorship.BaseCensor;
|
||||||
|
import eu.eudat.model.dmpblueprintdefinition.Section;
|
||||||
|
import gr.cite.commons.web.authz.service.AuthorizationService;
|
||||||
|
import gr.cite.tools.data.censor.CensorFactory;
|
||||||
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
|
import gr.cite.tools.logging.DataLogEntry;
|
||||||
|
import gr.cite.tools.logging.LoggerService;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public class SectionCensor extends BaseCensor {
|
||||||
|
|
||||||
|
private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(SectionCensor.class));
|
||||||
|
|
||||||
|
protected final AuthorizationService authService;
|
||||||
|
protected final CensorFactory censorFactory;
|
||||||
|
|
||||||
|
public SectionCensor(ConventionService conventionService,
|
||||||
|
AuthorizationService authService,
|
||||||
|
CensorFactory censorFactory) {
|
||||||
|
super(conventionService);
|
||||||
|
this.authService = authService;
|
||||||
|
this.censorFactory = censorFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void censor(FieldSet fields, UUID userId) {
|
||||||
|
logger.debug(new DataLogEntry("censoring fields", fields));
|
||||||
|
if (fields.isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
this.authService.authorizeForce(Permission.BrowseDmpBlueprint);
|
||||||
|
FieldSet fieldsFields = fields.extractPrefixed(this.asIndexerPrefix(Section._fields));
|
||||||
|
this.censorFactory.censor(FieldCensor.class).censor(fieldsFields, userId);
|
||||||
|
FieldSet descriptionTemplatesFields = fields.extractPrefixed(this.asIndexerPrefix(Section._descriptionTemplates));
|
||||||
|
this.censorFactory.censor(DescriptionTemplatesCensor.class).censor(descriptionTemplatesFields, userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,79 @@
|
||||||
|
package eu.eudat.model.deleter;
|
||||||
|
|
||||||
|
import eu.eudat.commons.enums.IsActive;
|
||||||
|
import eu.eudat.data.DmpBlueprintEntity;
|
||||||
|
import eu.eudat.query.DmpBlueprintQuery;
|
||||||
|
import gr.cite.tools.data.deleter.Deleter;
|
||||||
|
import gr.cite.tools.data.deleter.DeleterFactory;
|
||||||
|
import gr.cite.tools.data.query.QueryFactory;
|
||||||
|
import gr.cite.tools.logging.LoggerService;
|
||||||
|
import gr.cite.tools.logging.MapLogEntry;
|
||||||
|
import jakarta.persistence.EntityManager;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.management.InvalidApplicationException;
|
||||||
|
import java.time.Instant;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public class DmpBlueprintDeleter implements Deleter {
|
||||||
|
|
||||||
|
private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(DmpBlueprintDeleter.class));
|
||||||
|
|
||||||
|
private final EntityManager entityManager;
|
||||||
|
|
||||||
|
protected final QueryFactory queryFactory;
|
||||||
|
|
||||||
|
protected final DeleterFactory deleterFactory;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public DmpBlueprintDeleter(
|
||||||
|
EntityManager entityManager,
|
||||||
|
QueryFactory queryFactory,
|
||||||
|
DeleterFactory deleterFactory
|
||||||
|
) {
|
||||||
|
this.entityManager = entityManager;
|
||||||
|
this.queryFactory = queryFactory;
|
||||||
|
this.deleterFactory = deleterFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void deleteAndSaveByIds(List<UUID> ids) throws InvalidApplicationException {
|
||||||
|
logger.debug(new MapLogEntry("collecting to delete").And("count", Optional.ofNullable(ids).map(List::size).orElse(0)).And("ids", ids));
|
||||||
|
List<DmpBlueprintEntity> data = this.queryFactory.query(DmpBlueprintQuery.class).ids(ids).collect();
|
||||||
|
logger.trace("retrieved {} items", Optional.ofNullable(data).map(List::size).orElse(0));
|
||||||
|
this.deleteAndSave(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void deleteAndSave(List<DmpBlueprintEntity> data) throws InvalidApplicationException {
|
||||||
|
logger.debug("will delete {} items", Optional.ofNullable(data).map(List::size).orElse(0));
|
||||||
|
this.delete(data);
|
||||||
|
logger.trace("saving changes");
|
||||||
|
this.entityManager.flush();
|
||||||
|
logger.trace("changes saved");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void delete(List<DmpBlueprintEntity> data) throws InvalidApplicationException {
|
||||||
|
logger.debug("will delete {} items", Optional.ofNullable(data).map(List::size).orElse(0));
|
||||||
|
if (data == null || data.isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
Instant now = Instant.now();
|
||||||
|
|
||||||
|
for (DmpBlueprintEntity item : data) {
|
||||||
|
logger.trace("deleting item {}", item.getId());
|
||||||
|
item.setIsActive(IsActive.Inactive);
|
||||||
|
item.setUpdatedAt(now);
|
||||||
|
logger.trace("updating item");
|
||||||
|
this.entityManager.merge(item);
|
||||||
|
logger.trace("updated item");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
package eu.eudat.model.dmpblueprintdefinition;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class Definition {
|
||||||
|
|
||||||
|
public final static String _sections = "sections";
|
||||||
|
private List<Section> sections;
|
||||||
|
|
||||||
|
public List<Section> getSections() {
|
||||||
|
return sections;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSections(List<Section> sections) {
|
||||||
|
this.sections = sections;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,61 @@
|
||||||
|
package eu.eudat.model.dmpblueprintdefinition;
|
||||||
|
|
||||||
|
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 _label = "label";
|
||||||
|
private String label;
|
||||||
|
|
||||||
|
public final static String _minMultiplicity = "minMultiplicity";
|
||||||
|
private Integer minMultiplicity;
|
||||||
|
|
||||||
|
public final static String _maxMultiplicity = "maxMultiplicity";
|
||||||
|
private Integer maxMultiplicity;
|
||||||
|
|
||||||
|
public UUID getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(UUID id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public UUID getDescriptionTemplateId() {
|
||||||
|
return descriptionTemplateId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescriptionTemplateId(UUID descriptionTemplateId) {
|
||||||
|
this.descriptionTemplateId = descriptionTemplateId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLabel() {
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLabel(String label) {
|
||||||
|
this.label = label;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getMinMultiplicity() {
|
||||||
|
return minMultiplicity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMinMultiplicity(Integer minMultiplicity) {
|
||||||
|
this.minMultiplicity = minMultiplicity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getMaxMultiplicity() {
|
||||||
|
return maxMultiplicity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMaxMultiplicity(Integer maxMultiplicity) {
|
||||||
|
this.maxMultiplicity = maxMultiplicity;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
package eu.eudat.model.dmpblueprintdefinition;
|
||||||
|
|
||||||
|
import eu.eudat.commons.enums.DmpBlueprintExtraFieldType;
|
||||||
|
|
||||||
|
public class ExtraField extends Field {
|
||||||
|
|
||||||
|
public final static String _type = "type";
|
||||||
|
private DmpBlueprintExtraFieldType type;
|
||||||
|
|
||||||
|
public DmpBlueprintExtraFieldType getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(DmpBlueprintExtraFieldType type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,85 @@
|
||||||
|
package eu.eudat.model.dmpblueprintdefinition;
|
||||||
|
|
||||||
|
import eu.eudat.commons.enums.DmpBlueprintFieldCategory;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public abstract class Field {
|
||||||
|
|
||||||
|
public final static String _id = "id";
|
||||||
|
private UUID id;
|
||||||
|
|
||||||
|
public final static String _category = "category";
|
||||||
|
private DmpBlueprintFieldCategory category;
|
||||||
|
|
||||||
|
public final static String _label = "label";
|
||||||
|
private String label;
|
||||||
|
|
||||||
|
public final static String _placeholder = "placeholder";
|
||||||
|
private String placeholder;
|
||||||
|
|
||||||
|
public final static String _description = "description";
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
public final static String _ordinal = "ordinal";
|
||||||
|
private Integer ordinal;
|
||||||
|
|
||||||
|
public final static String _required = "required";
|
||||||
|
private boolean required;
|
||||||
|
|
||||||
|
public UUID getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(UUID id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DmpBlueprintFieldCategory getCategory() {
|
||||||
|
return category;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCategory(DmpBlueprintFieldCategory category) {
|
||||||
|
this.category = category;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLabel() {
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLabel(String label) {
|
||||||
|
this.label = label;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPlaceholder() {
|
||||||
|
return placeholder;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPlaceholder(String placeholder) {
|
||||||
|
this.placeholder = placeholder;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getOrdinal() {
|
||||||
|
return ordinal;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOrdinal(Integer ordinal) {
|
||||||
|
this.ordinal = ordinal;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isRequired() {
|
||||||
|
return required;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRequired(boolean required) {
|
||||||
|
this.required = required;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,93 @@
|
||||||
|
package eu.eudat.model.dmpblueprintdefinition;
|
||||||
|
|
||||||
|
|
||||||
|
import eu.eudat.commons.enums.DmpBlueprintExtraFieldType;
|
||||||
|
import eu.eudat.commons.enums.DmpBlueprintFieldCategory;
|
||||||
|
import eu.eudat.commons.enums.DmpBlueprintSystemFieldType;
|
||||||
|
import eu.eudat.commons.types.dmpblueprint.DescriptionTemplateEntity;
|
||||||
|
import eu.eudat.commons.types.dmpblueprint.FieldEntity;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public class Section {
|
||||||
|
|
||||||
|
public final static String _id = "id";
|
||||||
|
private UUID id;
|
||||||
|
|
||||||
|
public final static String _description = "description";
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
public final static String _label = "label";
|
||||||
|
private String label;
|
||||||
|
|
||||||
|
public final static String _ordinal = "ordinal";
|
||||||
|
private Integer ordinal;
|
||||||
|
|
||||||
|
public final static String _hasTemplates = "hasTemplates";
|
||||||
|
private Boolean hasTemplates;
|
||||||
|
|
||||||
|
public final static String _fields = "fields";
|
||||||
|
private List<Field> fields;
|
||||||
|
|
||||||
|
public final static String _descriptionTemplates = "descriptionTemplates";
|
||||||
|
private List<DescriptionTemplate> descriptionTemplates;
|
||||||
|
|
||||||
|
public UUID getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(UUID 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 Integer getOrdinal() {
|
||||||
|
return ordinal;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOrdinal(Integer ordinal) {
|
||||||
|
this.ordinal = ordinal;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean getHasTemplates() {
|
||||||
|
return hasTemplates;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHasTemplates(Boolean hasTemplates) {
|
||||||
|
this.hasTemplates = hasTemplates;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Field> getFields() {
|
||||||
|
return fields;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFields(List<Field> fields) {
|
||||||
|
this.fields = fields;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<DescriptionTemplate> getDescriptionTemplates() {
|
||||||
|
return descriptionTemplates;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescriptionTemplates(List<DescriptionTemplate> descriptionTemplates) {
|
||||||
|
this.descriptionTemplates = descriptionTemplates;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
package eu.eudat.model.dmpblueprintdefinition;
|
||||||
|
|
||||||
|
import eu.eudat.commons.enums.DmpBlueprintSystemFieldType;
|
||||||
|
|
||||||
|
public class SystemField extends Field {
|
||||||
|
|
||||||
|
public final static String _type = "type";
|
||||||
|
private DmpBlueprintSystemFieldType type;
|
||||||
|
|
||||||
|
public DmpBlueprintSystemFieldType getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(DmpBlueprintSystemFieldType type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,196 @@
|
||||||
|
package eu.eudat.query;
|
||||||
|
|
||||||
|
import eu.eudat.authorization.AuthorizationFlags;
|
||||||
|
import eu.eudat.commons.enums.DmpBlueprintStatus;
|
||||||
|
import eu.eudat.commons.enums.IsActive;
|
||||||
|
import eu.eudat.commons.scope.user.UserScope;
|
||||||
|
import eu.eudat.data.DmpBlueprintEntity;
|
||||||
|
import eu.eudat.model.DmpBlueprint;
|
||||||
|
import gr.cite.commons.web.authz.service.AuthorizationService;
|
||||||
|
import gr.cite.tools.data.query.FieldResolver;
|
||||||
|
import gr.cite.tools.data.query.QueryBase;
|
||||||
|
import gr.cite.tools.data.query.QueryContext;
|
||||||
|
import jakarta.persistence.Tuple;
|
||||||
|
import jakarta.persistence.criteria.CriteriaBuilder;
|
||||||
|
import jakarta.persistence.criteria.Predicate;
|
||||||
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.time.Instant;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public class DmpBlueprintQuery extends QueryBase<DmpBlueprintEntity> {
|
||||||
|
|
||||||
|
private String like;
|
||||||
|
|
||||||
|
private Collection<UUID> ids;
|
||||||
|
|
||||||
|
private Collection<IsActive> isActives;
|
||||||
|
|
||||||
|
private Collection<DmpBlueprintStatus> statuses;
|
||||||
|
|
||||||
|
private Collection<UUID> excludedIds;
|
||||||
|
|
||||||
|
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
||||||
|
|
||||||
|
public DmpBlueprintQuery like(String value) {
|
||||||
|
this.like = value;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DmpBlueprintQuery ids(UUID value) {
|
||||||
|
this.ids = List.of(value);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DmpBlueprintQuery ids(UUID... value) {
|
||||||
|
this.ids = Arrays.asList(value);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DmpBlueprintQuery ids(Collection<UUID> values) {
|
||||||
|
this.ids = values;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DmpBlueprintQuery isActive(IsActive value) {
|
||||||
|
this.isActives = List.of(value);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DmpBlueprintQuery isActive(IsActive... value) {
|
||||||
|
this.isActives = Arrays.asList(value);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DmpBlueprintQuery isActive(Collection<IsActive> values) {
|
||||||
|
this.isActives = values;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DmpBlueprintQuery statuses(DmpBlueprintStatus value) {
|
||||||
|
this.statuses = List.of(value);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DmpBlueprintQuery statuses(DmpBlueprintStatus... value) {
|
||||||
|
this.statuses = Arrays.asList(value);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DmpBlueprintQuery statuses(Collection<DmpBlueprintStatus> values) {
|
||||||
|
this.statuses = values;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DmpBlueprintQuery excludedIds(Collection<UUID> values) {
|
||||||
|
this.excludedIds = values;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DmpBlueprintQuery excludedIds(UUID value) {
|
||||||
|
this.excludedIds = List.of(value);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DmpBlueprintQuery excludedIds(UUID... value) {
|
||||||
|
this.excludedIds = Arrays.asList(value);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DmpBlueprintQuery authorize(EnumSet<AuthorizationFlags> values) {
|
||||||
|
this.authorize = values;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
private final UserScope userScope;
|
||||||
|
|
||||||
|
private final AuthorizationService authService;
|
||||||
|
|
||||||
|
public DmpBlueprintQuery(
|
||||||
|
UserScope userScope,
|
||||||
|
AuthorizationService authService
|
||||||
|
) {
|
||||||
|
this.userScope = userScope;
|
||||||
|
this.authService = authService;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<DmpBlueprintEntity> entityClass() {
|
||||||
|
return DmpBlueprintEntity.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Boolean isFalseQuery() {
|
||||||
|
return this.isEmpty(this.ids) || this.isEmpty(this.isActives) || this.isEmpty(this.excludedIds) || this.isEmpty(this.statuses);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected <X, Y> Predicate applyFilters(QueryContext<X, Y> queryContext) {
|
||||||
|
List<Predicate> predicates = new ArrayList<>();
|
||||||
|
if (this.ids != null) {
|
||||||
|
CriteriaBuilder.In<UUID> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(DmpBlueprintEntity._id));
|
||||||
|
for (UUID item : this.ids)
|
||||||
|
inClause.value(item);
|
||||||
|
predicates.add(inClause);
|
||||||
|
}
|
||||||
|
if (this.like != null && !this.like.isEmpty()) {
|
||||||
|
predicates.add(queryContext.CriteriaBuilder.like(queryContext.Root.get(DmpBlueprintEntity._label), this.like));
|
||||||
|
}
|
||||||
|
if (this.isActives != null) {
|
||||||
|
CriteriaBuilder.In<IsActive> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(DmpBlueprintEntity._isActive));
|
||||||
|
for (IsActive item : this.isActives)
|
||||||
|
inClause.value(item);
|
||||||
|
predicates.add(inClause);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.statuses != null) {
|
||||||
|
CriteriaBuilder.In<DmpBlueprintStatus> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(DmpBlueprintEntity._status));
|
||||||
|
for (DmpBlueprintStatus item : this.statuses)
|
||||||
|
inClause.value(item);
|
||||||
|
predicates.add(inClause);
|
||||||
|
}
|
||||||
|
if (this.excludedIds != null) {
|
||||||
|
CriteriaBuilder.In<UUID> notInClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(DmpBlueprintEntity._id));
|
||||||
|
for (UUID item : this.excludedIds)
|
||||||
|
notInClause.value(item);
|
||||||
|
predicates.add(notInClause.not());
|
||||||
|
}
|
||||||
|
if (!predicates.isEmpty()) {
|
||||||
|
Predicate[] predicatesArray = predicates.toArray(new Predicate[0]);
|
||||||
|
return queryContext.CriteriaBuilder.and(predicatesArray);
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected DmpBlueprintEntity convert(Tuple tuple, Set<String> columns) {
|
||||||
|
DmpBlueprintEntity item = new DmpBlueprintEntity();
|
||||||
|
item.setId(QueryBase.convertSafe(tuple, columns, DmpBlueprintEntity._id, UUID.class));
|
||||||
|
item.setLabel(QueryBase.convertSafe(tuple, columns, DmpBlueprintEntity._label, String.class));
|
||||||
|
item.setCreatedAt(QueryBase.convertSafe(tuple, columns, DmpBlueprintEntity._createdAt, Instant.class));
|
||||||
|
item.setUpdatedAt(QueryBase.convertSafe(tuple, columns, DmpBlueprintEntity._updatedAt, Instant.class));
|
||||||
|
item.setIsActive(QueryBase.convertSafe(tuple, columns, DmpBlueprintEntity._isActive, IsActive.class));
|
||||||
|
item.setDefinition(QueryBase.convertSafe(tuple, columns, DmpBlueprintEntity._definition, String.class));
|
||||||
|
item.setStatus(QueryBase.convertSafe(tuple, columns, DmpBlueprintEntity._status, DmpBlueprintStatus.class));
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String fieldNameOf(FieldResolver item) {
|
||||||
|
if (item.match(DmpBlueprint._id)) return DmpBlueprintEntity._id;
|
||||||
|
else if (item.match(DmpBlueprint._label)) return DmpBlueprintEntity._label;
|
||||||
|
else if (item.match(DmpBlueprint._definition)) return DmpBlueprintEntity._definition;
|
||||||
|
else if (item.prefix(DmpBlueprint._definition)) return DmpBlueprintEntity._definition;
|
||||||
|
else if (item.match(DmpBlueprint._createdAt)) return DmpBlueprintEntity._createdAt;
|
||||||
|
else if (item.match(DmpBlueprint._updatedAt)) return DmpBlueprintEntity._updatedAt;
|
||||||
|
else if (item.match(DmpBlueprint._isActive)) return DmpBlueprintEntity._isActive;
|
||||||
|
else if (item.match(DmpBlueprint._status)) return DmpBlueprintEntity._status;
|
||||||
|
else return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,15 +1,16 @@
|
||||||
package eu.eudat.data.dao.criteria;
|
package eu.eudat.data.dao.criteria;
|
||||||
|
|
||||||
import eu.eudat.data.old.DMPProfile;
|
import eu.eudat.commons.enums.DmpBlueprintStatus;
|
||||||
|
import eu.eudat.data.DmpBlueprintEntity;
|
||||||
|
|
||||||
public class DataManagementPlanBlueprintCriteria extends Criteria<DMPProfile> {
|
public class DataManagementPlanBlueprintCriteria extends Criteria<DmpBlueprintEntity> {
|
||||||
|
|
||||||
private Integer status;
|
private DmpBlueprintStatus status;
|
||||||
|
|
||||||
public Integer getStatus() {
|
public DmpBlueprintStatus getStatus() {
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
public void setStatus(Integer status) {
|
public void setStatus(DmpBlueprintStatus status) {
|
||||||
this.status = status;
|
this.status = status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package eu.eudat.data.dao.criteria;
|
package eu.eudat.data.dao.criteria;
|
||||||
|
|
||||||
import eu.eudat.data.old.DMP;
|
import eu.eudat.data.old.DMP;
|
||||||
import eu.eudat.data.old.DMPProfile;
|
import eu.eudat.data.DmpBlueprintEntity;
|
||||||
import eu.eudat.data.old.Grant;
|
import eu.eudat.data.old.Grant;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
@ -11,7 +11,7 @@ import java.util.UUID;
|
||||||
public class DataManagementPlanCriteria extends Criteria<DMP> {
|
public class DataManagementPlanCriteria extends Criteria<DMP> {
|
||||||
private Date periodStart;
|
private Date periodStart;
|
||||||
private Date periodEnd;
|
private Date periodEnd;
|
||||||
private DMPProfile profile;
|
private DmpBlueprintEntity profile;
|
||||||
private List<Grant> grants;
|
private List<Grant> grants;
|
||||||
private boolean allVersions;
|
private boolean allVersions;
|
||||||
private List<UUID> groupIds;
|
private List<UUID> groupIds;
|
||||||
|
@ -39,10 +39,10 @@ public class DataManagementPlanCriteria extends Criteria<DMP> {
|
||||||
this.periodEnd = periodEnd;
|
this.periodEnd = periodEnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DMPProfile getProfile() {
|
public DmpBlueprintEntity getProfile() {
|
||||||
return profile;
|
return profile;
|
||||||
}
|
}
|
||||||
public void setProfile(DMPProfile profile) {
|
public void setProfile(DmpBlueprintEntity profile) {
|
||||||
this.profile = profile;
|
this.profile = profile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package eu.eudat.data.dao.criteria;
|
package eu.eudat.data.dao.criteria;
|
||||||
|
|
||||||
import eu.eudat.data.old.DMPProfile;
|
import eu.eudat.data.DmpBlueprintEntity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by ikalyvas on 3/21/2018.
|
* Created by ikalyvas on 3/21/2018.
|
||||||
*/
|
*/
|
||||||
public class DataManagementPlanProfileCriteria extends Criteria<DMPProfile> {
|
public class DataManagementPlanProfileCriteria extends Criteria<DmpBlueprintEntity> {
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ package eu.eudat.data.dao.entities;
|
||||||
import eu.eudat.data.dao.DatabaseAccessLayer;
|
import eu.eudat.data.dao.DatabaseAccessLayer;
|
||||||
import eu.eudat.data.dao.criteria.DataManagementPlanBlueprintCriteria;
|
import eu.eudat.data.dao.criteria.DataManagementPlanBlueprintCriteria;
|
||||||
import eu.eudat.data.dao.criteria.DataManagementPlanProfileCriteria;
|
import eu.eudat.data.dao.criteria.DataManagementPlanProfileCriteria;
|
||||||
import eu.eudat.data.old.DMPProfile;
|
import eu.eudat.data.DmpBlueprintEntity;
|
||||||
import eu.eudat.queryable.QueryableList;
|
import eu.eudat.queryable.QueryableList;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
@ -11,10 +11,10 @@ import java.util.UUID;
|
||||||
/**
|
/**
|
||||||
* Created by ikalyvas on 3/21/2018.
|
* Created by ikalyvas on 3/21/2018.
|
||||||
*/
|
*/
|
||||||
public interface DMPProfileDao extends DatabaseAccessLayer<DMPProfile, UUID> {
|
public interface DMPProfileDao extends DatabaseAccessLayer<DmpBlueprintEntity, UUID> {
|
||||||
|
|
||||||
QueryableList<DMPProfile> getWithCriteria(DataManagementPlanProfileCriteria criteria);
|
QueryableList<DmpBlueprintEntity> getWithCriteria(DataManagementPlanProfileCriteria criteria);
|
||||||
|
|
||||||
QueryableList<DMPProfile> getWithCriteriaBlueprint(DataManagementPlanBlueprintCriteria criteria);
|
QueryableList<DmpBlueprintEntity> getWithCriteriaBlueprint(DataManagementPlanBlueprintCriteria criteria);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
package eu.eudat.data.dao.entities;
|
package eu.eudat.data.dao.entities;
|
||||||
|
|
||||||
|
import eu.eudat.commons.enums.DmpBlueprintStatus;
|
||||||
|
import eu.eudat.commons.enums.IsActive;
|
||||||
import eu.eudat.data.dao.DatabaseAccess;
|
import eu.eudat.data.dao.DatabaseAccess;
|
||||||
import eu.eudat.data.dao.criteria.DataManagementPlanBlueprintCriteria;
|
import eu.eudat.data.dao.criteria.DataManagementPlanBlueprintCriteria;
|
||||||
import eu.eudat.data.dao.criteria.DataManagementPlanProfileCriteria;
|
import eu.eudat.data.dao.criteria.DataManagementPlanProfileCriteria;
|
||||||
import eu.eudat.data.dao.databaselayer.service.DatabaseService;
|
import eu.eudat.data.dao.databaselayer.service.DatabaseService;
|
||||||
import eu.eudat.data.old.DMPProfile;
|
import eu.eudat.data.DmpBlueprintEntity;
|
||||||
import eu.eudat.queryable.QueryableList;
|
import eu.eudat.queryable.QueryableList;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.scheduling.annotation.Async;
|
import org.springframework.scheduling.annotation.Async;
|
||||||
|
@ -18,69 +20,69 @@ import java.util.concurrent.CompletableFuture;
|
||||||
* Created by ikalyvas on 3/21/2018.
|
* Created by ikalyvas on 3/21/2018.
|
||||||
*/
|
*/
|
||||||
@Service("dmpProfileDao")
|
@Service("dmpProfileDao")
|
||||||
public class DMPProfileDaoImpl extends DatabaseAccess<DMPProfile> implements DMPProfileDao {
|
public class DMPProfileDaoImpl extends DatabaseAccess<DmpBlueprintEntity> implements DMPProfileDao {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public DMPProfileDaoImpl(DatabaseService<DMPProfile> databaseService) {
|
public DMPProfileDaoImpl(DatabaseService<DmpBlueprintEntity> databaseService) {
|
||||||
super(databaseService);
|
super(databaseService);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Async
|
@Async
|
||||||
@Override
|
@Override
|
||||||
public CompletableFuture<DMPProfile> createOrUpdateAsync(DMPProfile item) {
|
public CompletableFuture<DmpBlueprintEntity> createOrUpdateAsync(DmpBlueprintEntity item) {
|
||||||
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));
|
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DMPProfile createOrUpdate(DMPProfile item) {
|
public DmpBlueprintEntity createOrUpdate(DmpBlueprintEntity item) {
|
||||||
return this.getDatabaseService().createOrUpdate(item, DMPProfile.class);
|
return this.getDatabaseService().createOrUpdate(item, DmpBlueprintEntity.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DMPProfile find(UUID id) throws InvalidApplicationException {
|
public DmpBlueprintEntity find(UUID id) throws InvalidApplicationException {
|
||||||
return getDatabaseService().getQueryable(DMPProfile.class).where((builder, root) -> builder.equal((root.get("id")), id)).getSingle();
|
return getDatabaseService().getQueryable(DmpBlueprintEntity.class).where((builder, root) -> builder.equal((root.get("id")), id)).getSingle();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DMPProfile find(UUID id, String hint) throws InvalidApplicationException {
|
public DmpBlueprintEntity find(UUID id, String hint) throws InvalidApplicationException {
|
||||||
return getDatabaseService().getQueryable(DMPProfile.class).where((builder, root) -> builder.equal((root.get("id")), id)).getSingle();
|
return getDatabaseService().getQueryable(DmpBlueprintEntity.class).where((builder, root) -> builder.equal((root.get("id")), id)).getSingle();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void delete(DMPProfile item) {
|
public void delete(DmpBlueprintEntity item) {
|
||||||
this.getDatabaseService().delete(item);
|
this.getDatabaseService().delete(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public QueryableList<DMPProfile> asQueryable() {
|
public QueryableList<DmpBlueprintEntity> asQueryable() {
|
||||||
return this.getDatabaseService().getQueryable(DMPProfile.class);
|
return this.getDatabaseService().getQueryable(DmpBlueprintEntity.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public QueryableList<DMPProfile> getWithCriteria(DataManagementPlanProfileCriteria criteria) {
|
public QueryableList<DmpBlueprintEntity> getWithCriteria(DataManagementPlanProfileCriteria criteria) {
|
||||||
QueryableList<DMPProfile> query = getDatabaseService().getQueryable(DMPProfile.class);
|
QueryableList<DmpBlueprintEntity> query = getDatabaseService().getQueryable(DmpBlueprintEntity.class);
|
||||||
if (criteria.getLike() != null && !criteria.getLike().isEmpty())
|
if (criteria.getLike() != null && !criteria.getLike().isEmpty())
|
||||||
query.where((builder, root) -> builder.like(builder.upper(root.get("label")), "%" + criteria.getLike().toUpperCase() + "%"));
|
query.where((builder, root) -> builder.like(builder.upper(root.get("label")), "%" + criteria.getLike().toUpperCase() + "%"));
|
||||||
query.where(((builder, root) -> builder.notEqual(root.get("status"), DMPProfile.Status.DELETED.getValue())));
|
query.where(((builder, root) -> builder.notEqual(root.get(DmpBlueprintEntity._isActive), IsActive.Inactive)));
|
||||||
return query;
|
return query;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public QueryableList<DMPProfile> getWithCriteriaBlueprint(DataManagementPlanBlueprintCriteria criteria){
|
public QueryableList<DmpBlueprintEntity> getWithCriteriaBlueprint(DataManagementPlanBlueprintCriteria criteria){
|
||||||
QueryableList<DMPProfile> query = getDatabaseService().getQueryable(DMPProfile.class);
|
QueryableList<DmpBlueprintEntity> query = getDatabaseService().getQueryable(DmpBlueprintEntity.class);
|
||||||
if (criteria.getLike() != null && !criteria.getLike().isEmpty())
|
if (criteria.getLike() != null && !criteria.getLike().isEmpty())
|
||||||
query.where((builder, root) -> builder.like(builder.upper(root.get("label")), "%" + criteria.getLike().toUpperCase() + "%"));
|
query.where((builder, root) -> builder.like(builder.upper(root.get("label")), "%" + criteria.getLike().toUpperCase() + "%"));
|
||||||
if (criteria.getStatus() != null) {
|
if (criteria.getStatus() != null) {
|
||||||
if (criteria.getStatus() == DMPProfile.Status.FINALIZED.getValue()) {
|
if (criteria.getStatus().equals(DmpBlueprintStatus.Finalized)) {
|
||||||
query.where((builder, root) -> builder.equal(root.get("status"), DMPProfile.Status.FINALIZED.getValue()));
|
query.where((builder, root) -> builder.equal(root.get(DmpBlueprintEntity._status), DmpBlueprintStatus.Finalized));
|
||||||
} else if (criteria.getStatus() == DMPProfile.Status.SAVED.getValue()) {
|
} else if (criteria.getStatus().equals(DmpBlueprintStatus.Draft)) {
|
||||||
query.where((builder, root) -> builder.equal(root.get("status"), DMPProfile.Status.SAVED.getValue()));
|
query.where((builder, root) -> builder.equal(root.get(DmpBlueprintEntity._status), DmpBlueprintStatus.Draft));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
query.where(((builder, root) -> builder.notEqual(root.get("status"), DMPProfile.Status.DELETED.getValue())));
|
query.where(((builder, root) -> builder.notEqual(root.get(DmpBlueprintEntity._isActive), IsActive.Inactive)));
|
||||||
return query;
|
return query;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
package eu.eudat.data.query.items.dmpblueprint;
|
package eu.eudat.data.query.items.dmpblueprint;
|
||||||
|
|
||||||
import eu.eudat.data.dao.criteria.DataManagementPlanBlueprintCriteria;
|
import eu.eudat.data.dao.criteria.DataManagementPlanBlueprintCriteria;
|
||||||
import eu.eudat.data.old.DMPProfile;
|
import eu.eudat.data.DmpBlueprintEntity;
|
||||||
import eu.eudat.data.query.PaginationService;
|
import eu.eudat.data.query.PaginationService;
|
||||||
import eu.eudat.data.query.definition.TableQuery;
|
import eu.eudat.data.query.definition.TableQuery;
|
||||||
import eu.eudat.queryable.QueryableList;
|
import eu.eudat.queryable.QueryableList;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class DataManagementPlanBlueprintTableRequest extends TableQuery<DataManagementPlanBlueprintCriteria, DMPProfile, UUID> {
|
public class DataManagementPlanBlueprintTableRequest extends TableQuery<DataManagementPlanBlueprintCriteria, DmpBlueprintEntity, UUID> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public QueryableList<DMPProfile> applyCriteria() {
|
public QueryableList<DmpBlueprintEntity> applyCriteria() {
|
||||||
QueryableList<DMPProfile> query = this.getQuery();
|
QueryableList<DmpBlueprintEntity> query = this.getQuery();
|
||||||
if (this.getCriteria().getLike() != null && !this.getCriteria().getLike().isEmpty())
|
if (this.getCriteria().getLike() != null && !this.getCriteria().getLike().isEmpty())
|
||||||
query.where((builder, root) -> builder.like(root.get("label"), "%" + this.getCriteria().getLike() + "%"));
|
query.where((builder, root) -> builder.like(root.get("label"), "%" + this.getCriteria().getLike() + "%"));
|
||||||
if (this.getCriteria().getStatus() != null)
|
if (this.getCriteria().getStatus() != null)
|
||||||
|
@ -21,7 +21,7 @@ public class DataManagementPlanBlueprintTableRequest extends TableQuery<DataMana
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public QueryableList<DMPProfile> applyPaging(QueryableList<DMPProfile> items) {
|
public QueryableList<DmpBlueprintEntity> applyPaging(QueryableList<DmpBlueprintEntity> items) {
|
||||||
return PaginationService.applyPaging(items, this);
|
return PaginationService.applyPaging(items, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
package eu.eudat.data.query.items.item.dmpprofile;
|
package eu.eudat.data.query.items.item.dmpprofile;
|
||||||
|
|
||||||
import eu.eudat.data.dao.criteria.DataManagementPlanProfileCriteria;
|
import eu.eudat.data.dao.criteria.DataManagementPlanProfileCriteria;
|
||||||
import eu.eudat.data.old.DMPProfile;
|
import eu.eudat.data.DmpBlueprintEntity;
|
||||||
import eu.eudat.data.query.definition.Query;
|
import eu.eudat.data.query.definition.Query;
|
||||||
import eu.eudat.queryable.QueryableList;
|
import eu.eudat.queryable.QueryableList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by ikalyvas on 3/21/2018.
|
* Created by ikalyvas on 3/21/2018.
|
||||||
*/
|
*/
|
||||||
public class DataManagementPlanProfileCriteriaRequest extends Query<DataManagementPlanProfileCriteria, DMPProfile> {
|
public class DataManagementPlanProfileCriteriaRequest extends Query<DataManagementPlanProfileCriteria, DmpBlueprintEntity> {
|
||||||
@Override
|
@Override
|
||||||
public QueryableList<DMPProfile> applyCriteria() {
|
public QueryableList<DmpBlueprintEntity> applyCriteria() {
|
||||||
QueryableList<DMPProfile> query = this.getQuery();
|
QueryableList<DmpBlueprintEntity> query = this.getQuery();
|
||||||
if (this.getCriteria().getLike() != null && !this.getCriteria().getLike().isEmpty())
|
if (this.getCriteria().getLike() != null && !this.getCriteria().getLike().isEmpty())
|
||||||
query.where((builder, root) -> builder.like(builder.upper(root.get("label")), "%" + this.getCriteria().getLike().toUpperCase() + "%"));
|
query.where((builder, root) -> builder.like(builder.upper(root.get("label")), "%" + this.getCriteria().getLike().toUpperCase() + "%"));
|
||||||
return query;
|
return query;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package eu.eudat.data.query.items.table.dmpprofile;
|
package eu.eudat.data.query.items.table.dmpprofile;
|
||||||
|
|
||||||
import eu.eudat.data.dao.criteria.DataManagementPlanProfileCriteria;
|
import eu.eudat.data.dao.criteria.DataManagementPlanProfileCriteria;
|
||||||
import eu.eudat.data.old.DMPProfile;
|
import eu.eudat.data.DmpBlueprintEntity;
|
||||||
import eu.eudat.data.query.PaginationService;
|
import eu.eudat.data.query.PaginationService;
|
||||||
import eu.eudat.data.query.definition.TableQuery;
|
import eu.eudat.data.query.definition.TableQuery;
|
||||||
import eu.eudat.queryable.QueryableList;
|
import eu.eudat.queryable.QueryableList;
|
||||||
|
@ -11,18 +11,18 @@ import java.util.UUID;
|
||||||
/**
|
/**
|
||||||
* Created by ikalyvas on 3/21/2018.
|
* Created by ikalyvas on 3/21/2018.
|
||||||
*/
|
*/
|
||||||
public class DataManagementPlanProfileTableRequest extends TableQuery<DataManagementPlanProfileCriteria, DMPProfile, UUID> {
|
public class DataManagementPlanProfileTableRequest extends TableQuery<DataManagementPlanProfileCriteria, DmpBlueprintEntity, UUID> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public QueryableList<DMPProfile> applyCriteria() {
|
public QueryableList<DmpBlueprintEntity> applyCriteria() {
|
||||||
QueryableList<DMPProfile> query = this.getQuery();
|
QueryableList<DmpBlueprintEntity> query = this.getQuery();
|
||||||
if (this.getCriteria().getLike() != null && !this.getCriteria().getLike().isEmpty())
|
if (this.getCriteria().getLike() != null && !this.getCriteria().getLike().isEmpty())
|
||||||
query.where((builder, root) -> builder.like(root.get("label"), "%" + this.getCriteria().getLike() + "%"));
|
query.where((builder, root) -> builder.like(root.get("label"), "%" + this.getCriteria().getLike() + "%"));
|
||||||
return query;
|
return query;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public QueryableList<DMPProfile> applyPaging(QueryableList<DMPProfile> items) {
|
public QueryableList<DmpBlueprintEntity> applyPaging(QueryableList<DmpBlueprintEntity> items) {
|
||||||
return PaginationService.applyPaging(items, this);
|
return PaginationService.applyPaging(items, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ package eu.eudat.controllers;
|
||||||
|
|
||||||
import eu.eudat.authorization.Permission;
|
import eu.eudat.authorization.Permission;
|
||||||
import eu.eudat.data.dao.criteria.RequestItem;
|
import eu.eudat.data.dao.criteria.RequestItem;
|
||||||
import eu.eudat.data.old.DMPProfile;
|
import eu.eudat.data.DmpBlueprintEntity;
|
||||||
import eu.eudat.data.old.DescriptionTemplate;
|
import eu.eudat.data.old.DescriptionTemplate;
|
||||||
import eu.eudat.data.query.items.dmpblueprint.DataManagementPlanBlueprintTableRequest;
|
import eu.eudat.data.query.items.dmpblueprint.DataManagementPlanBlueprintTableRequest;
|
||||||
import eu.eudat.data.query.items.table.dmpprofile.DataManagementPlanProfileTableRequest;
|
import eu.eudat.data.query.items.table.dmpprofile.DataManagementPlanProfileTableRequest;
|
||||||
|
@ -14,7 +14,6 @@ import eu.eudat.models.data.helpers.common.AutoCompleteLookupItem;
|
||||||
import eu.eudat.models.data.helpers.common.DataTableData;
|
import eu.eudat.models.data.helpers.common.DataTableData;
|
||||||
import eu.eudat.models.data.helpers.responses.ResponseItem;
|
import eu.eudat.models.data.helpers.responses.ResponseItem;
|
||||||
import eu.eudat.models.data.listingmodels.DataManagementPlanBlueprintListingModel;
|
import eu.eudat.models.data.listingmodels.DataManagementPlanBlueprintListingModel;
|
||||||
import eu.eudat.models.data.listingmodels.DataManagementPlanProfileListingModel;
|
|
||||||
import eu.eudat.types.ApiMessageCode;
|
import eu.eudat.types.ApiMessageCode;
|
||||||
import gr.cite.commons.web.authz.service.AuthorizationService;
|
import gr.cite.commons.web.authz.service.AuthorizationService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -31,8 +30,6 @@ import javax.xml.xpath.XPathExpressionException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static eu.eudat.types.Authorities.ADMIN;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by ikalyvas on 3/21/2018.
|
* Created by ikalyvas on 3/21/2018.
|
||||||
*/
|
*/
|
||||||
|
@ -51,34 +48,34 @@ public class DMPProfileController extends BaseController {
|
||||||
this.authorizationService = authorizationService;
|
this.authorizationService = authorizationService;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
// @Transactional
|
||||||
@RequestMapping(method = RequestMethod.POST, consumes = "application/json", produces = "application/json")
|
// @RequestMapping(method = RequestMethod.POST, consumes = "application/json", produces = "application/json")
|
||||||
public @ResponseBody
|
// public @ResponseBody
|
||||||
ResponseEntity<ResponseItem<DMPProfile>> createOrUpdate(@RequestBody DataManagementPlanProfileListingModel dataManagementPlan) throws Exception {
|
// ResponseEntity<ResponseItem<DmpBlueprintEntity>> createOrUpdate(@RequestBody DataManagementPlanProfileListingModel dataManagementPlan) throws Exception {
|
||||||
this.authorizationService.authorizeForce(Permission.AdminRole);
|
// this.authorizationService.authorizeForce(Permission.AdminRole);
|
||||||
|
//
|
||||||
this.dataManagementProfileManager.createOrUpdate(dataManagementPlan);
|
// this.dataManagementProfileManager.createOrUpdate(dataManagementPlan);
|
||||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DMPProfile>().status(ApiMessageCode.SUCCESS_MESSAGE).message("Created"));
|
// return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DmpBlueprintEntity>().status(ApiMessageCode.SUCCESS_MESSAGE).message("Created"));
|
||||||
}
|
// }
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
@RequestMapping(method = RequestMethod.POST, value = {"/blueprint"}, consumes = "application/json", produces = "application/json")
|
@RequestMapping(method = RequestMethod.POST, value = {"/blueprint"}, consumes = "application/json", produces = "application/json")
|
||||||
public @ResponseBody
|
public @ResponseBody
|
||||||
ResponseEntity<ResponseItem<DMPProfile>> createOrUpdateBlueprint(@RequestBody DataManagementPlanBlueprintListingModel dataManagementPlan) throws Exception {
|
ResponseEntity<ResponseItem<DmpBlueprintEntity>> createOrUpdateBlueprint(@RequestBody DataManagementPlanBlueprintListingModel dataManagementPlan) throws Exception {
|
||||||
this.authorizationService.authorizeForce(Permission.AdminRole);
|
this.authorizationService.authorizeForce(Permission.AdminRole);
|
||||||
|
|
||||||
this.dataManagementProfileManager.createOrUpdateBlueprint(dataManagementPlan);
|
this.dataManagementProfileManager.createOrUpdateBlueprint(dataManagementPlan);
|
||||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DMPProfile>().status(ApiMessageCode.SUCCESS_MESSAGE).message("Created"));
|
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DmpBlueprintEntity>().status(ApiMessageCode.SUCCESS_MESSAGE).message("Created"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(method = RequestMethod.GET, value = {"/getSingle/{id}"}, produces = "application/json")
|
// @RequestMapping(method = RequestMethod.GET, value = {"/getSingle/{id}"}, produces = "application/json")
|
||||||
public @ResponseBody
|
// public @ResponseBody
|
||||||
ResponseEntity<ResponseItem<DataManagementPlanProfileListingModel>> getSingle(@PathVariable String id) throws IllegalAccessException, InstantiationException, InvalidApplicationException {
|
// ResponseEntity<ResponseItem<DataManagementPlanProfileListingModel>> getSingle(@PathVariable String id) throws IllegalAccessException, InstantiationException, InvalidApplicationException {
|
||||||
this.authorizationService.authorizeForce(Permission.AuthenticatedRole);
|
// this.authorizationService.authorizeForce(Permission.AuthenticatedRole);
|
||||||
|
//
|
||||||
DataManagementPlanProfileListingModel dataManagementPlanProfileListingModel = this.dataManagementProfileManager.getSingle(id);
|
// DataManagementPlanProfileListingModel dataManagementPlanProfileListingModel = this.dataManagementProfileManager.getSingle(id);
|
||||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DataManagementPlanProfileListingModel>().status(ApiMessageCode.NO_MESSAGE).payload(dataManagementPlanProfileListingModel));
|
// return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DataManagementPlanProfileListingModel>().status(ApiMessageCode.NO_MESSAGE).payload(dataManagementPlanProfileListingModel));
|
||||||
}
|
// }
|
||||||
|
|
||||||
@RequestMapping(method = RequestMethod.GET, value = {"/getSingleBlueprint/{id}"}, produces = "application/json")
|
@RequestMapping(method = RequestMethod.GET, value = {"/getSingleBlueprint/{id}"}, produces = "application/json")
|
||||||
public @ResponseBody
|
public @ResponseBody
|
||||||
|
@ -89,14 +86,14 @@ public class DMPProfileController extends BaseController {
|
||||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DataManagementPlanBlueprintListingModel>().status(ApiMessageCode.NO_MESSAGE).payload(dataManagementPlanBlueprintListingModel));
|
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DataManagementPlanBlueprintListingModel>().status(ApiMessageCode.NO_MESSAGE).payload(dataManagementPlanBlueprintListingModel));
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(method = RequestMethod.POST, value = {"/getPaged"}, consumes = "application/json", produces = "application/json")
|
// @RequestMapping(method = RequestMethod.POST, value = {"/getPaged"}, consumes = "application/json", produces = "application/json")
|
||||||
public @ResponseBody
|
// public @ResponseBody
|
||||||
ResponseEntity<ResponseItem<DataTableData<DataManagementPlanProfileListingModel>>> getPaged(@Valid @RequestBody DataManagementPlanProfileTableRequest dataManagementPlanProfileTableRequest) throws Exception {
|
// ResponseEntity<ResponseItem<DataTableData<DataManagementPlanProfileListingModel>>> getPaged(@Valid @RequestBody DataManagementPlanProfileTableRequest dataManagementPlanProfileTableRequest) throws Exception {
|
||||||
this.authorizationService.authorizeForce(Permission.AuthenticatedRole);
|
// this.authorizationService.authorizeForce(Permission.AuthenticatedRole);
|
||||||
|
//
|
||||||
DataTableData<DataManagementPlanProfileListingModel> dataTable = this.dataManagementProfileManager.getPaged(dataManagementPlanProfileTableRequest);
|
// DataTableData<DataManagementPlanProfileListingModel> dataTable = this.dataManagementProfileManager.getPaged(dataManagementPlanProfileTableRequest);
|
||||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DataTableData<DataManagementPlanProfileListingModel>>().status(ApiMessageCode.NO_MESSAGE).payload(dataTable));
|
// return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DataTableData<DataManagementPlanProfileListingModel>>().status(ApiMessageCode.NO_MESSAGE).payload(dataTable));
|
||||||
}
|
// }
|
||||||
|
|
||||||
@RequestMapping(method = RequestMethod.POST, value = {"/getPagedBlueprint"}, consumes = "application/json", produces = "application/json")
|
@RequestMapping(method = RequestMethod.POST, value = {"/getPagedBlueprint"}, consumes = "application/json", produces = "application/json")
|
||||||
public @ResponseBody
|
public @ResponseBody
|
||||||
|
@ -155,9 +152,9 @@ public class DMPProfileController extends BaseController {
|
||||||
.status(ApiMessageCode.SUCCESS_MESSAGE).message(""));
|
.status(ApiMessageCode.SUCCESS_MESSAGE).message(""));
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(method = RequestMethod.POST, value = {"/search/autocomplete"})
|
// @RequestMapping(method = RequestMethod.POST, value = {"/search/autocomplete"})
|
||||||
public ResponseEntity<Object> getExternalAutocomplete(@RequestBody RequestItem<AutoCompleteLookupItem> lookupItem) throws XPathExpressionException, InvalidApplicationException {
|
// public ResponseEntity<Object> getExternalAutocomplete(@RequestBody RequestItem<AutoCompleteLookupItem> lookupItem) throws XPathExpressionException, InvalidApplicationException {
|
||||||
List<Tuple<String, String>> items = this.dataManagementProfileManager.getExternalAutocomplete(lookupItem);
|
// List<Tuple<String, String>> items = this.dataManagementProfileManager.getExternalAutocomplete(lookupItem);
|
||||||
return ResponseEntity.status(HttpStatus.OK).body(items);
|
// return ResponseEntity.status(HttpStatus.OK).body(items);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,130 @@
|
||||||
|
//package eu.eudat.controllers.v2;
|
||||||
|
//
|
||||||
|
//import eu.eudat.audit.AuditableAction;
|
||||||
|
//import eu.eudat.authorization.AuthorizationFlags;
|
||||||
|
//import eu.eudat.data.DescriptionTemplateTypeEntity;
|
||||||
|
//import eu.eudat.model.DmpBlueprint;
|
||||||
|
//import eu.eudat.model.builder.DescriptionTemplateTypeBuilder;
|
||||||
|
//import eu.eudat.model.censorship.DescriptionTemplateTypeCensor;
|
||||||
|
//import eu.eudat.model.persist.DescriptionTemplateTypePersist;
|
||||||
|
//import eu.eudat.model.result.QueryResult;
|
||||||
|
//import eu.eudat.query.DescriptionTemplateTypeQuery;
|
||||||
|
//import eu.eudat.query.lookup.DescriptionTemplateTypeLookup;
|
||||||
|
//import eu.eudat.service.DescriptionTemplateTypeService;
|
||||||
|
//import gr.cite.tools.auditing.AuditService;
|
||||||
|
//import gr.cite.tools.data.builder.BuilderFactory;
|
||||||
|
//import gr.cite.tools.data.censor.CensorFactory;
|
||||||
|
//import gr.cite.tools.data.query.QueryFactory;
|
||||||
|
//import gr.cite.tools.exception.MyApplicationException;
|
||||||
|
//import gr.cite.tools.exception.MyForbiddenException;
|
||||||
|
//import gr.cite.tools.exception.MyNotFoundException;
|
||||||
|
//import gr.cite.tools.fieldset.FieldSet;
|
||||||
|
//import gr.cite.tools.logging.LoggerService;
|
||||||
|
//import gr.cite.tools.logging.MapLogEntry;
|
||||||
|
//import gr.cite.tools.validation.MyValidate;
|
||||||
|
//import org.slf4j.LoggerFactory;
|
||||||
|
//import org.springframework.context.MessageSource;
|
||||||
|
//import org.springframework.context.i18n.LocaleContextHolder;
|
||||||
|
//import org.springframework.transaction.annotation.Transactional;
|
||||||
|
//import org.springframework.web.bind.annotation.*;
|
||||||
|
//
|
||||||
|
//import javax.management.InvalidApplicationException;
|
||||||
|
//import java.util.*;
|
||||||
|
//
|
||||||
|
//@RestController
|
||||||
|
//@CrossOrigin
|
||||||
|
//@RequestMapping(path = "api/dmp-blueprint")
|
||||||
|
//public class DmpBlueprintController {
|
||||||
|
//
|
||||||
|
// private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(DmpBlueprintController.class));
|
||||||
|
//
|
||||||
|
// private final BuilderFactory builderFactory;
|
||||||
|
//
|
||||||
|
// private final AuditService auditService;
|
||||||
|
//
|
||||||
|
// private final DescriptionTemplateTypeService descriptionTemplateTypeService;
|
||||||
|
//
|
||||||
|
// private final CensorFactory censorFactory;
|
||||||
|
//
|
||||||
|
// private final QueryFactory queryFactory;
|
||||||
|
//
|
||||||
|
// private final MessageSource messageSource;
|
||||||
|
//
|
||||||
|
// public DmpBlueprintController(
|
||||||
|
// BuilderFactory builderFactory,
|
||||||
|
// AuditService auditService,
|
||||||
|
// DescriptionTemplateTypeService descriptionTemplateTypeService,
|
||||||
|
// CensorFactory censorFactory,
|
||||||
|
// QueryFactory queryFactory,
|
||||||
|
// MessageSource messageSource) {
|
||||||
|
// this.builderFactory = builderFactory;
|
||||||
|
// this.auditService = auditService;
|
||||||
|
// this.descriptionTemplateTypeService = descriptionTemplateTypeService;
|
||||||
|
// this.censorFactory = censorFactory;
|
||||||
|
// this.queryFactory = queryFactory;
|
||||||
|
// this.messageSource = messageSource;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @PostMapping("query")
|
||||||
|
// public QueryResult<DmpBlueprint> Query(@RequestBody DescriptionTemplateTypeLookup lookup) throws MyApplicationException, MyForbiddenException {
|
||||||
|
// logger.debug("querying {}", DmpBlueprint.class.getSimpleName());
|
||||||
|
//
|
||||||
|
// this.censorFactory.censor(DescriptionTemplateTypeCensor.class).censor(lookup.getProject(), null);
|
||||||
|
//
|
||||||
|
// DescriptionTemplateTypeQuery query = lookup.enrich(this.queryFactory).authorize(AuthorizationFlags.OwnerOrPermission);
|
||||||
|
//
|
||||||
|
// List<DescriptionTemplateTypeEntity> data = query.collectAs(lookup.getProject());
|
||||||
|
// List<DmpBlueprint> models = this.builderFactory.builder(DescriptionTemplateTypeBuilder.class).authorize(AuthorizationFlags.OwnerOrPermission).build(lookup.getProject(), data);
|
||||||
|
// long count = (lookup.getMetadata() != null && lookup.getMetadata().getCountAll()) ? query.count() : models.size();
|
||||||
|
//
|
||||||
|
// this.auditService.track(AuditableAction.DescriptionTemplateType_Query, "lookup", lookup);
|
||||||
|
// //this.auditService.trackIdentity(AuditableAction.IdentityTracking_Action);
|
||||||
|
//
|
||||||
|
// return new QueryResult<>(models, count);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @GetMapping("{id}")
|
||||||
|
// public DmpBlueprint Get(@PathVariable("id") UUID id, FieldSet fieldSet, Locale locale) throws MyApplicationException, MyForbiddenException, MyNotFoundException {
|
||||||
|
// logger.debug(new MapLogEntry("retrieving" + DmpBlueprint.class.getSimpleName()).And("id", id).And("fields", fieldSet));
|
||||||
|
//
|
||||||
|
// this.censorFactory.censor(DescriptionTemplateTypeCensor.class).censor(fieldSet, null);
|
||||||
|
//
|
||||||
|
// DescriptionTemplateTypeQuery query = this.queryFactory.query(DescriptionTemplateTypeQuery.class).authorize(AuthorizationFlags.OwnerOrPermission).ids(id);
|
||||||
|
// DmpBlueprint model = this.builderFactory.builder(DescriptionTemplateTypeBuilder.class).authorize(AuthorizationFlags.OwnerOrPermission).build(fieldSet, query.firstAs(fieldSet));
|
||||||
|
// if (model == null)
|
||||||
|
// throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{id, DmpBlueprint.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||||
|
//
|
||||||
|
// this.auditService.track(AuditableAction.DescriptionTemplateType_Lookup, Map.ofEntries(
|
||||||
|
// new AbstractMap.SimpleEntry<String, Object>("id", id),
|
||||||
|
// new AbstractMap.SimpleEntry<String, Object>("fields", fieldSet)
|
||||||
|
// ));
|
||||||
|
// //this.auditService.trackIdentity(AuditableAction.IdentityTracking_Action);
|
||||||
|
//
|
||||||
|
// return model;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @PostMapping("persist")
|
||||||
|
// @Transactional
|
||||||
|
// public DmpBlueprint Persist(@MyValidate @RequestBody DescriptionTemplateTypePersist model, FieldSet fieldSet) throws MyApplicationException, MyForbiddenException, MyNotFoundException, InvalidApplicationException {
|
||||||
|
// logger.debug(new MapLogEntry("persisting" + DmpBlueprint.class.getSimpleName()).And("model", model).And("fieldSet", fieldSet));
|
||||||
|
// DmpBlueprint persisted = this.descriptionTemplateTypeService.persist(model, fieldSet);
|
||||||
|
//
|
||||||
|
// this.auditService.track(AuditableAction.DescriptionTemplateType_Persist, Map.ofEntries(
|
||||||
|
// new AbstractMap.SimpleEntry<String, Object>("model", model),
|
||||||
|
// new AbstractMap.SimpleEntry<String, Object>("fields", fieldSet)
|
||||||
|
// ));
|
||||||
|
// //this.auditService.trackIdentity(AuditableAction.IdentityTracking_Action);
|
||||||
|
// return persisted;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @DeleteMapping("{id}")
|
||||||
|
// @Transactional
|
||||||
|
// public void Delete(@PathVariable("id") UUID id) throws MyForbiddenException, InvalidApplicationException {
|
||||||
|
// logger.debug(new MapLogEntry("retrieving" + DmpBlueprint.class.getSimpleName()).And("id", id));
|
||||||
|
//
|
||||||
|
// this.descriptionTemplateTypeService.deleteAndSave(id);
|
||||||
|
//
|
||||||
|
// this.auditService.track(AuditableAction.DescriptionTemplateType_Delete, "id", id);
|
||||||
|
// //this.auditService.trackIdentity(AuditableAction.IdentityTracking_Action);
|
||||||
|
// }
|
||||||
|
//}
|
|
@ -10,7 +10,7 @@ import eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition.ViewStyl
|
||||||
import eu.eudat.models.data.admin.composite.DatasetProfile;
|
import eu.eudat.models.data.admin.composite.DatasetProfile;
|
||||||
import eu.eudat.logic.services.ApiContext;
|
import eu.eudat.logic.services.ApiContext;
|
||||||
import eu.eudat.logic.utilities.builders.ModelBuilder;
|
import eu.eudat.logic.utilities.builders.ModelBuilder;
|
||||||
import eu.eudat.logic.utilities.builders.XmlBuilder;
|
import eu.eudat.commons.types.xml.XmlBuilder;
|
||||||
import eu.eudat.service.DescriptionTemplateTypeService;
|
import eu.eudat.service.DescriptionTemplateTypeService;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
|
|
|
@ -5,8 +5,10 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import eu.eudat.authorization.Permission;
|
import eu.eudat.authorization.Permission;
|
||||||
import eu.eudat.commons.scope.user.UserScope;
|
import eu.eudat.commons.scope.user.UserScope;
|
||||||
import eu.eudat.commons.enums.EntityType;
|
import eu.eudat.commons.enums.EntityType;
|
||||||
|
import eu.eudat.commons.types.dmpblueprint.*;
|
||||||
import eu.eudat.configurations.dynamicgrant.DynamicGrantConfiguration;
|
import eu.eudat.configurations.dynamicgrant.DynamicGrantConfiguration;
|
||||||
import eu.eudat.configurations.dynamicgrant.entities.Property;
|
import eu.eudat.configurations.dynamicgrant.entities.Property;
|
||||||
|
import eu.eudat.data.DmpBlueprintEntity;
|
||||||
import eu.eudat.data.EntityDoiEntity;
|
import eu.eudat.data.EntityDoiEntity;
|
||||||
import eu.eudat.data.dao.criteria.*;
|
import eu.eudat.data.dao.criteria.*;
|
||||||
import eu.eudat.data.dao.entities.*;
|
import eu.eudat.data.dao.entities.*;
|
||||||
|
@ -41,7 +43,7 @@ import eu.eudat.logic.services.ApiContext;
|
||||||
import eu.eudat.logic.services.forms.VisibilityRuleService;
|
import eu.eudat.logic.services.forms.VisibilityRuleService;
|
||||||
import eu.eudat.logic.services.forms.VisibilityRuleServiceImpl;
|
import eu.eudat.logic.services.forms.VisibilityRuleServiceImpl;
|
||||||
import eu.eudat.logic.services.operations.DatabaseRepository;
|
import eu.eudat.logic.services.operations.DatabaseRepository;
|
||||||
import eu.eudat.logic.utilities.builders.XmlBuilder;
|
import eu.eudat.commons.types.xml.XmlBuilder;
|
||||||
import eu.eudat.logic.utilities.documents.helpers.FileEnvelope;
|
import eu.eudat.logic.utilities.documents.helpers.FileEnvelope;
|
||||||
import eu.eudat.logic.utilities.documents.pdf.PDFUtils;
|
import eu.eudat.logic.utilities.documents.pdf.PDFUtils;
|
||||||
import eu.eudat.logic.utilities.documents.types.ParagraphStyle;
|
import eu.eudat.logic.utilities.documents.types.ParagraphStyle;
|
||||||
|
@ -56,9 +58,8 @@ import eu.eudat.models.data.dmp.*;
|
||||||
import eu.eudat.models.data.doi.DepositRequest;
|
import eu.eudat.models.data.doi.DepositRequest;
|
||||||
import eu.eudat.models.data.doi.Doi;
|
import eu.eudat.models.data.doi.Doi;
|
||||||
import eu.eudat.models.data.dynamicfields.DynamicFieldWithValue;
|
import eu.eudat.models.data.dynamicfields.DynamicFieldWithValue;
|
||||||
import eu.eudat.models.data.entities.xmlmodels.dmpprofiledefinition.*;
|
import eu.eudat.commons.enums.DmpBlueprintFieldCategory;
|
||||||
import eu.eudat.models.data.entities.xmlmodels.dmpprofiledefinition.types.FieldCategory;
|
import eu.eudat.commons.enums.DmpBlueprintSystemFieldType;
|
||||||
import eu.eudat.models.data.entities.xmlmodels.dmpprofiledefinition.types.SystemFieldType;
|
|
||||||
import eu.eudat.models.data.funder.FunderDMPEditorModel;
|
import eu.eudat.models.data.funder.FunderDMPEditorModel;
|
||||||
import eu.eudat.models.data.grant.GrantDMPEditorModel;
|
import eu.eudat.models.data.grant.GrantDMPEditorModel;
|
||||||
import eu.eudat.models.data.helpermodels.Tuple;
|
import eu.eudat.models.data.helpermodels.Tuple;
|
||||||
|
@ -68,7 +69,6 @@ import eu.eudat.models.data.project.ProjectDMPEditorModel;
|
||||||
import eu.eudat.models.data.user.composite.PagedDatasetProfile;
|
import eu.eudat.models.data.user.composite.PagedDatasetProfile;
|
||||||
import eu.eudat.models.data.userinfo.UserListingModel;
|
import eu.eudat.models.data.userinfo.UserListingModel;
|
||||||
import eu.eudat.queryable.QueryableList;
|
import eu.eudat.queryable.QueryableList;
|
||||||
import eu.eudat.types.Authorities;
|
|
||||||
import eu.eudat.types.MetricNames;
|
import eu.eudat.types.MetricNames;
|
||||||
import gr.cite.commons.web.authz.service.AuthorizationService;
|
import gr.cite.commons.web.authz.service.AuthorizationService;
|
||||||
import org.apache.poi.xwpf.usermodel.XWPFDocument;
|
import org.apache.poi.xwpf.usermodel.XWPFDocument;
|
||||||
|
@ -500,8 +500,8 @@ public class DataManagementPlanManager {
|
||||||
|
|
||||||
DMP newDmp = dataManagementPlan.toDataModel();
|
DMP newDmp = dataManagementPlan.toDataModel();
|
||||||
if(dataManagementPlan.getProfile() != null){
|
if(dataManagementPlan.getProfile() != null){
|
||||||
DMPProfile dmpProfile = apiContext.getOperationsContext().getDatabaseRepository().getDmpProfileDao().find(dataManagementPlan.getProfile().getId());
|
DmpBlueprintEntity dmpBlueprint = apiContext.getOperationsContext().getDatabaseRepository().getDmpProfileDao().find(dataManagementPlan.getProfile().getId());
|
||||||
newDmp.setProfile(dmpProfile);
|
newDmp.setProfile(dmpBlueprint);
|
||||||
}
|
}
|
||||||
if (newDmp.getStatus() == (int) DMP.DMPStatus.FINALISED.getValue()) {
|
if (newDmp.getStatus() == (int) DMP.DMPStatus.FINALISED.getValue()) {
|
||||||
checkDmpValidationRules(newDmp);
|
checkDmpValidationRules(newDmp);
|
||||||
|
@ -509,18 +509,18 @@ public class DataManagementPlanManager {
|
||||||
UserInfo user = apiContext.getOperationsContext().getDatabaseRepository().getUserInfoDao().find(this.userScope.getUserId());
|
UserInfo user = apiContext.getOperationsContext().getDatabaseRepository().getUserInfoDao().find(this.userScope.getUserId());
|
||||||
newDmp.setCreator(user);
|
newDmp.setCreator(user);
|
||||||
|
|
||||||
if(this.dataManagementProfileManager.fieldInBlueprint(newDmp.getProfile(), SystemFieldType.ORGANIZATIONS)) {
|
if(this.dataManagementProfileManager.fieldInBlueprint(newDmp.getProfile(), DmpBlueprintSystemFieldType.Organizations)) {
|
||||||
createOrganisationsIfTheyDontExist(newDmp, apiContext.getOperationsContext().getDatabaseRepository().getOrganisationDao());
|
createOrganisationsIfTheyDontExist(newDmp, apiContext.getOperationsContext().getDatabaseRepository().getOrganisationDao());
|
||||||
}
|
}
|
||||||
if(this.dataManagementProfileManager.fieldInBlueprint(newDmp.getProfile(), SystemFieldType.RESEARCHERS)) {
|
if(this.dataManagementProfileManager.fieldInBlueprint(newDmp.getProfile(), DmpBlueprintSystemFieldType.Researchers)) {
|
||||||
createResearchersIfTheyDontExist(newDmp, apiContext.getOperationsContext().getDatabaseRepository().getResearcherDao(), user);
|
createResearchersIfTheyDontExist(newDmp, apiContext.getOperationsContext().getDatabaseRepository().getResearcherDao(), user);
|
||||||
}
|
}
|
||||||
if(this.dataManagementProfileManager.fieldInBlueprint(newDmp.getProfile(), SystemFieldType.FUNDER)) {
|
if(this.dataManagementProfileManager.fieldInBlueprint(newDmp.getProfile(), DmpBlueprintSystemFieldType.Funder)) {
|
||||||
createFunderIfItDoesntExist(newDmp, apiContext.getOperationsContext().getDatabaseRepository().getFunderDao());
|
createFunderIfItDoesntExist(newDmp, apiContext.getOperationsContext().getDatabaseRepository().getFunderDao());
|
||||||
}
|
}
|
||||||
if(this.dataManagementProfileManager.fieldInBlueprint(newDmp.getProfile(), SystemFieldType.GRANT)) {
|
if(this.dataManagementProfileManager.fieldInBlueprint(newDmp.getProfile(), DmpBlueprintSystemFieldType.Grant)) {
|
||||||
createGrantIfItDoesntExist(newDmp, apiContext.getOperationsContext().getDatabaseRepository().getGrantDao());
|
createGrantIfItDoesntExist(newDmp, apiContext.getOperationsContext().getDatabaseRepository().getGrantDao());
|
||||||
if(this.dataManagementProfileManager.fieldInBlueprint(newDmp.getProfile(), SystemFieldType.PROJECT)) {
|
if(this.dataManagementProfileManager.fieldInBlueprint(newDmp.getProfile(), DmpBlueprintSystemFieldType.Project)) {
|
||||||
if (newDmp.getProject() != null && newDmp.getGrant() != null && (newDmp.getProject().getLabel() == null || newDmp.getProject().getLabel().trim().isEmpty())) {
|
if (newDmp.getProject() != null && newDmp.getGrant() != null && (newDmp.getProject().getLabel() == null || newDmp.getProject().getLabel().trim().isEmpty())) {
|
||||||
newDmp.setProject(newDmp.getProject().projectFromGrant(newDmp.getGrant()));
|
newDmp.setProject(newDmp.getProject().projectFromGrant(newDmp.getGrant()));
|
||||||
}
|
}
|
||||||
|
@ -546,16 +546,16 @@ public class DataManagementPlanManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.dataManagementProfileManager.fieldInBlueprint(newDmp.getProfile(), SystemFieldType.GRANT)) {
|
if(this.dataManagementProfileManager.fieldInBlueprint(newDmp.getProfile(), DmpBlueprintSystemFieldType.Grant)) {
|
||||||
if (newDmp.getGrant() != null && newDmp.getGrant().getType().equals(Grant.GrantType.INTERNAL.getValue())) {
|
if (newDmp.getGrant() != null && newDmp.getGrant().getType().equals(Grant.GrantType.INTERNAL.getValue())) {
|
||||||
checkIfUserCanEditGrant(newDmp, user);
|
checkIfUserCanEditGrant(newDmp, user);
|
||||||
}
|
}
|
||||||
assignGrandUserIfInternal(newDmp, user);
|
assignGrandUserIfInternal(newDmp, user);
|
||||||
}
|
}
|
||||||
if(this.dataManagementProfileManager.fieldInBlueprint(newDmp.getProfile(), SystemFieldType.FUNDER)) {
|
if(this.dataManagementProfileManager.fieldInBlueprint(newDmp.getProfile(), DmpBlueprintSystemFieldType.Funder)) {
|
||||||
assignFunderUserIfInternal(newDmp, user);
|
assignFunderUserIfInternal(newDmp, user);
|
||||||
}
|
}
|
||||||
if(this.dataManagementProfileManager.fieldInBlueprint(newDmp.getProfile(), SystemFieldType.PROJECT)) {
|
if(this.dataManagementProfileManager.fieldInBlueprint(newDmp.getProfile(), DmpBlueprintSystemFieldType.Project)) {
|
||||||
assignProjectUserIfInternal(newDmp, user);
|
assignProjectUserIfInternal(newDmp, user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -565,7 +565,7 @@ public class DataManagementPlanManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.dataManagementProfileManager.fieldInBlueprint(newDmp.getProfile(), SystemFieldType.GRANT)) {
|
if(this.dataManagementProfileManager.fieldInBlueprint(newDmp.getProfile(), DmpBlueprintSystemFieldType.Grant)) {
|
||||||
if (newDmp.getGrant() != null) {
|
if (newDmp.getGrant() != null) {
|
||||||
apiContext.getOperationsContext().getDatabaseRepository().getGrantDao().createOrUpdate(newDmp.getGrant());
|
apiContext.getOperationsContext().getDatabaseRepository().getGrantDao().createOrUpdate(newDmp.getGrant());
|
||||||
}
|
}
|
||||||
|
@ -665,16 +665,16 @@ public class DataManagementPlanManager {
|
||||||
checkDmpValidationRules(tempDMP);
|
checkDmpValidationRules(tempDMP);
|
||||||
}
|
}
|
||||||
UserInfo user = apiContext.getOperationsContext().getDatabaseRepository().getUserInfoDao().find(this.userScope.getUserId());
|
UserInfo user = apiContext.getOperationsContext().getDatabaseRepository().getUserInfoDao().find(this.userScope.getUserId());
|
||||||
if(this.dataManagementProfileManager.fieldInBlueprint(tempDMP.getProfile(), SystemFieldType.ORGANIZATIONS)) {
|
if(this.dataManagementProfileManager.fieldInBlueprint(tempDMP.getProfile(), DmpBlueprintSystemFieldType.Organizations)) {
|
||||||
createOrganisationsIfTheyDontExist(tempDMP, apiContext.getOperationsContext().getDatabaseRepository().getOrganisationDao());
|
createOrganisationsIfTheyDontExist(tempDMP, apiContext.getOperationsContext().getDatabaseRepository().getOrganisationDao());
|
||||||
}
|
}
|
||||||
if(this.dataManagementProfileManager.fieldInBlueprint(tempDMP.getProfile(), SystemFieldType.RESEARCHERS)) {
|
if(this.dataManagementProfileManager.fieldInBlueprint(tempDMP.getProfile(), DmpBlueprintSystemFieldType.Researchers)) {
|
||||||
createResearchersIfTheyDontExist(tempDMP, apiContext.getOperationsContext().getDatabaseRepository().getResearcherDao(), user);
|
createResearchersIfTheyDontExist(tempDMP, apiContext.getOperationsContext().getDatabaseRepository().getResearcherDao(), user);
|
||||||
}
|
}
|
||||||
if(this.dataManagementProfileManager.fieldInBlueprint(tempDMP.getProfile(), SystemFieldType.FUNDER)) {
|
if(this.dataManagementProfileManager.fieldInBlueprint(tempDMP.getProfile(), DmpBlueprintSystemFieldType.Funder)) {
|
||||||
createFunderIfItDoesntExist(tempDMP, apiContext.getOperationsContext().getDatabaseRepository().getFunderDao());
|
createFunderIfItDoesntExist(tempDMP, apiContext.getOperationsContext().getDatabaseRepository().getFunderDao());
|
||||||
}
|
}
|
||||||
if(this.dataManagementProfileManager.fieldInBlueprint(tempDMP.getProfile(), SystemFieldType.GRANT)) {
|
if(this.dataManagementProfileManager.fieldInBlueprint(tempDMP.getProfile(), DmpBlueprintSystemFieldType.Grant)) {
|
||||||
createGrantIfItDoesntExist(tempDMP, apiContext.getOperationsContext().getDatabaseRepository().getGrantDao());
|
createGrantIfItDoesntExist(tempDMP, apiContext.getOperationsContext().getDatabaseRepository().getGrantDao());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -714,18 +714,18 @@ public class DataManagementPlanManager {
|
||||||
newDmp.setDmpProperties(oldDmp.getDmpProperties());
|
newDmp.setDmpProperties(oldDmp.getDmpProperties());
|
||||||
UserInfo user = apiContext.getOperationsContext().getBuilderFactory().getBuilder(UserInfoBuilder.class).id(this.userScope.getUserId()).build();
|
UserInfo user = apiContext.getOperationsContext().getBuilderFactory().getBuilder(UserInfoBuilder.class).id(this.userScope.getUserId()).build();
|
||||||
newDmp.setCreator(user);
|
newDmp.setCreator(user);
|
||||||
if(this.dataManagementProfileManager.fieldInBlueprint(newDmp.getProfile(), SystemFieldType.ORGANIZATIONS)) {
|
if(this.dataManagementProfileManager.fieldInBlueprint(newDmp.getProfile(), DmpBlueprintSystemFieldType.Organizations)) {
|
||||||
createOrganisationsIfTheyDontExist(newDmp, databaseRepository.getOrganisationDao());
|
createOrganisationsIfTheyDontExist(newDmp, databaseRepository.getOrganisationDao());
|
||||||
}
|
}
|
||||||
if(this.dataManagementProfileManager.fieldInBlueprint(newDmp.getProfile(), SystemFieldType.RESEARCHERS)) {
|
if(this.dataManagementProfileManager.fieldInBlueprint(newDmp.getProfile(), DmpBlueprintSystemFieldType.Researchers)) {
|
||||||
createResearchersIfTheyDontExist(newDmp, databaseRepository.getResearcherDao(), user);
|
createResearchersIfTheyDontExist(newDmp, databaseRepository.getResearcherDao(), user);
|
||||||
}
|
}
|
||||||
if(this.dataManagementProfileManager.fieldInBlueprint(newDmp.getProfile(), SystemFieldType.FUNDER)) {
|
if(this.dataManagementProfileManager.fieldInBlueprint(newDmp.getProfile(), DmpBlueprintSystemFieldType.Funder)) {
|
||||||
createFunderIfItDoesntExist(newDmp, databaseRepository.getFunderDao());
|
createFunderIfItDoesntExist(newDmp, databaseRepository.getFunderDao());
|
||||||
}
|
}
|
||||||
if(this.dataManagementProfileManager.fieldInBlueprint(newDmp.getProfile(), SystemFieldType.GRANT)) {
|
if(this.dataManagementProfileManager.fieldInBlueprint(newDmp.getProfile(), DmpBlueprintSystemFieldType.Grant)) {
|
||||||
createGrantIfItDoesntExist(newDmp, databaseRepository.getGrantDao());
|
createGrantIfItDoesntExist(newDmp, databaseRepository.getGrantDao());
|
||||||
if(this.dataManagementProfileManager.fieldInBlueprint(newDmp.getProfile(), SystemFieldType.PROJECT)) {
|
if(this.dataManagementProfileManager.fieldInBlueprint(newDmp.getProfile(), DmpBlueprintSystemFieldType.Project)) {
|
||||||
if (newDmp.getProject() != null && newDmp.getGrant() != null && (newDmp.getProject().getLabel() == null || newDmp.getProject().getLabel().trim().isEmpty())) {
|
if (newDmp.getProject() != null && newDmp.getGrant() != null && (newDmp.getProject().getLabel() == null || newDmp.getProject().getLabel().trim().isEmpty())) {
|
||||||
newDmp.setProject(newDmp.getProject().projectFromGrant(newDmp.getGrant()));
|
newDmp.setProject(newDmp.getProject().projectFromGrant(newDmp.getGrant()));
|
||||||
}
|
}
|
||||||
|
@ -737,19 +737,19 @@ public class DataManagementPlanManager {
|
||||||
newDmp.setVersion(oldDmp.getVersion() + 1);
|
newDmp.setVersion(oldDmp.getVersion() + 1);
|
||||||
newDmp.setId(null);
|
newDmp.setId(null);
|
||||||
|
|
||||||
if(this.dataManagementProfileManager.fieldInBlueprint(newDmp.getProfile(), SystemFieldType.GRANT)) {
|
if(this.dataManagementProfileManager.fieldInBlueprint(newDmp.getProfile(), DmpBlueprintSystemFieldType.Grant)) {
|
||||||
if (newDmp.getGrant() != null && newDmp.getGrant().getType().equals(Grant.GrantType.INTERNAL.getValue())) {
|
if (newDmp.getGrant() != null && newDmp.getGrant().getType().equals(Grant.GrantType.INTERNAL.getValue())) {
|
||||||
checkIfUserCanEditGrant(newDmp, user);
|
checkIfUserCanEditGrant(newDmp, user);
|
||||||
}
|
}
|
||||||
assignGrandUserIfInternal(newDmp, user);
|
assignGrandUserIfInternal(newDmp, user);
|
||||||
}
|
}
|
||||||
if(this.dataManagementProfileManager.fieldInBlueprint(newDmp.getProfile(), SystemFieldType.FUNDER)) {
|
if(this.dataManagementProfileManager.fieldInBlueprint(newDmp.getProfile(), DmpBlueprintSystemFieldType.Funder)) {
|
||||||
assignFunderUserIfInternal(newDmp, user);
|
assignFunderUserIfInternal(newDmp, user);
|
||||||
}
|
}
|
||||||
if(this.dataManagementProfileManager.fieldInBlueprint(newDmp.getProfile(), SystemFieldType.PROJECT)) {
|
if(this.dataManagementProfileManager.fieldInBlueprint(newDmp.getProfile(), DmpBlueprintSystemFieldType.Project)) {
|
||||||
assignProjectUserIfInternal(newDmp, user);
|
assignProjectUserIfInternal(newDmp, user);
|
||||||
}
|
}
|
||||||
if(this.dataManagementProfileManager.fieldInBlueprint(newDmp.getProfile(), SystemFieldType.GRANT)) {
|
if(this.dataManagementProfileManager.fieldInBlueprint(newDmp.getProfile(), DmpBlueprintSystemFieldType.Grant)) {
|
||||||
if (newDmp.getGrant() != null) {
|
if (newDmp.getGrant() != null) {
|
||||||
if (newDmp.getGrant().getStartdate() == null) {
|
if (newDmp.getGrant().getStartdate() == null) {
|
||||||
newDmp.getGrant().setStartdate(new Date());
|
newDmp.getGrant().setStartdate(new Date());
|
||||||
|
@ -803,18 +803,18 @@ public class DataManagementPlanManager {
|
||||||
|
|
||||||
UserInfo user = apiContext.getOperationsContext().getBuilderFactory().getBuilder(UserInfoBuilder.class).id(this.userScope.getUserId()).build();
|
UserInfo user = apiContext.getOperationsContext().getBuilderFactory().getBuilder(UserInfoBuilder.class).id(this.userScope.getUserId()).build();
|
||||||
newDmp.setCreator(user);
|
newDmp.setCreator(user);
|
||||||
if(this.dataManagementProfileManager.fieldInBlueprint(newDmp.getProfile(), SystemFieldType.ORGANIZATIONS)) {
|
if(this.dataManagementProfileManager.fieldInBlueprint(newDmp.getProfile(), DmpBlueprintSystemFieldType.Organizations)) {
|
||||||
createOrganisationsIfTheyDontExist(newDmp, databaseRepository.getOrganisationDao());
|
createOrganisationsIfTheyDontExist(newDmp, databaseRepository.getOrganisationDao());
|
||||||
}
|
}
|
||||||
if(this.dataManagementProfileManager.fieldInBlueprint(newDmp.getProfile(), SystemFieldType.RESEARCHERS)) {
|
if(this.dataManagementProfileManager.fieldInBlueprint(newDmp.getProfile(), DmpBlueprintSystemFieldType.Researchers)) {
|
||||||
createResearchersIfTheyDontExist(newDmp, databaseRepository.getResearcherDao(), user);
|
createResearchersIfTheyDontExist(newDmp, databaseRepository.getResearcherDao(), user);
|
||||||
}
|
}
|
||||||
if(this.dataManagementProfileManager.fieldInBlueprint(newDmp.getProfile(), SystemFieldType.FUNDER)) {
|
if(this.dataManagementProfileManager.fieldInBlueprint(newDmp.getProfile(), DmpBlueprintSystemFieldType.Funder)) {
|
||||||
createFunderIfItDoesntExist(newDmp, databaseRepository.getFunderDao());
|
createFunderIfItDoesntExist(newDmp, databaseRepository.getFunderDao());
|
||||||
}
|
}
|
||||||
if(this.dataManagementProfileManager.fieldInBlueprint(newDmp.getProfile(), SystemFieldType.GRANT)) {
|
if(this.dataManagementProfileManager.fieldInBlueprint(newDmp.getProfile(), DmpBlueprintSystemFieldType.Grant)) {
|
||||||
createGrantIfItDoesntExist(newDmp, databaseRepository.getGrantDao());
|
createGrantIfItDoesntExist(newDmp, databaseRepository.getGrantDao());
|
||||||
if(this.dataManagementProfileManager.fieldInBlueprint(newDmp.getProfile(), SystemFieldType.PROJECT)) {
|
if(this.dataManagementProfileManager.fieldInBlueprint(newDmp.getProfile(), DmpBlueprintSystemFieldType.Project)) {
|
||||||
if (newDmp.getProject() != null && newDmp.getGrant() != null && (newDmp.getProject().getLabel() == null || newDmp.getProject().getLabel().trim().isEmpty())) {
|
if (newDmp.getProject() != null && newDmp.getGrant() != null && (newDmp.getProject().getLabel() == null || newDmp.getProject().getLabel().trim().isEmpty())) {
|
||||||
newDmp.setProject(newDmp.getProject().projectFromGrant(newDmp.getGrant()));
|
newDmp.setProject(newDmp.getProject().projectFromGrant(newDmp.getGrant()));
|
||||||
}
|
}
|
||||||
|
@ -826,19 +826,19 @@ public class DataManagementPlanManager {
|
||||||
newDmp.setVersion(0);
|
newDmp.setVersion(0);
|
||||||
newDmp.setId(null);
|
newDmp.setId(null);
|
||||||
|
|
||||||
if(this.dataManagementProfileManager.fieldInBlueprint(newDmp.getProfile(), SystemFieldType.GRANT)) {
|
if(this.dataManagementProfileManager.fieldInBlueprint(newDmp.getProfile(), DmpBlueprintSystemFieldType.Grant)) {
|
||||||
if (newDmp.getGrant() != null && newDmp.getGrant().getType().equals(Grant.GrantType.INTERNAL.getValue())) {
|
if (newDmp.getGrant() != null && newDmp.getGrant().getType().equals(Grant.GrantType.INTERNAL.getValue())) {
|
||||||
checkIfUserCanEditGrant(newDmp, user);
|
checkIfUserCanEditGrant(newDmp, user);
|
||||||
}
|
}
|
||||||
assignGrandUserIfInternal(newDmp, user);
|
assignGrandUserIfInternal(newDmp, user);
|
||||||
}
|
}
|
||||||
if(this.dataManagementProfileManager.fieldInBlueprint(newDmp.getProfile(), SystemFieldType.FUNDER)) {
|
if(this.dataManagementProfileManager.fieldInBlueprint(newDmp.getProfile(), DmpBlueprintSystemFieldType.Funder)) {
|
||||||
assignFunderUserIfInternal(newDmp, user);
|
assignFunderUserIfInternal(newDmp, user);
|
||||||
}
|
}
|
||||||
if(this.dataManagementProfileManager.fieldInBlueprint(newDmp.getProfile(), SystemFieldType.PROJECT)) {
|
if(this.dataManagementProfileManager.fieldInBlueprint(newDmp.getProfile(), DmpBlueprintSystemFieldType.Project)) {
|
||||||
assignProjectUserIfInternal(newDmp, user);
|
assignProjectUserIfInternal(newDmp, user);
|
||||||
}
|
}
|
||||||
if(this.dataManagementProfileManager.fieldInBlueprint(newDmp.getProfile(), SystemFieldType.GRANT)) {
|
if(this.dataManagementProfileManager.fieldInBlueprint(newDmp.getProfile(), DmpBlueprintSystemFieldType.Grant)) {
|
||||||
if (newDmp.getGrant() != null) {
|
if (newDmp.getGrant() != null) {
|
||||||
databaseRepository.getGrantDao().createOrUpdate(newDmp.getGrant());
|
databaseRepository.getGrantDao().createOrUpdate(newDmp.getGrant());
|
||||||
}
|
}
|
||||||
|
@ -1111,7 +1111,7 @@ public class DataManagementPlanManager {
|
||||||
datasetElastic.setStatus(dataset1.getStatus());
|
datasetElastic.setStatus(dataset1.getStatus());
|
||||||
datasetElastic.setDmp(dataset1.getDmp().getId());
|
datasetElastic.setDmp(dataset1.getDmp().getId());
|
||||||
datasetElastic.setGroup(dataset1.getDmp().getGroupId());
|
datasetElastic.setGroup(dataset1.getDmp().getGroupId());
|
||||||
if(this.dataManagementProfileManager.fieldInBlueprint(dataset1.getDmp().getProfile(), SystemFieldType.GRANT)) {
|
if(this.dataManagementProfileManager.fieldInBlueprint(dataset1.getDmp().getProfile(), DmpBlueprintSystemFieldType.Grant)) {
|
||||||
datasetElastic.setGrant(dataset1.getDmp().getGrant().getId());
|
datasetElastic.setGrant(dataset1.getDmp().getGrant().getId());
|
||||||
}
|
}
|
||||||
if (dataset1.getDmp().getUsers() != null) {
|
if (dataset1.getDmp().getUsers() != null) {
|
||||||
|
@ -1134,7 +1134,7 @@ public class DataManagementPlanManager {
|
||||||
}).collect(Collectors.toList()));
|
}).collect(Collectors.toList()));
|
||||||
}
|
}
|
||||||
datasetElastic.setPublic(dataset1.getDmp().isPublic());
|
datasetElastic.setPublic(dataset1.getDmp().isPublic());
|
||||||
if(this.dataManagementProfileManager.fieldInBlueprint(dataset1.getDmp().getProfile(), SystemFieldType.GRANT)) {
|
if(this.dataManagementProfileManager.fieldInBlueprint(dataset1.getDmp().getProfile(), DmpBlueprintSystemFieldType.Grant)) {
|
||||||
datasetElastic.setGrantStatus(dataset1.getDmp().getGrant().getStatus());
|
datasetElastic.setGrantStatus(dataset1.getDmp().getGrant().getStatus());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1374,11 +1374,11 @@ public class DataManagementPlanManager {
|
||||||
// // Space below Datasets.
|
// // Space below Datasets.
|
||||||
// XWPFParagraph parBreakDatasets = document.createParagraph();
|
// XWPFParagraph parBreakDatasets = document.createParagraph();
|
||||||
|
|
||||||
DMPProfile dmpProfile = dmpEntity.getProfile();
|
DmpBlueprintEntity dmpProfile = dmpEntity.getProfile();
|
||||||
DataManagementPlanBlueprintListingModel dmpBlueprintModel = new DataManagementPlanBlueprintListingModel();
|
DataManagementPlanBlueprintListingModel dmpBlueprintModel = new DataManagementPlanBlueprintListingModel();
|
||||||
dmpBlueprintModel.fromDataModel(dmpProfile);
|
dmpBlueprintModel.fromDataModel(dmpProfile);
|
||||||
DataManagementPlanBlueprint dmpBlueprint = dmpBlueprintModel.getDefinition();
|
DefinitionEntity dmpBlueprint = dmpBlueprintModel.getDefinition();
|
||||||
for(Section section: dmpBlueprint.getSections()){
|
for(SectionEntity section: dmpBlueprint.getSections()){
|
||||||
wordBuilder.addParagraphContent("Section " + section.getOrdinal(), document, ParagraphStyle.HEADER1, BigInteger.ZERO, 0);
|
wordBuilder.addParagraphContent("Section " + section.getOrdinal(), document, ParagraphStyle.HEADER1, BigInteger.ZERO, 0);
|
||||||
XWPFParagraph sectionInfoParagraph = document.createParagraph();
|
XWPFParagraph sectionInfoParagraph = document.createParagraph();
|
||||||
sectionInfoParagraph.setSpacingBetween(1.0);
|
sectionInfoParagraph.setSpacingBetween(1.0);
|
||||||
|
@ -1397,10 +1397,10 @@ public class DataManagementPlanManager {
|
||||||
runSectionDescriptionText.setColor("116a78");
|
runSectionDescriptionText.setColor("116a78");
|
||||||
|
|
||||||
wordBuilder.addParagraphContent("Section Fields", document, ParagraphStyle.HEADER2, BigInteger.ZERO, 0);
|
wordBuilder.addParagraphContent("Section Fields", document, ParagraphStyle.HEADER2, BigInteger.ZERO, 0);
|
||||||
section.getFields().sort(Comparator.comparingInt(FieldModel::getOrdinal));
|
section.getFields().sort(Comparator.comparingInt(FieldEntity::getOrdinal));
|
||||||
for(FieldModel field: section.getFields()){
|
for(FieldEntity field: section.getFields()){
|
||||||
if(field.getCategory() == FieldCategory.SYSTEM){
|
if(field.getCategory() == DmpBlueprintFieldCategory.System){
|
||||||
SystemField systemField = field.toSystemField();
|
SystemFieldEntity systemField = (SystemFieldEntity) field;
|
||||||
XWPFParagraph systemFieldParagraph = document.createParagraph();
|
XWPFParagraph systemFieldParagraph = document.createParagraph();
|
||||||
systemFieldParagraph.setSpacingBetween(1.0);
|
systemFieldParagraph.setSpacingBetween(1.0);
|
||||||
XWPFRun runSyStemFieldTitle = systemFieldParagraph.createRun();
|
XWPFRun runSyStemFieldTitle = systemFieldParagraph.createRun();
|
||||||
|
@ -1425,62 +1425,62 @@ public class DataManagementPlanManager {
|
||||||
runInput.setText("Input: ");
|
runInput.setText("Input: ");
|
||||||
runInput.setColor("000000");
|
runInput.setColor("000000");
|
||||||
switch (systemField.getType()) {
|
switch (systemField.getType()) {
|
||||||
case TEXT:
|
case Text:
|
||||||
XWPFRun runTitle = systemFieldInput.createRun();
|
XWPFRun runTitle = systemFieldInput.createRun();
|
||||||
runTitle.setText(dmpEntity.getLabel());
|
runTitle.setText(dmpEntity.getLabel());
|
||||||
runTitle.setColor("116a78");
|
runTitle.setColor("116a78");
|
||||||
break;
|
break;
|
||||||
case HTML_TEXT:
|
case HtmlText:
|
||||||
XWPFRun runDescription = systemFieldInput.createRun();
|
XWPFRun runDescription = systemFieldInput.createRun();
|
||||||
runDescription.setText(dmpEntity.getDescription());
|
runDescription.setText(dmpEntity.getDescription());
|
||||||
runDescription.setColor("116a78");
|
runDescription.setColor("116a78");
|
||||||
break;
|
break;
|
||||||
case RESEARCHERS:
|
case Researchers:
|
||||||
for(Researcher researcher: dmpEntity.getResearchers()){
|
for(Researcher researcher: dmpEntity.getResearchers()){
|
||||||
XWPFRun runResearcher = systemFieldInput.createRun();
|
XWPFRun runResearcher = systemFieldInput.createRun();
|
||||||
runResearcher.setText("• " + researcher.getLabel());
|
runResearcher.setText("• " + researcher.getLabel());
|
||||||
runResearcher.setColor("116a78");
|
runResearcher.setColor("116a78");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ORGANIZATIONS:
|
case Organizations:
|
||||||
for(Organisation organisation: dmpEntity.getOrganisations()){
|
for(Organisation organisation: dmpEntity.getOrganisations()){
|
||||||
XWPFRun runOrganisation = systemFieldInput.createRun();
|
XWPFRun runOrganisation = systemFieldInput.createRun();
|
||||||
runOrganisation.setText("• " + organisation.getLabel());
|
runOrganisation.setText("• " + organisation.getLabel());
|
||||||
runOrganisation.setColor("116a78");
|
runOrganisation.setColor("116a78");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case LANGUAGE:
|
case Language:
|
||||||
XWPFRun runLanguage = systemFieldInput.createRun();
|
XWPFRun runLanguage = systemFieldInput.createRun();
|
||||||
runLanguage.setText(objectMapper.readValue(dmpEntity.getExtraProperties(), HashMap.class).get("language").toString());
|
runLanguage.setText(objectMapper.readValue(dmpEntity.getExtraProperties(), HashMap.class).get("language").toString());
|
||||||
runLanguage.setColor("116a78");
|
runLanguage.setColor("116a78");
|
||||||
break;
|
break;
|
||||||
case CONTACT:
|
case Contact:
|
||||||
XWPFRun runContact = systemFieldInput.createRun();
|
XWPFRun runContact = systemFieldInput.createRun();
|
||||||
runContact.setText(dmpEntity.getCreator().getName());
|
runContact.setText(dmpEntity.getCreator().getName());
|
||||||
runContact.setColor("116a78");
|
runContact.setColor("116a78");
|
||||||
break;
|
break;
|
||||||
case FUNDER:
|
case Funder:
|
||||||
if (dmpEntity.getGrant() != null && dmpEntity.getGrant().getFunder() != null) {
|
if (dmpEntity.getGrant() != null && dmpEntity.getGrant().getFunder() != null) {
|
||||||
XWPFRun runFunder = systemFieldInput.createRun();
|
XWPFRun runFunder = systemFieldInput.createRun();
|
||||||
runFunder.setText(dmpEntity.getGrant().getFunder().getLabel());
|
runFunder.setText(dmpEntity.getGrant().getFunder().getLabel());
|
||||||
runFunder.setColor("116a78");
|
runFunder.setColor("116a78");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GRANT:
|
case Grant:
|
||||||
if (dmpEntity.getGrant() != null) {
|
if (dmpEntity.getGrant() != null) {
|
||||||
XWPFRun runGrant = systemFieldInput.createRun();
|
XWPFRun runGrant = systemFieldInput.createRun();
|
||||||
runGrant.setText(dmpEntity.getGrant().getLabel());
|
runGrant.setText(dmpEntity.getGrant().getLabel());
|
||||||
runGrant.setColor("116a78");
|
runGrant.setColor("116a78");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PROJECT:
|
case Project:
|
||||||
if (dmpEntity.getProject() != null ) {
|
if (dmpEntity.getProject() != null ) {
|
||||||
XWPFRun runProject = systemFieldInput.createRun();
|
XWPFRun runProject = systemFieldInput.createRun();
|
||||||
runProject.setText(dmpEntity.getProject().getLabel());
|
runProject.setText(dmpEntity.getProject().getLabel());
|
||||||
runProject.setColor("116a78");
|
runProject.setColor("116a78");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case LICENSE:
|
case License:
|
||||||
Map extraProperties = objectMapper.readValue(dmpEntity.getExtraProperties(), HashMap.class);
|
Map extraProperties = objectMapper.readValue(dmpEntity.getExtraProperties(), HashMap.class);
|
||||||
if (extraProperties.containsKey("license")) {
|
if (extraProperties.containsKey("license")) {
|
||||||
XWPFRun runLicense = systemFieldInput.createRun();
|
XWPFRun runLicense = systemFieldInput.createRun();
|
||||||
|
@ -1488,7 +1488,7 @@ public class DataManagementPlanManager {
|
||||||
runLicense.setColor("116a78");
|
runLicense.setColor("116a78");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ACCESS_RIGHTS:
|
case AccessRights:
|
||||||
Map extraPropertiesMap = objectMapper.readValue(dmpEntity.getExtraProperties(), HashMap.class);
|
Map extraPropertiesMap = objectMapper.readValue(dmpEntity.getExtraProperties(), HashMap.class);
|
||||||
if (extraPropertiesMap.containsKey("visible")) {
|
if (extraPropertiesMap.containsKey("visible")) {
|
||||||
XWPFRun runAccessRights = systemFieldInput.createRun();
|
XWPFRun runAccessRights = systemFieldInput.createRun();
|
||||||
|
@ -1499,8 +1499,8 @@ public class DataManagementPlanManager {
|
||||||
}
|
}
|
||||||
document.createParagraph();
|
document.createParagraph();
|
||||||
}
|
}
|
||||||
else if(field.getCategory() == FieldCategory.EXTRA){
|
else if(field.getCategory() == DmpBlueprintFieldCategory.Extra){
|
||||||
ExtraField extraField = field.toExtraField();
|
ExtraFieldEntity extraField = (ExtraFieldEntity)field;
|
||||||
XWPFParagraph extraFieldParagraph = document.createParagraph();
|
XWPFParagraph extraFieldParagraph = document.createParagraph();
|
||||||
extraFieldParagraph.setSpacingBetween(1.0);
|
extraFieldParagraph.setSpacingBetween(1.0);
|
||||||
XWPFRun runExtraFieldLabel = extraFieldParagraph.createRun();
|
XWPFRun runExtraFieldLabel = extraFieldParagraph.createRun();
|
||||||
|
@ -1523,7 +1523,7 @@ public class DataManagementPlanManager {
|
||||||
if(!section.getDescriptionTemplates().isEmpty()){
|
if(!section.getDescriptionTemplates().isEmpty()){
|
||||||
wordBuilder.addParagraphContent("Section descriptions", document, ParagraphStyle.HEADER2, BigInteger.ZERO, 0);
|
wordBuilder.addParagraphContent("Section descriptions", document, ParagraphStyle.HEADER2, BigInteger.ZERO, 0);
|
||||||
wordBuilder.addParagraphContent("Description Templates", document, ParagraphStyle.HEADER4, BigInteger.ZERO, 0);
|
wordBuilder.addParagraphContent("Description Templates", document, ParagraphStyle.HEADER4, BigInteger.ZERO, 0);
|
||||||
for(eu.eudat.models.data.entities.xmlmodels.dmpprofiledefinition.DescriptionTemplate descriptionTemplate: section.getDescriptionTemplates()){
|
for(DescriptionTemplateEntity descriptionTemplate: section.getDescriptionTemplates()){
|
||||||
XWPFParagraph templateParagraph = document.createParagraph();
|
XWPFParagraph templateParagraph = document.createParagraph();
|
||||||
XWPFRun runTemplateLabel = templateParagraph.createRun();
|
XWPFRun runTemplateLabel = templateParagraph.createRun();
|
||||||
runTemplateLabel.setText("• " + descriptionTemplate.getLabel());
|
runTemplateLabel.setText("• " + descriptionTemplate.getLabel());
|
||||||
|
@ -1740,14 +1740,14 @@ public class DataManagementPlanManager {
|
||||||
dmpElement.appendChild(costs);
|
dmpElement.appendChild(costs);
|
||||||
}
|
}
|
||||||
|
|
||||||
DMPProfile dmpProfile = dmp.getProfile();
|
DmpBlueprintEntity dmpBlueprint = dmp.getProfile();
|
||||||
Element dmpProfileElement = xmlDoc.createElement("dmpProfile");
|
Element dmpProfileElement = xmlDoc.createElement("dmpProfile");
|
||||||
Element dmpProfileName = xmlDoc.createElement("dmpProfileName");
|
Element dmpProfileName = xmlDoc.createElement("dmpProfileName");
|
||||||
if (!(dmpProfile == null)) {
|
if (!(dmpBlueprint == null)) {
|
||||||
dmpProfileName.setTextContent(dmpProfile.getLabel());
|
dmpProfileName.setTextContent(dmpBlueprint.getLabel());
|
||||||
dmpProfileElement.appendChild(dmpProfileName);
|
dmpProfileElement.appendChild(dmpProfileName);
|
||||||
Element dmpProfileId = xmlDoc.createElement("dmpProfileId");
|
Element dmpProfileId = xmlDoc.createElement("dmpProfileId");
|
||||||
dmpProfileId.setTextContent(dmpProfile.getId().toString());
|
dmpProfileId.setTextContent(dmpBlueprint.getId().toString());
|
||||||
dmpProfileElement.appendChild(dmpProfileId);
|
dmpProfileElement.appendChild(dmpProfileId);
|
||||||
// Element values = xmlDoc.createElement("values");
|
// Element values = xmlDoc.createElement("values");
|
||||||
// values.setTextContent(dmpProfile.getDefinition());
|
// values.setTextContent(dmpProfile.getDefinition());
|
||||||
|
@ -1791,7 +1791,7 @@ public class DataManagementPlanManager {
|
||||||
|
|
||||||
// Funder.
|
// Funder.
|
||||||
Element funder = xmlDoc.createElement("funder");
|
Element funder = xmlDoc.createElement("funder");
|
||||||
if (this.dataManagementProfileManager.fieldInBlueprint(dmp.getProfile(), SystemFieldType.GRANT) && this.dataManagementProfileManager.fieldInBlueprint(dmp.getProfile(), SystemFieldType.FUNDER)) {
|
if (this.dataManagementProfileManager.fieldInBlueprint(dmp.getProfile(), DmpBlueprintSystemFieldType.Grant) && this.dataManagementProfileManager.fieldInBlueprint(dmp.getProfile(), DmpBlueprintSystemFieldType.Funder)) {
|
||||||
Element funderLabel = xmlDoc.createElement("label");
|
Element funderLabel = xmlDoc.createElement("label");
|
||||||
Element funderId = xmlDoc.createElement("id");
|
Element funderId = xmlDoc.createElement("id");
|
||||||
funderLabel.setTextContent(dmp.getGrant().getFunder().getLabel());
|
funderLabel.setTextContent(dmp.getGrant().getFunder().getLabel());
|
||||||
|
@ -1809,7 +1809,7 @@ public class DataManagementPlanManager {
|
||||||
dmpElement.appendChild(funder);
|
dmpElement.appendChild(funder);
|
||||||
// Grant.
|
// Grant.
|
||||||
Element grant = xmlDoc.createElement("grant");
|
Element grant = xmlDoc.createElement("grant");
|
||||||
if (this.dataManagementProfileManager.fieldInBlueprint(dmp.getProfile(), SystemFieldType.GRANT)) {
|
if (this.dataManagementProfileManager.fieldInBlueprint(dmp.getProfile(), DmpBlueprintSystemFieldType.Grant)) {
|
||||||
Element grantLabel = xmlDoc.createElement("label");
|
Element grantLabel = xmlDoc.createElement("label");
|
||||||
Element grantId = xmlDoc.createElement("id");
|
Element grantId = xmlDoc.createElement("id");
|
||||||
grantLabel.setTextContent(dmp.getGrant().getLabel());
|
grantLabel.setTextContent(dmp.getGrant().getLabel());
|
||||||
|
@ -1827,7 +1827,7 @@ public class DataManagementPlanManager {
|
||||||
dmpElement.appendChild(grant);
|
dmpElement.appendChild(grant);
|
||||||
// Project.
|
// Project.
|
||||||
Element project = xmlDoc.createElement("project");
|
Element project = xmlDoc.createElement("project");
|
||||||
if (this.dataManagementProfileManager.fieldInBlueprint(dmp.getProfile(), SystemFieldType.PROJECT)) {
|
if (this.dataManagementProfileManager.fieldInBlueprint(dmp.getProfile(), DmpBlueprintSystemFieldType.Project)) {
|
||||||
Element projectId = xmlDoc.createElement("id");
|
Element projectId = xmlDoc.createElement("id");
|
||||||
Element projectLabel = xmlDoc.createElement("label");
|
Element projectLabel = xmlDoc.createElement("label");
|
||||||
Element projectDescription = xmlDoc.createElement("description");
|
Element projectDescription = xmlDoc.createElement("description");
|
||||||
|
@ -1874,10 +1874,10 @@ public class DataManagementPlanManager {
|
||||||
|
|
||||||
Element extraFields = xmlDoc.createElement("extraFields");
|
Element extraFields = xmlDoc.createElement("extraFields");
|
||||||
Map<String, Object> dmpProperties = new ObjectMapper().readValue(dmp.getProperties(), new TypeReference<Map<String, Object>>() {});
|
Map<String, Object> dmpProperties = new ObjectMapper().readValue(dmp.getProperties(), new TypeReference<Map<String, Object>>() {});
|
||||||
DataManagementPlanBlueprint blueprint = this.dataManagementProfileManager.getSingleBlueprint(dmp.getProfile().getId().toString()).getDefinition();
|
DefinitionEntity blueprint = this.dataManagementProfileManager.getSingleBlueprint(dmp.getProfile().getId().toString()).getDefinition();
|
||||||
blueprint.getSections().forEach(section -> {
|
blueprint.getSections().forEach(section -> {
|
||||||
section.getFields().forEach(fieldModel -> {
|
section.getFields().forEach(fieldModel -> {
|
||||||
if (fieldModel.getCategory() == FieldCategory.EXTRA) {
|
if (fieldModel.getCategory() == DmpBlueprintFieldCategory.Extra) {
|
||||||
Element extraField = xmlDoc.createElement("extraField");
|
Element extraField = xmlDoc.createElement("extraField");
|
||||||
Element extraFieldId = xmlDoc.createElement("id");
|
Element extraFieldId = xmlDoc.createElement("id");
|
||||||
extraFieldId.setTextContent(fieldModel.getId().toString());
|
extraFieldId.setTextContent(fieldModel.getId().toString());
|
||||||
|
@ -2090,7 +2090,7 @@ public class DataManagementPlanManager {
|
||||||
}
|
}
|
||||||
dm.setProperties(dmpPropertiesMap);
|
dm.setProperties(dmpPropertiesMap);
|
||||||
|
|
||||||
if (this.dataManagementProfileManager.fieldInBlueprint(dmpProfileImportModel.getDmpProfileId().toString(), SystemFieldType.FUNDER)) {
|
if (this.dataManagementProfileManager.fieldInBlueprint(dmpProfileImportModel.getDmpProfileId().toString(), DmpBlueprintSystemFieldType.Funder)) {
|
||||||
eu.eudat.models.data.funder.Funder funder = new eu.eudat.models.data.funder.Funder();
|
eu.eudat.models.data.funder.Funder funder = new eu.eudat.models.data.funder.Funder();
|
||||||
FunderImportModels funderImport = dataManagementPlans.get(0).getFunderImportModels();
|
FunderImportModels funderImport = dataManagementPlans.get(0).getFunderImportModels();
|
||||||
funder.setId(funderImport.getId());
|
funder.setId(funderImport.getId());
|
||||||
|
@ -2101,7 +2101,7 @@ public class DataManagementPlanManager {
|
||||||
dm.setFunder(funderEditor);
|
dm.setFunder(funderEditor);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.dataManagementProfileManager.fieldInBlueprint(dmpProfileImportModel.getDmpProfileId().toString(), SystemFieldType.GRANT)) {
|
if (this.dataManagementProfileManager.fieldInBlueprint(dmpProfileImportModel.getDmpProfileId().toString(), DmpBlueprintSystemFieldType.Grant)) {
|
||||||
eu.eudat.models.data.grant.Grant grant = new eu.eudat.models.data.grant.Grant();
|
eu.eudat.models.data.grant.Grant grant = new eu.eudat.models.data.grant.Grant();
|
||||||
GrantImportModels grantImport = dataManagementPlans.get(0).getGrantImport();
|
GrantImportModels grantImport = dataManagementPlans.get(0).getGrantImport();
|
||||||
grant.setId(grantImport.getId());
|
grant.setId(grantImport.getId());
|
||||||
|
@ -2114,7 +2114,7 @@ public class DataManagementPlanManager {
|
||||||
dm.setGrant(grantEditor);
|
dm.setGrant(grantEditor);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.dataManagementProfileManager.fieldInBlueprint(dmpProfileImportModel.getDmpProfileId().toString(), SystemFieldType.PROJECT)) {
|
if (this.dataManagementProfileManager.fieldInBlueprint(dmpProfileImportModel.getDmpProfileId().toString(), DmpBlueprintSystemFieldType.Project)) {
|
||||||
eu.eudat.models.data.project.Project project = new eu.eudat.models.data.project.Project();
|
eu.eudat.models.data.project.Project project = new eu.eudat.models.data.project.Project();
|
||||||
ProjectImportModels projectImport = dataManagementPlans.get(0).getProjectImportModels();
|
ProjectImportModels projectImport = dataManagementPlans.get(0).getProjectImportModels();
|
||||||
project.setId(projectImport.getId());
|
project.setId(projectImport.getId());
|
||||||
|
|
|
@ -2,26 +2,29 @@ package eu.eudat.logic.managers;
|
||||||
|
|
||||||
import com.jayway.jsonpath.DocumentContext;
|
import com.jayway.jsonpath.DocumentContext;
|
||||||
import com.jayway.jsonpath.JsonPath;
|
import com.jayway.jsonpath.JsonPath;
|
||||||
|
import eu.eudat.commons.enums.DmpBlueprintStatus;
|
||||||
|
import eu.eudat.commons.enums.IsActive;
|
||||||
|
import eu.eudat.commons.types.dmpblueprint.ExternalAutoCompleteEntity;
|
||||||
|
import eu.eudat.commons.types.dmpblueprint.FieldEntity;
|
||||||
|
import eu.eudat.commons.types.dmpblueprint.SectionEntity;
|
||||||
|
import eu.eudat.commons.types.dmpblueprint.SystemFieldEntity;
|
||||||
import eu.eudat.data.dao.criteria.DataManagementPlanCriteria;
|
import eu.eudat.data.dao.criteria.DataManagementPlanCriteria;
|
||||||
import eu.eudat.data.dao.criteria.RequestItem;
|
import eu.eudat.data.dao.criteria.RequestItem;
|
||||||
import eu.eudat.data.old.DMPProfile;
|
import eu.eudat.data.DmpBlueprintEntity;
|
||||||
import eu.eudat.data.query.items.dmpblueprint.DataManagementPlanBlueprintTableRequest;
|
import eu.eudat.data.query.items.dmpblueprint.DataManagementPlanBlueprintTableRequest;
|
||||||
import eu.eudat.data.query.items.item.dmpprofile.DataManagementPlanProfileCriteriaRequest;
|
|
||||||
import eu.eudat.data.query.items.table.dmpprofile.DataManagementPlanProfileTableRequest;
|
|
||||||
import eu.eudat.exceptions.dmpblueprint.DmpBlueprintUsedException;
|
import eu.eudat.exceptions.dmpblueprint.DmpBlueprintUsedException;
|
||||||
import eu.eudat.logic.services.operations.DatabaseRepository;
|
import eu.eudat.logic.services.operations.DatabaseRepository;
|
||||||
import eu.eudat.logic.utilities.builders.XmlBuilder;
|
import eu.eudat.commons.types.xml.XmlBuilder;
|
||||||
import eu.eudat.logic.utilities.documents.helpers.FileEnvelope;
|
import eu.eudat.logic.utilities.documents.helpers.FileEnvelope;
|
||||||
import eu.eudat.logic.utilities.documents.xml.dmpXml.ExportXmlBuilderDmpBlueprint;
|
import eu.eudat.logic.utilities.documents.xml.dmpXml.ExportXmlBuilderDmpBlueprint;
|
||||||
import eu.eudat.logic.utilities.documents.xml.dmpXml.ImportXmlBuilderDmpBlueprint;
|
import eu.eudat.logic.utilities.documents.xml.dmpXml.ImportXmlBuilderDmpBlueprint;
|
||||||
import eu.eudat.models.data.entities.xmlmodels.dmpprofiledefinition.*;
|
import eu.eudat.commons.enums.DmpBlueprintFieldCategory;
|
||||||
import eu.eudat.models.data.entities.xmlmodels.dmpprofiledefinition.types.FieldCategory;
|
import eu.eudat.commons.enums.DmpBlueprintSystemFieldType;
|
||||||
import eu.eudat.models.data.entities.xmlmodels.dmpprofiledefinition.types.SystemFieldType;
|
|
||||||
import eu.eudat.models.data.helpermodels.Tuple;
|
import eu.eudat.models.data.helpermodels.Tuple;
|
||||||
import eu.eudat.models.data.helpers.common.AutoCompleteLookupItem;
|
import eu.eudat.models.data.helpers.common.AutoCompleteLookupItem;
|
||||||
import eu.eudat.models.data.helpers.common.DataTableData;
|
import eu.eudat.models.data.helpers.common.DataTableData;
|
||||||
import eu.eudat.models.data.listingmodels.DataManagementPlanBlueprintListingModel;
|
import eu.eudat.models.data.listingmodels.DataManagementPlanBlueprintListingModel;
|
||||||
import eu.eudat.models.data.listingmodels.DataManagementPlanProfileListingModel;
|
//import eu.eudat.models.data.listingmodels.DataManagementPlanProfileListingModel;
|
||||||
import eu.eudat.queryable.QueryableList;
|
import eu.eudat.queryable.QueryableList;
|
||||||
import eu.eudat.logic.services.ApiContext;
|
import eu.eudat.logic.services.ApiContext;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
@ -64,29 +67,12 @@ public class DataManagementProfileManager {
|
||||||
this.environment = environment;
|
this.environment = environment;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DataTableData<DataManagementPlanProfileListingModel> getPaged(DataManagementPlanProfileTableRequest dataManagementPlanProfileTableRequest) throws Exception {
|
|
||||||
|
|
||||||
QueryableList<DMPProfile> items = apiContext.getOperationsContext().getDatabaseRepository().getDmpProfileDao().getWithCriteria(dataManagementPlanProfileTableRequest.getCriteria());
|
|
||||||
QueryableList<DMPProfile> pagedItems = PaginationManager.applyPaging(items, dataManagementPlanProfileTableRequest);
|
|
||||||
|
|
||||||
DataTableData<DataManagementPlanProfileListingModel> dataTable = new DataTableData<DataManagementPlanProfileListingModel>();
|
|
||||||
|
|
||||||
CompletableFuture itemsFuture = pagedItems
|
|
||||||
.selectAsync(item -> new DataManagementPlanProfileListingModel().fromDataModel(item)).whenComplete((resultList, throwable) -> {
|
|
||||||
dataTable.setData(resultList);
|
|
||||||
});
|
|
||||||
|
|
||||||
CompletableFuture countFuture = items.countAsync().whenComplete((count, throwable) -> {
|
|
||||||
dataTable.setTotalCount(count);
|
|
||||||
});
|
|
||||||
CompletableFuture.allOf(itemsFuture, countFuture).join();
|
|
||||||
return dataTable;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DataTableData<DataManagementPlanBlueprintListingModel> getPagedBlueprint(DataManagementPlanBlueprintTableRequest dataManagementPlanBlueprintTableRequest) throws Exception {
|
public DataTableData<DataManagementPlanBlueprintListingModel> getPagedBlueprint(DataManagementPlanBlueprintTableRequest dataManagementPlanBlueprintTableRequest) throws Exception {
|
||||||
|
|
||||||
QueryableList<DMPProfile> items = apiContext.getOperationsContext().getDatabaseRepository().getDmpProfileDao().getWithCriteriaBlueprint(dataManagementPlanBlueprintTableRequest.getCriteria());
|
QueryableList<DmpBlueprintEntity> items = apiContext.getOperationsContext().getDatabaseRepository().getDmpProfileDao().getWithCriteriaBlueprint(dataManagementPlanBlueprintTableRequest.getCriteria());
|
||||||
QueryableList<DMPProfile> pagedItems = PaginationManager.applyPaging(items, dataManagementPlanBlueprintTableRequest);
|
QueryableList<DmpBlueprintEntity> pagedItems = PaginationManager.applyPaging(items, dataManagementPlanBlueprintTableRequest);
|
||||||
|
|
||||||
DataTableData<DataManagementPlanBlueprintListingModel> dataTable = new DataTableData<>();
|
DataTableData<DataManagementPlanBlueprintListingModel> dataTable = new DataTableData<>();
|
||||||
|
|
||||||
|
@ -97,32 +83,27 @@ public class DataManagementProfileManager {
|
||||||
return dataTable;
|
return dataTable;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DataManagementPlanProfileListingModel getSingle(String id) throws InstantiationException, IllegalAccessException, InvalidApplicationException {
|
|
||||||
DMPProfile dmpProfile = databaseRepository.getDmpProfileDao().find(UUID.fromString(id));
|
|
||||||
DataManagementPlanProfileListingModel dataManagementPlanProfileListingModel = new DataManagementPlanProfileListingModel();
|
|
||||||
dataManagementPlanProfileListingModel.fromDataModel(dmpProfile);
|
|
||||||
return dataManagementPlanProfileListingModel;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DataManagementPlanBlueprintListingModel getSingleBlueprint(String id) throws InvalidApplicationException {
|
public DataManagementPlanBlueprintListingModel getSingleBlueprint(String id) throws InvalidApplicationException {
|
||||||
DMPProfile dmpProfile = databaseRepository.getDmpProfileDao().find(UUID.fromString(id));
|
DmpBlueprintEntity dmpBlueprint = databaseRepository.getDmpProfileDao().find(UUID.fromString(id));
|
||||||
DataManagementPlanBlueprintListingModel dataManagementPlanBlueprintListingModel = new DataManagementPlanBlueprintListingModel();
|
DataManagementPlanBlueprintListingModel dataManagementPlanBlueprintListingModel = new DataManagementPlanBlueprintListingModel();
|
||||||
dataManagementPlanBlueprintListingModel.fromDataModel(dmpProfile);
|
dataManagementPlanBlueprintListingModel.fromDataModel(dmpBlueprint);
|
||||||
return dataManagementPlanBlueprintListingModel;
|
return dataManagementPlanBlueprintListingModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean fieldInBlueprint(String id, SystemFieldType type) throws InvalidApplicationException {
|
public boolean fieldInBlueprint(String id, DmpBlueprintSystemFieldType type) throws InvalidApplicationException {
|
||||||
DMPProfile dmpProfile = databaseRepository.getDmpProfileDao().find(UUID.fromString(id));
|
DmpBlueprintEntity dmpBlueprint = databaseRepository.getDmpProfileDao().find(UUID.fromString(id));
|
||||||
return this.fieldInBlueprint(dmpProfile, type);
|
return this.fieldInBlueprint(dmpBlueprint, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean fieldInBlueprint(DMPProfile dmpProfile, SystemFieldType type) {
|
public boolean fieldInBlueprint(DmpBlueprintEntity dmpProfile, DmpBlueprintSystemFieldType type) {
|
||||||
DataManagementPlanBlueprintListingModel dmpBlueprint = new DataManagementPlanBlueprintListingModel();
|
DataManagementPlanBlueprintListingModel dmpBlueprint = new DataManagementPlanBlueprintListingModel();
|
||||||
dmpBlueprint.fromDataModel(dmpProfile);
|
dmpBlueprint.fromDataModel(dmpProfile);
|
||||||
for(Section section: dmpBlueprint.getDefinition().getSections()){
|
for(SectionEntity section: dmpBlueprint.getDefinition().getSections()){
|
||||||
for(FieldModel field: section.getFields()){
|
for(FieldEntity field: section.getFields()){
|
||||||
if(field.getCategory().equals(FieldCategory.SYSTEM)){
|
if(field.getCategory().equals(DmpBlueprintFieldCategory.System)){
|
||||||
SystemField systemField = field.toSystemField();
|
SystemFieldEntity systemField = (SystemFieldEntity)field;
|
||||||
if(systemField.getType().equals(type)){
|
if(systemField.getType().equals(type)){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -132,29 +113,18 @@ public class DataManagementProfileManager {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<DataManagementPlanProfileListingModel> getWithCriteria(DataManagementPlanProfileCriteriaRequest dataManagementPlanProfileCriteriaRequest) throws IllegalAccessException, InstantiationException, InvalidApplicationException {
|
|
||||||
QueryableList<DMPProfile> items = databaseRepository.getDmpProfileDao().getWithCriteria(dataManagementPlanProfileCriteriaRequest.getCriteria());
|
|
||||||
List<DataManagementPlanProfileListingModel> datamanagementPlans = items.select(item -> new DataManagementPlanProfileListingModel().fromDataModel(item));
|
|
||||||
return datamanagementPlans;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void createOrUpdate(DataManagementPlanProfileListingModel dataManagementPlanProfileListingModel) throws Exception {
|
|
||||||
DMPProfile dmpProfile = dataManagementPlanProfileListingModel.toDataModel();
|
|
||||||
apiContext.getOperationsContext().getDatabaseRepository().getDmpProfileDao().createOrUpdate(dmpProfile);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void createOrUpdateBlueprint(DataManagementPlanBlueprintListingModel dataManagementPlanBlueprintListingModel) throws Exception {
|
public void createOrUpdateBlueprint(DataManagementPlanBlueprintListingModel dataManagementPlanBlueprintListingModel) throws Exception {
|
||||||
DMPProfile dmpProfile = dataManagementPlanBlueprintListingModel.toDataModel();
|
DmpBlueprintEntity dmpBlueprint = dataManagementPlanBlueprintListingModel.toDataModel();
|
||||||
apiContext.getOperationsContext().getDatabaseRepository().getDmpProfileDao().createOrUpdate(dmpProfile);
|
apiContext.getOperationsContext().getDatabaseRepository().getDmpProfileDao().createOrUpdate(dmpBlueprint);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void inactivate(String id) throws InvalidApplicationException {
|
public void inactivate(String id) throws InvalidApplicationException {
|
||||||
DMPProfile dmpProfile = databaseRepository.getDmpProfileDao().find(UUID.fromString(id));
|
DmpBlueprintEntity dmpBlueprint = databaseRepository.getDmpProfileDao().find(UUID.fromString(id));
|
||||||
DataManagementPlanCriteria dataManagementPlanCriteria = new DataManagementPlanCriteria();
|
DataManagementPlanCriteria dataManagementPlanCriteria = new DataManagementPlanCriteria();
|
||||||
dataManagementPlanCriteria.setProfile(dmpProfile);
|
dataManagementPlanCriteria.setProfile(dmpBlueprint);
|
||||||
if (dmpProfile.getStatus() == DMPProfile.Status.SAVED.getValue() || databaseRepository.getDmpDao().getWithCriteria(dataManagementPlanCriteria).count() == 0) {
|
if (DmpBlueprintStatus.Draft.equals(dmpBlueprint.getStatus()) || databaseRepository.getDmpDao().getWithCriteria(dataManagementPlanCriteria).count() == 0) {
|
||||||
dmpProfile.setStatus(DMPProfile.Status.DELETED.getValue());
|
dmpBlueprint.setIsActive(IsActive.Inactive);
|
||||||
databaseRepository.getDmpProfileDao().createOrUpdate(dmpProfile);
|
databaseRepository.getDmpProfileDao().createOrUpdate(dmpBlueprint);
|
||||||
} else {
|
} else {
|
||||||
throw new DmpBlueprintUsedException("This blueprint can not deleted, because DMPs are associated with it");
|
throw new DmpBlueprintUsedException("This blueprint can not deleted, because DMPs are associated with it");
|
||||||
}
|
}
|
||||||
|
@ -209,28 +179,6 @@ public class DataManagementProfileManager {
|
||||||
return convFile;
|
return convFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Tuple<String, String>> getExternalAutocomplete(RequestItem<AutoCompleteLookupItem> lookupItem) throws XPathExpressionException, InvalidApplicationException {
|
|
||||||
DMPProfile dmpProfile = this.apiContext.getOperationsContext().getDatabaseRepository().getDmpProfileDao().find(UUID.fromString(lookupItem.getCriteria().getProfileID()));
|
|
||||||
Field field = this.queryForField(dmpProfile.getDefinition(), lookupItem.getCriteria().getFieldID());
|
|
||||||
DmpProfileExternalAutoComplete data = field.getExternalAutocomplete();
|
|
||||||
return this.externalAutocompleteRequest(data, lookupItem.getCriteria().getLike());
|
|
||||||
}
|
|
||||||
|
|
||||||
private Field queryForField(String xml, String fieldId) throws XPathExpressionException {
|
|
||||||
Field field = new Field();
|
|
||||||
Document document = XmlBuilder.fromXml(xml);
|
|
||||||
XPathFactory xpathFactory = XPathFactory.newInstance();
|
|
||||||
XPath xpath = xpathFactory.newXPath();
|
|
||||||
XPathExpression expr = xpath.compile("//field[@id='" + fieldId + "']");
|
|
||||||
Element name = (Element) expr.evaluate(document, XPathConstants.NODE);
|
|
||||||
field.fromXml(name);
|
|
||||||
return field;
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<Tuple<String, String>> externalAutocompleteRequest(DmpProfileExternalAutoComplete data, String like) {
|
|
||||||
return externalAutocompleteRequest(data.getUrl(), data.getOptionsRoot(), data.getLabel(), data.getValue(), like);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static List<Tuple<String, String>> externalAutocompleteRequest(String url, String optionsRoot, String label, String value, String like) {
|
public static List<Tuple<String, String>> externalAutocompleteRequest(String url, String optionsRoot, String label, String value, String like) {
|
||||||
List<Tuple<String, String>> result = new LinkedList<>();
|
List<Tuple<String, String>> result = new LinkedList<>();
|
||||||
RestTemplate restTemplate = new RestTemplate();
|
RestTemplate restTemplate = new RestTemplate();
|
||||||
|
|
|
@ -16,7 +16,7 @@ import eu.eudat.logic.proxy.config.entities.GeneralUrls;
|
||||||
import eu.eudat.logic.proxy.fetching.RemoteFetcher;
|
import eu.eudat.logic.proxy.fetching.RemoteFetcher;
|
||||||
import eu.eudat.logic.services.ApiContext;
|
import eu.eudat.logic.services.ApiContext;
|
||||||
import eu.eudat.logic.services.operations.DatabaseRepository;
|
import eu.eudat.logic.services.operations.DatabaseRepository;
|
||||||
import eu.eudat.logic.utilities.builders.XmlBuilder;
|
import eu.eudat.commons.types.xml.XmlBuilder;
|
||||||
import eu.eudat.logic.utilities.documents.helpers.FileEnvelope;
|
import eu.eudat.logic.utilities.documents.helpers.FileEnvelope;
|
||||||
import eu.eudat.logic.utilities.documents.xml.datasetProfileXml.ExportXmlBuilderDatasetProfile;
|
import eu.eudat.logic.utilities.documents.xml.datasetProfileXml.ExportXmlBuilderDatasetProfile;
|
||||||
import eu.eudat.logic.utilities.documents.xml.datasetProfileXml.ImportXmlBuilderDatasetProfile;
|
import eu.eudat.logic.utilities.documents.xml.datasetProfileXml.ImportXmlBuilderDatasetProfile;
|
||||||
|
@ -30,7 +30,6 @@ import eu.eudat.models.data.listingmodels.UserInfoListingModel;
|
||||||
import eu.eudat.models.data.mail.SimpleMail;
|
import eu.eudat.models.data.mail.SimpleMail;
|
||||||
import eu.eudat.queryable.QueryableList;
|
import eu.eudat.queryable.QueryableList;
|
||||||
import eu.eudat.service.DescriptionTemplateTypeService;
|
import eu.eudat.service.DescriptionTemplateTypeService;
|
||||||
import eu.eudat.types.Authorities;
|
|
||||||
import eu.eudat.types.MetricNames;
|
import eu.eudat.types.MetricNames;
|
||||||
import gr.cite.commons.web.authz.service.AuthorizationService;
|
import gr.cite.commons.web.authz.service.AuthorizationService;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
|
|
@ -14,7 +14,7 @@ import eu.eudat.data.query.items.table.userinfo.UserInfoTableRequestItem;
|
||||||
import eu.eudat.logic.builders.entity.UserRoleBuilder;
|
import eu.eudat.logic.builders.entity.UserRoleBuilder;
|
||||||
import eu.eudat.logic.builders.model.models.DataTableDataBuilder;
|
import eu.eudat.logic.builders.model.models.DataTableDataBuilder;
|
||||||
import eu.eudat.logic.services.ApiContext;
|
import eu.eudat.logic.services.ApiContext;
|
||||||
import eu.eudat.logic.utilities.builders.XmlBuilder;
|
import eu.eudat.commons.types.xml.XmlBuilder;
|
||||||
import eu.eudat.models.HintedModelFactory;
|
import eu.eudat.models.HintedModelFactory;
|
||||||
import eu.eudat.models.data.dmp.DataManagementPlan;
|
import eu.eudat.models.data.dmp.DataManagementPlan;
|
||||||
import eu.eudat.models.data.helpers.common.DataTableData;
|
import eu.eudat.models.data.helpers.common.DataTableData;
|
||||||
|
|
|
@ -73,11 +73,9 @@ public class RemoteFetcher {
|
||||||
case Grants: return configLoader.getExternalUrls().getGrants();
|
case Grants: return configLoader.getExternalUrls().getGrants();
|
||||||
case Organizations: return configLoader.getExternalUrls().getOrganisations();
|
case Organizations: return configLoader.getExternalUrls().getOrganisations();
|
||||||
case Datasets: return configLoader.getExternalUrls().getDatasets();
|
case Datasets: return configLoader.getExternalUrls().getDatasets();
|
||||||
case Founder: return configLoader.getExternalUrls().getFunders();
|
case Funder: return configLoader.getExternalUrls().getFunders();
|
||||||
case Project: return configLoader.getExternalUrls().getProjects();
|
case Project: return configLoader.getExternalUrls().getProjects();
|
||||||
case Researcher: return configLoader.getExternalUrls().getResearchers();
|
case Researcher: return configLoader.getExternalUrls().getResearchers();
|
||||||
case Validators: return configLoader.getExternalUrls().getValidations();
|
|
||||||
// case Prefillings: return configLoader.getExternalUrls().getPrefillings();
|
|
||||||
default: throw new IllegalArgumentException("Type not found" + externalType);
|
default: throw new IllegalArgumentException("Type not found" + externalType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import eu.eudat.data.old.*;
|
import eu.eudat.data.old.*;
|
||||||
import eu.eudat.depositinterface.models.*;
|
import eu.eudat.depositinterface.models.*;
|
||||||
import eu.eudat.logic.utilities.builders.XmlBuilder;
|
import eu.eudat.commons.types.xml.XmlBuilder;
|
||||||
import jakarta.transaction.Transactional;
|
import jakarta.transaction.Transactional;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
|
@ -1,17 +1,14 @@
|
||||||
package eu.eudat.logic.utilities.documents.xml;
|
package eu.eudat.logic.utilities.documents.xml;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.fasterxml.jackson.databind.exc.MismatchedInputException;
|
|
||||||
import eu.eudat.logic.services.forms.VisibilityRuleService;
|
import eu.eudat.logic.services.forms.VisibilityRuleService;
|
||||||
import eu.eudat.logic.utilities.builders.XmlBuilder;
|
import eu.eudat.commons.types.xml.XmlBuilder;
|
||||||
import eu.eudat.models.data.components.commons.datafield.ExternalDatasetsData;
|
import eu.eudat.models.data.components.commons.datafield.ExternalDatasetsData;
|
||||||
import eu.eudat.models.data.user.components.datasetprofile.Field;
|
import eu.eudat.models.data.user.components.datasetprofile.Field;
|
||||||
import eu.eudat.models.data.user.components.datasetprofile.FieldSet;
|
import eu.eudat.models.data.user.components.datasetprofile.FieldSet;
|
||||||
import eu.eudat.models.data.user.components.datasetprofile.Section;
|
import eu.eudat.models.data.user.components.datasetprofile.Section;
|
||||||
import eu.eudat.models.data.user.composite.DatasetProfilePage;
|
import eu.eudat.models.data.user.composite.DatasetProfilePage;
|
||||||
import eu.eudat.models.data.user.composite.PagedDatasetProfile;
|
import eu.eudat.models.data.user.composite.PagedDatasetProfile;
|
||||||
import org.json.JSONArray;
|
|
||||||
import org.json.JSONException;
|
|
||||||
import org.springframework.core.env.Environment;
|
import org.springframework.core.env.Environment;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
|
|
|
@ -7,7 +7,7 @@ import eu.eudat.models.data.components.commons.datafield.*;
|
||||||
import eu.eudat.models.data.user.components.datasetprofile.Field;
|
import eu.eudat.models.data.user.components.datasetprofile.Field;
|
||||||
import eu.eudat.models.data.user.components.datasetprofile.FieldSet;
|
import eu.eudat.models.data.user.components.datasetprofile.FieldSet;
|
||||||
import eu.eudat.models.data.user.components.datasetprofile.Section;
|
import eu.eudat.models.data.user.components.datasetprofile.Section;
|
||||||
import eu.eudat.logic.utilities.builders.XmlBuilder;
|
import eu.eudat.commons.types.xml.XmlBuilder;
|
||||||
|
|
||||||
import org.springframework.core.env.Environment;
|
import org.springframework.core.env.Environment;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package eu.eudat.logic.utilities.documents.xml.dmpXml;
|
package eu.eudat.logic.utilities.documents.xml.dmpXml;
|
||||||
|
|
||||||
import eu.eudat.logic.utilities.builders.XmlBuilder;
|
import eu.eudat.commons.types.dmpblueprint.DefinitionEntity;
|
||||||
|
import eu.eudat.commons.types.xml.XmlBuilder;
|
||||||
|
|
||||||
import eu.eudat.models.data.entities.xmlmodels.dmpprofiledefinition.DataManagementPlanBlueprint;
|
import eu.eudat.commons.types.dmpblueprint.SectionEntity;
|
||||||
import eu.eudat.models.data.entities.xmlmodels.dmpprofiledefinition.Section;
|
|
||||||
import eu.eudat.models.data.listingmodels.DataManagementPlanBlueprintListingModel;
|
import eu.eudat.models.data.listingmodels.DataManagementPlanBlueprintListingModel;
|
||||||
import org.springframework.core.env.Environment;
|
import org.springframework.core.env.Environment;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
|
@ -35,9 +35,9 @@ public class ExportXmlBuilderDmpBlueprint {
|
||||||
return xmlFile;
|
return xmlFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Element createDefinition(DataManagementPlanBlueprint dmpDefinition, Document doc) {
|
public Element createDefinition(DefinitionEntity dmpDefinition, Document doc) {
|
||||||
Element sections = doc.createElement("sections");
|
Element sections = doc.createElement("sections");
|
||||||
for (Section section : dmpDefinition.getSections()) {
|
for (SectionEntity section : dmpDefinition.getSections()) {
|
||||||
sections.appendChild(section.toXml(doc));
|
sections.appendChild(section.toXml(doc));
|
||||||
}
|
}
|
||||||
return sections;
|
return sections;
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package eu.eudat.logic.utilities.documents.xml.dmpXml.dmpBlueprintModel;
|
package eu.eudat.logic.utilities.documents.xml.dmpXml.dmpBlueprintModel;
|
||||||
|
|
||||||
import eu.eudat.models.data.entities.xmlmodels.dmpprofiledefinition.types.FieldCategory;
|
import eu.eudat.commons.types.dmpblueprint.DescriptionTemplateEntity;
|
||||||
|
|
||||||
import jakarta.xml.bind.annotation.XmlAttribute;
|
import jakarta.xml.bind.annotation.XmlAttribute;
|
||||||
import jakarta.xml.bind.annotation.XmlRootElement;
|
import jakarta.xml.bind.annotation.XmlRootElement;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
@ -60,8 +59,8 @@ public class DescriptionTemplate {
|
||||||
this.maxMultiplicity = maxMultiplicity;
|
this.maxMultiplicity = maxMultiplicity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public eu.eudat.models.data.entities.xmlmodels.dmpprofiledefinition.DescriptionTemplate toDmpBlueprintCompositeModel() {
|
public DescriptionTemplateEntity toDmpBlueprintCompositeModel() {
|
||||||
eu.eudat.models.data.entities.xmlmodels.dmpprofiledefinition.DescriptionTemplate descriptionTemplate = new eu.eudat.models.data.entities.xmlmodels.dmpprofiledefinition.DescriptionTemplate();
|
DescriptionTemplateEntity descriptionTemplate = new DescriptionTemplateEntity();
|
||||||
descriptionTemplate.setId(UUID.fromString(this.id));
|
descriptionTemplate.setId(UUID.fromString(this.id));
|
||||||
descriptionTemplate.setDescriptionTemplateId(UUID.fromString(this.descriptionTemplateId));
|
descriptionTemplate.setDescriptionTemplateId(UUID.fromString(this.descriptionTemplateId));
|
||||||
descriptionTemplate.setLabel(this.label);
|
descriptionTemplate.setLabel(this.label);
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
package eu.eudat.logic.utilities.documents.xml.dmpXml.dmpBlueprintModel;
|
package eu.eudat.logic.utilities.documents.xml.dmpXml.dmpBlueprintModel;
|
||||||
|
|
||||||
import eu.eudat.data.old.DMPProfile;
|
import eu.eudat.commons.enums.DmpBlueprintStatus;
|
||||||
|
import eu.eudat.data.DmpBlueprintEntity;
|
||||||
import jakarta.xml.bind.annotation.XmlElement;
|
import jakarta.xml.bind.annotation.XmlElement;
|
||||||
import jakarta.xml.bind.annotation.XmlRootElement;
|
import jakarta.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
|
import java.time.Instant;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
@XmlRootElement(name = "root")
|
@XmlRootElement(name = "root")
|
||||||
|
@ -23,9 +25,9 @@ public class DmpBlueprint {
|
||||||
public eu.eudat.models.data.listingmodels.DataManagementPlanBlueprintListingModel toDmpProfileCompositeModel(String label) {
|
public eu.eudat.models.data.listingmodels.DataManagementPlanBlueprintListingModel toDmpProfileCompositeModel(String label) {
|
||||||
eu.eudat.models.data.listingmodels.DataManagementPlanBlueprintListingModel dmpProfileModel = new eu.eudat.models.data.listingmodels.DataManagementPlanBlueprintListingModel();
|
eu.eudat.models.data.listingmodels.DataManagementPlanBlueprintListingModel dmpProfileModel = new eu.eudat.models.data.listingmodels.DataManagementPlanBlueprintListingModel();
|
||||||
dmpProfileModel.setLabel(label);
|
dmpProfileModel.setLabel(label);
|
||||||
dmpProfileModel.setStatus(DMPProfile.Status.SAVED.getValue());
|
dmpProfileModel.setStatus(DmpBlueprintStatus.Draft);
|
||||||
dmpProfileModel.setCreated(new Date());
|
dmpProfileModel.setCreated(Instant.now());
|
||||||
dmpProfileModel.setModified(new Date());
|
dmpProfileModel.setModified(Instant.now());
|
||||||
if (this.dmpBlueprintDefinition != null) {
|
if (this.dmpBlueprintDefinition != null) {
|
||||||
dmpProfileModel.setDefinition(this.dmpBlueprintDefinition.toDmpBlueprintCompositeModel());
|
dmpProfileModel.setDefinition(this.dmpBlueprintDefinition.toDmpBlueprintCompositeModel());
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package eu.eudat.logic.utilities.documents.xml.dmpXml.dmpBlueprintModel;
|
package eu.eudat.logic.utilities.documents.xml.dmpXml.dmpBlueprintModel;
|
||||||
|
|
||||||
|
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.XmlElement;
|
||||||
import jakarta.xml.bind.annotation.XmlRootElement;
|
import jakarta.xml.bind.annotation.XmlRootElement;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
@ -19,9 +21,9 @@ public class DmpBlueprintDefinition {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public eu.eudat.models.data.entities.xmlmodels.dmpprofiledefinition.DataManagementPlanBlueprint toDmpBlueprintCompositeModel() {
|
public DefinitionEntity toDmpBlueprintCompositeModel() {
|
||||||
eu.eudat.models.data.entities.xmlmodels.dmpprofiledefinition.DataManagementPlanBlueprint dmpBlueprint = new eu.eudat.models.data.entities.xmlmodels.dmpprofiledefinition.DataManagementPlanBlueprint();
|
DefinitionEntity dmpBlueprint = new DefinitionEntity();
|
||||||
List<eu.eudat.models.data.entities.xmlmodels.dmpprofiledefinition.Section> dmpBlueprintSections = new LinkedList<>();
|
List<SectionEntity> dmpBlueprintSections = new LinkedList<>();
|
||||||
if (this.sections != null && this.sections.getSections() != null) {
|
if (this.sections != null && this.sections.getSections() != null) {
|
||||||
for (Section section : this.sections.getSections()) {
|
for (Section section : this.sections.getSections()) {
|
||||||
dmpBlueprintSections.add(section.toDmpBlueprintCompositeModel());
|
dmpBlueprintSections.add(section.toDmpBlueprintCompositeModel());
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
package eu.eudat.logic.utilities.documents.xml.dmpXml.dmpBlueprintModel;
|
package eu.eudat.logic.utilities.documents.xml.dmpXml.dmpBlueprintModel;
|
||||||
|
|
||||||
import eu.eudat.models.data.entities.xmlmodels.dmpprofiledefinition.types.FieldCategory;
|
import eu.eudat.commons.enums.DmpBlueprintExtraFieldType;
|
||||||
|
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.XmlAttribute;
|
import jakarta.xml.bind.annotation.XmlAttribute;
|
||||||
import jakarta.xml.bind.annotation.XmlRootElement;
|
import jakarta.xml.bind.annotation.XmlRootElement;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
@ -10,7 +13,7 @@ import java.util.UUID;
|
||||||
public class ExtraField {
|
public class ExtraField {
|
||||||
|
|
||||||
private String id;
|
private String id;
|
||||||
private int type;
|
private short type;
|
||||||
private String label;
|
private String label;
|
||||||
private String placeholder;
|
private String placeholder;
|
||||||
private String description;
|
private String description;
|
||||||
|
@ -27,11 +30,11 @@ public class ExtraField {
|
||||||
}
|
}
|
||||||
|
|
||||||
@XmlAttribute(name = "type")
|
@XmlAttribute(name = "type")
|
||||||
public int getType() {
|
public short getType() {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setType(int type) {
|
public void setType(short type) {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,11 +83,11 @@ public class ExtraField {
|
||||||
this.required = required;
|
this.required = required;
|
||||||
}
|
}
|
||||||
|
|
||||||
public eu.eudat.models.data.entities.xmlmodels.dmpprofiledefinition.FieldModel toDmpBlueprintCompositeModel() {
|
public FieldEntity toDmpBlueprintCompositeModel() {
|
||||||
eu.eudat.models.data.entities.xmlmodels.dmpprofiledefinition.FieldModel systemField = new eu.eudat.models.data.entities.xmlmodels.dmpprofiledefinition.FieldModel();
|
ExtraFieldEntity systemField = new ExtraFieldEntity();
|
||||||
systemField.setId(UUID.fromString(this.id));
|
systemField.setId(UUID.fromString(this.id));
|
||||||
systemField.setCategory(FieldCategory.EXTRA);
|
systemField.setCategory(DmpBlueprintFieldCategory.Extra);
|
||||||
systemField.setType(this.type);
|
systemField.setType(DmpBlueprintExtraFieldType.of(this.type));
|
||||||
systemField.setLabel(this.label);
|
systemField.setLabel(this.label);
|
||||||
systemField.setPlaceholder(this.placeholder);
|
systemField.setPlaceholder(this.placeholder);
|
||||||
systemField.setDescription(this.description);
|
systemField.setDescription(this.description);
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
package eu.eudat.logic.utilities.documents.xml.dmpXml.dmpBlueprintModel;
|
package eu.eudat.logic.utilities.documents.xml.dmpXml.dmpBlueprintModel;
|
||||||
|
|
||||||
|
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.XmlAttribute;
|
||||||
import jakarta.xml.bind.annotation.XmlElement;
|
import jakarta.xml.bind.annotation.XmlElement;
|
||||||
import jakarta.xml.bind.annotation.XmlRootElement;
|
import jakarta.xml.bind.annotation.XmlRootElement;
|
||||||
|
@ -91,14 +94,14 @@ public class Section {
|
||||||
this.descriptionTemplates = descriptionTemplates;
|
this.descriptionTemplates = descriptionTemplates;
|
||||||
}
|
}
|
||||||
|
|
||||||
public eu.eudat.models.data.entities.xmlmodels.dmpprofiledefinition.Section toDmpBlueprintCompositeModel() {
|
public SectionEntity toDmpBlueprintCompositeModel() {
|
||||||
eu.eudat.models.data.entities.xmlmodels.dmpprofiledefinition.Section section = new eu.eudat.models.data.entities.xmlmodels.dmpprofiledefinition.Section();
|
SectionEntity section = new SectionEntity();
|
||||||
section.setId(UUID.fromString(this.id));
|
section.setId(UUID.fromString(this.id));
|
||||||
section.setLabel(this.label);
|
section.setLabel(this.label);
|
||||||
section.setDescription(this.description);
|
section.setDescription(this.description);
|
||||||
section.setOrdinal(this.ordinal);
|
section.setOrdinal(this.ordinal);
|
||||||
section.setHasTemplates(this.hasTemplates);
|
section.setHasTemplates(this.hasTemplates);
|
||||||
List<eu.eudat.models.data.entities.xmlmodels.dmpprofiledefinition.FieldModel> dmpBlueprintFieldModels = new LinkedList<>();
|
List<FieldEntity> dmpBlueprintFieldModels = new LinkedList<>();
|
||||||
if (this.systemFields != null && this.systemFields.getSystemFields() != null) {
|
if (this.systemFields != null && this.systemFields.getSystemFields() != null) {
|
||||||
for (SystemField systemField : this.systemFields.getSystemFields()) {
|
for (SystemField systemField : this.systemFields.getSystemFields()) {
|
||||||
dmpBlueprintFieldModels.add(systemField.toDmpBlueprintCompositeModel());
|
dmpBlueprintFieldModels.add(systemField.toDmpBlueprintCompositeModel());
|
||||||
|
@ -110,7 +113,7 @@ public class Section {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
section.setFields(dmpBlueprintFieldModels);
|
section.setFields(dmpBlueprintFieldModels);
|
||||||
List<eu.eudat.models.data.entities.xmlmodels.dmpprofiledefinition.DescriptionTemplate> dmpBlueprintDescriptionTemplates = new LinkedList<>();
|
List<DescriptionTemplateEntity> dmpBlueprintDescriptionTemplates = new LinkedList<>();
|
||||||
if (this.descriptionTemplates != null && this.descriptionTemplates.getDescriptionTemplates() != null) {
|
if (this.descriptionTemplates != null && this.descriptionTemplates.getDescriptionTemplates() != null) {
|
||||||
for (DescriptionTemplate descriptionTemplate : this.descriptionTemplates.getDescriptionTemplates()) {
|
for (DescriptionTemplate descriptionTemplate : this.descriptionTemplates.getDescriptionTemplates()) {
|
||||||
dmpBlueprintDescriptionTemplates.add(descriptionTemplate.toDmpBlueprintCompositeModel());
|
dmpBlueprintDescriptionTemplates.add(descriptionTemplate.toDmpBlueprintCompositeModel());
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
package eu.eudat.logic.utilities.documents.xml.dmpXml.dmpBlueprintModel;
|
package eu.eudat.logic.utilities.documents.xml.dmpXml.dmpBlueprintModel;
|
||||||
|
|
||||||
import eu.eudat.models.data.entities.xmlmodels.dmpprofiledefinition.types.FieldCategory;
|
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.XmlAttribute;
|
import jakarta.xml.bind.annotation.XmlAttribute;
|
||||||
import jakarta.xml.bind.annotation.XmlRootElement;
|
import jakarta.xml.bind.annotation.XmlRootElement;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
@ -10,7 +13,7 @@ import java.util.UUID;
|
||||||
public class SystemField {
|
public class SystemField {
|
||||||
|
|
||||||
private String id;
|
private String id;
|
||||||
private int type;
|
private short type;
|
||||||
private String label;
|
private String label;
|
||||||
private String placeholder;
|
private String placeholder;
|
||||||
private String description;
|
private String description;
|
||||||
|
@ -27,11 +30,11 @@ public class SystemField {
|
||||||
}
|
}
|
||||||
|
|
||||||
@XmlAttribute(name = "type")
|
@XmlAttribute(name = "type")
|
||||||
public int getType() {
|
public short getType() {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setType(int type) {
|
public void setType(short type) {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,11 +83,11 @@ public class SystemField {
|
||||||
this.required = required;
|
this.required = required;
|
||||||
}
|
}
|
||||||
|
|
||||||
public eu.eudat.models.data.entities.xmlmodels.dmpprofiledefinition.FieldModel toDmpBlueprintCompositeModel() {
|
public FieldEntity toDmpBlueprintCompositeModel() {
|
||||||
eu.eudat.models.data.entities.xmlmodels.dmpprofiledefinition.FieldModel systemField = new eu.eudat.models.data.entities.xmlmodels.dmpprofiledefinition.FieldModel();
|
SystemFieldEntity systemField = new SystemFieldEntity();
|
||||||
systemField.setId(UUID.fromString(this.id));
|
systemField.setId(UUID.fromString(this.id));
|
||||||
systemField.setCategory(FieldCategory.SYSTEM);
|
systemField.setCategory(DmpBlueprintFieldCategory.System);
|
||||||
systemField.setType(this.type);
|
systemField.setType(DmpBlueprintSystemFieldType.of(this.type));
|
||||||
systemField.setLabel(this.label);
|
systemField.setLabel(this.label);
|
||||||
systemField.setPlaceholder(this.placeholder);
|
systemField.setPlaceholder(this.placeholder);
|
||||||
systemField.setDescription(this.description);
|
systemField.setDescription(this.description);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package eu.eudat.models.data.components.commons;
|
package eu.eudat.models.data.components.commons;
|
||||||
|
|
||||||
import eu.eudat.models.data.entities.xmlmodels.modeldefinition.DatabaseModelDefinition;
|
import eu.eudat.models.data.entities.xmlmodels.modeldefinition.DatabaseModelDefinition;
|
||||||
import eu.eudat.logic.utilities.interfaces.XmlSerializable;
|
import eu.eudat.commons.types.xml.XmlSerializable;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package eu.eudat.models.data.components.commons;
|
package eu.eudat.models.data.components.commons;
|
||||||
|
|
||||||
import eu.eudat.logic.utilities.interfaces.XmlSerializable;
|
import eu.eudat.commons.types.xml.XmlSerializable;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
import org.w3c.dom.Node;
|
import org.w3c.dom.Node;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package eu.eudat.models.data.components.commons.datafield;
|
package eu.eudat.models.data.components.commons.datafield;
|
||||||
|
|
||||||
import eu.eudat.logic.utilities.interfaces.XmlSerializable;
|
import eu.eudat.commons.types.xml.XmlSerializable;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package eu.eudat.models.data.components.commons.datafield;
|
package eu.eudat.models.data.components.commons.datafield;
|
||||||
|
|
||||||
import eu.eudat.logic.utilities.interfaces.XmlSerializable;
|
import eu.eudat.commons.types.xml.XmlSerializable;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package eu.eudat.models.data.components.commons.datafield;
|
package eu.eudat.models.data.components.commons.datafield;
|
||||||
|
|
||||||
import eu.eudat.logic.utilities.interfaces.XmlSerializable;
|
import eu.eudat.commons.types.xml.XmlSerializable;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
import org.w3c.dom.Node;
|
import org.w3c.dom.Node;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package eu.eudat.models.data.components.commons.datafield;
|
package eu.eudat.models.data.components.commons.datafield;
|
||||||
|
|
||||||
import eu.eudat.logic.utilities.interfaces.XmlSerializable;
|
import eu.eudat.commons.types.xml.XmlSerializable;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
import org.w3c.dom.Node;
|
import org.w3c.dom.Node;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package eu.eudat.models.data.dmp;
|
package eu.eudat.models.data.dmp;
|
||||||
|
|
||||||
import eu.eudat.data.old.DescriptionTemplate;
|
import eu.eudat.data.old.DescriptionTemplate;
|
||||||
import eu.eudat.logic.utilities.interfaces.XmlSerializable;
|
import eu.eudat.commons.types.xml.XmlSerializable;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ package eu.eudat.models.data.dmp;
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import eu.eudat.data.DmpBlueprintEntity;
|
||||||
import eu.eudat.data.old.*;
|
import eu.eudat.data.old.*;
|
||||||
import eu.eudat.models.DataModel;
|
import eu.eudat.models.DataModel;
|
||||||
import eu.eudat.models.data.datasetwizard.DatasetWizardModel;
|
import eu.eudat.models.data.datasetwizard.DatasetWizardModel;
|
||||||
|
@ -318,9 +319,9 @@ public class DataManagementPlan implements DataModel<DMP, DataManagementPlan> {
|
||||||
public DMP toDataModel() throws Exception {
|
public DMP toDataModel() throws Exception {
|
||||||
DMP dataManagementPlanEntity = new DMP();
|
DMP dataManagementPlanEntity = new DMP();
|
||||||
if (this.profile != null) {
|
if (this.profile != null) {
|
||||||
DMPProfile dmpProfile = new DMPProfile();
|
DmpBlueprintEntity dmpBlueprint = new DmpBlueprintEntity();
|
||||||
dmpProfile.setId(this.profile.getId());
|
dmpBlueprint.setId(this.profile.getId());
|
||||||
dataManagementPlanEntity.setProfile(dmpProfile);
|
dataManagementPlanEntity.setProfile(dmpBlueprint);
|
||||||
}
|
}
|
||||||
dataManagementPlanEntity.setId(this.id);
|
dataManagementPlanEntity.setId(this.id);
|
||||||
if (this.organisations != null && !this.organisations.isEmpty())
|
if (this.organisations != null && !this.organisations.isEmpty())
|
||||||
|
|
|
@ -2,6 +2,7 @@ package eu.eudat.models.data.dmp;
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import eu.eudat.data.DmpBlueprintEntity;
|
||||||
import eu.eudat.data.old.*;
|
import eu.eudat.data.old.*;
|
||||||
import eu.eudat.models.DataModel;
|
import eu.eudat.models.DataModel;
|
||||||
import eu.eudat.models.data.datasetwizard.DatasetWizardModel;
|
import eu.eudat.models.data.datasetwizard.DatasetWizardModel;
|
||||||
|
@ -286,9 +287,9 @@ public class DataManagementPlanEditorModel implements DataModel<DMP, DataManagem
|
||||||
public DMP toDataModel() throws Exception {
|
public DMP toDataModel() throws Exception {
|
||||||
DMP dataManagementPlanEntity = new DMP();
|
DMP dataManagementPlanEntity = new DMP();
|
||||||
if (this.profile != null) {
|
if (this.profile != null) {
|
||||||
DMPProfile dmpProfile = new DMPProfile();
|
DmpBlueprintEntity dmpBlueprint = new DmpBlueprintEntity();
|
||||||
dmpProfile.setId(this.profile.getId());
|
dmpBlueprint.setId(this.profile.getId());
|
||||||
dataManagementPlanEntity.setProfile(dmpProfile);
|
dataManagementPlanEntity.setProfile(dmpBlueprint);
|
||||||
}
|
}
|
||||||
dataManagementPlanEntity.setId(this.id);
|
dataManagementPlanEntity.setId(this.id);
|
||||||
if (this.organisations != null && !this.organisations.isEmpty())
|
if (this.organisations != null && !this.organisations.isEmpty())
|
||||||
|
|
|
@ -4,9 +4,9 @@ import eu.eudat.models.data.components.commons.DefaultValue;
|
||||||
import eu.eudat.models.data.components.commons.ViewStyle;
|
import eu.eudat.models.data.components.commons.ViewStyle;
|
||||||
import eu.eudat.models.data.components.commons.Visibility;
|
import eu.eudat.models.data.components.commons.Visibility;
|
||||||
import eu.eudat.models.data.components.commons.datafield.FieldData;
|
import eu.eudat.models.data.components.commons.datafield.FieldData;
|
||||||
import eu.eudat.logic.utilities.interfaces.XmlSerializable;
|
import eu.eudat.commons.types.xml.XmlSerializable;
|
||||||
import eu.eudat.logic.utilities.builders.ModelBuilder;
|
import eu.eudat.logic.utilities.builders.ModelBuilder;
|
||||||
import eu.eudat.logic.utilities.builders.XmlBuilder;
|
import eu.eudat.commons.types.xml.XmlBuilder;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
import org.w3c.dom.Node;
|
import org.w3c.dom.Node;
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition;
|
package eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition;
|
||||||
|
|
||||||
import eu.eudat.models.data.components.commons.Multiplicity;
|
import eu.eudat.models.data.components.commons.Multiplicity;
|
||||||
import eu.eudat.logic.utilities.interfaces.XmlSerializable;
|
import eu.eudat.commons.types.xml.XmlSerializable;
|
||||||
import eu.eudat.logic.utilities.builders.XmlBuilder;
|
import eu.eudat.commons.types.xml.XmlBuilder;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
import org.w3c.dom.Node;
|
import org.w3c.dom.Node;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition;
|
package eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition;
|
||||||
|
|
||||||
import eu.eudat.logic.utilities.interfaces.XmlSerializable;
|
import eu.eudat.commons.types.xml.XmlSerializable;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition;
|
package eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition;
|
||||||
|
|
||||||
import eu.eudat.logic.utilities.builders.XmlBuilder;
|
import eu.eudat.commons.types.xml.XmlBuilder;
|
||||||
import eu.eudat.logic.utilities.interfaces.XmlSerializable;
|
import eu.eudat.commons.types.xml.XmlSerializable;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
import org.w3c.dom.Node;
|
import org.w3c.dom.Node;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition;
|
package eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition;
|
||||||
|
|
||||||
import eu.eudat.logic.utilities.builders.XmlBuilder;
|
import eu.eudat.commons.types.xml.XmlBuilder;
|
||||||
import eu.eudat.logic.utilities.interfaces.XmlSerializable;
|
import eu.eudat.commons.types.xml.XmlSerializable;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
import org.w3c.dom.Node;
|
import org.w3c.dom.Node;
|
||||||
|
|
|
@ -1,50 +0,0 @@
|
||||||
package eu.eudat.models.data.entities.xmlmodels.dmpprofiledefinition;
|
|
||||||
|
|
||||||
import eu.eudat.logic.utilities.builders.XmlBuilder;
|
|
||||||
import eu.eudat.logic.utilities.interfaces.XmlSerializable;
|
|
||||||
import org.w3c.dom.Document;
|
|
||||||
import org.w3c.dom.Element;
|
|
||||||
import org.w3c.dom.Node;
|
|
||||||
import org.w3c.dom.NodeList;
|
|
||||||
|
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class DataManagementPlanBlueprint implements XmlSerializable<DataManagementPlanBlueprint> {
|
|
||||||
|
|
||||||
private List<Section> sections;
|
|
||||||
|
|
||||||
public List<Section> getSections() {
|
|
||||||
return sections;
|
|
||||||
}
|
|
||||||
public void setSections(List<Section> sections) {
|
|
||||||
this.sections = sections;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Element toXml(Document doc) {
|
|
||||||
Element root = doc.createElement("root");
|
|
||||||
Element sections = doc.createElement("sections");
|
|
||||||
for (Section section : this.sections) {
|
|
||||||
sections.appendChild(section.toXml(doc));
|
|
||||||
}
|
|
||||||
root.appendChild(sections);
|
|
||||||
return root;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public DataManagementPlanBlueprint 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 Section().fromXml((Element) sectionElement));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,54 +0,0 @@
|
||||||
package eu.eudat.models.data.entities.xmlmodels.dmpprofiledefinition;
|
|
||||||
|
|
||||||
import eu.eudat.logic.utilities.builders.XmlBuilder;
|
|
||||||
import eu.eudat.logic.utilities.interfaces.XmlSerializable;
|
|
||||||
import org.w3c.dom.Document;
|
|
||||||
import org.w3c.dom.Element;
|
|
||||||
import org.w3c.dom.Node;
|
|
||||||
import org.w3c.dom.NodeList;
|
|
||||||
|
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by ikalyvas on 3/21/2018.
|
|
||||||
*/
|
|
||||||
public class DataManagementPlanProfile implements XmlSerializable<DataManagementPlanProfile> {
|
|
||||||
|
|
||||||
private List<Field> fields;
|
|
||||||
|
|
||||||
public List<Field> getFields() {
|
|
||||||
return fields;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFields(List<Field> fields) {
|
|
||||||
this.fields = fields;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Element toXml(Document doc) {
|
|
||||||
Element root = doc.createElement("root");
|
|
||||||
Element fields = doc.createElement("fields");
|
|
||||||
for (Field field : this.fields) {
|
|
||||||
fields.appendChild(field.toXml(doc));
|
|
||||||
}
|
|
||||||
root.appendChild(fields);
|
|
||||||
return root;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public DataManagementPlanProfile fromXml(Element item) {
|
|
||||||
this.fields = new LinkedList();
|
|
||||||
Element fields = (Element) XmlBuilder.getNodeFromListByTagName(item.getChildNodes(), "fields");
|
|
||||||
if (fields != null) {
|
|
||||||
NodeList fieldElements = fields.getChildNodes();
|
|
||||||
for (int temp = 0; temp < fieldElements.getLength(); temp++) {
|
|
||||||
Node fieldElement = fieldElements.item(temp);
|
|
||||||
if (fieldElement.getNodeType() == Node.ELEMENT_NODE) {
|
|
||||||
this.fields.add(new Field().fromXml((Element) fieldElement));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,93 +0,0 @@
|
||||||
package eu.eudat.models.data.entities.xmlmodels.dmpprofiledefinition;
|
|
||||||
|
|
||||||
import eu.eudat.logic.utilities.interfaces.XmlSerializable;
|
|
||||||
import eu.eudat.models.data.entities.xmlmodels.dmpprofiledefinition.types.ExtraFieldType;
|
|
||||||
import org.w3c.dom.Document;
|
|
||||||
import org.w3c.dom.Element;
|
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
public class ExtraField implements XmlSerializable<ExtraField> {
|
|
||||||
|
|
||||||
private UUID id;
|
|
||||||
private String label;
|
|
||||||
private String description;
|
|
||||||
private String placeholder;
|
|
||||||
private ExtraFieldType type;
|
|
||||||
private Boolean required;
|
|
||||||
private Integer ordinal;
|
|
||||||
|
|
||||||
public UUID getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
public void setId(UUID 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 String getPlaceholder() {
|
|
||||||
return placeholder;
|
|
||||||
}
|
|
||||||
public void setPlaceholder(String placeholder) {
|
|
||||||
this.placeholder = placeholder;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ExtraFieldType getType() {
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
public void setType(ExtraFieldType type) {
|
|
||||||
this.type = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Boolean getRequired() {
|
|
||||||
return required;
|
|
||||||
}
|
|
||||||
public void setRequired(Boolean required) {
|
|
||||||
this.required = required;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getOrdinal() {
|
|
||||||
return ordinal;
|
|
||||||
}
|
|
||||||
public void setOrdinal(Integer ordinal) {
|
|
||||||
this.ordinal = ordinal;
|
|
||||||
}
|
|
||||||
|
|
||||||
@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("type", String.valueOf(this.type.getValue()));
|
|
||||||
rootElement.setAttribute("required", String.valueOf(this.required));
|
|
||||||
rootElement.setAttribute("ordinal", String.valueOf(this.ordinal));
|
|
||||||
return rootElement;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ExtraField 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.type = ExtraFieldType.fromInteger(Integer.parseInt(item.getAttribute("type")));
|
|
||||||
this.required = Boolean.parseBoolean(item.getAttribute("required"));
|
|
||||||
this.ordinal = Integer.valueOf(item.getAttribute("ordinal"));
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,101 +0,0 @@
|
||||||
package eu.eudat.models.data.entities.xmlmodels.dmpprofiledefinition;
|
|
||||||
|
|
||||||
import eu.eudat.models.data.entities.xmlmodels.dmpprofiledefinition.types.DMPProfileFieldDataType;
|
|
||||||
import eu.eudat.models.data.entities.xmlmodels.dmpprofiledefinition.types.DMPProfileType;
|
|
||||||
import eu.eudat.logic.utilities.interfaces.XmlSerializable;
|
|
||||||
import org.w3c.dom.Document;
|
|
||||||
import org.w3c.dom.Element;
|
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by ikalyvas on 3/21/2018.
|
|
||||||
*/
|
|
||||||
public class Field implements XmlSerializable<Field> {
|
|
||||||
|
|
||||||
private UUID id;
|
|
||||||
private DMPProfileType type;
|
|
||||||
private DMPProfileFieldDataType dataType;
|
|
||||||
private Boolean required;
|
|
||||||
private String label;
|
|
||||||
private Object value;
|
|
||||||
private DmpProfileExternalAutoComplete externalAutocomplete;
|
|
||||||
|
|
||||||
public UUID getId() {
|
|
||||||
if (this.id == null) this.id = UUID.randomUUID();
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
public void setId(UUID id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getType() {
|
|
||||||
return type.getValue();
|
|
||||||
}
|
|
||||||
public void setType(DMPProfileType type) {
|
|
||||||
this.type = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getDataType() {
|
|
||||||
return dataType.getValue();
|
|
||||||
}
|
|
||||||
public void setDataType(DMPProfileFieldDataType dataType) {
|
|
||||||
this.dataType = dataType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Boolean getRequired() {
|
|
||||||
return required;
|
|
||||||
}
|
|
||||||
public void setRequired(Boolean required) {
|
|
||||||
this.required = required;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getLabel() {
|
|
||||||
return label;
|
|
||||||
}
|
|
||||||
public void setLabel(String label) {
|
|
||||||
this.label = label;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Object getValue() {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
public void setValue(Object value) {
|
|
||||||
this.value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DmpProfileExternalAutoComplete getExternalAutocomplete() {
|
|
||||||
return externalAutocomplete;
|
|
||||||
}
|
|
||||||
public void setExternalAutocomplete(DmpProfileExternalAutoComplete externalAutocomplete) {
|
|
||||||
this.externalAutocomplete = externalAutocomplete;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Element toXml(Document doc) {
|
|
||||||
Element rootElement = doc.createElement("field");
|
|
||||||
rootElement.setAttribute("id", this.getId().toString());
|
|
||||||
rootElement.setAttribute("type", this.type.getValue().toString());
|
|
||||||
rootElement.setAttribute("datatype", "" + this.dataType.getValue().toString());
|
|
||||||
rootElement.setAttribute("required", this.required.toString());
|
|
||||||
rootElement.setAttribute("label", this.label);
|
|
||||||
if (this.externalAutocomplete != null)
|
|
||||||
rootElement.appendChild(this.externalAutocomplete.toXml(doc));
|
|
||||||
|
|
||||||
return rootElement;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public eu.eudat.models.data.entities.xmlmodels.dmpprofiledefinition.Field fromXml(Element item) {
|
|
||||||
this.id = UUID.fromString(item.getAttribute("id"));
|
|
||||||
this.label = item.getAttribute("label");
|
|
||||||
this.dataType = DMPProfileFieldDataType.fromInteger(Integer.parseInt(item.getAttribute("datatype")));
|
|
||||||
this.required = Boolean.valueOf(item.getAttribute("required"));
|
|
||||||
this.type = DMPProfileType.fromInteger(Integer.parseInt(item.getAttribute("type")));
|
|
||||||
Element optionElement = (Element) item.getElementsByTagName("externalAutocomplete").item(0);
|
|
||||||
if (optionElement != null) {
|
|
||||||
this.externalAutocomplete = new DmpProfileExternalAutoComplete().fromXml(optionElement);
|
|
||||||
}
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,127 +0,0 @@
|
||||||
package eu.eudat.models.data.entities.xmlmodels.dmpprofiledefinition;
|
|
||||||
|
|
||||||
import eu.eudat.models.data.entities.xmlmodels.dmpprofiledefinition.types.ExtraFieldType;
|
|
||||||
import eu.eudat.models.data.entities.xmlmodels.dmpprofiledefinition.types.FieldCategory;
|
|
||||||
import eu.eudat.models.data.entities.xmlmodels.dmpprofiledefinition.types.SystemFieldType;
|
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
public class FieldModel {
|
|
||||||
|
|
||||||
private UUID id;
|
|
||||||
private FieldCategory category;
|
|
||||||
private Integer type;
|
|
||||||
private String label;
|
|
||||||
private String placeholder;
|
|
||||||
private String description;
|
|
||||||
private Integer ordinal;
|
|
||||||
private boolean required;
|
|
||||||
|
|
||||||
public UUID getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
public void setId(UUID id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public FieldCategory getCategory() {
|
|
||||||
return category;
|
|
||||||
}
|
|
||||||
public void setCategory(FieldCategory category) {
|
|
||||||
this.category = category;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getType() {
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
public void setType(Integer type) {
|
|
||||||
this.type = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getLabel() {
|
|
||||||
return label;
|
|
||||||
}
|
|
||||||
public void setLabel(String label) {
|
|
||||||
this.label = label;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPlaceholder() {
|
|
||||||
return placeholder;
|
|
||||||
}
|
|
||||||
public void setPlaceholder(String placeholder) {
|
|
||||||
this.placeholder = placeholder;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDescription() {
|
|
||||||
return description;
|
|
||||||
}
|
|
||||||
public void setDescription(String description) {
|
|
||||||
this.description = description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getOrdinal() {
|
|
||||||
return ordinal;
|
|
||||||
}
|
|
||||||
public void setOrdinal(Integer ordinal) {
|
|
||||||
this.ordinal = ordinal;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isRequired() {
|
|
||||||
return required;
|
|
||||||
}
|
|
||||||
public void setRequired(boolean required) {
|
|
||||||
this.required = required;
|
|
||||||
}
|
|
||||||
|
|
||||||
public SystemField toSystemField(){
|
|
||||||
SystemField systemField = new SystemField();
|
|
||||||
if (this.category == FieldCategory.SYSTEM) {
|
|
||||||
systemField.setId(this.id);
|
|
||||||
systemField.setType(SystemFieldType.fromInteger(this.type));
|
|
||||||
systemField.setLabel(this.label);
|
|
||||||
systemField.setPlaceholder(this.placeholder);
|
|
||||||
systemField.setDescription(this.description);
|
|
||||||
systemField.setOrdinal(this.ordinal);
|
|
||||||
systemField.setRequired(this.required);
|
|
||||||
}
|
|
||||||
return systemField;
|
|
||||||
}
|
|
||||||
|
|
||||||
public FieldModel fromSystemField(SystemField systemField){
|
|
||||||
this.setId(systemField.getId());
|
|
||||||
this.setCategory(FieldCategory.SYSTEM);
|
|
||||||
this.setType(systemField.getType().getType());
|
|
||||||
this.setLabel(systemField.getLabel());
|
|
||||||
this.setPlaceholder(systemField.getPlaceholder());
|
|
||||||
this.setDescription(systemField.getDescription());
|
|
||||||
this.setOrdinal(systemField.getOrdinal());
|
|
||||||
this.setRequired(systemField.isRequired());
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ExtraField toExtraField(){
|
|
||||||
ExtraField extraField = new ExtraField();
|
|
||||||
if (this.category == FieldCategory.EXTRA) {
|
|
||||||
extraField.setId(this.id);
|
|
||||||
extraField.setType(ExtraFieldType.fromInteger(this.type));
|
|
||||||
extraField.setLabel(this.label);
|
|
||||||
extraField.setPlaceholder(this.placeholder);
|
|
||||||
extraField.setDescription(this.description);
|
|
||||||
extraField.setOrdinal(this.ordinal);
|
|
||||||
extraField.setRequired(this.required);
|
|
||||||
}
|
|
||||||
return extraField;
|
|
||||||
}
|
|
||||||
|
|
||||||
public FieldModel fromExtraField(ExtraField extraField){
|
|
||||||
this.setId(extraField.getId());
|
|
||||||
this.setCategory(FieldCategory.EXTRA);
|
|
||||||
this.setType(extraField.getType().getValue());
|
|
||||||
this.setLabel(extraField.getLabel());
|
|
||||||
this.setPlaceholder(extraField.getPlaceholder());
|
|
||||||
this.setDescription(extraField.getDescription());
|
|
||||||
this.setOrdinal(extraField.getOrdinal());
|
|
||||||
this.setRequired(extraField.getRequired());
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,25 +0,0 @@
|
||||||
package eu.eudat.models.data.entities.xmlmodels.dmpprofiledefinition;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by ikalyvas on 3/22/2018.
|
|
||||||
*/
|
|
||||||
public class FieldValues {
|
|
||||||
private String id;
|
|
||||||
private String value;
|
|
||||||
|
|
||||||
public String getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(String id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getValue() {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setValue(String value) {
|
|
||||||
this.value = value;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,94 +0,0 @@
|
||||||
package eu.eudat.models.data.entities.xmlmodels.dmpprofiledefinition;
|
|
||||||
|
|
||||||
import eu.eudat.logic.utilities.interfaces.XmlSerializable;
|
|
||||||
import eu.eudat.models.data.entities.xmlmodels.dmpprofiledefinition.types.SystemFieldType;
|
|
||||||
import org.w3c.dom.Document;
|
|
||||||
import org.w3c.dom.Element;
|
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
public class SystemField implements XmlSerializable<SystemField> {
|
|
||||||
|
|
||||||
private UUID id;
|
|
||||||
private SystemFieldType type;
|
|
||||||
private String label;
|
|
||||||
private String placeholder;
|
|
||||||
private String description;
|
|
||||||
private boolean required;
|
|
||||||
private Integer ordinal;
|
|
||||||
|
|
||||||
public UUID getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
public void setId(UUID id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public SystemFieldType getType() {
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
public void setType(SystemFieldType type) {
|
|
||||||
this.type = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getLabel() {
|
|
||||||
return label;
|
|
||||||
}
|
|
||||||
public void setLabel(String label) {
|
|
||||||
this.label = label;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPlaceholder() {
|
|
||||||
return placeholder;
|
|
||||||
}
|
|
||||||
public void setPlaceholder(String placeholder) {
|
|
||||||
this.placeholder = placeholder;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDescription() {
|
|
||||||
return description;
|
|
||||||
}
|
|
||||||
public void setDescription(String description) {
|
|
||||||
this.description = description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isRequired() {
|
|
||||||
return required;
|
|
||||||
}
|
|
||||||
public void setRequired(boolean required) {
|
|
||||||
this.required = required;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getOrdinal() {
|
|
||||||
return ordinal;
|
|
||||||
}
|
|
||||||
public void setOrdinal(Integer ordinal) {
|
|
||||||
this.ordinal = ordinal;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Element toXml(Document doc) {
|
|
||||||
Element rootElement = doc.createElement("systemField");
|
|
||||||
rootElement.setAttribute("id", this.getId().toString());
|
|
||||||
rootElement.setAttribute("type", String.valueOf(this.type.getType()));
|
|
||||||
rootElement.setAttribute("label", this.label);
|
|
||||||
rootElement.setAttribute("placeholder", this.placeholder);
|
|
||||||
rootElement.setAttribute("description", this.description);
|
|
||||||
rootElement.setAttribute("required", String.valueOf(this.required));
|
|
||||||
rootElement.setAttribute("ordinal", String.valueOf(this.ordinal));
|
|
||||||
return rootElement;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SystemField fromXml(Element item) {
|
|
||||||
this.id = UUID.fromString(item.getAttribute("id"));
|
|
||||||
this.type = SystemFieldType.fromInteger(Integer.parseInt(item.getAttribute("type")));
|
|
||||||
this.label = item.getAttribute("label");
|
|
||||||
this.placeholder = item.getAttribute("placeholder");
|
|
||||||
this.description = item.getAttribute("description");
|
|
||||||
this.required = Boolean.parseBoolean(item.getAttribute("required"));
|
|
||||||
this.ordinal = Integer.valueOf(item.getAttribute("ordinal"));
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,33 +0,0 @@
|
||||||
package eu.eudat.models.data.entities.xmlmodels.dmpprofiledefinition.types;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by ikalyvas on 3/21/2018.
|
|
||||||
*/
|
|
||||||
public enum DMPProfileFieldDataType {
|
|
||||||
DATE(0), NUMBER(1), TEXT(2), EXTERNAL_AUTOCOMPLETE(3);
|
|
||||||
|
|
||||||
private Integer value;
|
|
||||||
|
|
||||||
private DMPProfileFieldDataType(Integer value) {
|
|
||||||
this.value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getValue() {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static DMPProfileFieldDataType fromInteger(Integer value) {
|
|
||||||
switch (value) {
|
|
||||||
case 0:
|
|
||||||
return DATE;
|
|
||||||
case 1:
|
|
||||||
return NUMBER;
|
|
||||||
case 2:
|
|
||||||
return TEXT;
|
|
||||||
case 3:
|
|
||||||
return EXTERNAL_AUTOCOMPLETE;
|
|
||||||
default:
|
|
||||||
throw new RuntimeException("Unsupported DMPProfileFieldData Type");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,27 +0,0 @@
|
||||||
package eu.eudat.models.data.entities.xmlmodels.dmpprofiledefinition.types;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by ikalyvas on 3/21/2018.
|
|
||||||
*/
|
|
||||||
public enum DMPProfileType {
|
|
||||||
INPUT(0);
|
|
||||||
|
|
||||||
private Integer value;
|
|
||||||
|
|
||||||
DMPProfileType(Integer value) {
|
|
||||||
this.value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getValue() {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static DMPProfileType fromInteger(Integer value) {
|
|
||||||
switch (value) {
|
|
||||||
case 0:
|
|
||||||
return INPUT;
|
|
||||||
default:
|
|
||||||
throw new RuntimeException("Unsupported DMPProfile Type");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,30 +0,0 @@
|
||||||
package eu.eudat.models.data.entities.xmlmodels.dmpprofiledefinition.types;
|
|
||||||
|
|
||||||
public enum ExtraFieldType {
|
|
||||||
TEXT(0), RICH_TEXT(1), DATE(2), NUMBER(3);
|
|
||||||
|
|
||||||
private Integer value;
|
|
||||||
|
|
||||||
private ExtraFieldType(Integer value) {
|
|
||||||
this.value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getValue() {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ExtraFieldType fromInteger(Integer value) {
|
|
||||||
switch (value) {
|
|
||||||
case 0:
|
|
||||||
return TEXT;
|
|
||||||
case 1:
|
|
||||||
return RICH_TEXT;
|
|
||||||
case 2:
|
|
||||||
return DATE;
|
|
||||||
case 3:
|
|
||||||
return NUMBER;
|
|
||||||
default:
|
|
||||||
throw new RuntimeException("Unsupported ExtraFieldType Type");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,27 +0,0 @@
|
||||||
package eu.eudat.models.data.entities.xmlmodels.dmpprofiledefinition.types;
|
|
||||||
|
|
||||||
public enum FieldCategory {
|
|
||||||
SYSTEM(0),
|
|
||||||
EXTRA(1);
|
|
||||||
|
|
||||||
private Integer value;
|
|
||||||
|
|
||||||
private FieldCategory(Integer value) {
|
|
||||||
this.value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getValue() {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static FieldCategory fromInteger(Integer value) {
|
|
||||||
switch (value) {
|
|
||||||
case 0:
|
|
||||||
return SYSTEM;
|
|
||||||
case 1:
|
|
||||||
return EXTRA;
|
|
||||||
default:
|
|
||||||
throw new RuntimeException("Unsupported FieldCategory Type");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,55 +0,0 @@
|
||||||
package eu.eudat.models.data.entities.xmlmodels.dmpprofiledefinition.types;
|
|
||||||
|
|
||||||
public enum SystemFieldType {
|
|
||||||
|
|
||||||
TEXT(0),
|
|
||||||
HTML_TEXT(1),
|
|
||||||
RESEARCHERS(2),
|
|
||||||
ORGANIZATIONS(3),
|
|
||||||
LANGUAGE(4),
|
|
||||||
CONTACT(5),
|
|
||||||
FUNDER(6),
|
|
||||||
GRANT(7),
|
|
||||||
PROJECT(8),
|
|
||||||
LICENSE(9),
|
|
||||||
ACCESS_RIGHTS(10);
|
|
||||||
|
|
||||||
private int type;
|
|
||||||
|
|
||||||
SystemFieldType(int type) {
|
|
||||||
this.type = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getType() {
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static SystemFieldType fromInteger(int type) {
|
|
||||||
switch (type) {
|
|
||||||
case 0:
|
|
||||||
return TEXT;
|
|
||||||
case 1:
|
|
||||||
return HTML_TEXT;
|
|
||||||
case 2:
|
|
||||||
return RESEARCHERS;
|
|
||||||
case 3:
|
|
||||||
return ORGANIZATIONS;
|
|
||||||
case 4:
|
|
||||||
return LANGUAGE;
|
|
||||||
case 5:
|
|
||||||
return CONTACT;
|
|
||||||
case 6:
|
|
||||||
return FUNDER;
|
|
||||||
case 7:
|
|
||||||
return GRANT;
|
|
||||||
case 8:
|
|
||||||
return PROJECT;
|
|
||||||
case 9:
|
|
||||||
return LICENSE;
|
|
||||||
case 10:
|
|
||||||
return ACCESS_RIGHTS;
|
|
||||||
default:
|
|
||||||
throw new RuntimeException("Unsupported System Section Type");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,22 +1,23 @@
|
||||||
package eu.eudat.models.data.listingmodels;
|
package eu.eudat.models.data.listingmodels;
|
||||||
|
|
||||||
import eu.eudat.data.old.DMPProfile;
|
import eu.eudat.commons.enums.DmpBlueprintStatus;
|
||||||
import eu.eudat.logic.utilities.builders.XmlBuilder;
|
import eu.eudat.commons.types.dmpblueprint.DefinitionEntity;
|
||||||
|
import eu.eudat.data.DmpBlueprintEntity;
|
||||||
|
import eu.eudat.commons.types.xml.XmlBuilder;
|
||||||
import eu.eudat.models.DataModel;
|
import eu.eudat.models.DataModel;
|
||||||
import eu.eudat.models.data.entities.xmlmodels.dmpprofiledefinition.DataManagementPlanBlueprint;
|
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.time.Instant;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class DataManagementPlanBlueprintListingModel implements DataModel<DMPProfile, DataManagementPlanBlueprintListingModel> {
|
public class DataManagementPlanBlueprintListingModel implements DataModel<DmpBlueprintEntity, DataManagementPlanBlueprintListingModel> {
|
||||||
|
|
||||||
private UUID id;
|
private UUID id;
|
||||||
private String label;
|
private String label;
|
||||||
private DataManagementPlanBlueprint definition;
|
private DefinitionEntity definition;
|
||||||
private int status;
|
private DmpBlueprintStatus status;
|
||||||
private Date created = null;
|
private Instant created = null;
|
||||||
private Date modified = new Date();
|
private Instant modified = Instant.now();
|
||||||
|
|
||||||
public UUID getId() {
|
public UUID getId() {
|
||||||
return id;
|
return id;
|
||||||
|
@ -32,57 +33,60 @@ public class DataManagementPlanBlueprintListingModel implements DataModel<DMPPro
|
||||||
this.label = label;
|
this.label = label;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DataManagementPlanBlueprint getDefinition() {
|
public DefinitionEntity getDefinition() {
|
||||||
return definition;
|
return definition;
|
||||||
}
|
}
|
||||||
public void setDefinition(DataManagementPlanBlueprint definition) {
|
public void setDefinition(DefinitionEntity definition) {
|
||||||
this.definition = definition;
|
this.definition = definition;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getStatus() {
|
public DmpBlueprintStatus getStatus() {
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
public void setStatus(int status) {
|
|
||||||
|
public void setStatus(DmpBlueprintStatus status) {
|
||||||
this.status = status;
|
this.status = status;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getCreated() {
|
public Instant getCreated() {
|
||||||
return created;
|
return created;
|
||||||
}
|
}
|
||||||
public void setCreated(Date created) {
|
|
||||||
|
public void setCreated(Instant created) {
|
||||||
this.created = created;
|
this.created = created;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getModified() {
|
public Instant getModified() {
|
||||||
return modified;
|
return modified;
|
||||||
}
|
}
|
||||||
public void setModified(Date modified) {
|
|
||||||
|
public void setModified(Instant modified) {
|
||||||
this.modified = modified;
|
this.modified = modified;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DataManagementPlanBlueprintListingModel fromDataModel(DMPProfile entity) {
|
public DataManagementPlanBlueprintListingModel fromDataModel(DmpBlueprintEntity entity) {
|
||||||
this.id = entity.getId();
|
this.id = entity.getId();
|
||||||
this.created = entity.getCreated();
|
this.created = entity.getCreatedAt();
|
||||||
this.definition = new DataManagementPlanBlueprint().fromXml(XmlBuilder.fromXml(entity.getDefinition()).getDocumentElement());
|
this.definition = new DefinitionEntity().fromXml(XmlBuilder.fromXml(entity.getDefinition()).getDocumentElement());
|
||||||
this.modified = entity.getModified();
|
this.modified = entity.getUpdatedAt();
|
||||||
this.label = entity.getLabel();
|
this.label = entity.getLabel();
|
||||||
this.status = entity.getStatus();
|
this.status = entity.getStatus();
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DMPProfile toDataModel() throws Exception {
|
public DmpBlueprintEntity toDataModel() throws Exception {
|
||||||
Document document = XmlBuilder.getDocument();
|
Document document = XmlBuilder.getDocument();
|
||||||
document.appendChild(this.definition.toXml(document));
|
document.appendChild(this.definition.toXml(document));
|
||||||
DMPProfile dmpProfile = new DMPProfile();
|
DmpBlueprintEntity dmpBlueprint = new DmpBlueprintEntity();
|
||||||
dmpProfile.setCreated(this.created == null ? new Date() : this.created);
|
dmpBlueprint.setCreatedAt(this.created == null ? Instant.now() : this.created);
|
||||||
dmpProfile.setDefinition(XmlBuilder.generateXml(document));
|
dmpBlueprint.setDefinition(XmlBuilder.generateXml(document));
|
||||||
dmpProfile.setId(this.id);
|
dmpBlueprint.setId(this.id);
|
||||||
dmpProfile.setLabel(this.label);
|
dmpBlueprint.setLabel(this.label);
|
||||||
dmpProfile.setStatus(this.status);
|
dmpBlueprint.setStatus(this.status);
|
||||||
dmpProfile.setModified(this.modified == null ? new Date() : this.modified);
|
dmpBlueprint.setUpdatedAt(this.modified == null ? Instant.now() : this.modified);
|
||||||
return dmpProfile;
|
return dmpBlueprint;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,106 +1,107 @@
|
||||||
package eu.eudat.models.data.listingmodels;
|
//package eu.eudat.models.data.listingmodels;
|
||||||
|
//
|
||||||
import eu.eudat.data.old.DMPProfile;
|
//import eu.eudat.commons.enums.DmpBlueprintStatus;
|
||||||
import eu.eudat.models.DataModel;
|
//import eu.eudat.commons.types.dmpblueprint.DefinitionEntity;
|
||||||
import eu.eudat.models.data.entities.xmlmodels.dmpprofiledefinition.DataManagementPlanProfile;
|
//import eu.eudat.data.DmpBlueprintEntity;
|
||||||
import eu.eudat.logic.utilities.builders.XmlBuilder;
|
//import eu.eudat.models.DataModel;
|
||||||
import org.w3c.dom.Document;
|
//import eu.eudat.commons.types.xml.XmlBuilder;
|
||||||
|
//import org.w3c.dom.Document;
|
||||||
import java.util.Date;
|
//
|
||||||
import java.util.UUID;
|
//import java.time.Instant;
|
||||||
|
//import java.util.UUID;
|
||||||
/**
|
//
|
||||||
* Created by ikalyvas on 3/21/2018.
|
///**
|
||||||
*/
|
// * Created by ikalyvas on 3/21/2018.
|
||||||
public class DataManagementPlanProfileListingModel implements DataModel<DMPProfile, DataManagementPlanProfileListingModel> {
|
// */
|
||||||
|
//public class DataManagementPlanProfileListingModel implements DataModel<DmpBlueprintEntity, DataManagementPlanProfileListingModel> {
|
||||||
private UUID id;
|
//
|
||||||
|
// private UUID id;
|
||||||
private String label;
|
//
|
||||||
|
// private String label;
|
||||||
private DataManagementPlanProfile definition;
|
//
|
||||||
|
// private DefinitionEntity definitionEntity;
|
||||||
private int status;
|
//
|
||||||
|
// private DmpBlueprintStatus status;
|
||||||
private Date created = null;
|
//
|
||||||
|
// private Instant created = null;
|
||||||
private Date modified = new Date();
|
//
|
||||||
|
// private Instant modified = Instant.now();
|
||||||
public UUID getId() {
|
//
|
||||||
return id;
|
// public UUID getId() {
|
||||||
}
|
// return id;
|
||||||
|
// }
|
||||||
public void setId(UUID id) {
|
//
|
||||||
this.id = id;
|
// public void setId(UUID id) {
|
||||||
}
|
// this.id = id;
|
||||||
|
// }
|
||||||
public String getLabel() {
|
//
|
||||||
return label;
|
// public String getLabel() {
|
||||||
}
|
// return label;
|
||||||
|
// }
|
||||||
public void setLabel(String label) {
|
//
|
||||||
this.label = label;
|
// public void setLabel(String label) {
|
||||||
}
|
// this.label = label;
|
||||||
|
// }
|
||||||
public DataManagementPlanProfile getDefinition() {
|
//
|
||||||
return definition;
|
// public DefinitionEntity getDefinition() {
|
||||||
}
|
// return definitionEntity;
|
||||||
|
// }
|
||||||
public void setDefinition(DataManagementPlanProfile definition) {
|
//
|
||||||
this.definition = definition;
|
// public void setDefinition(DefinitionEntity definitionEntity) {
|
||||||
}
|
// this.definitionEntity = definitionEntity;
|
||||||
|
// }
|
||||||
public int getStatus() {
|
//
|
||||||
return status;
|
// public DmpBlueprintStatus getStatus() {
|
||||||
}
|
// return status;
|
||||||
|
// }
|
||||||
public void setStatus(int status) {
|
//
|
||||||
this.status = status;
|
// public void setStatus(DmpBlueprintStatus status) {
|
||||||
}
|
// this.status = status;
|
||||||
|
// }
|
||||||
public Date getCreated() {
|
//
|
||||||
return created;
|
// public Instant getCreated() {
|
||||||
}
|
// return created;
|
||||||
|
// }
|
||||||
public void setCreated(Date created) {
|
//
|
||||||
this.created = created;
|
// public void setCreated(Instant created) {
|
||||||
}
|
// this.created = created;
|
||||||
|
// }
|
||||||
public Date getModified() {
|
//
|
||||||
return modified;
|
// public Instant getModified() {
|
||||||
}
|
// return modified;
|
||||||
|
// }
|
||||||
public void setModified(Date modified) {
|
//
|
||||||
this.modified = modified;
|
// public void setModified(Instant modified) {
|
||||||
}
|
// this.modified = modified;
|
||||||
|
// }
|
||||||
@Override
|
//
|
||||||
public DataManagementPlanProfileListingModel fromDataModel(DMPProfile entity) {
|
// @Override
|
||||||
this.id = entity.getId();
|
// public DataManagementPlanProfileListingModel fromDataModel(DmpBlueprintEntity entity) {
|
||||||
this.created = entity.getCreated();
|
// this.id = entity.getId();
|
||||||
this.definition = new DataManagementPlanProfile().fromXml(XmlBuilder.fromXml(entity.getDefinition()).getDocumentElement());
|
// this.created = entity.getCreatedAt();
|
||||||
this.modified = entity.getModified();
|
// this.definitionEntity = new DefinitionEntity().fromXml(XmlBuilder.fromXml(entity.getDefinition()).getDocumentElement());
|
||||||
this.label = entity.getLabel();
|
// this.modified = entity.getUpdatedAt();
|
||||||
this.status = entity.getStatus();
|
// this.label = entity.getLabel();
|
||||||
return this;
|
// this.status = entity.getStatus();
|
||||||
}
|
// return this;
|
||||||
|
// }
|
||||||
@Override
|
//
|
||||||
public DMPProfile toDataModel() throws Exception {
|
// @Override
|
||||||
Document document = XmlBuilder.getDocument();
|
// public DmpBlueprintEntity toDataModel() throws Exception {
|
||||||
document.appendChild(this.definition.toXml(document));
|
// Document document = XmlBuilder.getDocument();
|
||||||
DMPProfile dmpProfile = new DMPProfile();
|
// document.appendChild(this.definitionEntity.toXml(document));
|
||||||
dmpProfile.setCreated(this.created == null ? new Date() : this.created);
|
// DmpBlueprintEntity dmpBlueprint = new DmpBlueprintEntity();
|
||||||
dmpProfile.setDefinition(XmlBuilder.generateXml(document));
|
// dmpBlueprint.setCreatedAt(this.created == null ? Instant.now() : this.created);
|
||||||
dmpProfile.setId(this.id);
|
// dmpBlueprint.setDefinition(XmlBuilder.generateXml(document));
|
||||||
dmpProfile.setLabel(this.label);
|
// dmpBlueprint.setId(this.id);
|
||||||
dmpProfile.setStatus(this.status);
|
// dmpBlueprint.setLabel(this.label);
|
||||||
dmpProfile.setModified(this.modified == null ? new Date() : this.modified);
|
// dmpBlueprint.setStatus(this.status);
|
||||||
return dmpProfile;
|
// dmpBlueprint.setUpdatedAt(this.modified == null ? Instant.now() : this.modified);
|
||||||
}
|
// return dmpBlueprint;
|
||||||
|
// }
|
||||||
@Override
|
//
|
||||||
public String getHint() {
|
// @Override
|
||||||
return null;
|
// public String getHint() {
|
||||||
}
|
// return null;
|
||||||
}
|
// }
|
||||||
|
//}
|
||||||
|
|
|
@ -6,7 +6,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.jayway.jsonpath.JsonPath;
|
import com.jayway.jsonpath.JsonPath;
|
||||||
import eu.eudat.data.old.Dataset;
|
import eu.eudat.data.old.Dataset;
|
||||||
import eu.eudat.logic.managers.DatasetManager;
|
import eu.eudat.logic.managers.DatasetManager;
|
||||||
import eu.eudat.logic.utilities.builders.XmlBuilder;
|
import eu.eudat.commons.types.xml.XmlBuilder;
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
|
|
@ -9,7 +9,7 @@ import eu.eudat.exceptions.security.ForbiddenException;
|
||||||
import eu.eudat.logic.managers.PaginationManager;
|
import eu.eudat.logic.managers.PaginationManager;
|
||||||
import eu.eudat.logic.services.ApiContext;
|
import eu.eudat.logic.services.ApiContext;
|
||||||
import eu.eudat.logic.services.operations.DatabaseRepository;
|
import eu.eudat.logic.services.operations.DatabaseRepository;
|
||||||
import eu.eudat.logic.utilities.builders.XmlBuilder;
|
import eu.eudat.commons.types.xml.XmlBuilder;
|
||||||
import eu.eudat.models.HintedModelFactory;
|
import eu.eudat.models.HintedModelFactory;
|
||||||
import eu.eudat.models.data.helpers.common.DataTableData;
|
import eu.eudat.models.data.helpers.common.DataTableData;
|
||||||
import eu.eudat.models.data.user.composite.PagedDatasetProfile;
|
import eu.eudat.models.data.user.composite.PagedDatasetProfile;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package eu.eudat.publicapi.models.associatedprofile;
|
package eu.eudat.publicapi.models.associatedprofile;
|
||||||
|
|
||||||
import eu.eudat.data.old.DescriptionTemplate;
|
import eu.eudat.data.old.DescriptionTemplate;
|
||||||
import eu.eudat.logic.utilities.interfaces.XmlSerializable;
|
import eu.eudat.commons.types.xml.XmlSerializable;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ import eu.eudat.data.old.DMP;
|
||||||
import eu.eudat.data.old.DMPDatasetProfile;
|
import eu.eudat.data.old.DMPDatasetProfile;
|
||||||
import eu.eudat.data.old.Dataset;
|
import eu.eudat.data.old.Dataset;
|
||||||
import eu.eudat.data.old.DescriptionTemplate;
|
import eu.eudat.data.old.DescriptionTemplate;
|
||||||
import eu.eudat.logic.utilities.builders.XmlBuilder;
|
import eu.eudat.commons.types.xml.XmlBuilder;
|
||||||
import eu.eudat.models.DataModel;
|
import eu.eudat.models.DataModel;
|
||||||
import eu.eudat.models.data.user.composite.PagedDatasetProfile;
|
import eu.eudat.models.data.user.composite.PagedDatasetProfile;
|
||||||
import eu.eudat.publicapi.models.associatedprofile.AssociatedProfilePublicModel;
|
import eu.eudat.publicapi.models.associatedprofile.AssociatedProfilePublicModel;
|
||||||
|
|
|
@ -88,6 +88,26 @@ permissions:
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
allowAnonymous: false
|
allowAnonymous: false
|
||||||
allowAuthenticated: false
|
allowAuthenticated: false
|
||||||
|
# DmpBlueprint
|
||||||
|
BrowseDmpBlueprint:
|
||||||
|
roles:
|
||||||
|
- Admin
|
||||||
|
clients: [ ]
|
||||||
|
allowAnonymous: false
|
||||||
|
allowAuthenticated: false
|
||||||
|
EditDmpBlueprint:
|
||||||
|
roles:
|
||||||
|
- Admin
|
||||||
|
clients: [ ]
|
||||||
|
allowAnonymous: false
|
||||||
|
allowAuthenticated: false
|
||||||
|
DeleteDmpBlueprint:
|
||||||
|
roles:
|
||||||
|
- Admin
|
||||||
|
claims: [ ]
|
||||||
|
clients: [ ]
|
||||||
|
allowAnonymous: false
|
||||||
|
allowAuthenticated: false
|
||||||
|
|
||||||
# ViewPage Permissions
|
# ViewPage Permissions
|
||||||
ViewDescriptionTemplateTypePage:
|
ViewDescriptionTemplateTypePage:
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
ALTER TABLE public."DMPProfile" RENAME TO "DmpBlueprint";
|
||||||
|
|
||||||
|
ALTER TABLE public."DmpBlueprint" RENAME "ID" TO id;
|
||||||
|
|
||||||
|
ALTER TABLE public."DmpBlueprint" RENAME "Label" TO label;
|
||||||
|
|
||||||
|
ALTER TABLE public."DmpBlueprint" RENAME "Definition" TO definition;
|
||||||
|
|
||||||
|
ALTER TABLE public."DmpBlueprint" RENAME "Status" TO status;
|
||||||
|
|
||||||
|
ALTER TABLE public."DmpBlueprint" RENAME "Created" TO created_at;
|
||||||
|
|
||||||
|
ALTER TABLE public."DmpBlueprint" ALTER COLUMN created_at TYPE timestamp without time zone ;
|
||||||
|
|
||||||
|
ALTER TABLE public."DmpBlueprint" RENAME "Modified" TO updated_at;
|
||||||
|
|
||||||
|
ALTER TABLE public."DmpBlueprint" ALTER COLUMN updated_at TYPE timestamp without time zone ;
|
||||||
|
|
||||||
|
ALTER TABLE public."DmpBlueprint" ADD COLUMN is_active smallint;
|
||||||
|
|
||||||
|
UPDATE public."DmpBlueprint" SET is_active = 1;
|
||||||
|
|
||||||
|
UPDATE public."DmpBlueprint" SET is_active = 0 where status = 99;
|
||||||
|
UPDATE public."DmpBlueprint" SET status = 0 where is_active = 0;
|
||||||
|
|
||||||
|
ALTER TABLE public."DmpBlueprint" ALTER COLUMN is_active SET NOT NULL;
|
Loading…
Reference in New Issue