Merge branch 'dmp-refactoring' of https://code-repo.d4science.org/MaDgiK-CITE/argos into dmp-refactoring

This commit is contained in:
Sofia Papacharalampous 2024-04-29 18:32:34 +03:00
commit d1492e0a93
265 changed files with 75007 additions and 1223 deletions

View File

@ -5,4 +5,5 @@ import java.util.EnumSet;
public enum AuthorizationFlags {
None, Permission, DmpAssociated, Public, Owner;
public static final EnumSet<AuthorizationFlags> OwnerOrDmpAssociatedOrPermission = EnumSet.of(DmpAssociated, Permission, Owner);
public static final EnumSet<AuthorizationFlags> OwnerOrDmpAssociatedOrPermissionOrPublic = EnumSet.of(DmpAssociated, Permission, Owner, Public);
}

View File

@ -109,6 +109,7 @@ public final class Permission {
public static String FinalizeDescription = "FinalizeDescription";
public static String DeleteDescription = "DeleteDescription";
public static String CloneDescription = "CloneDescription";
public static String ExportDescription = "ExportDescription";
//DescriptionTag
public static String BrowseDescriptionTag = "BrowseDescriptionTag";

View File

@ -0,0 +1,32 @@
package org.opencdmp.commons.types.description.importexport;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlElement;
@XmlAccessorType(XmlAccessType.FIELD)
public class DescriptionExternalIdentifierImportExport {
@XmlElement(name = "identifier")
private String identifier;
@XmlElement(name = "type")
private String type;
public String getIdentifier() {
return this.identifier;
}
public void setIdentifier(String identifier) {
this.identifier = identifier;
}
public String getType() {
return this.type;
}
public void setType(String type) {
this.type = type;
}
}

View File

@ -0,0 +1,66 @@
package org.opencdmp.commons.types.description.importexport;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlElementWrapper;
import java.time.Instant;
import java.util.List;
@XmlAccessorType(XmlAccessType.FIELD)
public class DescriptionFieldImportExport {
@XmlElement(name = "fieldId")
private String fieldId;
@XmlElement(name = "textValue")
private String textValue;
@XmlElementWrapper(name = "textListValues")
@XmlElement(name = "textListValue")
private List<String> textListValue;
@XmlElement(name = "dateValue")
private Instant dateValue;
@XmlElement(name = "externalIdentifier")
private DescriptionExternalIdentifierImportExport externalIdentifier;
public String getFieldId() {
return this.fieldId;
}
public void setFieldId(String fieldId) {
this.fieldId = fieldId;
}
public String getTextValue() {
return this.textValue;
}
public void setTextValue(String textValue) {
this.textValue = textValue;
}
public List<String> getTextListValue() {
return this.textListValue;
}
public void setTextListValue(List<String> textListValue) {
this.textListValue = textListValue;
}
public Instant getDateValue() {
return this.dateValue;
}
public void setDateValue(Instant dateValue) {
this.dateValue = dateValue;
}
public DescriptionExternalIdentifierImportExport getExternalIdentifier() {
return this.externalIdentifier;
}
public void setExternalIdentifier(DescriptionExternalIdentifierImportExport externalIdentifier) {
this.externalIdentifier = externalIdentifier;
}
}

View File

@ -0,0 +1,103 @@
package org.opencdmp.commons.types.description.importexport;
import jakarta.xml.bind.annotation.*;
import org.opencdmp.commons.types.descriptiontemplate.importexport.DescriptionTemplateImportExport;
import java.time.Instant;
import java.util.List;
import java.util.UUID;
@XmlRootElement(name = "description")
@XmlAccessorType(XmlAccessType.FIELD)
public class DescriptionImportExport {
@XmlElement(name = "id")
private UUID id;
@XmlElement(name = "description")
private String description;
@XmlElement(name = "label")
private String label;
@XmlElement(name = "finalizedAt")
private Instant finalizedAt;
@XmlElement(name = "sectionId")
private UUID sectionId;
@XmlElement(name = "descriptionTemplate")
private DescriptionTemplateImportExport descriptionTemplate;
@XmlElementWrapper(name = "references")
@XmlElement(name = "reference")
private List<DescriptionReferenceImportExport> references;
@XmlElement(name = "properties")
private DescriptionPropertyDefinitionImportExport properties;
public UUID getId() {
return this.id;
}
public void setId(UUID id) {
this.id = id;
}
public String getDescription() {
return this.description;
}
public void setDescription(String description) {
this.description = description;
}
public String getLabel() {
return this.label;
}
public void setLabel(String label) {
this.label = label;
}
public Instant getFinalizedAt() {
return this.finalizedAt;
}
public void setFinalizedAt(Instant finalizedAt) {
this.finalizedAt = finalizedAt;
}
public UUID getSectionId() {
return this.sectionId;
}
public void setSectionId(UUID sectionId) {
this.sectionId = sectionId;
}
public DescriptionTemplateImportExport getDescriptionTemplate() {
return this.descriptionTemplate;
}
public void setDescriptionTemplate(DescriptionTemplateImportExport descriptionTemplate) {
this.descriptionTemplate = descriptionTemplate;
}
public List<DescriptionReferenceImportExport> getReferences() {
return this.references;
}
public void setReferences(List<DescriptionReferenceImportExport> references) {
this.references = references;
}
public DescriptionPropertyDefinitionImportExport getProperties() {
return this.properties;
}
public void setProperties(DescriptionPropertyDefinitionImportExport properties) {
this.properties = properties;
}
}

View File

@ -0,0 +1,34 @@
package org.opencdmp.commons.types.description.importexport;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlElementWrapper;
import java.util.List;
@XmlAccessorType(XmlAccessType.FIELD)
public class DescriptionPropertyDefinitionFieldSetImportExport {
@XmlElement(name = "fieldSetId")
private String fieldSetId;
@XmlElementWrapper(name = "items")
@XmlElement(name = "item")
private List<DescriptionPropertyDefinitionFieldSetItemImportExport> items;
public List<DescriptionPropertyDefinitionFieldSetItemImportExport> getItems() {
return this.items;
}
public void setItems(List<DescriptionPropertyDefinitionFieldSetItemImportExport> items) {
this.items = items;
}
public String getFieldSetId() {
return this.fieldSetId;
}
public void setFieldSetId(String fieldSetId) {
this.fieldSetId = fieldSetId;
}
}

View File

@ -0,0 +1,45 @@
package org.opencdmp.commons.types.description.importexport;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlElementWrapper;
import java.util.List;
@XmlAccessorType(XmlAccessType.FIELD)
public class DescriptionPropertyDefinitionFieldSetItemImportExport {
@XmlElementWrapper(name = "fields")
@XmlElement(name = "field")
private List<DescriptionFieldImportExport> fields;
@XmlElement(name = "comment")
private String comment;
@XmlElement(name = "ordinal")
private int ordinal;
public List<DescriptionFieldImportExport> getFields() {
return this.fields;
}
public void setFields(List<DescriptionFieldImportExport> fields) {
this.fields = fields;
}
public String getComment() {
return this.comment;
}
public void setComment(String comment) {
this.comment = comment;
}
public int getOrdinal() {
return this.ordinal;
}
public void setOrdinal(int ordinal) {
this.ordinal = ordinal;
}
}

View File

@ -0,0 +1,27 @@
package org.opencdmp.commons.types.description.importexport;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlElementWrapper;
import java.util.List;
@XmlAccessorType(XmlAccessType.FIELD)
public class DescriptionPropertyDefinitionImportExport {
@XmlElementWrapper(name = "fieldSets")
@XmlElement(name = "fieldSet")
private List<DescriptionPropertyDefinitionFieldSetImportExport> fieldSets;
public List<DescriptionPropertyDefinitionFieldSetImportExport> getFieldSets() {
return this.fieldSets;
}
public void setFieldSets(List<DescriptionPropertyDefinitionFieldSetImportExport> fieldSets) {
this.fieldSets = fieldSets;
}
}

View File

@ -0,0 +1,62 @@
package org.opencdmp.commons.types.description.importexport;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlElement;
import java.util.UUID;
@XmlAccessorType(XmlAccessType.FIELD)
public class DescriptionReferenceImportExport {
@XmlElement(name = "id")
private UUID id;
@XmlElement(name = "label")
private String label;
@XmlElement(name = "reference")
private String reference;
@XmlElement(name = "fieldId")
private String fieldId;
@XmlElement(name = "type")
private DescriptionReferenceTypeImportExport type;
public UUID getId() {
return this.id;
}
public void setId(UUID id) {
this.id = id;
}
public String getLabel() {
return this.label;
}
public void setLabel(String label) {
this.label = label;
}
public String getReference() {
return this.reference;
}
public void setReference(String reference) {
this.reference = reference;
}
public DescriptionReferenceTypeImportExport getType() {
return this.type;
}
public void setType(DescriptionReferenceTypeImportExport type) {
this.type = type;
}
public String getFieldId() {
return this.fieldId;
}
public void setFieldId(String fieldId) {
this.fieldId = fieldId;
}
}

View File

@ -0,0 +1,43 @@
package org.opencdmp.commons.types.description.importexport;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlElement;
import java.util.UUID;
@XmlAccessorType(XmlAccessType.FIELD)
public class DescriptionReferenceTypeImportExport {
@XmlElement(name = "id")
private UUID id;
@XmlElement(name = "name")
private String name;
@XmlElement(name = "code")
private String code;
public UUID getId() {
return this.id;
}
public void setId(UUID id) {
this.id = id;
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
public String getCode() {
return this.code;
}
public void setCode(String code) {
this.code = code;
}
}

View File

@ -5,7 +5,7 @@ import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlAttribute;
@XmlAccessorType(XmlAccessType.FIELD)
public class ExternalIdentifierImportExport {
public class DescriptionTemplateExternalIdentifierImportExport {
@XmlAttribute(name="identifier")
private String identifier;

View File

@ -8,7 +8,7 @@ import jakarta.xml.bind.annotation.*;
import java.util.List;
@XmlAccessorType(XmlAccessType.FIELD)
public class FieldImportExport {
public class DescriptionTemplateFieldImportExport {
@XmlAttribute(name = "id")
private String id;
@ -28,7 +28,7 @@ public class FieldImportExport {
@XmlElementWrapper(name = "visibilityRules")
@XmlElement(name = "visibilityRule")
private List<RuleImportExport> visibilityRules;
private List<DescriptionTemplateRuleImportExport> visibilityRules;
@XmlElement(name = "fieldType")
private FieldType fieldType;
@ -111,11 +111,11 @@ public class FieldImportExport {
this.schematics = schematics;
}
public List<RuleImportExport> getVisibilityRules() {
public List<DescriptionTemplateRuleImportExport> getVisibilityRules() {
return visibilityRules;
}
public void setVisibilityRules(List<RuleImportExport> visibilityRules) {
public void setVisibilityRules(List<DescriptionTemplateRuleImportExport> visibilityRules) {
this.visibilityRules = visibilityRules;
}

View File

@ -5,7 +5,7 @@ import jakarta.xml.bind.annotation.*;
import java.util.List;
@XmlAccessorType(XmlAccessType.FIELD)
public class FieldSetImportExport {
public class DescriptionTemplateFieldSetImportExport {
@XmlAttribute(name="id")
private String id;
@ -14,7 +14,7 @@ public class FieldSetImportExport {
@XmlElementWrapper(name = "fields")
@XmlElement(name = "field")
private List<FieldImportExport> fields;
private List<DescriptionTemplateFieldImportExport> fields;
@XmlAttribute(name="numbering")
private String numbering;
@XmlAttribute(name="title")
@ -26,7 +26,7 @@ public class FieldSetImportExport {
@XmlAttribute(name="additionalInformation")
private String additionalInformation;
@XmlElement(name="multiplicity")
private MultiplicityImportExport multiplicity;
private DescriptionTemplateMultiplicityImportExport multiplicity;
@XmlAttribute(name="hasMultiplicity")
private boolean hasMultiplicity;
@ -49,11 +49,11 @@ public class FieldSetImportExport {
this.ordinal = ordinal;
}
public List<FieldImportExport> getFields() {
public List<DescriptionTemplateFieldImportExport> getFields() {
return fields;
}
public void setFields(List<FieldImportExport> fields) {
public void setFields(List<DescriptionTemplateFieldImportExport> fields) {
this.fields = fields;
}
@ -72,11 +72,11 @@ public class FieldSetImportExport {
this.hasCommentField = hasCommentField;
}
public MultiplicityImportExport getMultiplicity() {
public DescriptionTemplateMultiplicityImportExport getMultiplicity() {
return multiplicity;
}
public void setMultiplicity(MultiplicityImportExport multiplicity) {
public void setMultiplicity(DescriptionTemplateMultiplicityImportExport multiplicity) {
this.multiplicity = multiplicity;
}

View File

@ -1,23 +1,17 @@
package org.opencdmp.commons.types.descriptiontemplate.importexport;
import org.opencdmp.commons.enums.DescriptionTemplateStatus;
import org.opencdmp.model.persist.DescriptionTemplatePersist;
import org.opencdmp.model.persist.NewVersionDescriptionTemplatePersist;
import org.opencdmp.model.persist.descriptiontemplatedefinition.DefinitionPersist;
import org.opencdmp.model.persist.descriptiontemplatedefinition.PagePersist;
import org.opencdmp.model.persist.descriptiontemplatedefinition.SectionPersist;
import org.opencdmp.service.fielddatahelper.FieldDataHelperServiceProvider;
import jakarta.xml.bind.annotation.*;
import java.util.LinkedList;
import java.util.List;
import java.util.UUID;
@XmlRootElement(name = "root")
@XmlRootElement(name = "descriptionTemplate")
@XmlAccessorType(XmlAccessType.FIELD)
public class DescriptionTemplateImportExport {
@XmlElement(name = "id")
private UUID id;
@XmlAttribute(name = "description")
private String description;
@XmlAttribute(name = "language")
@ -26,20 +20,27 @@ public class DescriptionTemplateImportExport {
private UUID type;
@XmlElementWrapper(name = "pages")
@XmlElement(name = "page")
private List<PageImportExport> pages;
private List<DescriptionTemplatePageImportExport> pages;
public List<PageImportExport> getPages() {
return pages;
public UUID getId() {
return this.id;
}
public void setPages(List<PageImportExport> pages) {
public void setId(UUID id) {
this.id = id;
}
public List<DescriptionTemplatePageImportExport> getPages() {
return this.pages;
}
public void setPages(List<DescriptionTemplatePageImportExport> pages) {
this.pages = pages;
}
public String getDescription() {
return description;
return this.description;
}
public void setDescription(String description) {
@ -48,7 +49,7 @@ public class DescriptionTemplateImportExport {
public String getLanguage() {
return language;
return this.language;
}
public void setLanguage(String language) {
@ -57,7 +58,7 @@ public class DescriptionTemplateImportExport {
public UUID getType() {
return type;
return this.type;
}
public void setType(UUID type) {

View File

@ -6,7 +6,7 @@ import jakarta.xml.bind.annotation.XmlAttribute;
@XmlAccessorType(XmlAccessType.FIELD)
public class MultiplicityImportExport {
public class DescriptionTemplateMultiplicityImportExport {
@XmlAttribute(name="min")
private int min;
@XmlAttribute(name="max")

View File

@ -1,14 +1,11 @@
package org.opencdmp.commons.types.descriptiontemplate.importexport;
import org.opencdmp.model.persist.descriptiontemplatedefinition.PagePersist;
import org.opencdmp.model.persist.descriptiontemplatedefinition.SectionPersist;
import org.opencdmp.service.fielddatahelper.FieldDataHelperServiceProvider;
import jakarta.xml.bind.annotation.*;
import java.util.List;
@XmlAccessorType(XmlAccessType.FIELD)
public class PageImportExport {
public class DescriptionTemplatePageImportExport {
@XmlAttribute(name = "id")
private String id;
@XmlAttribute(name = "ordinal")
@ -18,7 +15,7 @@ public class PageImportExport {
private String title;
@XmlElementWrapper(name = "sections")
@XmlElement(name = "section")
private List<SectionImportExport> sections;
private List<DescriptionTemplateSectionImportExport> sections;
public String getId() {
@ -44,11 +41,11 @@ public class PageImportExport {
this.title = title;
}
public List<SectionImportExport> getSections() {
public List<DescriptionTemplateSectionImportExport> getSections() {
return sections;
}
public void setSections(List<SectionImportExport> sections) {
public void setSections(List<DescriptionTemplateSectionImportExport> sections) {
this.sections = sections;
}

View File

@ -6,7 +6,7 @@ import java.time.Instant;
import java.util.List;
@XmlAccessorType(XmlAccessType.FIELD)
public class RuleImportExport {
public class DescriptionTemplateRuleImportExport {
@XmlAttribute(name="target")
private String target;
@ -20,7 +20,7 @@ public class RuleImportExport {
private Instant dateValue;
@XmlElement(name="externalIdentifier")
private ExternalIdentifierImportExport externalIdentifier;
private DescriptionTemplateExternalIdentifierImportExport externalIdentifier;
public String getTarget() {
return target;
@ -54,11 +54,11 @@ public class RuleImportExport {
this.dateValue = dateValue;
}
public ExternalIdentifierImportExport getExternalIdentifier() {
public DescriptionTemplateExternalIdentifierImportExport getExternalIdentifier() {
return externalIdentifier;
}
public void setExternalIdentifier(ExternalIdentifierImportExport externalIdentifier) {
public void setExternalIdentifier(DescriptionTemplateExternalIdentifierImportExport externalIdentifier) {
this.externalIdentifier = externalIdentifier;
}
}

View File

@ -5,7 +5,7 @@ import jakarta.xml.bind.annotation.*;
import java.util.List;
@XmlAccessorType(XmlAccessType.FIELD)
public class SectionImportExport {
public class DescriptionTemplateSectionImportExport {
@XmlAttribute(name = "id")
private String id;
@XmlAttribute(name = "ordinal")
@ -14,7 +14,7 @@ public class SectionImportExport {
private Boolean defaultVisibility;
@XmlElementWrapper(name = "fieldSets")
@XmlElement(name = "fieldSet")
private List<FieldSetImportExport> fieldSets;
private List<DescriptionTemplateFieldSetImportExport> fieldSets;
@XmlElement(name = "numbering")
private String numbering;
@XmlElement(name = "description")
@ -23,7 +23,7 @@ public class SectionImportExport {
private String title;
@XmlElementWrapper(name = "sections")
@XmlElement(name = "section")
private List<SectionImportExport> sections;
private List<DescriptionTemplateSectionImportExport> sections;
@XmlAttribute(name = "multiplicity")
private Boolean multiplicity;
@ -51,11 +51,11 @@ public class SectionImportExport {
this.defaultVisibility = defaultVisibility;
}
public List<FieldSetImportExport> getFieldSets() {
public List<DescriptionTemplateFieldSetImportExport> getFieldSets() {
return fieldSets;
}
public void setFieldSets(List<FieldSetImportExport> fieldSets) {
public void setFieldSets(List<DescriptionTemplateFieldSetImportExport> fieldSets) {
this.fieldSets = fieldSets;
}
@ -83,11 +83,11 @@ public class SectionImportExport {
this.title = title;
}
public List<SectionImportExport> getSections() {
public List<DescriptionTemplateSectionImportExport> getSections() {
return sections;
}
public void setSections(List<SectionImportExport> sections) {
public void setSections(List<DescriptionTemplateSectionImportExport> sections) {
this.sections = sections;
}

View File

@ -2,6 +2,7 @@ package org.opencdmp.commons.types.dmp.importexport;
import jakarta.xml.bind.annotation.*;
import org.opencdmp.commons.enums.DmpAccessType;
import org.opencdmp.commons.types.description.importexport.DescriptionImportExport;
import org.opencdmp.commons.types.dmpblueprint.importexport.BlueprintImportExport;
import java.time.Instant;
@ -56,6 +57,10 @@ public class DmpImportExport {
@XmlElement(name = "reference")
private List<DmpReferenceImportExport> references;
@XmlElementWrapper(name = "descriptions")
@XmlElement(name = "description")
private List<DescriptionImportExport> descriptions;
public UUID getId() {
return this.id;
}
@ -160,5 +165,13 @@ public class DmpImportExport {
public void setReferences(List<DmpReferenceImportExport> references) {
this.references = references;
}
public List<DescriptionImportExport> getDescriptions() {
return this.descriptions;
}
public void setDescriptions(List<DescriptionImportExport> descriptions) {
this.descriptions = descriptions;
}
}

View File

@ -6,17 +6,17 @@ import java.util.List;
@XmlRootElement(name = "root")
@XmlAccessorType(XmlAccessType.FIELD)
public class DefinitionImportExport {
public class BlueprintDefinitionImportExport {
@XmlElementWrapper(name = "sections")
@XmlElement(name = "section")
private List<SectionImportExport> sections;
private List<BlueprintSectionImportExport> sections;
public List<SectionImportExport> getSections() {
public List<BlueprintSectionImportExport> getSections() {
return sections;
}
public void setSections(List<SectionImportExport> sections) {
public void setSections(List<BlueprintSectionImportExport> sections) {
this.sections = sections;
}
}

View File

@ -7,8 +7,7 @@ import jakarta.xml.bind.annotation.XmlAttribute;
import java.util.UUID;
@XmlAccessorType(XmlAccessType.FIELD)
public class DescriptionTemplateImportExport {
public class BlueprintDescriptionTemplateImportExport {
@XmlAttribute(name = "descriptionTemplateGroupId")
private UUID descriptionTemplateGroupId;
@XmlAttribute(name = "label")
@ -19,7 +18,7 @@ public class DescriptionTemplateImportExport {
private int maxMultiplicity;
public UUID getDescriptionTemplateGroupId() {
return descriptionTemplateGroupId;
return this.descriptionTemplateGroupId;
}
public void setDescriptionTemplateGroupId(UUID descriptionTemplateGroupId) {
@ -27,7 +26,7 @@ public class DescriptionTemplateImportExport {
}
public String getLabel() {
return label;
return this.label;
}
public void setLabel(String label) {
@ -35,7 +34,7 @@ public class DescriptionTemplateImportExport {
}
public int getMinMultiplicity() {
return minMultiplicity;
return this.minMultiplicity;
}
public void setMinMultiplicity(int minMultiplicity) {
@ -43,12 +42,10 @@ public class DescriptionTemplateImportExport {
}
public int getMaxMultiplicity() {
return maxMultiplicity;
return this.maxMultiplicity;
}
public void setMaxMultiplicity(int maxMultiplicity) {
this.maxMultiplicity = maxMultiplicity;
}
}

View File

@ -1,7 +1,6 @@
package org.opencdmp.commons.types.dmpblueprint.importexport;
import org.opencdmp.commons.enums.DmpBlueprintExtraFieldDataType;
import org.opencdmp.commons.enums.DmpBlueprintSystemFieldType;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlAttribute;
@ -9,7 +8,7 @@ import jakarta.xml.bind.annotation.XmlAttribute;
import java.util.UUID;
@XmlAccessorType(XmlAccessType.FIELD)
public class ExtraFieldImportExport {
public class BlueprintExtraFieldImportExport {
@XmlAttribute(name = "id")
private UUID id;

View File

@ -1,12 +1,9 @@
package org.opencdmp.commons.types.dmpblueprint.importexport;
import jakarta.persistence.Column;
import jakarta.persistence.Id;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlRootElement;
import org.opencdmp.data.DmpBlueprintEntity;
import java.util.UUID;
@ -21,7 +18,7 @@ public class BlueprintImportExport {
private String label;
@XmlElement(name = "definition")
private DefinitionImportExport dmpBlueprintDefinition;
private BlueprintDefinitionImportExport dmpBlueprintDefinition;
public UUID getId() {
return this.id;
@ -39,11 +36,11 @@ public class BlueprintImportExport {
this.label = label;
}
public DefinitionImportExport getDmpBlueprintDefinition() {
public BlueprintDefinitionImportExport getDmpBlueprintDefinition() {
return this.dmpBlueprintDefinition;
}
public void setDmpBlueprintDefinition(DefinitionImportExport dmpBlueprintDefinition) {
public void setDmpBlueprintDefinition(BlueprintDefinitionImportExport dmpBlueprintDefinition) {
this.dmpBlueprintDefinition = dmpBlueprintDefinition;
}
}

View File

@ -7,7 +7,7 @@ import jakarta.xml.bind.annotation.XmlAttribute;
import java.util.UUID;
@XmlAccessorType(XmlAccessType.FIELD)
public class ReferenceTypeFieldImportExport {
public class BlueprintReferenceTypeFieldImportExport {
@XmlAttribute(name = "id")
private UUID id;

View File

@ -6,7 +6,7 @@ import java.util.List;
import java.util.UUID;
@XmlAccessorType(XmlAccessType.FIELD)
public class SectionImportExport {
public class BlueprintSectionImportExport {
@XmlAttribute(name = "id")
private UUID id;
@ -18,18 +18,18 @@ public class SectionImportExport {
private int ordinal;
@XmlElementWrapper(name = "systemFields")
@XmlElement(name = "systemField")
private List<SystemFieldImportExport> systemFields;
private List<BlueprintSystemFieldImportExport> systemFields;
@XmlElementWrapper(name = "extraFields")
@XmlElement(name = "extraField")
private List<ExtraFieldImportExport> extraFields;
private List<BlueprintExtraFieldImportExport> extraFields;
@XmlElementWrapper(name = "referenceFields")
@XmlElement(name = "referenceField")
private List<ReferenceTypeFieldImportExport> referenceFields;
private List<BlueprintReferenceTypeFieldImportExport> referenceFields;
@XmlAttribute(name = "hasTemplates")
private boolean hasTemplates;
@XmlElementWrapper(name = "descriptionTemplates")
@XmlElement(name = "descriptionTemplate")
private List<DescriptionTemplateImportExport> descriptionTemplates;
private List<BlueprintDescriptionTemplateImportExport> descriptionTemplates;
public UUID getId() {
return id;
@ -63,27 +63,27 @@ public class SectionImportExport {
this.ordinal = ordinal;
}
public List<SystemFieldImportExport> getSystemFields() {
public List<BlueprintSystemFieldImportExport> getSystemFields() {
return systemFields;
}
public void setSystemFields(List<SystemFieldImportExport> systemFields) {
public void setSystemFields(List<BlueprintSystemFieldImportExport> systemFields) {
this.systemFields = systemFields;
}
public List<ExtraFieldImportExport> getExtraFields() {
public List<BlueprintExtraFieldImportExport> getExtraFields() {
return extraFields;
}
public void setExtraFields(List<ExtraFieldImportExport> extraFields) {
public void setExtraFields(List<BlueprintExtraFieldImportExport> extraFields) {
this.extraFields = extraFields;
}
public List<ReferenceTypeFieldImportExport> getReferenceFields() {
public List<BlueprintReferenceTypeFieldImportExport> getReferenceFields() {
return referenceFields;
}
public void setReferenceFields(List<ReferenceTypeFieldImportExport> referenceFields) {
public void setReferenceFields(List<BlueprintReferenceTypeFieldImportExport> referenceFields) {
this.referenceFields = referenceFields;
}
@ -95,11 +95,11 @@ public class SectionImportExport {
this.hasTemplates = hasTemplates;
}
public List<DescriptionTemplateImportExport> getDescriptionTemplates() {
public List<BlueprintDescriptionTemplateImportExport> getDescriptionTemplates() {
return descriptionTemplates;
}
public void setDescriptionTemplates(List<DescriptionTemplateImportExport> descriptionTemplates) {
public void setDescriptionTemplates(List<BlueprintDescriptionTemplateImportExport> descriptionTemplates) {
this.descriptionTemplates = descriptionTemplates;
}

View File

@ -8,7 +8,7 @@ import jakarta.xml.bind.annotation.XmlAttribute;
import java.util.UUID;
@XmlAccessorType(XmlAccessType.FIELD)
public class SystemFieldImportExport {
public class BlueprintSystemFieldImportExport {
@XmlAttribute(name = "id")
private UUID id;

View File

@ -1,5 +1,6 @@
package org.opencdmp.service.description;
import org.opencdmp.commons.types.description.importexport.DescriptionImportExport;
import org.opencdmp.data.StorageFileEntity;
import org.opencdmp.model.Description;
import org.opencdmp.model.DescriptionValidationResult;
@ -14,11 +15,13 @@ import jakarta.xml.bind.JAXBException;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.multipart.MultipartFile;
import org.xml.sax.SAXException;
import javax.crypto.BadPaddingException;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;
import javax.management.InvalidApplicationException;
import javax.xml.parsers.ParserConfigurationException;
import java.io.IOException;
import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
@ -45,4 +48,8 @@ public interface DescriptionService {
StorageFile uploadFieldFile(DescriptionFieldFilePersist model, MultipartFile file, FieldSet fields) throws IOException;
StorageFileEntity getFieldFile(UUID descriptionId, UUID storageFileId);
void updateDescriptionTemplate(UpdateDescriptionTemplatePersist model) throws InvalidApplicationException, IOException, JAXBException;
DescriptionImportExport exportXmlEntity(UUID id, boolean ignoreAuthorize) throws MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, IOException, InstantiationException, IllegalAccessException, SAXException, InvalidApplicationException;
ResponseEntity<byte[]> exportXml(UUID id) throws MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, IOException, InstantiationException, IllegalAccessException, SAXException, InvalidApplicationException;
}

View File

@ -10,10 +10,14 @@ import org.opencdmp.commons.enums.*;
import org.opencdmp.commons.scope.tenant.TenantScope;
import org.opencdmp.commons.scope.user.UserScope;
import org.opencdmp.commons.types.description.*;
import org.opencdmp.commons.types.description.importexport.*;
import org.opencdmp.commons.types.descriptionreference.DescriptionReferenceDataEntity;
import org.opencdmp.commons.types.descriptiontemplate.FieldSetEntity;
import org.opencdmp.commons.types.descriptiontemplate.fielddata.ReferenceTypeDataEntity;
import org.opencdmp.commons.types.descriptiontemplate.fielddata.UploadDataEntity;
import org.opencdmp.commons.types.dmp.DmpBlueprintValueEntity;
import org.opencdmp.commons.types.dmp.DmpContactEntity;
import org.opencdmp.commons.types.dmp.importexport.*;
import org.opencdmp.commons.types.notification.*;
import org.opencdmp.commons.types.reference.DefinitionEntity;
import org.opencdmp.commons.notification.NotificationProperties;
@ -37,7 +41,9 @@ import org.opencdmp.model.persist.descriptionproperties.*;
import org.opencdmp.model.persist.descriptionreference.DescriptionReferenceDataPersist;
import org.opencdmp.model.persist.referencedefinition.DefinitionPersist;
import org.opencdmp.query.*;
import org.opencdmp.service.descriptiontemplate.DescriptionTemplateService;
import org.opencdmp.service.elastic.ElasticService;
import org.opencdmp.service.responseutils.ResponseUtilsService;
import org.opencdmp.service.storage.StorageFileProperties;
import org.opencdmp.service.storage.StorageFileService;
import org.opencdmp.service.filetransformer.FileTransformerService;
@ -66,11 +72,13 @@ import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.util.unit.DataSize;
import org.springframework.web.multipart.MultipartFile;
import org.xml.sax.SAXException;
import javax.crypto.BadPaddingException;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;
import javax.management.InvalidApplicationException;
import javax.xml.parsers.ParserConfigurationException;
import java.io.IOException;
import java.net.URLConnection;
import java.security.InvalidAlgorithmParameterException;
@ -108,6 +116,8 @@ public class DescriptionServiceImpl implements DescriptionService {
private final AnnotationEntityTouchedIntegrationEventHandler annotationEntityTouchedIntegrationEventHandler;
private final AnnotationEntityRemovalIntegrationEventHandler annotationEntityRemovalIntegrationEventHandler;
private final TenantScope tenantScope;
private final ResponseUtilsService responseUtilsService;
private final DescriptionTemplateService descriptionTemplateService;
@Autowired
public DescriptionServiceImpl(
@ -122,7 +132,7 @@ public class DescriptionServiceImpl implements DescriptionService {
QueryFactory queryFactory,
JsonHandlingService jsonHandlingService,
UserScope userScope,
XmlHandlingService xmlHandlingService, NotifyIntegrationEventHandler eventHandler, NotificationProperties notificationProperties, FileTransformerService fileTransformerService, ElasticService elasticService, ValidatorFactory validatorFactory, StorageFileProperties storageFileConfig, StorageFileService storageFileService, AuthorizationContentResolver authorizationContentResolver, AnnotationEntityTouchedIntegrationEventHandler annotationEntityTouchedIntegrationEventHandler, AnnotationEntityRemovalIntegrationEventHandler annotationEntityRemovalIntegrationEventHandler, TenantScope tenantScope) {
XmlHandlingService xmlHandlingService, NotifyIntegrationEventHandler eventHandler, NotificationProperties notificationProperties, FileTransformerService fileTransformerService, ElasticService elasticService, ValidatorFactory validatorFactory, StorageFileProperties storageFileConfig, StorageFileService storageFileService, AuthorizationContentResolver authorizationContentResolver, AnnotationEntityTouchedIntegrationEventHandler annotationEntityTouchedIntegrationEventHandler, AnnotationEntityRemovalIntegrationEventHandler annotationEntityRemovalIntegrationEventHandler, TenantScope tenantScope, ResponseUtilsService responseUtilsService, DescriptionTemplateService descriptionTemplateService) {
this.entityManager = entityManager;
this.authorizationService = authorizationService;
this.deleterFactory = deleterFactory;
@ -146,6 +156,8 @@ public class DescriptionServiceImpl implements DescriptionService {
this.annotationEntityTouchedIntegrationEventHandler = annotationEntityTouchedIntegrationEventHandler;
this.annotationEntityRemovalIntegrationEventHandler = annotationEntityRemovalIntegrationEventHandler;
this.tenantScope = tenantScope;
this.responseUtilsService = responseUtilsService;
this.descriptionTemplateService = descriptionTemplateService;
}
@Override
@ -175,7 +187,7 @@ public class DescriptionServiceImpl implements DescriptionService {
Boolean isUpdate = this.conventionService.isValidGuid(model.getId());
DmpDescriptionTemplateEntity dmpDescriptionTemplate = this.entityManager.find(DmpDescriptionTemplateEntity.class, model.getDmpDescriptionTemplateId());
if (dmpDescriptionTemplate == null) throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{model.getDmpDescriptionTemplateId(), DmpDescriptionTemplate.class.getSimpleName()}, LocaleContextHolder.getLocale()));
if (dmpDescriptionTemplate == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{model.getDmpDescriptionTemplateId(), DmpDescriptionTemplate.class.getSimpleName()}, LocaleContextHolder.getLocale()));
if (isUpdate) this.authorizationService.authorizeAtLeastOneForce(List.of(this.authorizationContentResolver.descriptionAffiliation(model.getId())), Permission.EditDescription);
else this.authorizationService.authorizeAtLeastOneForce(List.of(this.authorizationContentResolver.descriptionsAffiliationBySection(model.getDmpId(), dmpDescriptionTemplate.getSectionId())), Permission.EditDescription);
@ -183,7 +195,7 @@ public class DescriptionServiceImpl implements DescriptionService {
DescriptionEntity data;
if (isUpdate) {
data = this.entityManager.find(DescriptionEntity.class, model.getId());
if (data == null) throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{model.getId(), Description.class.getSimpleName()}, LocaleContextHolder.getLocale()));
if (data == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{model.getId(), Description.class.getSimpleName()}, LocaleContextHolder.getLocale()));
if (!this.conventionService.hashValue(data.getUpdatedAt()).equals(model.getHash())) throw new MyValidationException(this.errors.getHashConflict().getCode(), this.errors.getHashConflict().getMessage());
if (data.getStatus().equals(DescriptionStatus.Finalized)) throw new MyValidationException(this.errors.getDescriptionIsFinalized().getCode(), this.errors.getDescriptionIsFinalized().getMessage());
if (!data.getDmpId().equals(model.getDmpId())) throw new MyValidationException(this.errors.getDmpCanNotChange().getCode(), this.errors.getDmpCanNotChange().getMessage());
@ -199,12 +211,12 @@ public class DescriptionServiceImpl implements DescriptionService {
}
DescriptionTemplateEntity descriptionTemplateEntity = this.entityManager.find(DescriptionTemplateEntity.class, model.getDescriptionTemplateId());
if (descriptionTemplateEntity == null) throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{model.getDescriptionTemplateId(), DescriptionTemplate.class.getSimpleName()}, LocaleContextHolder.getLocale()));
if (descriptionTemplateEntity == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{model.getDescriptionTemplateId(), DescriptionTemplate.class.getSimpleName()}, LocaleContextHolder.getLocale()));
if (!dmpDescriptionTemplate.getDescriptionTemplateGroupId().equals(descriptionTemplateEntity.getGroupId())) throw new MyValidationException(this.errors.getInvalidDescriptionTemplate().getCode(), this.errors.getInvalidDescriptionTemplate().getMessage());
DmpEntity dmp = this.entityManager.find(DmpEntity.class, data.getDmpId());
if (dmp == null) throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{data.getDmpId(), Dmp.class.getSimpleName()}, LocaleContextHolder.getLocale()));
if (dmp == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{data.getDmpId(), Dmp.class.getSimpleName()}, LocaleContextHolder.getLocale()));
if (dmp.getStatus().equals(DmpStatus.Finalized) && isUpdate) throw new MyValidationException(this.errors.getDmpIsFinalized().getCode(), this.errors.getDmpIsFinalized().getMessage());
@ -251,14 +263,14 @@ public class DescriptionServiceImpl implements DescriptionService {
this.authorizationService.authorizeAtLeastOneForce(List.of(this.authorizationContentResolver.descriptionAffiliation(model.getId())), Permission.EditDescription);
DescriptionEntity data = this.entityManager.find(DescriptionEntity.class, model.getId());
if (data == null) throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{model.getId(), Description.class.getSimpleName()}, LocaleContextHolder.getLocale()));
if (data == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{model.getId(), Description.class.getSimpleName()}, LocaleContextHolder.getLocale()));
if (!this.conventionService.hashValue(data.getUpdatedAt()).equals(model.getHash())) throw new MyValidationException(this.errors.getHashConflict().getCode(), this.errors.getHashConflict().getMessage());
DescriptionTemplateEntity oldDescriptionTemplateEntity = this.entityManager.find(DescriptionTemplateEntity.class, data.getDescriptionTemplateId());
if (oldDescriptionTemplateEntity == null) throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{data.getDescriptionTemplateId(), DescriptionTemplate.class.getSimpleName()}, LocaleContextHolder.getLocale()));
if (oldDescriptionTemplateEntity == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{data.getDescriptionTemplateId(), DescriptionTemplate.class.getSimpleName()}, LocaleContextHolder.getLocale()));
DmpDescriptionTemplateEntity dmpDescriptionTemplateEntity = this.entityManager.find(DmpDescriptionTemplateEntity.class, data.getDmpDescriptionTemplateId());
if (dmpDescriptionTemplateEntity == null) throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{data.getDmpDescriptionTemplateId(), DmpDescriptionTemplate.class.getSimpleName()}, LocaleContextHolder.getLocale()));
if (dmpDescriptionTemplateEntity == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{data.getDmpDescriptionTemplateId(), DmpDescriptionTemplate.class.getSimpleName()}, LocaleContextHolder.getLocale()));
List<DescriptionTemplateEntity> latestVersionDescriptionTemplates = this.queryFactory.query(DescriptionTemplateQuery.class)
@ -367,9 +379,9 @@ public class DescriptionServiceImpl implements DescriptionService {
List<ContactPair> contactPairs = new ArrayList<>();
contactPairs.add(new ContactPair(ContactInfoType.Email, query.first().getValue()));
NotificationContactData contactData = new NotificationContactData(contactPairs, null, null);
event.setContactHint(jsonHandlingService.toJsonSafe(contactData));
event.setContactHint(this.jsonHandlingService.toJsonSafe(contactData));
event = this.applyNotificationType(description.getStatus(), event);
this.applyNotificationType(description.getStatus(), event);
NotificationFieldData data = new NotificationFieldData();
List<FieldInfo> fieldInfoList = new ArrayList<>();
fieldInfoList.add(new FieldInfo("{recipient}", DataType.String, user.getName()));
@ -377,18 +389,18 @@ public class DescriptionServiceImpl implements DescriptionService {
fieldInfoList.add(new FieldInfo("{name}", DataType.String, description.getLabel()));
fieldInfoList.add(new FieldInfo("{id}", DataType.String, description.getId().toString()));
data.setFields(fieldInfoList);
event.setData(jsonHandlingService.toJsonSafe(data));
event.setData(this.jsonHandlingService.toJsonSafe(data));
eventHandler.handle(event);
this.eventHandler.handle(event);
}
private NotifyIntegrationEvent applyNotificationType(DescriptionStatus status, NotifyIntegrationEvent event) {
switch (status) {
case Draft:
event.setNotificationType(notificationProperties.getDescriptionModifiedType());
event.setNotificationType(this.notificationProperties.getDescriptionModifiedType());
break;
case Finalized:
event.setNotificationType(notificationProperties.getDescriptionFinalisedType());
event.setNotificationType(this.notificationProperties.getDescriptionFinalisedType());
break;
default:
throw new MyApplicationException("Unsupported Description Status.");
@ -403,13 +415,13 @@ public class DescriptionServiceImpl implements DescriptionService {
this.authorizationService.authorizeAtLeastOneForce(List.of(this.authorizationContentResolver.descriptionAffiliation(model.getId())), Permission.EditDescription);
DescriptionEntity data = this.entityManager.find(DescriptionEntity.class, model.getId());
if (data == null) throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{model.getId(), Description.class.getSimpleName()}, LocaleContextHolder.getLocale()));
if (data == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{model.getId(), Description.class.getSimpleName()}, LocaleContextHolder.getLocale()));
if (!this.conventionService.hashValue(data.getUpdatedAt()).equals(model.getHash())) throw new MyValidationException(this.errors.getHashConflict().getCode(), this.errors.getHashConflict().getMessage());
if (!data.getStatus().equals(model.getStatus())){
if (data.getStatus().equals(DescriptionStatus.Finalized)){
this.authorizationService.authorizeAtLeastOneForce(List.of(this.authorizationContentResolver.descriptionAffiliation(model.getId())), Permission.FinalizeDescription);
DmpEntity dmpEntity = this.entityManager.find(DmpEntity.class, data.getDmpId());
if (dmpEntity == null) throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{data.getDmpId(), DmpEntity.class.getSimpleName()}, LocaleContextHolder.getLocale()));
if (dmpEntity == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{data.getDmpId(), DmpEntity.class.getSimpleName()}, LocaleContextHolder.getLocale()));
if(!dmpEntity.getStatus().equals(DmpStatus.Draft)) throw new MyValidationException(this.errors.getDmpIsFinalized().getCode(), this.errors.getDmpIsFinalized().getMessage());
}
@ -442,8 +454,8 @@ public class DescriptionServiceImpl implements DescriptionService {
DescriptionPersist.DescriptionPersistValidator validator = this.validatorFactory.validator(DescriptionPersist.DescriptionPersistValidator.class);
validator.validate(this.buildDescriptionPersist(description));
if (validator.result().isValid()) descriptionValidationResult.setResult(DescriptionValidationOutput.Valid);;
descriptionValidationResults.add(descriptionValidationResult);
if (validator.result().isValid()) descriptionValidationResult.setResult(DescriptionValidationOutput.Valid);
descriptionValidationResults.add(descriptionValidationResult);
}
return descriptionValidationResults;
@ -523,10 +535,10 @@ public class DescriptionServiceImpl implements DescriptionService {
if (!this.conventionService.isListNullOrEmpty(persist.getTextListValue())) persist.getTextListValue().stream().map(UUID::fromString).toList();
else if (!this.conventionService.isNullOrEmpty(persist.getTextValue())) ids.add(UUID.fromString(persist.getTextValue()));
if (ids.size() > 0){
if (!ids.isEmpty()){
Set<UUID> existingIds = this.queryFactory.query(DmpQuery.class).ids(ids).collectAs(new BaseFieldSet().ensure(Dmp._id)).stream().map(DmpEntity::getId).collect(Collectors.toSet());
for (UUID id : ids){
if (!existingIds.contains(id)) throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{id, Dmp.class.getSimpleName()}, LocaleContextHolder.getLocale()));
if (!existingIds.contains(id)) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, Dmp.class.getSimpleName()}, LocaleContextHolder.getLocale()));
}
}
@ -534,10 +546,10 @@ public class DescriptionServiceImpl implements DescriptionService {
if ( !this.conventionService.isListNullOrEmpty(persist.getTextListValue())) ids = persist.getTextListValue().stream().map(UUID::fromString).toList();
else if (!this.conventionService.isNullOrEmpty(persist.getTextValue())) ids.add(UUID.fromString(persist.getTextValue()));
if (ids.size() > 0) {
if (!ids.isEmpty()) {
Set<UUID> existingIds = this.queryFactory.query(DescriptionQuery.class).ids(ids).collectAs(new BaseFieldSet().ensure(Description._id)).stream().map(DescriptionEntity::getId).collect(Collectors.toSet());
for (UUID id : ids){
if (!existingIds.contains(id)) throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{id, Description.class.getSimpleName()}, LocaleContextHolder.getLocale()));
if (!existingIds.contains(id)) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, Description.class.getSimpleName()}, LocaleContextHolder.getLocale()));
}
}
}
@ -581,7 +593,7 @@ public class DescriptionServiceImpl implements DescriptionService {
if (definitionFieldSetItemPersist.getFields() != null && !definitionFieldSetItemPersist.getFields().isEmpty()) {
for (String key : definitionFieldSetItemPersist.getFields().keySet()) {
FieldPersist fieldPersist = definitionFieldSetItemPersist.getFields().get(key);
BuildDescriptionReferencePersist(key, fieldPersist, descriptionReferencePersists);
this.BuildDescriptionReferencePersist(key, fieldPersist, descriptionReferencePersists);
}
}
}
@ -634,10 +646,10 @@ public class DescriptionServiceImpl implements DescriptionService {
ReferenceEntity referenceEntity = null;
if (this.conventionService.isValidGuid(referencePersist.getId())){
referenceEntity = this.entityManager.find(ReferenceEntity.class, referencePersist.getId());
if (referenceEntity == null) throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{referencePersist.getId(), Reference.class.getSimpleName()}, LocaleContextHolder.getLocale()));
if (referenceEntity == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{referencePersist.getId(), Reference.class.getSimpleName()}, LocaleContextHolder.getLocale()));
} else {
ReferenceTypeDataEntity fieldEntity = definition.getFieldById(model.getData().getFieldId()).stream().filter(x-> x.getData() != null && x.getData().getFieldType().equals(FieldType.REFERENCE_TYPES)).map(x-> (ReferenceTypeDataEntity)x.getData()).findFirst().orElse(null);
if (fieldEntity == null) throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{model.getData().getFieldId(), ReferenceTypeDataEntity.class.getSimpleName()}, LocaleContextHolder.getLocale()));
if (fieldEntity == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{model.getData().getFieldId(), ReferenceTypeDataEntity.class.getSimpleName()}, LocaleContextHolder.getLocale()));
referenceEntity = this.queryFactory.query(ReferenceQuery.class).sourceTypes(referencePersist.getSourceType()).typeIds(fieldEntity.getReferenceTypeId()).sources(referencePersist.getSource()).isActive(IsActive.Active).references(referencePersist.getReference()).first();
if (referenceEntity == null){
@ -656,14 +668,14 @@ public class DescriptionServiceImpl implements DescriptionService {
referenceEntity.setSourceType(referencePersist.getSourceType());
try {
ReferenceTypeEntity referenceType = this.queryFactory.query(ReferenceTypeQuery.class).ids(fieldEntity.getReferenceTypeId()).firstAs(new BaseFieldSet().ensure(ReferenceType._id).ensure(ReferenceTypeEntity._tenantId));
if (referenceType == null) throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{fieldEntity.getReferenceTypeId(), ReferenceType.class.getSimpleName()}, LocaleContextHolder.getLocale()));
if (referenceType == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{fieldEntity.getReferenceTypeId(), ReferenceType.class.getSimpleName()}, LocaleContextHolder.getLocale()));
if (referenceEntity.getSourceType().equals(ReferenceSourceType.External) && !this.tenantScope.isDefaultTenant() && referenceType.getTenantId() == null){
this.tenantScope.setTempTenant(this.entityManager.getEntityManager(), null, this.tenantScope.getDefaultTenantCode());
}
this.entityManager.persist(referenceEntity);
} finally {
tenantScope.removeTempTenant(this.entityManager.getEntityManager());
this.tenantScope.removeTempTenant(this.entityManager.getEntityManager());
}
}
}
@ -816,7 +828,7 @@ public class DescriptionServiceImpl implements DescriptionService {
newDescription.setDmpId(dmpId);
newDescription.setDmpDescriptionTemplateId(existing.getDmpDescriptionTemplateId());
newDescription.setDescriptionTemplateId(existing.getDescriptionTemplateId());
newDescription.setCreatedById(userScope.getUserId());
newDescription.setCreatedById(this.userScope.getUserId());
newDescription.setCreatedAt(Instant.now());
newDescription.setUpdatedAt(Instant.now());
newDescription.setIsActive(IsActive.Active);
@ -889,13 +901,13 @@ public class DescriptionServiceImpl implements DescriptionService {
this.authorizationService.authorizeForce(Permission.EditDescription);//TODO: Missing Description or dmp for authz
DescriptionTemplateEntity descriptionTemplate = this.queryFactory.query(DescriptionTemplateQuery.class).ids(model.getDescriptionTemplateId()).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).first();
if (descriptionTemplate == null) throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{model.getDescriptionTemplateId(), DescriptionTemplate.class.getSimpleName()}, LocaleContextHolder.getLocale()));
if (descriptionTemplate == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{model.getDescriptionTemplateId(), DescriptionTemplate.class.getSimpleName()}, LocaleContextHolder.getLocale()));
org.opencdmp.commons.types.descriptiontemplate.DefinitionEntity definition = this.xmlHandlingService.fromXmlSafe(org.opencdmp.commons.types.descriptiontemplate.DefinitionEntity.class, descriptionTemplate.getDefinition());
if (definition == null) throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{model.getDescriptionTemplateId(), org.opencdmp.commons.types.descriptiontemplate.DefinitionEntity.class.getSimpleName()}, LocaleContextHolder.getLocale()));
if (definition == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{model.getDescriptionTemplateId(), org.opencdmp.commons.types.descriptiontemplate.DefinitionEntity.class.getSimpleName()}, LocaleContextHolder.getLocale()));
org.opencdmp.commons.types.descriptiontemplate.FieldEntity fieldEntity = definition.getFieldById(model.getFieldId()).stream().filter(x -> x != null && x.getData() != null && x.getData().getFieldType().equals(FieldType.UPLOAD)).findFirst().orElse(null);
if (fieldEntity == null) throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{model.getFieldId(), org.opencdmp.commons.types.descriptiontemplate.FieldEntity.class.getSimpleName()}, LocaleContextHolder.getLocale()));
if (fieldEntity == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{model.getFieldId(), org.opencdmp.commons.types.descriptiontemplate.FieldEntity.class.getSimpleName()}, LocaleContextHolder.getLocale()));
UploadDataEntity uploadDataEntity = (UploadDataEntity)fieldEntity.getData();
if (DataSize.ofBytes(file.getSize()).equals(DataSize.ofMegabytes(uploadDataEntity.getMaxFileSizeInMB()))) {
@ -929,13 +941,13 @@ public class DescriptionServiceImpl implements DescriptionService {
this.authorizationService.authorizeAtLeastOneForce(List.of(this.authorizationContentResolver.descriptionAffiliation(descriptionId)), Permission.BrowseDescription);
DescriptionEntity descriptionEntity = this.queryFactory.query(DescriptionQuery.class).isActive(IsActive.Active).ids(descriptionId).first();
if (descriptionEntity == null) throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{descriptionId, Description.class.getSimpleName()}, LocaleContextHolder.getLocale()));
if (descriptionEntity == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{descriptionId, Description.class.getSimpleName()}, LocaleContextHolder.getLocale()));
DmpDescriptionTemplateEntity dmpDescriptionTemplateEntity = this.queryFactory.query(DmpDescriptionTemplateQuery.class).ids(descriptionEntity.getDmpDescriptionTemplateId()).isActive(IsActive.Active).first();
if (dmpDescriptionTemplateEntity == null) throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{descriptionEntity.getDmpDescriptionTemplateId(), DmpDescriptionTemplate.class.getSimpleName()}, LocaleContextHolder.getLocale()));
if (dmpDescriptionTemplateEntity == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{descriptionEntity.getDmpDescriptionTemplateId(), DmpDescriptionTemplate.class.getSimpleName()}, LocaleContextHolder.getLocale()));
DmpEntity dmpEntity = this.queryFactory.query(DmpQuery.class).ids(dmpDescriptionTemplateEntity.getDmpId()).isActive(IsActive.Active).first();
if (dmpEntity == null) throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{dmpDescriptionTemplateEntity.getDmpId(), Dmp.class.getSimpleName()}, LocaleContextHolder.getLocale()));
if (dmpEntity == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{dmpDescriptionTemplateEntity.getDmpId(), Dmp.class.getSimpleName()}, LocaleContextHolder.getLocale()));
if (!dmpEntity.getAccessType().equals(DmpAccessType.Public))
{
@ -944,7 +956,7 @@ public class DescriptionServiceImpl implements DescriptionService {
}
StorageFileEntity storageFile = this.queryFactory.query(StorageFileQuery.class).ids(storageFileId).first();
if (storageFile == null) throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{storageFileId, StorageFile.class.getSimpleName()}, LocaleContextHolder.getLocale()));
if (storageFile == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{storageFileId, StorageFile.class.getSimpleName()}, LocaleContextHolder.getLocale()));
return storageFile;
}
@ -957,7 +969,7 @@ public class DescriptionServiceImpl implements DescriptionService {
if (data == null) return persist;
DescriptionTemplateEntity descriptionTemplateEntity = this.entityManager.find(DescriptionTemplateEntity.class, data.getDescriptionTemplateId());
if (descriptionTemplateEntity == null) throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{data.getDescriptionTemplateId(), DescriptionTemplate.class.getSimpleName()}, LocaleContextHolder.getLocale()));
if (descriptionTemplateEntity == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{data.getDescriptionTemplateId(), DescriptionTemplate.class.getSimpleName()}, LocaleContextHolder.getLocale()));
persist.setLabel(data.getLabel());
persist.setStatus(DescriptionStatus.Finalized);
@ -997,13 +1009,15 @@ public class DescriptionServiceImpl implements DescriptionService {
if (data.getFieldSets() != null && !data.getFieldSets().isEmpty()){
for (PropertyDefinitionFieldSetEntity fieldSet: data.getFieldSets().values()) {
if (!this.conventionService.isListNullOrEmpty(fieldSet.getItems()));
for (PropertyDefinitionFieldSetItemEntity item: fieldSet.getItems()) {
if (item.getFields() != null && !item.getFields().isEmpty());
for (String key: item.getFields().keySet()) {
if (definition.getFieldById(key).getFirst() != null && FieldType.isReferenceType(definition.getFieldById(key).getFirst().getData().getFieldType())){
if (!this.conventionService.isListNullOrEmpty(item.getFields().get(key).getTextListValue())){
referenceIds.addAll(item.getFields().get(key).getTextListValue());
if (!this.conventionService.isListNullOrEmpty(fieldSet.getItems())){
for (PropertyDefinitionFieldSetItemEntity item: fieldSet.getItems()) {
if (item.getFields() != null && !item.getFields().isEmpty()) {
for (String key : item.getFields().keySet()) {
if (definition.getFieldById(key).getFirst() != null && FieldType.isReferenceType(definition.getFieldById(key).getFirst().getData().getFieldType())) {
if (!this.conventionService.isListNullOrEmpty(item.getFields().get(key).getTextListValue())) {
referenceIds.addAll(item.getFields().get(key).getTextListValue());
}
}
}
}
}
@ -1013,7 +1027,7 @@ public class DescriptionServiceImpl implements DescriptionService {
if (!this.conventionService.isListNullOrEmpty(referenceIds)) {
referenceIds = referenceIds.stream().distinct().collect(Collectors.toList());
return referenceIds.stream().filter(x -> this.conventionService.isValidGuid(UUID.fromString(x))).collect(Collectors.toList()).stream().map(x -> UUID.fromString(x)).collect(Collectors.toList());
return referenceIds.stream().filter(x -> this.conventionService.isValidGuid(UUID.fromString(x))).toList().stream().map(UUID::fromString).collect(Collectors.toList());
}
@ -1059,7 +1073,7 @@ public class DescriptionServiceImpl implements DescriptionService {
else if (FieldType.isExternalIdentifierType(fieldType) && data.getExternalIdentifier() != null) persist.setExternalIdentifier(this.buildExternalIdentifierPersist(data.getExternalIdentifier()));
else if (FieldType.isReferenceType(fieldType) && fieldEntity != null ) {
if (!this.conventionService.isListNullOrEmpty(data.getTextListValue()) && !this.conventionService.isListNullOrEmpty(references)){
List<UUID> referenceIdsInField = data.getTextListValue().stream().filter(x -> this.conventionService.isValidGuid(UUID.fromString(x))).collect(Collectors.toList()).stream().map(x -> UUID.fromString(x)).collect(Collectors.toList());
List<UUID> referenceIdsInField = data.getTextListValue().stream().filter(x -> this.conventionService.isValidGuid(UUID.fromString(x))).toList().stream().map(UUID::fromString).collect(Collectors.toList());
if (!this.conventionService.isListNullOrEmpty(referenceIdsInField)){
List<ReferenceEntity> referencesInField = references.stream().filter(x -> referenceIdsInField.contains(x.getId())).collect(Collectors.toList());
if (!this.conventionService.isListNullOrEmpty(referencesInField)){
@ -1101,4 +1115,165 @@ public class DescriptionServiceImpl implements DescriptionService {
return referencesPersist;
}
//region Export
@Override
public DescriptionImportExport exportXmlEntity(UUID id, boolean ignoreAuthorize) throws MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, IOException, InstantiationException, IllegalAccessException, SAXException, InvalidApplicationException {
logger.debug(new MapLogEntry("export xml").And("id", id));
if (!ignoreAuthorize) this.authorizationService.authorizeForce(Permission.ExportDescription);
DescriptionEntity data = this.queryFactory.query(DescriptionQuery.class).ids(id).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).isActive(IsActive.Active).first();
if (data == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, Description.class.getSimpleName()}, LocaleContextHolder.getLocale()));
PropertyDefinitionEntity definition = this.jsonHandlingService.fromJson(PropertyDefinitionEntity.class, data.getProperties());
return this.toExport(data, definition);
}
@Override
public ResponseEntity<byte[]> exportXml(UUID id) throws MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, IOException, InstantiationException, IllegalAccessException, SAXException, InvalidApplicationException {
logger.debug(new MapLogEntry("export xml").And("id", id));
this.authorizationService.authorizeForce(Permission.ExportDescription);
DescriptionEntity data = this.queryFactory.query(DescriptionQuery.class).ids(id).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).isActive(IsActive.Active).first();
if (data == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, Description.class.getSimpleName()}, LocaleContextHolder.getLocale()));
String xml = this.xmlHandlingService.toXml(this.exportXmlEntity(data.getId(), false));
return this.responseUtilsService.buildResponseFileFromText(xml, data.getLabel() + ".xml");
}
private DescriptionImportExport toExport(DescriptionEntity data, PropertyDefinitionEntity propertiesEntity) throws InvalidApplicationException, JAXBException, ParserConfigurationException, IOException, InstantiationException, IllegalAccessException, SAXException {
DescriptionImportExport xml = new DescriptionImportExport();
xml.setId(data.getId());
xml.setDescription(data.getDescription());
xml.setLabel(data.getLabel());
xml.setFinalizedAt(data.getFinalizedAt());
DescriptionTemplateEntity blueprintEntity = this.queryFactory.query(DescriptionTemplateQuery.class).ids(data.getDescriptionTemplateId()).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).isActive(IsActive.Active).first();
if (blueprintEntity != null) {
xml.setDescriptionTemplate(this.descriptionTemplateService.exportXmlEntity(blueprintEntity.getId(), true));
}
if (propertiesEntity != null) {
xml.setProperties(this.descriptionPropertyDefinitionToExport(propertiesEntity));
}
List<DescriptionReferenceEntity> dmpReferences = this.queryFactory.query(DescriptionReferenceQuery.class).descriptionIds(data.getId()).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).isActive(IsActive.Active).collect();
if (!this.conventionService.isListNullOrEmpty(dmpReferences)) {
List<ReferenceEntity> references = this.queryFactory.query(ReferenceQuery.class).ids(dmpReferences.stream().map(DescriptionReferenceEntity::getReferenceId).distinct().toList()).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).isActive(IsActive.Active).collect();
Map<UUID, ReferenceEntity> referenceEntityMap = references == null ? new HashMap<>() : references.stream().collect(Collectors.toMap(ReferenceEntity::getId, x-> x));
List<ReferenceTypeEntity> referenceTypes = references == null ? new ArrayList<>() : this.queryFactory.query(ReferenceTypeQuery.class).ids(references.stream().map(ReferenceEntity::getTypeId).distinct().toList()).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).isActive(IsActive.Active).collect();
Map<UUID, ReferenceTypeEntity> referenceTypeEntityMap = referenceTypes == null ? new HashMap<>() : referenceTypes.stream().collect(Collectors.toMap(ReferenceTypeEntity::getId, x-> x));
List<DescriptionReferenceImportExport> dmpReferenceImportExports = new LinkedList<>();
for (DescriptionReferenceEntity descriptionTemplateEntity : dmpReferences) {
dmpReferenceImportExports.add(this.descriptionReferenceToExport(descriptionTemplateEntity, referenceEntityMap, referenceTypeEntityMap));
}
xml.setReferences(dmpReferenceImportExports);
}
return xml;
}
private DescriptionReferenceImportExport descriptionReferenceToExport(DescriptionReferenceEntity entity, Map<UUID, ReferenceEntity> referenceEntityMap, Map<UUID, ReferenceTypeEntity> referenceTypeEntityMap) {
DescriptionReferenceImportExport xml = new DescriptionReferenceImportExport();
if (entity == null) return xml;
DescriptionReferenceDataEntity referenceData = this.jsonHandlingService.fromJsonSafe(DescriptionReferenceDataEntity.class, entity.getData());
if (referenceData != null) xml.setFieldId(referenceData.getFieldId());
ReferenceEntity reference = referenceEntityMap.getOrDefault(entity.getReferenceId(), null);
if (reference != null){
xml.setId(reference.getId());
xml.setLabel(reference.getLabel());
xml.setReference(reference.getReference());
ReferenceTypeEntity referenceType = referenceTypeEntityMap.getOrDefault(reference.getTypeId(), null);
if (referenceType != null) xml.setType(this.descriptionReferenceTypeToExport(referenceType));
}
return xml;
}
private DescriptionReferenceTypeImportExport descriptionReferenceTypeToExport(ReferenceTypeEntity entity) {
DescriptionReferenceTypeImportExport xml = new DescriptionReferenceTypeImportExport();
if (entity == null) return xml;
xml.setId(entity.getId());
xml.setCode(entity.getCode());
xml.setName(entity.getName());
return xml;
}
private DescriptionPropertyDefinitionImportExport descriptionPropertyDefinitionToExport(PropertyDefinitionEntity entity) {
DescriptionPropertyDefinitionImportExport xml = new DescriptionPropertyDefinitionImportExport();
if (entity == null) return xml;
if (entity.getFieldSets() != null && !entity.getFieldSets().isEmpty()) {
List<DescriptionPropertyDefinitionFieldSetImportExport> exports = new LinkedList<>();
for (Map.Entry<String, PropertyDefinitionFieldSetEntity> fieldSetEntityEntry : entity.getFieldSets().entrySet()) {
exports.add(this.descriptionPropertyDefinitionFieldSetToExport(fieldSetEntityEntry.getValue(), fieldSetEntityEntry.getKey()));
}
xml.setFieldSets(exports);
}
return xml;
}
private DescriptionPropertyDefinitionFieldSetImportExport descriptionPropertyDefinitionFieldSetToExport(PropertyDefinitionFieldSetEntity entity, String fieldSetId) {
DescriptionPropertyDefinitionFieldSetImportExport xml = new DescriptionPropertyDefinitionFieldSetImportExport();
xml.setFieldSetId(fieldSetId);
if (entity == null) return xml;
if (entity.getItems() != null && !entity.getItems().isEmpty()) {
List<DescriptionPropertyDefinitionFieldSetItemImportExport> exports = new LinkedList<>();
for (PropertyDefinitionFieldSetItemEntity propertyDefinitionFieldSetItemEntity : entity.getItems()) {
exports.add(this.descriptionPropertyDefinitionFieldSetItemToExport(propertyDefinitionFieldSetItemEntity));
}
xml.setItems(exports);
}
return xml;
}
private DescriptionPropertyDefinitionFieldSetItemImportExport descriptionPropertyDefinitionFieldSetItemToExport(PropertyDefinitionFieldSetItemEntity entity) {
DescriptionPropertyDefinitionFieldSetItemImportExport xml = new DescriptionPropertyDefinitionFieldSetItemImportExport();
if (entity == null) return xml;
xml.setComment(entity.getComment());
xml.setOrdinal(entity.getOrdinal());
if (entity.getFields() != null && !entity.getFields().isEmpty()) {
List<DescriptionFieldImportExport> exports = new LinkedList<>();
for (Map.Entry<String, FieldEntity> fieldSetEntityEntry : entity.getFields().entrySet()) {
exports.add(this.descriptionFieldImportExportToExport(fieldSetEntityEntry.getValue(), fieldSetEntityEntry.getKey()));
}
xml.setFields(exports);
}
return xml;
}
private DescriptionFieldImportExport descriptionFieldImportExportToExport(FieldEntity entity, String fieldId) {
DescriptionFieldImportExport xml = new DescriptionFieldImportExport();
xml.setFieldId(fieldId);
if (entity == null) return xml;
xml.setDateValue(entity.getDateValue());
xml.setTextValue(entity.getTextValue());
xml.setTextListValue(entity.getTextListValue());
if (entity.getExternalIdentifier() != null) {
xml.setExternalIdentifier(this.descriptionExternalIdentifierToExport(entity.getExternalIdentifier()));
}
return xml;
}
private DescriptionExternalIdentifierImportExport descriptionExternalIdentifierToExport(ExternalIdentifierEntity entity) {
DescriptionExternalIdentifierImportExport xml = new DescriptionExternalIdentifierImportExport();
if (entity == null) return xml;
xml.setIdentifier(entity.getIdentifier());
xml.setType(entity.getType());
return xml;
}
//endregion
}

View File

@ -1,6 +1,7 @@
package org.opencdmp.service.descriptiontemplate;
import com.fasterxml.jackson.core.JsonProcessingException;
import org.opencdmp.commons.types.descriptiontemplate.importexport.DescriptionTemplateImportExport;
import org.opencdmp.model.DescriptionTemplate;
import org.opencdmp.model.persist.DescriptionTemplatePersist;
import org.opencdmp.model.persist.NewVersionDescriptionTemplatePersist;
@ -26,6 +27,9 @@ public interface DescriptionTemplateService {
DescriptionTemplate buildClone(UUID id, FieldSet fields) throws MyForbiddenException, MyValidationException, MyApplicationException, MyNotFoundException;
DescriptionTemplate createNewVersion(NewVersionDescriptionTemplatePersist model, FieldSet fields) throws MyForbiddenException, MyValidationException, MyApplicationException, MyNotFoundException, InvalidApplicationException, JAXBException, ParserConfigurationException, JsonProcessingException, TransformerException;
DescriptionTemplate importXml(byte[] bytes, UUID id, String label, FieldSet fields) throws MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, TransformerException, InvalidApplicationException, IOException, InstantiationException, IllegalAccessException, SAXException;
DescriptionTemplateImportExport exportXmlEntity(UUID id, boolean ignoreAuthorize) throws MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, IOException, InstantiationException, IllegalAccessException, SAXException, InvalidApplicationException;
ResponseEntity<byte[]> exportXml(UUID id) throws MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, IOException, InstantiationException, IllegalAccessException, SAXException, TransformerException, InvalidApplicationException;
}

View File

@ -6,7 +6,6 @@ import org.opencdmp.authorization.Permission;
import org.opencdmp.commons.JsonHandlingService;
import org.opencdmp.commons.XmlHandlingService;
import org.opencdmp.commons.enums.*;
import org.opencdmp.commons.enums.notification.NotificationContactType;
import org.opencdmp.commons.scope.tenant.TenantScope;
import org.opencdmp.commons.scope.user.UserScope;
import org.opencdmp.commons.types.descriptiontemplate.*;
@ -158,7 +157,7 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
if (isUpdate) {
data = this.entityManager.find(DescriptionTemplateEntity.class, model.getId());
if (data == null)
throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{model.getId(), DescriptionTemplate.class.getSimpleName()}, LocaleContextHolder.getLocale()));
throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{model.getId(), DescriptionTemplate.class.getSimpleName()}, LocaleContextHolder.getLocale()));
if (!this.conventionService.hashValue(data.getUpdatedAt()).equals(model.getHash()))
throw new MyValidationException(this.errors.getHashConflict().getCode(), this.errors.getHashConflict().getMessage());
if (data.getStatus().equals(DescriptionTemplateStatus.Finalized))
@ -260,11 +259,11 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
UserEntity user = this.entityManager.find(UserEntity.class, userDescriptionTemplate.getUserId());
if (user == null){
throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{userDescriptionTemplate.getUserId(), User.class.getSimpleName()}, LocaleContextHolder.getLocale()));
throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{userDescriptionTemplate.getUserId(), User.class.getSimpleName()}, LocaleContextHolder.getLocale()));
}
DescriptionTemplateEntity descriptionTemplate = this.queryFactory.query(DescriptionTemplateQuery.class).isActive(IsActive.Active).ids(userDescriptionTemplate.getDescriptionTemplateId()).first();
if (descriptionTemplate == null){
throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{userDescriptionTemplate.getDescriptionTemplateId(), DescriptionTemplate.class.getSimpleName()}, LocaleContextHolder.getLocale()));
throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{userDescriptionTemplate.getDescriptionTemplateId(), DescriptionTemplate.class.getSimpleName()}, LocaleContextHolder.getLocale()));
}
event.setUserId(user.getId());
UserContactInfoQuery query = this.queryFactory.query(UserContactInfoQuery.class).userIds(user.getId());
@ -273,16 +272,16 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
List<ContactPair> contactPairs = new ArrayList<>();
contactPairs.add(new ContactPair(ContactInfoType.Email, query.first().getValue()));
NotificationContactData contactData = new NotificationContactData(contactPairs, null, null);
event.setContactHint(jsonHandlingService.toJsonSafe(contactData));
event.setNotificationType(notificationProperties.getDescriptionTemplateInvitationType());
event.setContactHint(this.jsonHandlingService.toJsonSafe(contactData));
event.setNotificationType(this.notificationProperties.getDescriptionTemplateInvitationType());
NotificationFieldData data = new NotificationFieldData();
List<FieldInfo> fieldInfoList = new ArrayList<>();
fieldInfoList.add(new FieldInfo("{recipient}", DataType.String, user.getName()));
fieldInfoList.add(new FieldInfo("{templateName}", DataType.String, descriptionTemplate.getLabel()));
fieldInfoList.add(new FieldInfo("{templateID}", DataType.String, descriptionTemplate.getId().toString()));
data.setFields(fieldInfoList);
event.setData(jsonHandlingService.toJsonSafe(data));
eventHandler.handle(event);
event.setData(this.jsonHandlingService.toJsonSafe(data));
this.eventHandler.handle(event);
}
private void addOwner(DescriptionTemplateEntity descriptionTemplateEntity) throws InvalidApplicationException {
@ -292,7 +291,7 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
data.setCreatedAt(Instant.now());
data.setUpdatedAt(Instant.now());
data.setRole(UserDescriptionTemplateRole.Owner);
data.setUserId(userScope.getUserId());
data.setUserId(this.userScope.getUserId());
data.setDescriptionTemplateId(descriptionTemplateEntity.getId());
this.entityManager.persist(data);
}
@ -418,13 +417,13 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
List<UUID> ids = persist.getTextListValue().stream().map(UUID::fromString).toList();
Set<UUID> existingIds = this.queryFactory.query(DmpQuery.class).ids(ids).isActive(IsActive.Active).collectAs(new BaseFieldSet().ensure(Dmp._id)).stream().map(DmpEntity::getId).collect(Collectors.toSet());
for (UUID id : ids){
if (!existingIds.contains(id)) throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{id, Dmp.class.getSimpleName()}, LocaleContextHolder.getLocale()));
if (!existingIds.contains(id)) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, Dmp.class.getSimpleName()}, LocaleContextHolder.getLocale()));
}
} if (FieldType.INTERNAL_ENTRIES_DESCRIPTIONS.equals(fieldType) && !this.conventionService.isListNullOrEmpty(persist.getTextListValue())){
List<UUID> ids = persist.getTextListValue().stream().map(UUID::fromString).toList();
Set<UUID> existingIds = this.queryFactory.query(DescriptionQuery.class).ids(ids).isActive(IsActive.Active).collectAs(new BaseFieldSet().ensure(Description._id)).stream().map(DescriptionEntity::getId).collect(Collectors.toSet());
for (UUID id : ids){
if (!existingIds.contains(id)) throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{id, Description.class.getSimpleName()}, LocaleContextHolder.getLocale()));
if (!existingIds.contains(id)) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, Description.class.getSimpleName()}, LocaleContextHolder.getLocale()));
}
}
data.setTextListValue(persist.getTextListValue());
@ -456,7 +455,7 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
ReferenceEntity data;
if (this.conventionService.isValidGuid(model.getId())){
data = this.entityManager.find(ReferenceEntity.class, model.getId());
if (data == null) throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{model.getId(), Reference.class.getSimpleName()}, LocaleContextHolder.getLocale()));
if (data == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{model.getId(), Reference.class.getSimpleName()}, LocaleContextHolder.getLocale()));
} else {
ReferenceTypeDataEntity referenceTypeDataEntity = ((ReferenceTypeDataEntity)fieldEntity.getData());
data = this.queryFactory.query(ReferenceQuery.class).sourceTypes(model.getSourceType()).typeIds(referenceTypeDataEntity.getReferenceTypeId()).sources(model.getSource()).isActive(IsActive.Active).references(model.getReference()).first();
@ -476,14 +475,14 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
try {
ReferenceTypeEntity referenceType = this.queryFactory.query(ReferenceTypeQuery.class).ids(referenceTypeDataEntity.getReferenceTypeId()).firstAs(new BaseFieldSet().ensure(ReferenceType._id).ensure(ReferenceTypeEntity._tenantId));
if (referenceType == null) throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{referenceTypeDataEntity.getReferenceTypeId(), ReferenceType.class.getSimpleName()}, LocaleContextHolder.getLocale()));
if (referenceType == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{referenceTypeDataEntity.getReferenceTypeId(), ReferenceType.class.getSimpleName()}, LocaleContextHolder.getLocale()));
if (data.getSourceType().equals(ReferenceSourceType.External) && !this.tenantScope.isDefaultTenant() && referenceType.getTenantId() == null){
this.tenantScope.setTempTenant(this.entityManager.getEntityManager(), null, this.tenantScope.getDefaultTenantCode());
}
this.entityManager.persist(data);
} finally {
tenantScope.removeTempTenant(this.entityManager.getEntityManager());
this.tenantScope.removeTempTenant(this.entityManager.getEntityManager());
}
}
}
@ -562,7 +561,7 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
this.authorizationService.authorizeForce(Permission.DeleteDescriptionTemplate);
DescriptionTemplateEntity data = this.entityManager.find(DescriptionTemplateEntity.class, id);
if (data == null) throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{id, DescriptionTemplate.class.getSimpleName()}, LocaleContextHolder.getLocale()));
if (data == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, DescriptionTemplate.class.getSimpleName()}, LocaleContextHolder.getLocale()));
if (data.getVersionStatus().equals(DescriptionTemplateVersionStatus.Current)){
DescriptionTemplateQuery descriptionTemplateQuery = this.queryFactory.query(DescriptionTemplateQuery.class)
@ -597,7 +596,7 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
DescriptionTemplateQuery query = this.queryFactory.query(DescriptionTemplateQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).ids(id);
DescriptionTemplate model = this.builderFactory.builder(DescriptionTemplateBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(fields, query.firstAs(fields));
if (model == null)
throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{id, DescriptionTemplate.class.getSimpleName()}, LocaleContextHolder.getLocale()));
throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, DescriptionTemplate.class.getSimpleName()}, LocaleContextHolder.getLocale()));
model.setLabel(model.getLabel() + " new ");
model.setId(null);
@ -678,7 +677,7 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
DescriptionTemplateEntity oldDescriptionTemplateEntity = this.entityManager.find(DescriptionTemplateEntity.class, model.getId());
if (oldDescriptionTemplateEntity == null)
throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{model.getId(), DescriptionTemplate.class.getSimpleName()}, LocaleContextHolder.getLocale()));
throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{model.getId(), DescriptionTemplate.class.getSimpleName()}, LocaleContextHolder.getLocale()));
if (!this.conventionService.hashValue(oldDescriptionTemplateEntity.getUpdatedAt()).equals(model.getHash()))
throw new MyValidationException(this.errors.getHashConflict().getCode(), this.errors.getHashConflict().getMessage());
@ -742,6 +741,7 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
this.authorizationService.authorizeForce(Permission.ImportDescriptionTemplate);
DescriptionTemplateImportExport importXml = this.xmlHandlingService.fromXml(DescriptionTemplateImportExport.class, new String(bytes, StandardCharsets.UTF_8));
if (id == null) id = importXml.getId();
if (id == null) {
DescriptionTemplatePersist persist = new DescriptionTemplatePersist();
persist.setLabel(label);
@ -764,7 +764,7 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
DescriptionTemplateEntity oldDescriptionTemplateEntity = this.entityManager.find(DescriptionTemplateEntity.class, id);
if (oldDescriptionTemplateEntity == null)
throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{id, DescriptionTemplate.class.getSimpleName()}, LocaleContextHolder.getLocale()));
throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, DescriptionTemplate.class.getSimpleName()}, LocaleContextHolder.getLocale()));
persist.setHash(this.conventionService.hashValue(oldDescriptionTemplateEntity.getUpdatedAt()));
this.validatorFactory.validator(DescriptionTemplatePersist.DescriptionTemplatePersistValidator.class).validateForce(persist);
return this.createNewVersion(persist, fields);
@ -778,7 +778,7 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
List<PagePersist> pagesDatasetEntity = new LinkedList<>();
if (!this.conventionService.isListNullOrEmpty(importExport.getPages())) {
for (PageImportExport xmlPage : importExport.getPages()) {
for (DescriptionTemplatePageImportExport xmlPage : importExport.getPages()) {
pagesDatasetEntity.add(this.xmlPageToPersist(xmlPage));
}
}
@ -787,14 +787,14 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
return definitionPersist;
}
public PagePersist xmlPageToPersist(PageImportExport importExport) {
public PagePersist xmlPageToPersist(DescriptionTemplatePageImportExport importExport) {
PagePersist pageEntity = new PagePersist();
pageEntity.setId(importExport.getId());
pageEntity.setOrdinal(importExport.getOrdinal());
pageEntity.setTitle(importExport.getTitle());
if (!this.conventionService.isListNullOrEmpty(importExport.getSections())) {
List<SectionPersist> sectionsListEntity = new LinkedList<>();
for (SectionImportExport xmlSection : importExport.getSections()) {
for (DescriptionTemplateSectionImportExport xmlSection : importExport.getSections()) {
sectionsListEntity.add(this.xmlSectionToPersist(xmlSection));
}
pageEntity.setSections(sectionsListEntity);
@ -803,12 +803,12 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
return pageEntity;
}
public SectionPersist xmlSectionToPersist(SectionImportExport importExport) {
public SectionPersist xmlSectionToPersist(DescriptionTemplateSectionImportExport importExport) {
SectionPersist sectionEntity = new SectionPersist();
List<SectionPersist> sectionsListEntity = new LinkedList<>();
if (!this.conventionService.isListNullOrEmpty(importExport.getSections())) {
for (SectionImportExport xmlSection : importExport.getSections()) {
for (DescriptionTemplateSectionImportExport xmlSection : importExport.getSections()) {
sectionsListEntity.add(this.xmlSectionToPersist(xmlSection));
}
}
@ -818,7 +818,7 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
sectionEntity.setDescription(importExport.getDescription());
List<FieldSetPersist> fieldSetEntity = new LinkedList<>();
if (!this.conventionService.isListNullOrEmpty(importExport.getFieldSets())) {
for (FieldSetImportExport xmlFieldSet : importExport.getFieldSets()) {
for (DescriptionTemplateFieldSetImportExport xmlFieldSet : importExport.getFieldSets()) {
fieldSetEntity.add(this.toFieldSetModel(xmlFieldSet));
}
}
@ -829,7 +829,7 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
return sectionEntity;
}
public FieldSetPersist toFieldSetModel(FieldSetImportExport importExport) {
public FieldSetPersist toFieldSetModel(DescriptionTemplateFieldSetImportExport importExport) {
FieldSetPersist fieldSet1Entity = new FieldSetPersist();
fieldSet1Entity.setId(importExport.getId());
fieldSet1Entity.setOrdinal(importExport.getOrdinal());
@ -843,7 +843,7 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
List<FieldPersist> fieldsEntity = new LinkedList<>();
if (!this.conventionService.isListNullOrEmpty(importExport.getFields())) {
for (FieldImportExport xmlField : importExport.getFields()) {
for (DescriptionTemplateFieldImportExport xmlField : importExport.getFields()) {
fieldsEntity.add(this.xmlFieldToPersist(xmlField));
}
}
@ -851,7 +851,7 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
return fieldSet1Entity;
}
public FieldPersist xmlFieldToPersist(FieldImportExport importExport) {
public FieldPersist xmlFieldToPersist(DescriptionTemplateFieldImportExport importExport) {
FieldPersist fieldEntity = new FieldPersist();
fieldEntity.setId(importExport.getId());
fieldEntity.setOrdinal(importExport.getOrdinal());
@ -859,7 +859,7 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
fieldEntity.setDefaultValue(importExport.getDefaultValue());
List<RulePersist> rulePersists = new ArrayList<>();
if (importExport.getVisibilityRules() != null) {
for (RuleImportExport xmlRule : importExport.getVisibilityRules()) {
for (DescriptionTemplateRuleImportExport xmlRule : importExport.getVisibilityRules()) {
rulePersists.add(this.toRuleModel(xmlRule));
}
}
@ -874,7 +874,7 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
return fieldEntity;
}
public RulePersist toRuleModel(RuleImportExport importExport) {
public RulePersist toRuleModel(DescriptionTemplateRuleImportExport importExport) {
RulePersist ruleEntity = new RulePersist();
ruleEntity.setTarget(importExport.getTarget());
ruleEntity.setDateValue(importExport.getDateValue());
@ -884,7 +884,7 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
return ruleEntity;
}
public MultiplicityPersist xmlMultiplicityToPersist(MultiplicityImportExport importXml) {
public MultiplicityPersist xmlMultiplicityToPersist(DescriptionTemplateMultiplicityImportExport importXml) {
MultiplicityPersist multiplicityEntity = new MultiplicityPersist();
multiplicityEntity.setMax(importXml.getMax());
multiplicityEntity.setMin(importXml.getMin());
@ -898,25 +898,38 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
//region Export
@Override
public ResponseEntity<byte[]> exportXml(UUID id) throws MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, IOException, InstantiationException, IllegalAccessException, SAXException, InvalidApplicationException {
logger.debug(new MapLogEntry("persisting data").And("id", id));
public DescriptionTemplateImportExport exportXmlEntity(UUID id, boolean ignoreAuthorize) throws MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, IOException, InstantiationException, IllegalAccessException, SAXException, InvalidApplicationException {
logger.debug(new MapLogEntry("exportXml").And("id", id));
this.authorizationService.authorizeForce(Permission.ExportDescriptionTemplate);
DescriptionTemplateEntity data = this.entityManager.find(DescriptionTemplateEntity.class, id);
if (data == null)
throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{id, DescriptionTemplate.class.getSimpleName()}, LocaleContextHolder.getLocale()));
if (!ignoreAuthorize) this.authorizationService.authorizeForce(Permission.ExportDescriptionTemplate);
DescriptionTemplateEntity data = this.queryFactory.query(DescriptionTemplateQuery.class).ids(id).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).isActive(IsActive.Active).first();
if (data == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, DescriptionTemplate.class.getSimpleName()}, LocaleContextHolder.getLocale()));
DefinitionEntity definition = this.xmlHandlingService.fromXml(DefinitionEntity.class, data.getDefinition());
String xml = this.xmlHandlingService.toXml(this.definitionXmlToExport(data, definition));
return this.definitionXmlToExport(data, definition);
}
@Override
public ResponseEntity<byte[]> exportXml(UUID id) throws MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, IOException, InstantiationException, IllegalAccessException, SAXException, InvalidApplicationException {
logger.debug(new MapLogEntry("exportXml").And("id", id));
this.authorizationService.authorizeForce(Permission.ExportDescriptionTemplate);
DescriptionTemplateEntity data = this.queryFactory.query(DescriptionTemplateQuery.class).ids(id).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).isActive(IsActive.Active).first();
if (data == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, DescriptionTemplate.class.getSimpleName()}, LocaleContextHolder.getLocale()));
String xml = this.xmlHandlingService.toXml(this.exportXmlEntity(id, false));
return this.responseUtilsService.buildResponseFileFromText(xml, data.getLabel() + ".xml");
}
private DescriptionTemplateImportExport definitionXmlToExport(DescriptionTemplateEntity data, DefinitionEntity entity) {
DescriptionTemplateImportExport xml = new DescriptionTemplateImportExport();
xml.setId(data.getId());
xml.setType(data.getTypeId());
xml.setType(data.getTypeId());
xml.setLanguage(data.getLanguage());
xml.setDescription(data.getDescription());
List<PageImportExport> pagesDatasetEntity = new LinkedList<>();
List<DescriptionTemplatePageImportExport> pagesDatasetEntity = new LinkedList<>();
for (PageEntity xmlPage : entity.getPages()) {
pagesDatasetEntity.add(this.pageXmlToExport(xmlPage));
}
@ -925,12 +938,12 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
return xml;
}
private PageImportExport pageXmlToExport(PageEntity entity) {
PageImportExport xml = new PageImportExport();
private DescriptionTemplatePageImportExport pageXmlToExport(PageEntity entity) {
DescriptionTemplatePageImportExport xml = new DescriptionTemplatePageImportExport();
xml.setId(entity.getId());
xml.setOrdinal(entity.getOrdinal());
xml.setTitle(entity.getTitle());
List<SectionImportExport> sectionsListEntity = new LinkedList<>();
List<DescriptionTemplateSectionImportExport> sectionsListEntity = new LinkedList<>();
if (!this.conventionService.isListNullOrEmpty(entity.getSections())) {
for (SectionEntity section : entity.getSections()) {
sectionsListEntity.add(this.sectionXmlToExport(section));
@ -941,9 +954,9 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
return xml;
}
private SectionImportExport sectionXmlToExport(SectionEntity entity) {
SectionImportExport xml = new SectionImportExport();
List<SectionImportExport> sectionsListEntity = new LinkedList<>();
private DescriptionTemplateSectionImportExport sectionXmlToExport(SectionEntity entity) {
DescriptionTemplateSectionImportExport xml = new DescriptionTemplateSectionImportExport();
List<DescriptionTemplateSectionImportExport> sectionsListEntity = new LinkedList<>();
if (!this.conventionService.isListNullOrEmpty(entity.getSections())) {
for (SectionEntity xmlSection : entity.getSections()) {
@ -956,7 +969,7 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
xml.setOrdinal(entity.getOrdinal());
xml.setTitle(entity.getTitle());
xml.setDescription(entity.getDescription());
List<FieldSetImportExport> fieldSetEntity = new LinkedList<>();
List<DescriptionTemplateFieldSetImportExport> fieldSetEntity = new LinkedList<>();
if (!this.conventionService.isListNullOrEmpty(entity.getFieldSets())) {
for (FieldSetEntity xmlFieldSet : entity.getFieldSets()) {
fieldSetEntity.add(this.fieldSetXmlToExport(xmlFieldSet));
@ -968,8 +981,8 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
return xml;
}
private FieldSetImportExport fieldSetXmlToExport(FieldSetEntity entity) {
FieldSetImportExport fieldSet1Entity = new FieldSetImportExport();
private DescriptionTemplateFieldSetImportExport fieldSetXmlToExport(FieldSetEntity entity) {
DescriptionTemplateFieldSetImportExport fieldSet1Entity = new DescriptionTemplateFieldSetImportExport();
fieldSet1Entity.setId(entity.getId());
fieldSet1Entity.setOrdinal(entity.getOrdinal());
fieldSet1Entity.setHasCommentField(entity.getHasCommentField());
@ -980,7 +993,7 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
fieldSet1Entity.setExtendedDescription(entity.getExtendedDescription());
fieldSet1Entity.setAdditionalInformation(entity.getAdditionalInformation());
List<FieldImportExport> fieldsEntity = new LinkedList<>();
List<DescriptionTemplateFieldImportExport> fieldsEntity = new LinkedList<>();
if (entity.getFields() != null) {
for (FieldEntity xmlField : entity.getFields()) {
fieldsEntity.add(this.fieldXmlToExport(xmlField));
@ -990,13 +1003,13 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
return fieldSet1Entity;
}
private FieldImportExport fieldXmlToExport(FieldEntity entity) {
FieldImportExport xml = new FieldImportExport();
private DescriptionTemplateFieldImportExport fieldXmlToExport(FieldEntity entity) {
DescriptionTemplateFieldImportExport xml = new DescriptionTemplateFieldImportExport();
xml.setId(entity.getId());
xml.setOrdinal(entity.getOrdinal());
xml.setValidations(entity.getValidations());
xml.setDefaultValue(entity.getDefaultValue());
List<RuleImportExport> rulePersists = new ArrayList<>();
List<DescriptionTemplateRuleImportExport> rulePersists = new ArrayList<>();
if (!this.conventionService.isListNullOrEmpty(entity.getVisibilityRules())) {
for (RuleEntity xmlRule : entity.getVisibilityRules()) {
rulePersists.add(this.toRuleModel(xmlRule));
@ -1013,22 +1026,22 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
return xml;
}
private RuleImportExport toRuleModel(RuleEntity entity) {
RuleImportExport xml = new RuleImportExport();
private DescriptionTemplateRuleImportExport toRuleModel(RuleEntity entity) {
DescriptionTemplateRuleImportExport xml = new DescriptionTemplateRuleImportExport();
xml.setTarget(entity.getTarget());
xml.setDateValue(entity.getDateValue());
xml.setTextListValue(entity.getTextListValue());
xml.setTextValue(entity.getTextValue());
if (entity.getExternalIdentifier() != null){
xml.setExternalIdentifier(new ExternalIdentifierImportExport());
xml.setExternalIdentifier(new DescriptionTemplateExternalIdentifierImportExport());
xml.getExternalIdentifier().setIdentifier(entity.getExternalIdentifier().getIdentifier());
xml.getExternalIdentifier().setType(entity.getExternalIdentifier().getType());
}
return xml;
}
private MultiplicityImportExport multiplicityXmlToExport(MultiplicityEntity entity) {
MultiplicityImportExport xml = new MultiplicityImportExport();
private DescriptionTemplateMultiplicityImportExport multiplicityXmlToExport(MultiplicityEntity entity) {
DescriptionTemplateMultiplicityImportExport xml = new DescriptionTemplateMultiplicityImportExport();
xml.setMax(entity.getMax());
xml.setMin(entity.getMin());
xml.setPlaceholder(entity.getPlaceholder());

View File

@ -52,7 +52,7 @@ public interface DmpService {
void dmpInvitationAccept(String token) throws InvalidApplicationException, IOException;
DmpImportExport exportXmlEntity(UUID id) throws MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, IOException, InstantiationException, IllegalAccessException, SAXException, InvalidApplicationException;
DmpImportExport exportXmlEntity(UUID id, boolean ignoreAuthorize) throws MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, IOException, InstantiationException, IllegalAccessException, SAXException, InvalidApplicationException;
ResponseEntity<byte[]> exportXml(UUID id) throws MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, IOException, InstantiationException, IllegalAccessException, SAXException, InvalidApplicationException;
}

View File

@ -11,6 +11,7 @@ import org.opencdmp.commons.enums.notification.NotificationContactType;
import org.opencdmp.commons.scope.tenant.TenantScope;
import org.opencdmp.commons.scope.user.UserScope;
import org.opencdmp.commons.types.actionconfirmation.DmpInvitationEntity;
import org.opencdmp.commons.types.description.importexport.DescriptionImportExport;
import org.opencdmp.commons.types.dmp.DmpBlueprintValueEntity;
import org.opencdmp.commons.types.dmp.DmpContactEntity;
import org.opencdmp.commons.types.dmp.DmpPropertiesEntity;
@ -142,6 +143,7 @@ public class DmpServiceImpl implements DmpService {
private final TenantScope tenantScope;
private final ResponseUtilsService responseUtilsService;
private final DmpBlueprintService dmpBlueprintService;
@Autowired
public DmpServiceImpl(
TenantEntityManager entityManager,
@ -231,8 +233,8 @@ public class DmpServiceImpl implements DmpService {
private void checkIfDescriptionTemplateIsUse (List<DmpDescriptionTemplatePersist> descriptionTemplates, UUID id){
List<DmpDescriptionTemplateEntity> existingDmpDescriptionTemplates = this.queryFactory.query(DmpDescriptionTemplateQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).dmpIds(id).isActive(IsActive.Active).collect();
List<DmpDescriptionTemplateEntity> removedDescriptionTemplates = existingDmpDescriptionTemplates.stream().filter(x -> descriptionTemplates.stream().noneMatch(y -> y.getDescriptionTemplateGroupId().equals(x.getDescriptionTemplateGroupId()))).collect(Collectors.toList());
DmpDescriptionTemplateQuery dmpDescriptionTemplateQuery = this.queryFactory.query(DmpDescriptionTemplateQuery.class).isActive(IsActive.Active).dmpIds(id).descriptionTemplateGroupIds(removedDescriptionTemplates.stream().map(x -> x.getDescriptionTemplateGroupId()).collect(Collectors.toList()));
List<DmpDescriptionTemplateEntity> removedDescriptionTemplates = existingDmpDescriptionTemplates.stream().filter(x -> descriptionTemplates.stream().noneMatch(y -> y.getDescriptionTemplateGroupId().equals(x.getDescriptionTemplateGroupId()))).toList();
DmpDescriptionTemplateQuery dmpDescriptionTemplateQuery = this.queryFactory.query(DmpDescriptionTemplateQuery.class).isActive(IsActive.Active).dmpIds(id).descriptionTemplateGroupIds(removedDescriptionTemplates.stream().map(DmpDescriptionTemplateEntity::getDescriptionTemplateGroupId).collect(Collectors.toList()));
DescriptionQuery query = this.queryFactory.query(DescriptionQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).dmpDescriptionTemplateSubQuery(dmpDescriptionTemplateQuery).isActive(IsActive.Active);
if (query != null && query.count() > 0) throw new MyValidationException(this.errors.getDmpDescriptionTemplateCanNotRemove().getCode(), this.errors.getDmpDescriptionTemplateCanNotRemove().getMessage());
@ -1066,7 +1068,7 @@ public class DmpServiceImpl implements DmpService {
if (!this.conventionService.isListNullOrEmpty(dmpDescriptionTemplateEntities)){
persist.setDescriptionTemplates(new ArrayList<>());
for (DmpDescriptionTemplateEntity descriptionTemplateEntity: dmpDescriptionTemplateEntities) {
persist.getDescriptionTemplates().add(this.buildDmpDescriptionTemplatePersists(descriptionTemplateEntity, definition.getSections()));
persist.getDescriptionTemplates().add(this.buildDmpDescriptionTemplatePersists(descriptionTemplateEntity));
}
}
persist.setProperties(this.buildDmpPropertyDefinitionPersist( this.jsonHandlingService.fromJsonSafe(DmpPropertiesEntity.class, data.getProperties()), dmpReferenceEntities, definition.getSections()));
@ -1100,7 +1102,7 @@ public class DmpServiceImpl implements DmpService {
for (DmpReferenceEntity dmpReferenceEntity : dmpReferenceEntities) {
DmpReferenceData referenceData = this.jsonHandlingService.fromJsonSafe(DmpReferenceData.class, dmpReferenceEntity.getData());
ReferenceEntity reference = referencesFromAllFields.stream().filter(x -> x.getId().equals(dmpReferenceEntity.getReferenceId())).collect(Collectors.toList()).getFirst();
ReferenceEntity reference = referencesFromAllFields.stream().filter(x -> x.getId().equals(dmpReferenceEntity.getReferenceId())).toList().getFirst();
if (referenceData.getBlueprintFieldId().equals(fieldEntity.getId()) && reference != null) {
referencePersists.add(this.buildReferencePersist(reference));
}
@ -1152,7 +1154,7 @@ public class DmpServiceImpl implements DmpService {
return persist;
}
private @NotNull DmpDescriptionTemplatePersist buildDmpDescriptionTemplatePersists(DmpDescriptionTemplateEntity data, List<SectionEntity> sectionEntities){
private @NotNull DmpDescriptionTemplatePersist buildDmpDescriptionTemplatePersists(DmpDescriptionTemplateEntity data){
DmpDescriptionTemplatePersist persist = new DmpDescriptionTemplatePersist();
if (data == null) return persist;
@ -1234,7 +1236,7 @@ public class DmpServiceImpl implements DmpService {
if (userId != null){
user.setUser(userId);
usersToAssign.add(user);
if (this.userScope.getUserId() != userId && !existingUsers.stream().map(x -> x.getUserId()).collect(Collectors.toList()).contains(userId)){
if (this.userScope.getUserId() != userId && !existingUsers.stream().map(DmpUserEntity::getUserId).toList().contains(userId)){
this.sendDmpInvitationExistingUser(user.getUser(), dmp, user.getRole());
}
}else if (user.getEmail() != null) {
@ -1343,13 +1345,12 @@ public class DmpServiceImpl implements DmpService {
//region Export
@Override
public DmpImportExport exportXmlEntity(UUID id) throws MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, IOException, InstantiationException, IllegalAccessException, SAXException, InvalidApplicationException {
public DmpImportExport exportXmlEntity(UUID id, boolean ignoreAuthorize) throws MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, IOException, InstantiationException, IllegalAccessException, SAXException, InvalidApplicationException {
logger.debug(new MapLogEntry("export xml").And("id", id));
this.authorizationService.authorizeForce(Permission.ExportDmp);
DmpEntity data = this.entityManager.find(DmpEntity.class, id);
if (data == null)
throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, Dmp.class.getSimpleName()}, LocaleContextHolder.getLocale()));
if (!ignoreAuthorize) this.authorizationService.authorizeForce(Permission.ExportDmp);
DmpEntity data = this.queryFactory.query(DmpQuery.class).ids(id).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).isActive(IsActive.Active).first();
if (data == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, Dmp.class.getSimpleName()}, LocaleContextHolder.getLocale()));
DmpPropertiesEntity definition = this.jsonHandlingService.fromJson(DmpPropertiesEntity.class, data.getProperties());
return this.definitionXmlToExport(data, definition);
@ -1360,11 +1361,10 @@ public class DmpServiceImpl implements DmpService {
logger.debug(new MapLogEntry("export xml").And("id", id));
this.authorizationService.authorizeForce(Permission.ExportDmp);
DmpEntity data = this.entityManager.find(DmpEntity.class, id);
if (data == null)
throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, Dmp.class.getSimpleName()}, LocaleContextHolder.getLocale()));
DmpEntity data = this.queryFactory.query(DmpQuery.class).ids(id).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).isActive(IsActive.Active).first();
if (data == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, Dmp.class.getSimpleName()}, LocaleContextHolder.getLocale()));
String xml = this.xmlHandlingService.toXml(this.exportXmlEntity(data.getId()));
String xml = this.xmlHandlingService.toXml(this.exportXmlEntity(data.getId(), false));
return this.responseUtilsService.buildResponseFileFromText(xml, data.getLabel() + ".xml");
}
@ -1380,7 +1380,7 @@ public class DmpServiceImpl implements DmpService {
if (propertiesEntity != null && !this.conventionService.isListNullOrEmpty(propertiesEntity.getContacts())) {
List<DmpContactImportExport> dmpContactImportExports = new LinkedList<>();
List<UserEntity> users = this.queryFactory.query(UserQuery.class).ids(propertiesEntity.getContacts().stream().filter(x-> x.getUserId() != null).map(DmpContactEntity::getUserId).distinct().toList()).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).isActive(IsActive.Active).collect();
List<UserEntity> users = this.queryFactory.query(UserQuery.class).ids(propertiesEntity.getContacts().stream().map(DmpContactEntity::getUserId).filter(Objects::nonNull).distinct().toList()).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).isActive(IsActive.Active).collect();
Map<UUID, UserEntity> usersMap = users == null ? new HashMap<>() : users.stream().collect(Collectors.toMap(UserEntity::getId, x-> x));
for (DmpContactEntity contactEntity : propertiesEntity.getContacts()) {
dmpContactImportExports.add(this.dmpContactToExport(contactEntity, usersMap));
@ -1388,9 +1388,9 @@ public class DmpServiceImpl implements DmpService {
xml.setContacts(dmpContactImportExports);
}
List<DmpUserEntity> dmpUsers = this.queryFactory.query(DmpUserQuery.class).dmpIds(data.getId()).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).isActives(IsActive.Active).collect();
List<DmpUserEntity> dmpUsers = this.queryFactory.query(DmpUserQuery.class).dmpIds(data.getId()).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).isActives(IsActive.Active).collect();
if (!this.conventionService.isListNullOrEmpty(dmpUsers)) {
List<UserEntity> users = this.queryFactory.query(UserQuery.class).ids(dmpUsers.stream().map(DmpUserEntity::getUserId).distinct().toList()).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).isActive(IsActive.Active).collect();
List<UserEntity> users = this.queryFactory.query(UserQuery.class).ids(dmpUsers.stream().map(DmpUserEntity::getUserId).distinct().toList()).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).isActive(IsActive.Active).collect();
Map<UUID, UserEntity> usersMap = users == null ? new HashMap<>() : users.stream().collect(Collectors.toMap(UserEntity::getId, x-> x));
List<DmpUserImportExport> dmpUserImportExports = new LinkedList<>();
for (DmpUserEntity dmpUserEntity : dmpUsers) {
@ -1398,12 +1398,12 @@ public class DmpServiceImpl implements DmpService {
}
xml.setUsers(dmpUserImportExports);
}
DmpBlueprintEntity blueprintEntity = this.queryFactory.query(DmpBlueprintQuery.class).ids(data.getBlueprintId()).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).isActive(IsActive.Active).first();
DmpBlueprintEntity blueprintEntity = this.queryFactory.query(DmpBlueprintQuery.class).ids(data.getBlueprintId()).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).isActive(IsActive.Active).first();
if (blueprintEntity != null) {
xml.setBlueprint(this.dmpBlueprintService.getExportXmlEntity(blueprintEntity.getId()));
xml.setBlueprint(this.dmpBlueprintService.getExportXmlEntity(blueprintEntity.getId(), true));
}
List<DmpDescriptionTemplateEntity> dmpDescriptionTemplateEntities = this.queryFactory.query(DmpDescriptionTemplateQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).dmpIds(data.getId()).isActive(IsActive.Active).collect();
List<DmpDescriptionTemplateEntity> dmpDescriptionTemplateEntities = this.queryFactory.query(DmpDescriptionTemplateQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).dmpIds(data.getId()).isActive(IsActive.Active).collect();
if (!this.conventionService.isListNullOrEmpty(dmpDescriptionTemplateEntities)) {
List<DmpDescriptionTemplateImportExport> dmpDescriptionTemplateImportExports = new LinkedList<>();
for (DmpDescriptionTemplateEntity descriptionTemplateEntity : dmpDescriptionTemplateEntities) {
@ -1420,9 +1420,9 @@ public class DmpServiceImpl implements DmpService {
xml.setBlueprintValues(dmpDescriptionTemplateImportExports);
}
List<DmpReferenceEntity> dmpReferences = this.queryFactory.query(DmpReferenceQuery.class).dmpIds(data.getId()).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).isActives(IsActive.Active).collect();
List<DmpReferenceEntity> dmpReferences = this.queryFactory.query(DmpReferenceQuery.class).dmpIds(data.getId()).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).isActives(IsActive.Active).collect();
if (!this.conventionService.isListNullOrEmpty(dmpReferences)) {
List<ReferenceEntity> references = this.queryFactory.query(ReferenceQuery.class).ids(dmpReferences.stream().map(DmpReferenceEntity::getReferenceId).distinct().toList()).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).isActive(IsActive.Active).collect();
List<ReferenceEntity> references = this.queryFactory.query(ReferenceQuery.class).ids(dmpReferences.stream().map(DmpReferenceEntity::getReferenceId).distinct().toList()).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).isActive(IsActive.Active).collect();
Map<UUID, ReferenceEntity> referenceEntityMap = references == null ? new HashMap<>() : references.stream().collect(Collectors.toMap(ReferenceEntity::getId, x-> x));
List<ReferenceTypeEntity> referenceTypes = references == null ? new ArrayList<>() : this.queryFactory.query(ReferenceTypeQuery.class).ids(references.stream().map(ReferenceEntity::getTypeId).distinct().toList()).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).isActive(IsActive.Active).collect();
Map<UUID, ReferenceTypeEntity> referenceTypeEntityMap = referenceTypes == null ? new HashMap<>() : referenceTypes.stream().collect(Collectors.toMap(ReferenceTypeEntity::getId, x-> x));
@ -1432,6 +1432,14 @@ public class DmpServiceImpl implements DmpService {
}
xml.setReferences(dmpReferenceImportExports);
}
List<DescriptionEntity> descriptions = this.queryFactory.query(DescriptionQuery.class).dmpIds(data.getId()).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).dmpIds(data.getId()).isActive(IsActive.Active).collect();
if (!this.conventionService.isListNullOrEmpty(descriptions)) {
List<DescriptionImportExport> descriptionImportExports = new LinkedList<>();
for (DescriptionEntity description : descriptions) {
descriptionImportExports.add(this.descriptionService.exportXmlEntity(description.getId(), true));
}
xml.setDescriptions(descriptionImportExports);
}
return xml;
}

View File

@ -35,7 +35,7 @@ public interface DmpBlueprintService {
DmpBlueprint createNewVersion(NewVersionDmpBlueprintPersist model, FieldSet fieldSet) throws MyForbiddenException, MyValidationException, MyApplicationException, MyNotFoundException, InvalidApplicationException, JAXBException, ParserConfigurationException, JsonProcessingException, TransformerException;
BlueprintImportExport getExportXmlEntity(UUID id) throws MyForbiddenException, MyNotFoundException, InvalidApplicationException, JAXBException, ParserConfigurationException, IOException, InstantiationException, IllegalAccessException, SAXException;
BlueprintImportExport getExportXmlEntity(UUID id, boolean ignoreAuthorize) throws MyForbiddenException, MyNotFoundException, InvalidApplicationException, JAXBException, ParserConfigurationException, IOException, InstantiationException, IllegalAccessException, SAXException;
ResponseEntity<byte[]> exportXml(UUID id) throws MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, IOException, InstantiationException, IllegalAccessException, SAXException, TransformerException, InvalidApplicationException;
DmpBlueprint importXml(byte[] bytes, String label, FieldSet fields) throws MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, TransformerException, InvalidApplicationException, IOException, InstantiationException, IllegalAccessException, SAXException;

View File

@ -10,6 +10,7 @@ import org.opencdmp.commons.types.dmpblueprint.*;
import org.opencdmp.commons.types.dmpblueprint.importexport.*;
import org.opencdmp.convention.ConventionService;
import org.opencdmp.data.DmpBlueprintEntity;
import org.opencdmp.data.DmpEntity;
import org.opencdmp.data.TenantEntityManager;
import org.opencdmp.errorcode.ErrorThesaurusProperties;
import org.opencdmp.model.DmpBlueprint;
@ -22,6 +23,7 @@ import org.opencdmp.model.persist.DmpBlueprintPersist;
import org.opencdmp.model.persist.NewVersionDmpBlueprintPersist;
import org.opencdmp.model.persist.dmpblueprintdefinition.*;
import org.opencdmp.query.DmpBlueprintQuery;
import org.opencdmp.query.DmpQuery;
import org.opencdmp.service.responseutils.ResponseUtilsService;
import gr.cite.commons.web.authz.service.AuthorizationService;
import gr.cite.tools.data.builder.BuilderFactory;
@ -445,13 +447,12 @@ public class DmpBlueprintServiceImpl implements DmpBlueprintService {
@Override
public BlueprintImportExport getExportXmlEntity(UUID id) throws MyForbiddenException, MyNotFoundException, InvalidApplicationException, JAXBException, ParserConfigurationException, IOException, InstantiationException, IllegalAccessException, SAXException {
public BlueprintImportExport getExportXmlEntity(UUID id, boolean ignoreAuthorize) throws MyForbiddenException, MyNotFoundException, InvalidApplicationException, JAXBException, ParserConfigurationException, IOException, InstantiationException, IllegalAccessException, SAXException {
logger.debug(new MapLogEntry("export xml").And("id", id));
this.authorizationService.authorizeForce(Permission.ExportDmpBlueprint);
DmpBlueprintEntity data = this.entityManager.find(DmpBlueprintEntity.class, id);
if (data == null)
throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, DmpBlueprint.class.getSimpleName()}, LocaleContextHolder.getLocale()));
if (!ignoreAuthorize) this.authorizationService.authorizeForce(Permission.ExportDmpBlueprint);
DmpBlueprintEntity data = this.queryFactory.query(DmpBlueprintQuery.class).ids(id).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).isActive(IsActive.Active).first();
if (data == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, DmpBlueprint.class.getSimpleName()}, LocaleContextHolder.getLocale()));
return this.definitionXmlToExport(data);
}
@ -460,11 +461,10 @@ public class DmpBlueprintServiceImpl implements DmpBlueprintService {
@Override
public ResponseEntity<byte[]> exportXml(UUID id) throws MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, IOException, InstantiationException, IllegalAccessException, SAXException, TransformerException, InvalidApplicationException {
logger.debug(new MapLogEntry("export xml").And("id", id));
DmpBlueprintEntity data = this.entityManager.find(DmpBlueprintEntity.class, id);
if (data == null)
throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, DmpBlueprint.class.getSimpleName()}, LocaleContextHolder.getLocale()));
DmpBlueprintEntity data = this.queryFactory.query(DmpBlueprintQuery.class).ids(id).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).isActive(IsActive.Active).first();
if (data == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, DmpBlueprint.class.getSimpleName()}, LocaleContextHolder.getLocale()));
String xml = this.xmlHandlingService.toXml(this.getExportXmlEntity(id));
String xml = this.xmlHandlingService.toXml(this.getExportXmlEntity(id, false));
return this.responseUtilsService.buildResponseFileFromText(xml, data.getLabel() + ".xml");
}
@ -481,11 +481,11 @@ public class DmpBlueprintServiceImpl implements DmpBlueprintService {
return xml;
}
private DefinitionImportExport definitionXmlToExport(DefinitionEntity entity) {
private BlueprintDefinitionImportExport definitionXmlToExport(DefinitionEntity entity) {
if (entity == null)
return null;
DefinitionImportExport xml = new DefinitionImportExport();
List<SectionImportExport> dmpBlueprintSections = new ArrayList<>();
BlueprintDefinitionImportExport xml = new BlueprintDefinitionImportExport();
List<BlueprintSectionImportExport> dmpBlueprintSections = new ArrayList<>();
if (!this.conventionService.isListNullOrEmpty(entity.getSections())) {
for (SectionEntity section : entity.getSections()) {
dmpBlueprintSections.add(this.sectionXmlToExport(section));
@ -495,14 +495,14 @@ public class DmpBlueprintServiceImpl implements DmpBlueprintService {
return xml;
}
private SectionImportExport sectionXmlToExport(SectionEntity entity) {
SectionImportExport xml = new SectionImportExport();
private BlueprintSectionImportExport sectionXmlToExport(SectionEntity entity) {
BlueprintSectionImportExport xml = new BlueprintSectionImportExport();
xml.setId(entity.getId());
xml.setLabel(entity.getLabel());
xml.setDescription(entity.getDescription());
xml.setOrdinal(entity.getOrdinal());
xml.setHasTemplates(entity.getHasTemplates());
List<SystemFieldImportExport> dmpBlueprintSystemFieldModels = new LinkedList<>();
List<BlueprintSystemFieldImportExport> dmpBlueprintSystemFieldModels = new LinkedList<>();
if (!this.conventionService.isListNullOrEmpty(entity.getFields())) {
for (SystemFieldEntity systemField : entity.getFields().stream().filter(x -> x.getCategory() == DmpBlueprintFieldCategory.System).map(x -> (SystemFieldEntity) x).toList()) {
dmpBlueprintSystemFieldModels.add(this.systemFieldXmlToExport(systemField));
@ -510,7 +510,7 @@ public class DmpBlueprintServiceImpl implements DmpBlueprintService {
}
xml.setSystemFields(dmpBlueprintSystemFieldModels);
List<ExtraFieldImportExport> dmpBlueprintExtraFieldModels = new LinkedList<>();
List<BlueprintExtraFieldImportExport> dmpBlueprintExtraFieldModels = new LinkedList<>();
if (!this.conventionService.isListNullOrEmpty(entity.getFields())) {
for (ExtraFieldEntity systemField : entity.getFields().stream().filter(x -> x.getCategory() == DmpBlueprintFieldCategory.Extra).map(x -> (ExtraFieldEntity) x).toList()) {
dmpBlueprintExtraFieldModels.add(this.extraFieldXmlToExport(systemField));
@ -518,7 +518,7 @@ public class DmpBlueprintServiceImpl implements DmpBlueprintService {
}
xml.setExtraFields(dmpBlueprintExtraFieldModels);
List<ReferenceTypeFieldImportExport> dmpBlueprintReferenceFieldModels = new LinkedList<>();
List<BlueprintReferenceTypeFieldImportExport> dmpBlueprintReferenceFieldModels = new LinkedList<>();
if (!this.conventionService.isListNullOrEmpty(entity.getFields())) {
for (ReferenceTypeFieldEntity referenceTypeFieldEntity : entity.getFields().stream().filter(x -> x.getCategory() == DmpBlueprintFieldCategory.ReferenceType).map(x -> (ReferenceTypeFieldEntity) x).toList()) {
dmpBlueprintReferenceFieldModels.add(this.referenceFieldXmlToExport(referenceTypeFieldEntity));
@ -526,7 +526,7 @@ public class DmpBlueprintServiceImpl implements DmpBlueprintService {
}
xml.setReferenceFields(dmpBlueprintReferenceFieldModels);
List<DescriptionTemplateImportExport> dmpBlueprintDescriptionTemplates = new LinkedList<>();
List<BlueprintDescriptionTemplateImportExport> dmpBlueprintDescriptionTemplates = new LinkedList<>();
if (!this.conventionService.isListNullOrEmpty(entity.getDescriptionTemplates())) {
for (DescriptionTemplateEntity descriptionTemplate : entity.getDescriptionTemplates()) {
dmpBlueprintDescriptionTemplates.add(this.descriptionTemplateXmlToExport(descriptionTemplate));
@ -536,8 +536,8 @@ public class DmpBlueprintServiceImpl implements DmpBlueprintService {
return xml;
}
private DescriptionTemplateImportExport descriptionTemplateXmlToExport(DescriptionTemplateEntity entity) {
DescriptionTemplateImportExport xml = new DescriptionTemplateImportExport();
private BlueprintDescriptionTemplateImportExport descriptionTemplateXmlToExport(DescriptionTemplateEntity entity) {
BlueprintDescriptionTemplateImportExport xml = new BlueprintDescriptionTemplateImportExport();
xml.setDescriptionTemplateGroupId(entity.getDescriptionTemplateGroupId());
xml.setLabel(entity.getLabel());
if (entity.getMinMultiplicity() != null ) xml.setMinMultiplicity(entity.getMinMultiplicity());
@ -545,8 +545,8 @@ public class DmpBlueprintServiceImpl implements DmpBlueprintService {
return xml;
}
private ExtraFieldImportExport extraFieldXmlToExport(ExtraFieldEntity entity) {
ExtraFieldImportExport xml = new ExtraFieldImportExport();
private BlueprintExtraFieldImportExport extraFieldXmlToExport(ExtraFieldEntity entity) {
BlueprintExtraFieldImportExport xml = new BlueprintExtraFieldImportExport();
xml.setId(entity.getId());
xml.setType(entity.getType());
xml.setLabel(entity.getLabel());
@ -557,8 +557,8 @@ public class DmpBlueprintServiceImpl implements DmpBlueprintService {
return xml;
}
private ReferenceTypeFieldImportExport referenceFieldXmlToExport(ReferenceTypeFieldEntity entity) {
ReferenceTypeFieldImportExport xml = new ReferenceTypeFieldImportExport();
private BlueprintReferenceTypeFieldImportExport referenceFieldXmlToExport(ReferenceTypeFieldEntity entity) {
BlueprintReferenceTypeFieldImportExport xml = new BlueprintReferenceTypeFieldImportExport();
xml.setId(entity.getId());
xml.setReferenceTypeId(entity.getReferenceTypeId());
xml.setLabel(entity.getLabel());
@ -570,8 +570,8 @@ public class DmpBlueprintServiceImpl implements DmpBlueprintService {
return xml;
}
private SystemFieldImportExport systemFieldXmlToExport(SystemFieldEntity entity) {
SystemFieldImportExport xml = new SystemFieldImportExport();
private BlueprintSystemFieldImportExport systemFieldXmlToExport(SystemFieldEntity entity) {
BlueprintSystemFieldImportExport xml = new BlueprintSystemFieldImportExport();
xml.setId(entity.getId());
xml.setType(entity.getType());
xml.setLabel(entity.getLabel());
@ -614,13 +614,13 @@ public class DmpBlueprintServiceImpl implements DmpBlueprintService {
return this.persist(persist, fields);
}
private DefinitionPersist xmlDefinitionToPersist(DefinitionImportExport importXml) {
private DefinitionPersist xmlDefinitionToPersist(BlueprintDefinitionImportExport importXml) {
if (importXml == null)
return null;
DefinitionPersist persist = new DefinitionPersist();
List<SectionPersist> dmpBlueprintSections = new ArrayList<>();
if (!this.conventionService.isListNullOrEmpty(importXml.getSections())) {
for (SectionImportExport section : importXml.getSections()) {
for (BlueprintSectionImportExport section : importXml.getSections()) {
dmpBlueprintSections.add(this.xmlSectionToPersist(section));
}
}
@ -628,7 +628,7 @@ public class DmpBlueprintServiceImpl implements DmpBlueprintService {
return persist;
}
private SectionPersist xmlSectionToPersist(SectionImportExport importXml) {
private SectionPersist xmlSectionToPersist(BlueprintSectionImportExport importXml) {
SectionPersist persist = new SectionPersist();
persist.setId(importXml.getId());
persist.setLabel(importXml.getLabel());
@ -637,24 +637,24 @@ public class DmpBlueprintServiceImpl implements DmpBlueprintService {
persist.setHasTemplates(importXml.isHasTemplates());
List<FieldPersist> dmpBlueprintFieldModels = new LinkedList<>();
if (!this.conventionService.isListNullOrEmpty(importXml.getSystemFields())) {
for (SystemFieldImportExport systemField : importXml.getSystemFields()) {
for (BlueprintSystemFieldImportExport systemField : importXml.getSystemFields()) {
dmpBlueprintFieldModels.add(this.xmlSystemFieldToPersist(systemField));
}
}
if (!this.conventionService.isListNullOrEmpty(importXml.getReferenceFields())) {
for (ReferenceTypeFieldImportExport referenceField : importXml.getReferenceFields()) {
for (BlueprintReferenceTypeFieldImportExport referenceField : importXml.getReferenceFields()) {
dmpBlueprintFieldModels.add(this.xmlReferenceFieldToPersist(referenceField));
}
}
if (!this.conventionService.isListNullOrEmpty(importXml.getExtraFields())) {
for (ExtraFieldImportExport extraField : importXml.getExtraFields()) {
for (BlueprintExtraFieldImportExport extraField : importXml.getExtraFields()) {
dmpBlueprintFieldModels.add(this.xmlExtraFieldToPersist(extraField));
}
}
persist.setFields(dmpBlueprintFieldModels);
List<DescriptionTemplatePersist> dmpBlueprintDescriptionTemplates = new LinkedList<>();
if (!this.conventionService.isListNullOrEmpty(importXml.getDescriptionTemplates())) {
for (DescriptionTemplateImportExport descriptionTemplate : importXml.getDescriptionTemplates()) {
for (BlueprintDescriptionTemplateImportExport descriptionTemplate : importXml.getDescriptionTemplates()) {
dmpBlueprintDescriptionTemplates.add(this.xmlDescriptionTemplateToPersist(descriptionTemplate));
}
}
@ -662,7 +662,7 @@ public class DmpBlueprintServiceImpl implements DmpBlueprintService {
return persist;
}
private DescriptionTemplatePersist xmlDescriptionTemplateToPersist(DescriptionTemplateImportExport importXml) {
private DescriptionTemplatePersist xmlDescriptionTemplateToPersist(BlueprintDescriptionTemplateImportExport importXml) {
DescriptionTemplatePersist persist = new DescriptionTemplatePersist();
persist.setDescriptionTemplateGroupId(importXml.getDescriptionTemplateGroupId());
persist.setLabel(importXml.getLabel());
@ -671,7 +671,7 @@ public class DmpBlueprintServiceImpl implements DmpBlueprintService {
return persist;
}
private FieldPersist xmlExtraFieldToPersist(ExtraFieldImportExport importXml) {
private FieldPersist xmlExtraFieldToPersist(BlueprintExtraFieldImportExport importXml) {
ExtraFieldPersist persist = new ExtraFieldPersist();
persist.setId(importXml.getId());
persist.setCategory(DmpBlueprintFieldCategory.Extra);
@ -684,7 +684,7 @@ public class DmpBlueprintServiceImpl implements DmpBlueprintService {
return persist;
}
private FieldPersist xmlSystemFieldToPersist(SystemFieldImportExport importXml) {
private FieldPersist xmlSystemFieldToPersist(BlueprintSystemFieldImportExport importXml) {
SystemFieldPersist persist = new SystemFieldPersist();
persist.setId(importXml.getId());
persist.setCategory(DmpBlueprintFieldCategory.System);
@ -697,7 +697,7 @@ public class DmpBlueprintServiceImpl implements DmpBlueprintService {
return persist;
}
private FieldPersist xmlReferenceFieldToPersist(ReferenceTypeFieldImportExport importXml) {
private FieldPersist xmlReferenceFieldToPersist(BlueprintReferenceTypeFieldImportExport importXml) {
ReferenceTypeFieldPersist persist = new ReferenceTypeFieldPersist();
persist.setId(importXml.getId());
persist.setCategory(DmpBlueprintFieldCategory.ReferenceType);

View File

@ -46,11 +46,13 @@ import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.xml.sax.SAXException;
import javax.crypto.BadPaddingException;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;
import javax.management.InvalidApplicationException;
import javax.xml.parsers.ParserConfigurationException;
import java.io.IOException;
import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
@ -121,7 +123,7 @@ public class DescriptionController {
DescriptionQuery query = this.queryFactory.query(DescriptionQuery.class).authorize(EnumSet.of(Public)).ids(id).dmpSubQuery(this.queryFactory.query(DmpQuery.class).isActive(IsActive.Active).statuses(DmpStatus.Finalized).accessTypes(DmpAccessType.Public));
PublicDescription model = this.builderFactory.builder(PublicDescriptionBuilder.class).authorize(EnumSet.of(Public)).build(fieldSet, query.firstAs(fieldSet));
if (model == null) throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{id, PublicDescription.class.getSimpleName()}, LocaleContextHolder.getLocale()));
if (model == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, PublicDescription.class.getSimpleName()}, LocaleContextHolder.getLocale()));
this.auditService.track(AuditableAction.Description_PublicLookup, Map.ofEntries(
new AbstractMap.SimpleEntry<String, Object>("id", id),
@ -154,7 +156,7 @@ public class DescriptionController {
DescriptionQuery query = this.queryFactory.query(DescriptionQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).ids(id);
Description model = this.builderFactory.builder(DescriptionBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(fieldSet, query.firstAs(fieldSet));
if (model == null)
throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{id, Description.class.getSimpleName()}, LocaleContextHolder.getLocale()));
throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, Description.class.getSimpleName()}, LocaleContextHolder.getLocale()));
this.auditService.track(AuditableAction.Description_Lookup, Map.ofEntries(
new AbstractMap.SimpleEntry<String, Object>("id", id),
@ -208,7 +210,7 @@ public class DescriptionController {
}
@GetMapping("validate")
public List<DescriptionValidationResult> validate(@RequestParam(value="descriptionIds") List<UUID> descriptionIds) throws MyApplicationException, MyForbiddenException, MyNotFoundException, InvalidApplicationException {
public List<DescriptionValidationResult> validate(@RequestParam("descriptionIds") List<UUID> descriptionIds) throws MyApplicationException, MyForbiddenException, MyNotFoundException, InvalidApplicationException {
logger.debug(new MapLogEntry("validating" + Description.class.getSimpleName()).And("descriptionIds", descriptionIds));
this.censorFactory.censor(DescriptionCensor.class).censor(null, null);
@ -261,7 +263,7 @@ public class DescriptionController {
StorageFileEntity storageFile = this.descriptionService.getFieldFile(id, fileId);
byte[] file = this.storageFileService.readAsBytesSafe(id);
if (file == null) throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{id, StorageFile.class.getSimpleName()}, LocaleContextHolder.getLocale()));
if (file == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, StorageFile.class.getSimpleName()}, LocaleContextHolder.getLocale()));
this.auditService.track(AuditableAction.Description_GetFieldFile, Map.ofEntries(
new AbstractMap.SimpleEntry<String, Object>("id", id)
@ -289,4 +291,16 @@ public class DescriptionController {
return true;
}
@RequestMapping(method = RequestMethod.GET, value = {"/xml/export/{id}"}, produces = "application/xml")
public @ResponseBody ResponseEntity<byte[]> getXml(@PathVariable UUID id) throws JAXBException, ParserConfigurationException, IOException, InstantiationException, IllegalAccessException, SAXException, InvalidApplicationException {
logger.debug(new MapLogEntry("export" + DmpBlueprint.class.getSimpleName()).And("id", id));
ResponseEntity<byte[]> response = this.descriptionService.exportXml(id);
this.auditService.track(AuditableAction.DmpBlueprint_GetXml, Map.ofEntries(
new AbstractMap.SimpleEntry<String, Object>("id", id)
));
return response;
}
}

View File

@ -34,6 +34,7 @@ import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import org.xml.sax.SAXException;
import javax.crypto.BadPaddingException;
import javax.crypto.IllegalBlockSizeException;
@ -331,4 +332,16 @@ public class DmpController {
return true;
}
@RequestMapping(method = RequestMethod.GET, value = {"/xml/export/{id}"}, produces = "application/xml")
public @ResponseBody ResponseEntity<byte[]> getXml(@PathVariable UUID id) throws JAXBException, ParserConfigurationException, IOException, InstantiationException, IllegalAccessException, SAXException, InvalidApplicationException {
logger.debug(new MapLogEntry("export" + DmpBlueprint.class.getSimpleName()).And("id", id));
ResponseEntity<byte[]> response = this.dmpService.exportXml(id);
this.auditService.track(AuditableAction.DmpBlueprint_GetXml, Map.ofEntries(
new AbstractMap.SimpleEntry<String, Object>("id", id)
));
return response;
}
}

View File

@ -221,6 +221,11 @@ permissions:
clients: [ ]
allowAnonymous: false
allowAuthenticated: false
ExportDescription:
roles: []
clients: [ ]
allowAnonymous: false
allowAuthenticated: true
# Tag
BrowseTag:
roles:
@ -378,6 +383,7 @@ permissions:
ExportDescriptionTemplate:
roles:
- TenantAdmin
- Admin
- TenantDescriptionTemplateEditor
claims: [ ]
clients: [ ]
@ -442,15 +448,11 @@ permissions:
allowAnonymous: false
allowAuthenticated: false
ExportDmp:
roles:
- TenantAdmin
dmp:
roles:
- Owner
roles: [ ]
claims: [ ]
clients: [ ]
allowAnonymous: false
allowAuthenticated: false
allowAuthenticated: true
CreateNewVersionDmp:
roles:
- TenantAdmin
@ -532,6 +534,7 @@ permissions:
ExportDmpBlueprint:
roles:
- TenantAdmin
- Admin
clients: [ ]
allowAnonymous: false
allowAuthenticated: false

View File

@ -18,7 +18,7 @@ GOTENBERG_TAG=8.4.0
#Application configuration
DOCKER_REGISTRY=crepo.cite.gr/
PROFILE=staging
PROFILE=test
#port speficiations
SERVER_PORT=8080

View File

@ -17,140 +17,141 @@ services:
- opendmp-proxy-network
############################## OPENDMP APP #################################
# opendmp.backend:
# restart: unless-stopped
# cpus: 1
# mem_limit: 2048m
# environment:
# - PROFILE=${PROFILE}
# ports:
# - "8080"
# volumes:
# - opendmp/backend/config:/config
# - opendmp/backend/certificates:/certificates
# - opendmp/backend/i18n:/i18n
# - opendmp/backend/material:/material
# - opendmp/backend/Semantics.json:/Semantics.json
# - storage/backend:/storage
# - logs/backend:/logs
# networks:
# - opendmp-proxy-network
# - opendmp-backend-network
# - opendmp-plugins-network
# - opendmp-gotenberg-shared-network
# - opendmp-elastic-shared-network
# - opendmp-keycloak-shared-network
# - opendmp-postgres-shared-network
# - opendmp-rabbitmq-shared-network
opendmp.backend:
restart: unless-stopped
cpus: 1
mem_limit: 2048m
environment:
- PROFILE=${PROFILE}
ports:
- "8080"
volumes:
- ./opendmp/backend/config:/config
- ./opendmp/backend/certificates:/certificates
- ./opendmp/backend/i18n:/i18n
- ./opendmp/backend/material:/material
- ./opendmp/backend/Semantics.json:/Semantics.json
- ./storage/opendmp/backend:/storage
- ./logs/opendmp/backend:/logs
networks:
- opendmp-proxy-network
- opendmp-backend-network
- opendmp-plugins-network
- opendmp-gotenberg-shared-network
- opendmp-elastic-shared-network
- opendmp-keycloak-shared-network
- opendmp-postgres-shared-network
- opendmp-rabbitmq-shared-network
# opendmp.frontend:
# restart: unless-stopped
# cpus: 1
# mem_limit: 2048m
# ports:
# - "8080"
# volumes:
# - opendmp/webapp/config.json:/usr/share/nginx/html/assets/config/config.json
# - opendmp/webapp/nginx.conf:/etc/nginx/nginx.conf
# - opendmp/webapp/WebAppNginx.conf:/etc/nginx/conf.d/default.conf
# networks:
# - opendmp-proxy-network
opendmp.frontend:
restart: unless-stopped
cpus: 1
mem_limit: 2048m
ports:
- "8080"
volumes:
- ./opendmp/frontend/config.json:/usr/share/nginx/html/assets/config/config.json
- ./opendmp/frontend/nginx.conf:/etc/nginx/nginx.conf
- ./opendmp/frontend/WebAppNginx.conf:/etc/nginx/conf.d/default.conf
networks:
- opendmp-proxy-network
# opendmp.notification:
# cpus: 1
# mem_limit: 1024m
# restart: unless-stopped
# ports:
# - "8080"
# environment:
# - PROFILE=${PROFILE}
# volumes:
# - opendmp/notification-api/config:/config
# - opendmp/notification-api/messages:/messages
# - opendmp/notification-api/notification_templates:/notification_templates
# - logs/notification-api:/logs
# networks:
# - opendmp-proxy-network
# - opendmp-backend-network
# - opendmp-plugins-network
# - opendmp-rabbitmq-shared-network
# - opendmp-keycloak-shared-network
# - opendmp-postgres-shared-network
opendmp.notification:
cpus: 1
mem_limit: 1024m
restart: unless-stopped
ports:
- "8080"
environment:
- PROFILE=${PROFILE}
volumes:
- ./opendmp/notification/config:/config
- ./opendmp/notification/messages:/messages
- ./opendmp/notification/notification_templates:/notification_templates
- ./logs/opendmp/notification-api:/logs
networks:
- opendmp-proxy-network
- opendmp-backend-network
- opendmp-plugins-network
- opendmp-rabbitmq-shared-network
- opendmp-keycloak-shared-network
- opendmp-postgres-shared-network
# opendmp.annotation:
# cpus: 1
# mem_limit: 1024m
# restart: unless-stopped
# ports:
# - "8080"
# environment:
# - PROFILE=${PROFILE}
# volumes:
# - opendmp/annotation-api/config:/config
# - opendmp/annotation-api/messages:/messages
# - logs/annotation-api:/logs
# networks:
# - opendmp-proxy-network
# - opendmp-backend-network
# - opendmp-plugins-network
# - opendmp-rabbitmq-shared-network
# - opendmp-keycloak-shared-network
# - opendmp-postgres-shared-network
opendmp.annotation:
cpus: 1
mem_limit: 1024m
restart: unless-stopped
ports:
- "8080"
environment:
- PROFILE=${PROFILE}
volumes:
- ./opendmp/annotation/config:/config
- ./opendmp/annotation/messages:/messages
- ./logs/opendmp/annotation-api:/logs
networks:
- opendmp-proxy-network
- opendmp-backend-network
- opendmp-plugins-network
- opendmp-rabbitmq-shared-network
- opendmp-keycloak-shared-network
- opendmp-postgres-shared-network
# ############################## FILE-TRANSFORMER #################################
# opendmp.file.transformer.docx:
# restart: unless-stopped
# cpus: 1
# mem_limit: 1024m
# expose:
# - "8080"
# environment:
# - SERVER_PORT=${SERVER_PORT}
# - PROFILE=${PROFILE}
# volumes:
# - opendmp/file-transformer-docx/config:/config
# - logs/file-transformer-docx:/logs
# - storage/file-transformer-docx:/storage
# networks:
# - opendmp-backend-network
# - opendmp-plugins-network
# - opendmp-gotenberg-shared-network
opendmp.file.transformer.docx:
restart: unless-stopped
cpus: 1
mem_limit: 1024m
expose:
- "8080"
environment:
- SERVER_PORT=${SERVER_PORT}
- PROFILE=${PROFILE}
volumes:
- ./opendmp/file-transformer-docx/config:/config
- ./logs/opendmp/file-transformer-docx:/logs
- ./storage/opendmp/file-transformer-docx:/storage
networks:
- opendmp-backend-network
- opendmp-plugins-network
- opendmp-gotenberg-shared-network
# opendmp.file.transformer.rdajson:
# restart: unless-stopped
# cpus: 1
# mem_limit: 1024m
# expose:
# - "8080"
# environment:
# - SERVER_PORT=${SERVER_PORT}
# - PROFILE=${PROFILE}
# volumes:
# - opendmp/file-transformer-rda-json/config:/config
# - opendmp/file-transformer-rda-json/internal:/internal
# - logs/file-transformer-rda-json:/logs
# - storage/file-transformer-rda-json:/storage
# networks:
# - opendmp-backend-network
# - opendmp-plugins-network
opendmp.file.transformer.rdajson:
restart: unless-stopped
cpus: 1
mem_limit: 1024m
expose:
- "8080"
environment:
- SERVER_PORT=${SERVER_PORT}
- PROFILE=${PROFILE}
volumes:
- ./opendmp/file-transformer-rda-json/config:/config
- ./opendmp/file-transformer-rda-json/internal:/internal
- ./logs/opendmp/file-transformer-rda-json:/logs
- ./storage/opendmp/file-transformer-rda-json:/storage
networks:
- opendmp-backend-network
- opendmp-plugins-network
############################## ZENODO #######################################
# opendmp.zenodo:
# restart: unless-stopped
# cpus: 1
# mem_limit: 1024m
# expose:
# - "8080"
# environment:
# - PROFILE=${PROFILE}
# volumes:
# - /opendmp/zenodo/config:/config
# - /opendmp/zenodo/zenodo.jpg:/zenodo.jpg
# - /logs/zenodo:/logs
# networks:
# - opendmp-plugins-network
# - opendmp-keycloak-shared-network
opendmp.zenodo:
restart: unless-stopped
cpus: 1
mem_limit: 1024m
expose:
- "8080"
environment:
- PROFILE=${PROFILE}
volumes:
- ./opendmp/zenodo/config:/config
- ./opendmp/zenodo/zenodo.jpg:/zenodo.jpg
- ./storage/opendmp/zenodo:/storage
- ./logs/opendmp/zenodo:/logs
networks:
- opendmp-plugins-network
- opendmp-keycloak-shared-network
############################## POSTGRES 16 #################################
@ -175,155 +176,56 @@ services:
retries: 5
################################# ELK #################################################
# elk.setup:
# profiles:
# - setup
# build:
# context: ./elk/setup/
# args:
# ELASTIC_VERSION: ${ELASTIC_VERSION}
# init: true
# env_file:
# - elk/elk.env
# volumes:
# - ./setup/entrypoint.sh:/entrypoint.sh:ro,Z
# - ./setup/lib.sh:/lib.sh:ro,Z
# - ./setup/roles:/roles:ro,Z
# environment:
# ELASTIC_PASSWORD: ${ELASTIC_PASSWORD:-}
# LOGSTASH_INTERNAL_PASSWORD: ${LOGSTASH_INTERNAL_PASSWORD:-}
# KIBANA_SYSTEM_PASSWORD: ${KIBANA_SYSTEM_PASSWORD:-}
# METRICBEAT_INTERNAL_PASSWORD: ${METRICBEAT_INTERNAL_PASSWORD:-}
# FILEBEAT_INTERNAL_PASSWORD: ${FILEBEAT_INTERNAL_PASSWORD:-}
# HEARTBEAT_INTERNAL_PASSWORD: ${HEARTBEAT_INTERNAL_PASSWORD:-}
# MONITORING_INTERNAL_PASSWORD: ${MONITORING_INTERNAL_PASSWORD:-}
# BEATS_SYSTEM_PASSWORD: ${BEATS_SYSTEM_PASSWORD:-}
# networks:
# - opendmp-elastic-network
# opendmp.elasticsearch:
# restart: unless-stopped
# cpus: 2
# mem_limit: 1024m
# init: true
# env_file:
# - elk/elk.env
# environment:
# ES_JAVA_OPTS: -Xmx512m -Xms512m
# node.name: elasticsearch
# ELASTIC_PASSWORD: ${ELASTIC_PASSWORD:-}
# ulimits:
# nproc: 65535
# memlock:
# soft: -1
# hard: -1
# volumes:
# - ./elk/config-elk/elasticsearch/config/log4j2.properties:/usr/share/elasticsearch/config/log4j2.properties:ro
# - ./elk/config-elk/elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml:ro
# - ./elk/data-elk/elasticsearch-data:/usr/share/elasticsearch/data
# - ./elk/data-elk/elasticsearch-log:/usr/share/elasticsearch/logs
# expose:
# - "9200"
# - "9300"
# networks:
# - opendmp-elastic-network
# - opendmp-elastic-shared-network
# healthcheck:
# test: curl --cacert /usr/share/elasticsearch/config/certificates/ca/ca.crt -s https://localhost:9200 >/dev/null; if [[ $$? == 52 ]]; then echo 0; else echo 1; fi
# interval: 30s
# timeout: 10s
# retries: 5
# opendmp.kibana:
# restart: unless-stopped
# cpus: 2
# mem_limit: 1024m
# ulimits:
# memlock:
# soft: -1
# hard: -1
# environment:
# - xpack.license.self_generated.type=basic
# - xpack.security.enabled=true
# volumes:
# - ./elk/config-elk/kibana/config:/usr/share/kibana/config:ro
# expose:
# - "5601"
# networks:
# - opendmp-elastic-network
# logstash:
# build:
# context: logstash/
# args:
# ELASTIC_VERSION: ${ELASTIC_VERSION}
# volumes:
# - ./logstash/config/logstash.yml:/usr/share/logstash/config/logstash.yml:ro,Z
# - ./logstash/pipeline:/usr/share/logstash/pipeline:ro,Z
# ports:
# - 5044:5044
# - 50000:50000/tcp
# - 50000:50000/udp
# - 9600:9600
# environment:
# LS_JAVA_OPTS: -Xms256m -Xmx256m
# LOGSTASH_INTERNAL_PASSWORD: ${LOGSTASH_INTERNAL_PASSWORD:-}
# networks:
# - elk
# depends_on:
# - elasticsearch
# restart: unless-stopped
# # - /elk/data-elk/logstash-log:/usr/share/logstash/logs
# opendmp.filebeat:
# restart: unless-stopped
# cpus: 1
# mem_limit: 1024m
# ulimits:
# memlock:
# soft: -1
# hard: -1
# volumes:
# - /var/run/docker.sock:/host_docker/docker.sock
# - /var/lib/docker:/host_docker/var/lib/docker
# - ./filebeat.yml:/usr/share/filebeat/filebeat.yml
# command: ["--strict.perms=false"]
# ulimits:
# memlock:
# soft: -1
# hard: -1
# stdin_open: true
# tty: true
# network_mode: bridge
# deploy:
# mode: global
# logging:
# driver: "json-file"
# options:
# max-size: "10m"
# max-file: "50"
################################# ELASTICSEARCH #################################################
opendmp.elasticsearch:
restart: unless-stopped
cpus: 2
mem_limit: 1024m
env_file:
- elk/elk.env
environment:
ES_JAVA_OPTS: -Xmx512m -Xms512m
ulimits:
nproc: 65535
memlock:
soft: -1
hard: -1
volumes:
- ./elk/elasticsearch/index_init.sh:/usr/share/elasticsearch/config/index_init.sh
- ./elk/elasticsearch/log4j2.properties:/usr/share/elasticsearch/config/log4j2.properties:ro
- ./elk/elasticsearch/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml:ro
- ./storage/elasticsearch:/usr/share/elasticsearch/data
- ./logs/elasticsearch:/usr/share/elasticsearch/logs
expose:
- "9200"
- "9300"
networks:
- opendmp-elastic-shared-network
healthcheck:
test: curl -s http://localhost:9200 >/dev/null; if [[ $$? == 52 ]]; then echo 0; else echo 1; fi
interval: 30s
timeout: 10s
retries: 5
############################## KEYCLOAK ###############################################
opendmp.keycloak:
restart: unless-stopped
command: ["start-dev", "--log=console,file", "--log-file=/tmp/logs/keycloak.log", "--import-realm"]
cpus: 1
mem_limit: 1024M
env_file:
- keycloak/keycloak.env
environment:
- JAVA_OPTS_APPEND="-Djava.net.preferIPv4Stack=true"
volumes:
- ./logs/keycloak:/tmp/logs
- ./keycloak/imports/opendmp-realm.json:/opt/keycloak/data/import/opendmp-realm.json
expose:
- "8080"
networks:
- opendmp-proxy-network
- opendmp-postgres-shared-network
- opendmp-keycloak-shared-network
# opendmp.keycloak:
# restart: unless-stopped
# command: ["start-dev", "--log=console,file", "--log-file=/tmp/logs/keycloak.log", "--import-realm"]
# cpus: 2
# mem_limit: 2048M
# env_file:
# - keycloak/keycloak.env
# environment:
# - JAVA_OPTS_APPEND="-Djava.net.preferIPv4Stack=true"
# volumes:
# - ./logs/keycloak:/tmp/logs
# - ./keycloak/imports/opendmp-realm.json:/opt/keycloak/data/import/opendmp-realm.json
# expose:
# - "8080"
# networks:
# - opendmp-proxy-network
# - opendmp-postgres-shared-network
# - opendmp-keycloak-shared-network
############################## RABBITMQ ###############################################
opendmp.rabbitmq:
@ -345,6 +247,7 @@ services:
############################## GOTENBERG ##############################################
opendmp.gotenberg:
cpus: 2
mem_limit: 2048m
restart: unless-stopped
expose:
@ -356,8 +259,6 @@ services:
- opendmp-gotenberg-shared-network
networks:
opendmp-elastic-network:
name: opendmp-elastic-network
opendmp-proxy-network:
name: opendmp-proxy-network
opendmp-backend-network:

View File

@ -3,100 +3,75 @@ services:
opendmp.proxy:
container_name: opendmp.proxy
image: nginx:${PROXY_TAG}
depends_on:
- opendmp.keycloak
# - opendmp.kibana
# depends_on:
# - opendmp.keycloak
# ############################## OPENDMP APP #################################
############################## OPENDMP APP #################################
# opendmp.frontend:
# container_name: opendmp.frontend
# image: ${DOCKER_REGISTRY}open-dmp-webapp:${MAIN_APP_TAG}
# depends_on:
# - opendmp.backend
# - opendmp.notification
# - opendmp.annotation
opendmp.frontend:
container_name: opendmp.frontend
image: ${DOCKER_REGISTRY}open-dmp-webapp:${MAIN_APP_TAG}
depends_on:
- opendmp.backend
- opendmp.notification
- opendmp.annotation
# opendmp.backend:
# container_name: opendmp.backend
# image: ${DOCKER_REGISTRY}open-dmp-api:${MAIN_APP_TAG}
# depends_on:
# - opendmp.postgres
opendmp.backend:
container_name: opendmp.backend
image: ${DOCKER_REGISTRY}open-dmp-api:${MAIN_APP_TAG}
depends_on:
- opendmp.postgres
# opendmp.notification:
# container_name: opendmp.notification
# image: ${DOCKER_REGISTRY}open-dmp-notification-api:${NOTIFICATION_APP_TAG}
# depends_on:
# - opendmp.postgres
opendmp.notification:
container_name: opendmp.notification
image: ${DOCKER_REGISTRY}open-dmp-notification-api:${NOTIFICATION_APP_TAG}
depends_on:
- opendmp.postgres
# opendmp.annotation:
# container_name: opendmp.annotation
# image: ${DOCKER_REGISTRY}open-dmp-annotation-api:${ANNOTATION_APP_TAG}
# depends_on:
# - opendmp.postgres
opendmp.annotation:
container_name: opendmp.annotation
image: ${DOCKER_REGISTRY}open-dmp-annotation-api:${ANNOTATION_APP_TAG}
depends_on:
- opendmp.postgres
# ############################## FILE-TRANSFORMERS #######################################
# opendmp.file.transformer.docx:
# container_name: opendmp.file.transformer.docx
# image: ${DOCKER_REGISTRY}file-transformation-docx-api:${DOCX_APP_TAG}
# depends_on:
# - opendmp.backend
opendmp.file.transformer.docx:
container_name: opendmp.file.transformer.docx
image: ${DOCKER_REGISTRY}file-transformation-docx-api:${DOCX_APP_TAG}
depends_on:
- opendmp.backend
# opendmp.file.transformer.rdajson:
# container_name: opendmp.file.transformer.rdajson
# image: ${DOCKER_REGISTRY}file-transformation-rda-json-api:${JSON_APP_TAG}
# depends_on:
# - opendmp.backend
opendmp.file.transformer.rdajson:
container_name: opendmp.file.transformer.rdajson
image: ${DOCKER_REGISTRY}file-transformation-rda-json-api:${JSON_APP_TAG}
depends_on:
- opendmp.backend
################################ ZENODO ###############################################
# opendmp.zenodo:
# container_name: opendmp.zenodo
# image: ${DOCKER_REGISTRY}repository-deposit-zenodo:${ZENODO_APP_TAG}
# depends_on:
# - opendmp.backend
opendmp.zenodo:
container_name: opendmp.zenodo
image: ${DOCKER_REGISTRY}repository-deposit-zenodo:${ZENODO_APP_TAG}
depends_on:
- opendmp.backend
############################## POSTGRES 16 ############################################
opendmp.postgres:
container_name: opendmp.postgres
image: postgres:${POSTGRES_TAG}
################################# ELK #################################################
# elk.setup:
# container_name: elk.setup
# depends_on:
# - opendmp.elasticsearch
# opendmp.elasticsearch:
# container_name: opendmp.elasticsearch
# image: docker.elastic.co/elasticsearch/elasticsearch:${ELK_TAG}
# opendmp.kibana:
# container_name: opendmp.kibana
# image: docker.elastic.co/kibana/kibana:${ELK_TAG}
# depends_on:
# - opendmp.elasticsearch
# opendmp.logstash:
# container_name: opendmp.logstash
# image: docker.elastic.co/beats/filebeat:${ELK_TAG}
# depends_on:
# - opendmp.elasticsearch
# opendmp.filebeat:
# container_name: opendmp.filebeat
# image: docker.elastic.co/logstash/logstash:${ELK_TAG}
# depends_on:
# - opendmp.elasticsearch
# - opendmp.logstash
################################# ELASTICSEARCH #################################################
opendmp.elasticsearch:
container_name: opendmp.elasticsearch
image: docker.elastic.co/elasticsearch/elasticsearch:${ELK_TAG}
############################## KEYCLOAK ###############################################
opendmp.keycloak:
container_name: opendmp.keycloak
image: quay.io/keycloak/keycloak:${KEYCLOAK_TAG}
depends_on:
opendmp.postgres:
condition: service_healthy
# opendmp.keycloak:
# container_name: opendmp.keycloak
# image: quay.io/keycloak/keycloak:${KEYCLOAK_TAG}
# depends_on:
# opendmp.postgres:
# condition: service_healthy
############################## RABBITMQ ###############################################
opendmp.rabbitmq:

View File

@ -3,3 +3,9 @@ cluster.name: opendmp-cluster
network.host: 0.0.0.0
discovery.type: single-node
node.name: elasticsearch
xpack.license.self_generated.type: trial
xpack.security.enabled: true
xpack.security.authc.api_key.enabled: true
xpack.monitoring.collection.enabled: true

View File

@ -0,0 +1,50 @@
#!/bin/bash
echo "Elasticsearch is now available. Proceeding with initialization..."
echo "Creating Elasticsearch indexes, roles, and users..."
# Command to create the "plans" index
curl -XPUT "http://localhost:9200/plans" -u elastic:elastic -H 'Content-Type: application/json' -d '{
"settings": {
"number_of_shards": 1,
"number_of_replicas": 1
},
"mappings": {
"properties": {
"title": { "type": "text" },
"description": { "type": "text" },
"price": { "type": "float" },
"date_added": { "type": "date" }
}
}
}'
# Command to create the "descriptions" index
curl -XPUT "http://localhost:9200/descriptions" -u elastic:elastic -H 'Content-Type: application/json' -d '{
"settings": {
"number_of_shards": 1,
"number_of_replicas": 1
},
"mappings": {
"properties": {
"product_id": { "type": "keyword" },
"description_text": { "type": "text" },
"language": { "type": "keyword" }
}
}
}'
curl -XPOST "localhost:9200/_security/role/opendmp-api-test" -u elastic:elastic -H 'Content-Type: application/json' -d '{
"indices": [
{
"names": [ "opendmp-*-test" ],
"privileges": [ "all" ]
}
]
}'
curl -XPOST "localhost:9200/_security/user/opendmp-api-test?pretty" -u elastic:elastic -H 'Content-Type: application/json' -d'
{
"password" : "your_password_here",
"roles" : [ "opendmp-api-test" ]
}'

View File

@ -1,4 +1,4 @@
#https://github.com/elastic/elasticsearch/blob/7.4/distribution/src/config/log4j2.properties
#http://github.com/elastic/elasticsearch/blob/7.4/distribution/src/config/log4j2.properties
status = error

View File

@ -1,8 +1 @@
ELASTIC_PASSWORD= elastic
KIBANA_SYSTEM_PASSWORD= kibana
LOGSTASH_INTERNAL_PASSWORD= logstash
FILEBEAT_INTERNAL_PASSWORD= filebeat
METRICBEAT_INTERNAL_PASSWORD=''
HEARTBEAT_INTERNAL_PASSWORD=''
MONITORING_INTERNAL_PASSWORD=''
BEATS_SYSTEM_PASSWORD=''

View File

@ -1,8 +0,0 @@
---
server.name: opendmp.kibana
server.host: 0.0.0.0
elasticsearch.hosts: [ "http://opendmp.elasticsearch:9200" ]
elasticsearch.username: kibana
elasticsearch.password: ${KIBANA_SYSTEM_PASSWORD}

View File

@ -1,4 +0,0 @@
---
http.host: 0.0.0.0
node.name: logstash

View File

@ -1,119 +0,0 @@
#!/usr/bin/env bash
set -eu
set -o pipefail
source "${BASH_SOURCE[0]%/*}"/lib.sh
# --------------------------------------------------------
# Users declarations
declare -A users_passwords
users_passwords=(
[logstash_internal]="${LOGSTASH_INTERNAL_PASSWORD:-}"
[kibana_system]="${KIBANA_SYSTEM_PASSWORD:-}"
[metricbeat_internal]="${METRICBEAT_INTERNAL_PASSWORD:-}"
[filebeat_internal]="${FILEBEAT_INTERNAL_PASSWORD:-}"
[heartbeat_internal]="${HEARTBEAT_INTERNAL_PASSWORD:-}"
[monitoring_internal]="${MONITORING_INTERNAL_PASSWORD:-}"
[beats_system]="${BEATS_SYSTEM_PASSWORD=:-}"
)
declare -A users_roles
users_roles=(
[logstash_internal]='logstash_writer'
[metricbeat_internal]='metricbeat_writer'
[filebeat_internal]='filebeat_writer'
[heartbeat_internal]='heartbeat_writer'
[monitoring_internal]='remote_monitoring_collector'
)
# --------------------------------------------------------
# Roles declarations
declare -A roles_files
roles_files=(
[logstash_writer]='logstash_writer.json'
[metricbeat_writer]='metricbeat_writer.json'
[filebeat_writer]='filebeat_writer.json'
[heartbeat_writer]='heartbeat_writer.json'
)
# --------------------------------------------------------
log 'Waiting for availability of Elasticsearch. This can take several minutes.'
declare -i exit_code=0
wait_for_elasticsearch || exit_code=$?
if ((exit_code)); then
case $exit_code in
6)
suberr 'Could not resolve host. Is Elasticsearch running?'
;;
7)
suberr 'Failed to connect to host. Is Elasticsearch healthy?'
;;
28)
suberr 'Timeout connecting to host. Is Elasticsearch healthy?'
;;
*)
suberr "Connection to Elasticsearch failed. Exit code: ${exit_code}"
;;
esac
exit $exit_code
fi
sublog 'Elasticsearch is running'
log 'Waiting for initialization of built-in users'
wait_for_builtin_users || exit_code=$?
if ((exit_code)); then
suberr 'Timed out waiting for condition'
exit $exit_code
fi
sublog 'Built-in users were initialized'
for role in "${!roles_files[@]}"; do
log "Role '$role'"
declare body_file
body_file="${BASH_SOURCE[0]%/*}/roles/${roles_files[$role]:-}"
if [[ ! -f "${body_file:-}" ]]; then
sublog "No role body found at '${body_file}', skipping"
continue
fi
sublog 'Creating/updating'
ensure_role "$role" "$(<"${body_file}")"
done
for user in "${!users_passwords[@]}"; do
log "User '$user'"
if [[ -z "${users_passwords[$user]:-}" ]]; then
sublog 'No password defined, skipping'
continue
fi
declare -i user_exists=0
user_exists="$(check_user_exists "$user")"
if ((user_exists)); then
sublog 'User exists, setting password'
set_user_password "$user" "${users_passwords[$user]}"
else
if [[ -z "${users_roles[$user]:-}" ]]; then
suberr ' No role defined, skipping creation'
continue
fi
sublog 'User does not exist, creating'
create_user "$user" "${users_passwords[$user]}" "${users_roles[$user]}"
fi
done

View File

@ -1,240 +0,0 @@
#!/usr/bin/env bash
# Log a message.
function log {
echo "[+] $1"
}
# Log a message at a sub-level.
function sublog {
echo "$1"
}
# Log an error.
function err {
echo "[x] $1" >&2
}
# Log an error at a sub-level.
function suberr {
echo "$1" >&2
}
# Poll the 'elasticsearch' service until it responds with HTTP code 200.
function wait_for_elasticsearch {
local elasticsearch_host="${ELASTICSEARCH_HOST:-elasticsearch}"
local -a args=( '-s' '-D-' '-m15' '-w' '%{http_code}' "http://${elasticsearch_host}:9200/" )
if [[ -n "${ELASTIC_PASSWORD:-}" ]]; then
args+=( '-u' "elastic:${ELASTIC_PASSWORD}" )
fi
local -i result=1
local output
# retry for max 300s (60*5s)
for _ in $(seq 1 60); do
local -i exit_code=0
output="$(curl "${args[@]}")" || exit_code=$?
if ((exit_code)); then
result=$exit_code
fi
if [[ "${output: -3}" -eq 200 ]]; then
result=0
break
fi
sleep 5
done
if ((result)) && [[ "${output: -3}" -ne 000 ]]; then
echo -e "\n${output::-3}"
fi
return $result
}
# Poll the Elasticsearch users API until it returns users.
function wait_for_builtin_users {
local elasticsearch_host="${ELASTICSEARCH_HOST:-elasticsearch}"
local -a args=( '-s' '-D-' '-m15' "http://${elasticsearch_host}:9200/_security/user?pretty" )
if [[ -n "${ELASTIC_PASSWORD:-}" ]]; then
args+=( '-u' "elastic:${ELASTIC_PASSWORD}" )
fi
local -i result=1
local line
local -i exit_code
local -i num_users
# retry for max 30s (30*1s)
for _ in $(seq 1 30); do
num_users=0
# read exits with a non-zero code if the last read input doesn't end
# with a newline character. The printf without newline that follows the
# curl command ensures that the final input not only contains curl's
# exit code, but causes read to fail so we can capture the return value.
# Ref. https://unix.stackexchange.com/a/176703/152409
while IFS= read -r line || ! exit_code="$line"; do
if [[ "$line" =~ _reserved.+true ]]; then
(( num_users++ ))
fi
done < <(curl "${args[@]}"; printf '%s' "$?")
if ((exit_code)); then
result=$exit_code
fi
# we expect more than just the 'elastic' user in the result
if (( num_users > 1 )); then
result=0
break
fi
sleep 1
done
return $result
}
# Verify that the given Elasticsearch user exists.
function check_user_exists {
local username=$1
local elasticsearch_host="${ELASTICSEARCH_HOST:-elasticsearch}"
local -a args=( '-s' '-D-' '-m15' '-w' '%{http_code}'
"http://${elasticsearch_host}:9200/_security/user/${username}"
)
if [[ -n "${ELASTIC_PASSWORD:-}" ]]; then
args+=( '-u' "elastic:${ELASTIC_PASSWORD}" )
fi
local -i result=1
local -i exists=0
local output
output="$(curl "${args[@]}")"
if [[ "${output: -3}" -eq 200 || "${output: -3}" -eq 404 ]]; then
result=0
fi
if [[ "${output: -3}" -eq 200 ]]; then
exists=1
fi
if ((result)); then
echo -e "\n${output::-3}"
else
echo "$exists"
fi
return $result
}
# Set password of a given Elasticsearch user.
function set_user_password {
local username=$1
local password=$2
local elasticsearch_host="${ELASTICSEARCH_HOST:-elasticsearch}"
local -a args=( '-s' '-D-' '-m15' '-w' '%{http_code}'
"http://${elasticsearch_host}:9200/_security/user/${username}/_password"
'-X' 'POST'
'-H' 'Content-Type: application/json'
'-d' "{\"password\" : \"${password}\"}"
)
if [[ -n "${ELASTIC_PASSWORD:-}" ]]; then
args+=( '-u' "elastic:${ELASTIC_PASSWORD}" )
fi
local -i result=1
local output
output="$(curl "${args[@]}")"
if [[ "${output: -3}" -eq 200 ]]; then
result=0
fi
if ((result)); then
echo -e "\n${output::-3}\n"
fi
return $result
}
# Create the given Elasticsearch user.
function create_user {
local username=$1
local password=$2
local role=$3
local elasticsearch_host="${ELASTICSEARCH_HOST:-elasticsearch}"
local -a args=( '-s' '-D-' '-m15' '-w' '%{http_code}'
"http://${elasticsearch_host}:9200/_security/user/${username}"
'-X' 'POST'
'-H' 'Content-Type: application/json'
'-d' "{\"password\":\"${password}\",\"roles\":[\"${role}\"]}"
)
if [[ -n "${ELASTIC_PASSWORD:-}" ]]; then
args+=( '-u' "elastic:${ELASTIC_PASSWORD}" )
fi
local -i result=1
local output
output="$(curl "${args[@]}")"
if [[ "${output: -3}" -eq 200 ]]; then
result=0
fi
if ((result)); then
echo -e "\n${output::-3}\n"
fi
return $result
}
# Ensure that the given Elasticsearch role is up-to-date, create it if required.
function ensure_role {
local name=$1
local body=$2
local elasticsearch_host="${ELASTICSEARCH_HOST:-elasticsearch}"
local -a args=( '-s' '-D-' '-m15' '-w' '%{http_code}'
"http://${elasticsearch_host}:9200/_security/role/${name}"
'-X' 'POST'
'-H' 'Content-Type: application/json'
'-d' "$body"
)
if [[ -n "${ELASTIC_PASSWORD:-}" ]]; then
args+=( '-u' "elastic:${ELASTIC_PASSWORD}" )
fi
local -i result=1
local output
output="$(curl "${args[@]}")"
if [[ "${output: -3}" -eq 200 ]]; then
result=0
fi
if ((result)); then
echo -e "\n${output::-3}\n"
fi
return $result
}

View File

@ -1,20 +0,0 @@
{
"cluster": [
"manage_ilm",
"manage_index_templates",
"manage_ingest_pipelines",
"monitor",
"read_pipeline"
],
"indices": [
{
"names": [
"filebeat-*"
],
"privileges": [
"create_doc",
"manage"
]
}
]
}

View File

@ -1,18 +0,0 @@
{
"cluster": [
"manage_ilm",
"manage_index_templates",
"monitor"
],
"indices": [
{
"names": [
"heartbeat-*"
],
"privileges": [
"create_doc",
"manage"
]
}
]
}

View File

@ -1,33 +0,0 @@
{
"cluster": [
"manage_index_templates",
"monitor",
"manage_ilm"
],
"indices": [
{
"names": [
"logs-generic-default",
"logstash-*",
"ecs-logstash-*"
],
"privileges": [
"write",
"create",
"create_index",
"manage",
"manage_ilm"
]
},
{
"names": [
"logstash",
"ecs-logstash"
],
"privileges": [
"write",
"manage"
]
}
]
}

View File

@ -1,19 +0,0 @@
{
"cluster": [
"manage_ilm",
"manage_index_templates",
"monitor"
],
"indices": [
{
"names": [
".monitoring-*-mb",
"metricbeat-*"
],
"privileges": [
"create_doc",
"manage"
]
}
]
}

View File

@ -1,23 +0,0 @@
-----BEGIN CERTIFICATE-----
MIIDvzCCAqegAwIBAgIUL9YHiVgQxrFPSGq4nMe6KbMznaowDQYJKoZIhvcNAQEL
BQAwbzELMAkGA1UEBhMCR1IxDzANBgNVBAgMBkF0dGljYTEPMA0GA1UEBwwGQXRo
ZW5zMQwwCgYDVQQKDANOTEcxDjAMBgNVBAsMBU9TRFlFMSAwHgYDVQQDDBdubGct
b3NkeWUubG9jYWwuY2l0ZS5ncjAeFw0yMDExMjcxODMzNTJaFw0yMTExMjcxODMz
NTJaMG8xCzAJBgNVBAYTAkdSMQ8wDQYDVQQIDAZBdHRpY2ExDzANBgNVBAcMBkF0
aGVuczEMMAoGA1UECgwDTkxHMQ4wDAYDVQQLDAVPU0RZRTEgMB4GA1UEAwwXbmxn
LW9zZHllLmxvY2FsLmNpdGUuZ3IwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK
AoIBAQCYsoKFVSg67/NckladOuqFDeJWMYOYa1MhMTCpLL5UksoYM+BiKbWvXmRH
AGZAjIO2sGf6vTFO7SN6LdjCRRqJfS9zQVKHZKUdvfxkGnPaAIqWAwQkM4fFUlZF
e5jsGd7owCoEEFAirJpz53z27Xa0En5CLSI5eLGBqLNz31zi1Rdh5BPLAtgLGEoS
kOhlDXwgGtTmBAS82sXRr51J6DQr5stKsN68+DCwJiY6GU3Kun2Kyl+bepkEtHLM
SOxe5Du3F93kC4TwFckG+JSLrq8neXNbyoBOLYNxPzAGLg9vmD7nX02hFfONdX5p
zeGMD+0oyujL0HtH8nKkv9OtvYP1AgMBAAGjUzBRMB0GA1UdDgQWBBTrvPpWYBX6
spVt2gpkpDW6yzrBZzAfBgNVHSMEGDAWgBTrvPpWYBX6spVt2gpkpDW6yzrBZzAP
BgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IBAQAqfOJiorxiszfKKeD2
eVda5pBU+qDnUOewRKizAktPm7V+cjM7bTEkmEHQ/oKlsT0FX5nsa8YfZCYgdotd
cDWC9KqYy9itXPESoJIZ/gMJ57v1BaVDly8tHedXEltob9ywrUyf7OF55eP0fWwb
AK90PfnRsxaurVYU5nfI9U/2jpi/LdsEYlJ7zUj7KM/Z2MwPA+be4EqjNcYLT/NB
bavhjLgZNoTkI7wYOJug+ouPn6xJJcj06RS1Q4FxtfrsnAuT+L33HemUludEUE00
TJwYWJN9hOgbyzTf5EsHxxME1gIhcYLYPMeBr9VIyJxdAEuuDJbn87oOB094sCA+
nvpp
-----END CERTIFICATE-----

View File

@ -1,28 +0,0 @@
-----BEGIN PRIVATE KEY-----
MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCYsoKFVSg67/Nc
kladOuqFDeJWMYOYa1MhMTCpLL5UksoYM+BiKbWvXmRHAGZAjIO2sGf6vTFO7SN6
LdjCRRqJfS9zQVKHZKUdvfxkGnPaAIqWAwQkM4fFUlZFe5jsGd7owCoEEFAirJpz
53z27Xa0En5CLSI5eLGBqLNz31zi1Rdh5BPLAtgLGEoSkOhlDXwgGtTmBAS82sXR
r51J6DQr5stKsN68+DCwJiY6GU3Kun2Kyl+bepkEtHLMSOxe5Du3F93kC4TwFckG
+JSLrq8neXNbyoBOLYNxPzAGLg9vmD7nX02hFfONdX5pzeGMD+0oyujL0HtH8nKk
v9OtvYP1AgMBAAECggEAajxoCpPAtaCT1GgL0sBWwdNzETzJrZWd9I3gqRL0KKsn
58bP6fvS5/voEG36thYM3WHGNfDDCYJ7GFolYKPrXpS2Gp3r6T7gkdzIaGzvBVEz
GkNm8jjX0TUDyLvBHSKyr4RitwkSd81WeCUqEDIOUCI9rZTxJsMN3IOetpNEcJt1
xR2kVuTkQiIs5evQCQ2arqTf/VQFb7FuVTtmrOggsTn33FnrUDujTAAsbEoglgvw
w1A2AYtMdGcrFIsUMJFdECkQGPVeqzKHddi1k1hv3DmOx5Rf4xJCdTL9ZYzbU1lw
ydSAM88UA7MTZWNYCGb4HjqEeDRnMUN/Qbi4f80PgQKBgQDKWLxsCBBgFRoH6nlh
TmBwYOmdQkBE09txpcpAFVZVv3eq/syZnT5+pcyj7EUexhu/p78UHPPkXDfnIKKe
C+7VOEmSM9cPMZU6cqB1x4+YZkyiU1rPD2SG46ZxBBTKsPWauJNvtuhW3K6kwMCT
ECiwG1f9EAmf9q7YKqdXGgUL3QKBgQDBL5WDIRtqHBdIPgHMue/teM+fP8I0/GKV
D3oJjBLE+I7JNp0lpeVhDvqfAL0AgZ5023hjlPobUNtpWyuLufzY6S2Pv1scyM3A
xW/LVXtC7QzdPmhrPxZkHEmRFA1zXdYo0xH4O+KDXVmYuzpIPfgrQkzt1EvP5jxv
tbjY935C+QKBgHZhr+rsVNhBwDb9YQIi3p0gtcyBZCRgZjR5MHiJgzcri5GI/J6q
tlNWIQGOS2oTsUxRkaLsxWvG4BXirAEXLiWkhrZ4icuj0JCfW21M0Z/xycf2SFx3
vvKD4W6hWqCzIx3f+rITKp8XAT32XzQq8gMGHFY7ucXShryFR93XpTgpAoGALaAF
WaDaDqdvwDoUxrsrNRSRRHUUctsglT/AfLy+OhLR9ieV2axijhexjRfpi1MRj1u+
BRbMMuNXznwfvrJASyJXBloVNKkgHuUCUC1yHQ5LOX1hv+J4cVBU95Sa0KJaz+15
kvzhtFC5tl6Rlzo7gEv6SzkWZpVjtKZgb62T/lECgYBr6PyDcGVGc8rbjxugnUnm
rShh7nMRUiTMLpWrucf7Mfr4cwFgejCoEMXPgxJF5Q1acppL0dKQzfmLVqazNX58
0XM0+fNDIeGyYKAbqtnqfmyI7O/Lb1jXPFuCNujzDxfeJX0yxoo38US4ZCD2iUrW
ZK/FFkm5ncXTenBhpHOANQ==
-----END PRIVATE KEY-----

View File

@ -1003,7 +1003,7 @@
"enabled": true,
"alwaysDisplayInConsole": false,
"clientAuthenticatorType": "client-secret",
"secret": "**********",
"secret": "annotation_secret",
"redirectUris": [
"/*"
],
@ -1104,7 +1104,7 @@
"enabled": true,
"alwaysDisplayInConsole": false,
"clientAuthenticatorType": "client-secret",
"secret": "**********",
"secret": "notification_secret",
"redirectUris": [
"/*"
],
@ -1212,7 +1212,7 @@
"enabled": true,
"alwaysDisplayInConsole": false,
"clientAuthenticatorType": "client-secret",
"secret": "**********",
"secret": "plugins_secret",
"redirectUris": [
"/*"
],
@ -1312,7 +1312,7 @@
"enabled": true,
"alwaysDisplayInConsole": false,
"clientAuthenticatorType": "client-secret",
"secret": "**********",
"secret": "web_secret",
"redirectUris": [
"/*"
],
@ -1414,18 +1414,18 @@
"clientId": "dmp_webapp",
"name": "dmp_webapp",
"description": "",
"rootUrl": "http://localhost:8081/home",
"rootUrl": "http://localhost:8082/home",
"adminUrl": "",
"baseUrl": "http://localhost:8081/home",
"baseUrl": "http://localhost:8082/home",
"surrogateAuthRequired": false,
"enabled": true,
"alwaysDisplayInConsole": false,
"clientAuthenticatorType": "client-secret",
"redirectUris": [
"http://localhost:8081/*"
"http://localhost:8082/*"
],
"webOrigins": [
"http://localhost:8081"
"http://localhost:8082"
],
"notBefore": 0,
"bearerOnly": false,

View File

@ -0,0 +1,33 @@
#DB
DB_CONNECTION_STRING=jdbc:postgresql://opendmp.postgres:5432/opendmp
DB_USER=opendmp-psql
DB_PASSWORD=opendmp-admin
#Server
WEB_PORT=8087
#Security
IDP_APIKEY_CLIENT_ID=dmp_annotation
IDP_APIKEY_CLIENT_SECRET=annotation_secret
IDP_APIKEY_SCOPE=dmp_annotation-dedicated
IDP_OPAQUE_CLIENT_ID=
IDP_OPAQUE_CLIENT_SECRET=
IDP_ISSUER_URI=http://localhost:8082/keycloak/realms/OpenDMP
QUEUE_APP_ID=opendmp-annotation-staging
#RABBITMQ
RABBIT_HOST=opendmp.rabbitmq
RABBIT_PORT=5672
RABBIT_USER=guest
RABBIT_PASS=guest
#EMAIL
MAIL_HOST=smtp.office365.com
MAIL_PORT=587
MAIL_USERNAME=
MAIL_PASSWORD=
MAIL_AUTH=false
MAIL_TLS=true
MAIL_ADDRESS=dmp_annotation@admin.gr

View File

@ -0,0 +1,12 @@
cipher:
symetric-encryption:
default-o: null
options:
configuration:
aes:
key: ${CIPHER_SYMETRIC_ENCRYPTION_CONFIGURATION_AES_KEY:}
iv: ${CIPHER_SYMETRIC_ENCRYPTION_CONFIGURATION_AES_IV:}
queue:
aes:
key: ${CIPHER_SYMETRIC_ENCRYPTION_QUEUE_AES_KEY:}
iv: ${CIPHER_SYMETRIC_ENCRYPTION_QUEUE_AES_IV:}

View File

@ -0,0 +1,3 @@
web:
cors:
allowed-origins: [ http://localhost:8081 ]

View File

@ -0,0 +1,15 @@
spring:
jpa:
show-sql: true
properties:
hibernate:
show_sql: true
format_sql: false
datasource:
maxIdle: 10
minIdle: 5
maxActive: 10
url: ${DB_CONNECTION_STRING}
username: ${DB_USER}
password: ${DB_PASSWORD}
driver-class-name: org.postgresql.Driver

View File

@ -0,0 +1,14 @@
spring:
mail:
host: ${MAIL_HOST:}
port: ${MAIL_PORT:}
username: ${MAIL_USERNAME:}
password: ${MAIL_PASSWORD:}
properties:
mail:
smtp:
auth: ${MAIL_AUTH:}
starttls:
enable: ${MAIL_TLS:}
email:
address: ${MAIL_ADDRESS:}

View File

@ -0,0 +1,2 @@
logging:
config: /config/logging/logback-${spring.profiles.active}.xml

View File

@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false">
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<Pattern>%date{ISO8601} [%thread] %-5level %logger{36} [%X{req.id}] - %message%n</Pattern>
</encoder>
</appender>
<appender name="TROUBLESHOOTING" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>/logs/logging.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>logs/logging.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<maxHistory>15</maxHistory>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<Pattern>%date{ISO8601} [%thread] %-5level %logger{36} [%X{req.id}] - %message%n</Pattern>
</encoder>
</appender>
<appender name="AUDITING" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>/logs/auditing.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>logs/auditing.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<maxHistory>15</maxHistory>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<Pattern>%date{ISO8601} - %X{req.id} - %message%n</Pattern>
</encoder>
</appender>
<logger name="org.springframework.web" level="WARN" additivity="false">
<appender-ref ref="TROUBLESHOOTING"/>
<appender-ref ref="STDOUT"/>
</logger>
<logger name="org.hibernate" level="WARN" additivity="false">
<appender-ref ref="TROUBLESHOOTING"/>
<appender-ref ref="STDOUT"/>
</logger>
<logger name="gr.cite" level="WARN" additivity="false">
<appender-ref ref="TROUBLESHOOTING"/>
<appender-ref ref="STDOUT"/>
</logger>
<logger name="org.springframework.data.elasticsearch.client.WIRE" level="TRACE" additivity="false">
<appender-ref ref="TROUBLESHOOTING"/>
<appender-ref ref="STDOUT"/>
</logger>
<logger name="audit" level="INFO" additivity="false">
<appender-ref ref="AUDITING"/>
<appender-ref ref="STDOUT"/>
</logger>
<root level="info">
<appender-ref ref="TROUBLESHOOTING"/>
<appender-ref ref="STDOUT"/>
</root>
</configuration>

View File

@ -0,0 +1,25 @@
queue:
rabbitmq:
host: ${RABBIT_HOST}
port: ${RABBIT_PORT}
username: ${RABBIT_USER}
password: ${RABBIT_PASS}
enable: true
durable: true
queue: cite_dmp_test_annotation_inbox_queue
exchange: cite_dmp_test_queue
listenerEnabled: true
publisherEnabled: true
task:
publisher:
enable: true
options:
exchange: cite_dmp_test_queue
rabbitmq:
enable: true
listener:
enable: true
options:
exchange: cite_dmp_test_queue
rabbitmq:
enable: true

View File

@ -0,0 +1,21 @@
web:
security:
enabled: true
authorized-endpoints: [ api ]
allowed-endpoints: [ health ]
idp:
api-key:
enabled: true
authorization-header: Authorization
client-id: ${IDP_APIKEY_CLIENT_ID:}
client-secret: ${IDP_APIKEY_CLIENT_SECRET:}
scope: ${IDP_APIKEY_SCOPE:}
resource:
token-type: JWT #| opaque
opaque:
client-id: ${IDP_OPAQUE_CLIENT_ID:}
client-secret: ${IDP_OPAQUE_CLIENT_SECRET:}
jwt:
claims: [ role, x-role ]
issuer-uri: ${IDP_ISSUER_URI:}
audiences: [ "dmp_annotation" ]

View File

@ -0,0 +1,3 @@
server:
port: ${WEB_PORT}
forward-headers-strategy: FRAMEWORK

View File

@ -0,0 +1,7 @@
tenant:
multitenancy:
is-multitenant: true
default-tenant-code: default
interceptor:
client-claims-prefix: client_
enforce-trusted-tenant: false

View File

@ -0,0 +1,10 @@
validation.empty=Value cannot be empty
validation.hashempty=Hash must be set
validation.lowerthanmin=Value must be larger than {value}
validation.largerthanmax=Value must be less than {value}
validation.invalidid=Not valid id
General_ItemNotFound=Item {0} of type {1} not found
Validation_Required={0} is required
Validation_OverPosting=Too much info
Validation_MaxLength={0} too long
Validation_UnexpectedValue=Unexpected value in field {0}

View File

@ -0,0 +1,6 @@
validation.empty=el-Value cannot be empty
validation.hashempty=el-Hash must be set
validation.lowerthanmin=el-Value must be larger than {value}
validation.largerthanmax=el-Value must be less than {value}
validation.invalidid=el-Not valid id
General_ItemNotFound=el-Item {0} of type {1} not found

View File

@ -0,0 +1,458 @@
[
{
"category": "rda",
"name": "rda.dataset.data_quality_assurance"
},
{
"category": "rda",
"name": "rda.dataset.distribution.access_url"
},
{
"category": "rda",
"name": "rda.dataset.distribution.available_until"
},
{
"category": "rda",
"name": "rda.dataset.distribution.byte_size"
},
{
"category": "rda",
"name": "rda.dataset.distribution.data_access"
},
{
"category": "rda",
"name": "rda.dataset.distribution.description"
},
{
"category": "rda",
"name": "rda.dataset.distribution.download_url"
},
{
"category": "rda",
"name": "rda.dataset.distribution.format"
},
{
"category": "rda",
"name": "rda.dataset.distribution.host.availability"
},
{
"category": "rda",
"name": "rda.dataset.distribution.host.backup_frequency"
},
{
"category": "rda",
"name": "rda.dataset.distribution.host.backup_type"
},
{
"category": "rda",
"name": "rda.dataset.distribution.host.certified_with"
},
{
"category": "rda",
"name": "rda.dataset.distribution.host.description"
},
{
"category": "rda",
"name": "rda.dataset.distribution.host.geo_location"
},
{
"category": "rda",
"name": "rda.dataset.distribution.host.pid_system"
},
{
"category": "rda",
"name": "rda.dataset.distribution.host.storage_type"
},
{
"category": "rda",
"name": "rda.dataset.distribution.host.supports_versioning"
},
{
"category": "rda",
"name": "rda.dataset.distribution.host.title"
},
{
"category": "rda",
"name": "rda.dataset.distribution.host.url"
},
{
"category": "rda",
"name": "rda.dataset.distribution.license.license_ref"
},
{
"category": "rda",
"name": "rda.dataset.distribution.license.start_date"
},
{
"category": "rda",
"name": "rda.dataset.distribution.title"
},
{
"category": "rda",
"name": "rda.dataset.keyword"
},
{
"category": "rda",
"name": "rda.dataset.language"
},
{
"category": "rda",
"name": "rda.dataset.metadata.description"
},
{
"category": "rda",
"name": "rda.dataset.metadata.language"
},
{
"category": "rda",
"name": "rda.dataset.metadata.metadata_standard_id"
},
{
"category": "rda",
"name": "rda.dataset.metadata.metadata_standard_id.identifier"
},
{
"category": "rda",
"name": "rda.dataset.metadata.metadata_standard_id.type"
},
{
"category": "rda",
"name": "rda.dataset.personal_data"
},
{
"category": "rda",
"name": "rda.dataset.preservation_statement"
},
{
"category": "rda",
"name": "rda.dataset.security_and_privacy"
},
{
"category": "rda",
"name": "rda.dataset.security_and_privacy.description"
},
{
"category": "rda",
"name": "rda.dataset.security_and_privacy.title"
},
{
"category": "rda",
"name": "rda.dataset.sensitive_data"
},
{
"category": "rda",
"name": "rda.dataset.technical_resource.description"
},
{
"category": "rda",
"name": "rda.dataset.technical_resource.name"
},
{
"category": "rda",
"name": "rda.dataset.title"
},
{
"category": "rda",
"name": "rda.dataset.type"
},
{
"category": "rda",
"name": "rda.dataset.issued"
},
{
"category": "rda",
"name": "rda.dataset.dataset_id"
},
{
"category": "rda",
"name": "rda.dataset.dataset_id.identifier"
},
{
"category": "rda",
"name": "rda.dataset.dataset_id.type"
},
{
"category": "rda",
"name": "rda.dataset.description"
},
{
"category": "rda",
"name": "rda.dmp.contact"
},
{
"category": "rda",
"name": "rda.dmp.contact.contact_id.identifier"
},
{
"category": "rda",
"name": "rda.dmp.contact.contact_id.type"
},
{
"category": "rda",
"name": "rda.dmp.contact.mbox"
},
{
"category": "rda",
"name": "rda.dmp.contact.name"
},
{
"category": "rda",
"name": "rda.dmp.contributor"
},
{
"category": "rda",
"name": "rda.dmp.contributor.contributor_id.identifier"
},
{
"category": "rda",
"name": "rda.dmp.contributor.contributor_id.type"
},
{
"category": "rda",
"name": "rda.dmp.contributor.mbox"
},
{
"category": "rda",
"name": "rda.dmp.contributor.name"
},
{
"category": "rda",
"name": "rda.dmp.contributor.role"
},
{
"category": "rda",
"name": "rda.dmp.cost"
},
{
"category": "rda",
"name": "rda.dmp.cost.currency_code"
},
{
"category": "rda",
"name": "rda.dmp.cost.description"
},
{
"category": "rda",
"name": "rda.dmp.cost.title"
},
{
"category": "rda",
"name": "rda.dmp.cost.value"
},
{
"category": "rda",
"name": "rda.dmp.created"
},
{
"category": "rda",
"name": "rda.dmp.description"
},
{
"category": "rda",
"name": "rda.dmp.dmp_id"
},
{
"category": "rda",
"name": "rda.dmp.dmp_id.identifier"
},
{
"category": "rda",
"name": "rda.dmp.dmp_id.type"
},
{
"category": "rda",
"name": "rda.dmp.ethical_issues_description"
},
{
"category": "rda",
"name": "rda.dmp.ethical_issues_exist"
},
{
"category": "rda",
"name": "rda.dmp.ethical_issues_report"
},
{
"category": "rda",
"name": "rda.dmp.language"
},
{
"category": "rda",
"name": "rda.dmp.modified"
},
{
"category": "rda",
"name": "rda.dmp.project"
},
{
"category": "rda",
"name": "rda.dmp.project.description"
},
{
"category": "rda",
"name": "rda.dmp.project.end"
},
{
"category": "rda",
"name": "rda.dmp.project.funding"
},
{
"category": "rda",
"name": "rda.dmp.project.funding.funder_id.identifier"
},
{
"category": "rda",
"name": "rda.dmp.project.funding.funder_id.type"
},
{
"category": "rda",
"name": "rda.dmp.project.funding.funding_status"
},
{
"category": "rda",
"name": "rda.dmp.project.funding.grant_id.identifier"
},
{
"category": "rda",
"name": "rda.dmp.project.funding.grant_id.type"
},
{
"category": "rda",
"name": "rda.dmp.project.start"
},
{
"category": "rda",
"name": "rda.dmp.dmp.project.title"
},
{
"category": "rda",
"name": "rda.dmp.title"
},
{
"category": "zenodo",
"name": "zenodo.related_identifiers.isCitedBy"
},
{
"category": "zenodo",
"name": "zenodo.related_identifiers.cites"
},
{
"category": "zenodo",
"name": "zenodo.related_identifiers.isSupplementTo"
},
{
"category": "zenodo",
"name": "zenodo.related_identifiers.isSupplementedBy"
},
{
"category": "zenodo",
"name": "zenodo.related_identifiers.isContinuedBy"
},
{
"category": "zenodo",
"name": "zenodo.related_identifiers.continues"
},
{
"category": "zenodo",
"name": "zenodo.related_identifiers.isDescribedBy"
},
{
"category": "zenodo",
"name": "zenodo.related_identifiers.describes"
},
{
"category": "zenodo",
"name": "zenodo.related_identifiers.hasMetadata"
},
{
"category": "zenodo",
"name": "zenodo.related_identifiers.isMetadataFor"
},
{
"category": "zenodo",
"name": "zenodo.related_identifiers.isNewVersionOf"
},
{
"category": "zenodo",
"name": "zenodo.related_identifiers.isPreviousVersionOf"
},
{
"category": "zenodo",
"name": "zenodo.related_identifiers.isPartOf"
},
{
"category": "zenodo",
"name": "zenodo.related_identifiers.hasPart"
},
{
"category": "zenodo",
"name": "zenodo.related_identifiers.isReferencedBy"
},
{
"category": "zenodo",
"name": "zenodo.related_identifiers.references"
},
{
"category": "zenodo",
"name": "zenodo.related_identifiers.isDocumentedBy"
},
{
"category": "zenodo",
"name": "zenodo.related_identifiers.documents"
},
{
"category": "zenodo",
"name": "zenodo.related_identifiers.isCompiledBy"
},
{
"category": "zenodo",
"name": "zenodo.related_identifiers.compiles"
},
{
"category": "zenodo",
"name": "zenodo.related_identifiers.isVariantFormOf"
},
{
"category": "zenodo",
"name": "zenodo.related_identifiers.isOriginalFormof"
},
{
"category": "zenodo",
"name": "zenodo.related_identifiers.isIdenticalTo"
},
{
"category": "zenodo",
"name": "zenodo.related_identifiers.isAlternateIdentifier"
},
{
"category": "zenodo",
"name": "zenodo.related_identifiers.isReviewedBy"
},
{
"category": "zenodo",
"name": "zenodo.related_identifiers.reviews"
},
{
"category": "zenodo",
"name": "zenodo.related_identifiers.isDerivedFrom"
},
{
"category": "zenodo",
"name": "zenodo.related_identifiers.isSourceOf"
},
{
"category": "zenodo",
"name": "zenodo.related_identifiers.requires"
},
{
"category": "zenodo",
"name": "zenodo.related_identifiers.isRequiredBy"
},
{
"category": "zenodo",
"name": "zenodo.related_identifiers.isObsoletedBy"
},
{
"category": "zenodo",
"name": "zenodo.related_identifiers.obsoletes"
}
]

View File

@ -0,0 +1,20 @@
-----BEGIN CERTIFICATE-----
MIIDXDCCAkSgAwIBAgIUK8FEbNAIdyPoRF/pTyqNuL3kP54wDQYJKoZIhvcNAQEL
BQAwRzELMAkGA1UEBhMCR1IxDTALBgNVBAgMBENJVEUxDDAKBgNVBAcMA0FUSDEN
MAsGA1UECgwEQ0lURTEMMAoGA1UEAwwDZWxrMCAXDTIyMDkwODA4MjgxM1oYDzIx
MjIwODE1MDgyODEzWjAYMRYwFAYDVQQDDA1lbGFzdGljc2VhcmNoMIIBIjANBgkq
hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAoC6DoPC1kesTH0cKs1blVW8ddsQ3VmFO
ROJiUorhDIHB3sXJhCSw0hxZFNZtqgG35CTa5w3XiQMT1fr6Ar/ztOQmARg9CMQa
mOf8gR+tMTSwP7zr7WBR/1Q+GseeOnthFOfvfq7LLpRs8VNb/mhcSIjJsT9kMNXN
5iHIyEuGhQSwPZDUYx+6Ag4belQLvic+QYDhwvujtPFWj8qLSG7kTpbBK5ahH/5E
mvT5mpOYTR10f3LG4DKw7t6qG9tzh4WkwR0JYmlgxpAA/HBSa/QjS7CGxLrA4Sop
gQF8KQPEP/0w98EbYpBUPS5jqbkBr6093M7Epksi86oRjtbcXAT0qwIDAQABo20w
azApBgNVHREEIjAggg1lbGFzdGljc2VhcmNogglsb2NhbGhvc3SHBH8AAAEwHQYD
VR0OBBYEFC/cKMOAVbx8bwyoKdg2Oiej9xoSMB8GA1UdIwQYMBaAFBIAjWDf6ACx
PkEdV9pY+U0XL0iCMA0GCSqGSIb3DQEBCwUAA4IBAQBo42FOuxIMeIiMaKa347gc
WsHpkazYOA6iHK5xXPsVUU1xSCLKp5HLCC04FU5P9njCDyZo1e/SR6rirQJJHEtT
SAn7iabREE+vy0oN3JnyV+eJPmKWxlqeFr9Cs9uIXQbgjwyyj9rxT06eLr3M1MA1
IsARV2eyxcgS5sCC8JBCEpKR4jLRrpAs0tGJOeIh1cmf/1id+NQaDa14sLFKHBH1
3+6TfBPrhJoGqFz92jV2airr7dppyCXgmWymVc66iD00Nak6Bvchg6ARTkqJnfoZ
2/Tz7asHV2V052ZLiow7Si34nS/9Hp8F8vUaj+FYXowvGwQUXLQIg/53KXh7piuW
-----END CERTIFICATE-----

View File

@ -0,0 +1,57 @@
#DB
DB_URL=jdbc:postgresql://opendmp.postgres:5432/opendmp
DB_USER=opendmp-psql
DB_PASS=opendmp-admin
#ELASTICSEARCH
ELASTIC_ENABLED=true
ELASTIC_USE_SSL=false
ELASTIC_HOST=opendmp.elasticsearch:9200
ELASTIC_USER= opendmp-api-test
ELASTIC_PASS=your_password_here
ELASTIC_DMP_INDEX=plans
ELASTIC_DESCRIPTION_INDEX=descriptions
#SERVER
WEB_PORT=8081
#GOTENBERG
PDF_CONVERTER_URL=http://opendmp.gotenberg:3000/
#STORAGE
FILE_STORAGE=/storage
#RABBITMQ
RABBIT_HOST=opendmp.rabbitmq
RABBIT_PORT=5672
RABBIT_USER=guest
RABBIT_PASS=guest
#KEYCLOAK
KEYCLOAK_API_SERVER_URL=http://localhost:8082/keycloak/
KEYCLOAK_API_REALM=OpenDMP
KEYCLOAK_API_USERNAME=keycloak-admin
KEYCLOAK_API_PASSWORD=admin
KEYCLOAK_API_CLIENT_ID=dmp_web
KEYCLOAK_API_CLIENT_SECRET=VNK5kd01faV8Fp9BZgKcthOPo1eXdodK
#SECURITY
IDP_ISSUER_URI=http://localhost:8082/keycloak/realms/OpenDMP
IDP_ISSUER_URI_TOKEN=http://localhost:8082/keycloak/realms/OpenDMP/protocol/openid-connect/token
IDP_APIKEY_CLIENT_ID=dmp_web
IDP_APIKEY_CLIENT_SECRET=VNK5kd01faV8Fp9BZgKcthOPo1eXdodK
IDP_APIKEY_SCOPE=dmp_plugins
#METRICS
IDP_APIKEY_CLIENT_ID_UUID=c82150e9-a9e5-4a5f-bd0f-5f25460b3e08
QUEUE_APP_ID=opendmp-web-staging
#EMAIL
MAIL_HOST=smtp.office365.com
MAIL_PORT=587
MAIL_USERNAME=
MAIL_PASSWORD=
MAIL_AUTH=false
MAIL_TLS=true
MAIL_ADDRESS=dmp_web@admin.gr

View File

@ -0,0 +1,3 @@
web:
cors:
allowed-origins: [ http://localhost, http://localhost:8082, http://localhost:8081 ]

View File

@ -0,0 +1,14 @@
spring:
jpa:
show-sql: true
properties:
hibernate:
format_sql: false
datasource:
maxIdle: 10
minIdle: 5
maxActive: 10
url: ${DB_URL:}
username: ${DB_USER:}
password: ${DB_PASS:}

View File

@ -0,0 +1,10 @@
deposit:
sources:
- url: http://opendmp.zenodo:8080
repositoryId: Zenodo
pdfTransformerId: docx-file-transformer
rdaTransformerId: rda-file-transformer
issuer-url: ${IDP_ISSUER_URI_TOKEN}
client-id: ${IDP_APIKEY_CLIENT_ID}
client-secret: ${IDP_APIKEY_CLIENT_SECRET}
scope: ${IDP_APIKEY_SCOPE}

View File

@ -0,0 +1,23 @@
elastic:
enabled: ${ELASTIC_ENABLED:}
disableHostnameVerifier: true
serverCertificatePaths:
- /certificates/elasticsearch_dev04.crt
hosts:
- ${ELASTIC_HOST:}
username: ${ELASTIC_USER:}
password: ${ELASTIC_PASS:}
useSSL: ${ELASTIC_USE_SSL:}
socketTimeoutMillis: 30000
connectTimeoutMillis: 30000
defaultResultSize: 100
defaultCollectAllResultSize: 1000
defaultScrollSize: 100
defaultScrollSeconds: 120
defaultCompositeAggregationResultSize: 200000
app-elastic:
enableIcuAnalysisPlugin: true
enabled: ${ELASTIC_ENABLED:}
dmpIndexName: ${ELASTIC_DMP_INDEX:}
descriptionIndexName: ${ELASTIC_DESCRIPTION_INDEX:}
resetBatchSize: 1000

View File

@ -0,0 +1,14 @@
file-transformer:
sources:
- url: http://opendmp.file.transformer.docx:8080
transformerId: docx-file-transformer
issuer-url: ${IDP_ISSUER_URI_TOKEN}
client-id: ${IDP_APIKEY_CLIENT_ID}
client-secret: ${IDP_APIKEY_CLIENT_SECRET}
scope: ${IDP_APIKEY_SCOPE}
- url: http://opendmp.file.transformer.rdajson:8080
transformerId: rda-file-transformer
issuer-url: ${IDP_ISSUER_URI_TOKEN}
client-id: ${IDP_APIKEY_CLIENT_ID}
client-secret: ${IDP_APIKEY_CLIENT_SECRET}
scope: ${IDP_APIKEY_SCOPE}

View File

@ -0,0 +1,21 @@
keycloak-resources:
tenantGroupsNamingStrategy: 'tenant-{tenantCode}'
tenantRoleAttributeName: 'tenant_role'
authorities:
User:
groupId: 011269bd-9eec-445f-926d-1ebd1f45b5aa
Admin:
groupId: 935ab34d-700a-407f-bb7b-8a00ddcef1d8
tenantAuthorities:
TenantAdmin:
parent: 01195be1-f754-415b-8225-3cc470744d62
roleAttributeValueStrategy: 'TenantAdmin:{tenantCode}'
TenantUser:
parent: 64c07220-0d92-44e5-be6e-d9edf6c10a56
roleAttributeValueStrategy: 'TenantUser:{tenantCode}'
TenantManager:
parent: 35f22f1-a0cc-4afd-af4c-dba6bb2e7415
roleAttributeValueStrategy: 'TenantManager:{tenantCode}'
TenantDescriptionTemplateEditor:
parent: 1bfe8064-4e44-4ec1-a69e-836364a36e37
roleAttributeValueStrategy: 'TenantDescriptionTemplateEditor:{tenantCode}'

View File

@ -0,0 +1,2 @@
logging:
config: /config/logging/logback-${spring.profiles.active}.xml

View File

@ -0,0 +1,67 @@
<configuration debug="false">
<include resource="org/springframework/boot/logging/logback/defaults.xml"/>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<Pattern>%date{ISO8601} [%thread] %-5level %logger{36} [%X{req.id}] - %message%n</Pattern>
</encoder>
</appender>
<appender name="TROUBLESHOOTING" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>/logs/logging.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>logs/logging.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<maxHistory>15</maxHistory>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<Pattern>%date{ISO8601} [%thread] %-5level %logger{36} [%X{req.id}] - %message%n</Pattern>
</encoder>
</appender>
<appender name="AUDITING" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>/logs/auditing.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>logs/auditing.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<maxHistory>15</maxHistory>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<Pattern>%date{ISO8601} - %X{req.id} - %message%n</Pattern>
</encoder>
</appender>
<logger name="org.springframework.web" level="WARN" additivity="false">
<appender-ref ref="TROUBLESHOOTING"/>
<appender-ref ref="STDOUT"/>
</logger>
<logger name="org.hibernate" level="WARN" additivity="false">
<appender-ref ref="TROUBLESHOOTING"/>
<appender-ref ref="STDOUT"/>
</logger>
<logger name="gr.cite" level="WARN" additivity="false">
<appender-ref ref="TROUBLESHOOTING"/>
<appender-ref ref="STDOUT"/>
</logger>
<logger name="eu.eudat" level="WARN" additivity="false">
<appender-ref ref="TROUBLESHOOTING"/>
<appender-ref ref="STDOUT"/>
</logger>
<logger name="org.springframework.data.elasticsearch.client.WIRE" level="TRACE" additivity="false">
<appender-ref ref="TROUBLESHOOTING"/>
<appender-ref ref="STDOUT"/>
</logger>
<logger name="audit" level="INFO" additivity="false">
<appender-ref ref="AUDITING"/>
<appender-ref ref="STDOUT"/>
</logger>
<root level="INFO">
<appender-ref ref="TROUBLESHOOTING"/>
<appender-ref ref="STDOUT"/>
</root>
</configuration>

View File

@ -0,0 +1,14 @@
metrics:
task:
enable: true
intervalSeconds: 600
nexusDate: "2021-01-01T00:00:00.00Z"
usersLoginClient: ${IDP_APIKEY_CLIENT_ID_UUID:}
referenceTypes:
funderIds: ["538928bb-c7c6-452e-b66d-08e539f5f082"]
grantIds: ["5b9c284f-f041-4995-96cc-fad7ad13289c"]
projectIds: ["3d372db5-a456-45e6-a845-e41e1a8311f8"]
researcherIds: ["5a2112e7-ea99-4cfe-98a1-68665e26726e"]
endpoints:
prometheus:
sensitive: false

View File

@ -0,0 +1,19 @@
queue:
rabbitmq:
enable: true
durable: true
queue: cite_dmp_test_web_inbox_queue
exchange: cite_dmp_test_queue
listenerEnabled: true
publisherEnabled: true
task:
publisher:
options:
exchange: cite_dmp_test_queue
rabbitmq:
enable: true
listener:
options:
exchange: cite_dmp_test_queue
rabbitmq:
enable: true

View File

@ -0,0 +1,15 @@
web:
security:
enabled: true
authorized-endpoints: [ api ]
allowed-endpoints: [ api/public, api/dmp/public, api/description/public, api/supportive-material/public, api/language/public, api/contact-support/public, api/dashboard/public ]
idp:
api-key:
enabled: false
resource:
token-type: JWT #| opaque
jwt:
claims: [ role, x-role ]
issuer-uri: ${IDP_ISSUER_URI:}
audiences: [ "dmp_web" ]
validIssuer: ${IDP_ISSUER_URI:}

View File

@ -0,0 +1,2 @@
server:
max-http-request-header-size: 16KB

View File

@ -0,0 +1,21 @@
storage:
service:
defaultLanguage: en
storages:
- type: Temp
basePath: ${FILE_STORAGE}/temp
- type: Main
basePath: ${FILE_STORAGE}/main
- type: Transformer
basePath: ${FILE_STORAGE}/transformer
- type: Deposit
basePath: ${FILE_STORAGE}/deposit
static-files:
semantics: /Semantics.json
material-files:
userGuide: /material/user-guide/
about: /material/about/
termsOfService: /material/terms-of-service/
glossary: /material/glossary/
faq: /material/faq/
language: /i18n/

View File

@ -0,0 +1,10 @@
tenant:
configEncryptionAesKey: rmpTvZnRWzyisUtFADBcZCn0q7Z75Xdz
configEncryptionAesIv: ec05d521a23f80ad
multitenancy:
is-multitenant: true
default-tenant-code: default
interceptor:
client-claims-prefix: client_
enforce-trusted-tenant: false
auto-create-tenant-user: true

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,76 @@
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="content-type">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-KK94CHFLLe+nY2dmCWGMq91rCGa5gtU4mk92HdvYe+M/SXH301p5ILy+dN9+nJOZ" crossorigin="anonymous">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300&display=swap" rel="stylesheet">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ENjdO4Dr2bkBIFxQpeoTz1HIcje39Wm4jDKdf19U8gI4ddQ3GYNS7NTKfAdVQSZe" crossorigin="anonymous"></script>
<style type="text/css">
h1 {
text-align: center;
margin: 2rem 0 1rem 0;
font-size: 3.3125rem;
line-height: 1.15;
font-weight: 300;
color: rgba(0,0,0,.87);
}
@media (min-width: 576px) {
.container {
max-width:540px
}
}
@media (min-width: 768px) {
.container {
max-width:720px
}
}
@media (min-width: 992px) {
.container {
max-width:960px
}
}
@media (min-width: 1244px) {
.container {
max-width:1204px!important
}
}
body {
font-family: Roboto,Helvetica,Arial,sans-serif;
font-size: 1rem;
font-weight: 300;
line-height: 1.5;
color: #212121;
text-align: left;
background: transparent;
}
</style>
</head>
<body>
<div class="container">
<div class="row">
<div class="col-md-12">
<h1>About</h1>
</div>
</div>
<div class="row">
<div class="col-md-12">
<p>ARGOS is an online tool in support of automated processes to creating, managing, sharing and linking DMPs with research artifacts they correspond to. It is the joint effort of OpenAIRE and EUDAT to deliver an open platform for Data Management Planning that addresses FAIR and Open best practices and assumes no barriers for its use and adoption. It does so by applying common standards for machine-actionable DMPs as defined by the global research data community of RDA and by communicating and consulting with researchers, research communities and funders to better reflect on their needs.
<br /><br />ARGOS provides a flexible environment and an easy interface for users to navigate and use.</p>
</div>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,749 @@
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="content-type">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-KK94CHFLLe+nY2dmCWGMq91rCGa5gtU4mk92HdvYe+M/SXH301p5ILy+dN9+nJOZ" crossorigin="anonymous">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;500&display=swap" rel="stylesheet">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ENjdO4Dr2bkBIFxQpeoTz1HIcje39Wm4jDKdf19U8gI4ddQ3GYNS7NTKfAdVQSZe" crossorigin="anonymous"></script>
<style type="text/css">
h3 {
font-size: 1.5625rem;
margin: 20px 0 10px;
line-height: 1.4em;
font-weight: 300;
}
h4 {
font-size: 1rem;
line-height: 1em;
font-weight: 500;
}
p {
text-align: left;
font-family: Roboto,sans-serif;
letter-spacing: 0;
color: #212121;
}
a {
text-decoration: none;
background-color: transparent;
}
a:hover {
color: #2e75b6;
}
p a {
color: #23bcba;
}
ul {
padding-left: 2.5rem;
}
.container-fluid {
margin: 0;
padding-left: 0;
}
.col-md-12 {
padding-right: 25px;
}
body {
font-family: Roboto,Helvetica,Arial,sans-serif;
font-size: 1rem;
font-weight: 300;
line-height: 1.5;
color: #212121;
text-align: left;
background: transparent;
}
</style>
</head>
<body>
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<h3>About ARGOS</h3>
<h4>What is ARGOS?</h4>
<p>Argos is an open and collaborative platform developed by <a href="https://www.openaire.eu/"
target="_blank">OpenAIRE</a> to facilitate
Research Data Management (RDM) activities concerning the implementation of Data
Management Plans. It uses OpenAIRE guides created by the <a
href="https://www.openaire.eu/task-forces-in-openaire-advance" target="_blank">RDM Task Force</a> to
familiarize users with basic RDM concepts and guide them throughout the process of
writing DMPs. It also utilises the OpenAIRE pool of services and inferred sources to
make DMPs more dynamic in use and easier to be completed and published. Argos is
based on the OpenDMP <a href="https://code-repo.d4science.org/MaDgiK-CITE/argos/src/branch/master"
target="_blank">open source software</a> and is available through the <a
href="http://catalogue.openaire.eu/" target="_blank">OpenAIRE
Service catalogue</a> and the <a
href="https://marketplace.eosc-portal.eu/services/argos?fromc=data-management"
target="_blank">EOSC</a>.</p>
<br />
<h4>Is Argos designed for one specific funder, e.g. the EC/Horizon Europe?</h4>
<p>
Argos is a flexible tool, designed to accommodate all research performing
and research funding organisations policies and Research Data Management (RDM) needs.
It already supports templates for different authorities.
These templates are created by Admin users in Argos.
In addition, we currently work to provide non-administrative users with the capability
to modify templates according to their own needs.
</p>
<br />
<h4>Why use Argos?</h4>
<p>Argos is easy to use and navigate around. It familiarises users with the DMP process
and provides guidance on basic RDM concepts so that users find useful resources to
learn from without having to leave the Argos environment. Users can invite their
colleagues and collaboratively work on completing a DMP. Moreover, Argos is an
integral part of the OpeAIRE ecosystem and the <a href="https://zenodo.org/record/2643199#.X3HL0WgzY2x"
target="_blank">Research
Graph</a>. Argos integrates
other services of the ecosystem to enable contextualisation of information, which is
especially useful when data are re-used, for example to understand how/ if they can
be repurposed.</p>
<br />
<h4>Who is Argos for?</h4>
<p>Argos is designed as a tool for inclusive use by researchers, students, funders,
research communities and institutions. It can be used in the context of research
projects conduct to comply with funders RDM requirements, as a tool in support of
literacy programmes in academia or can be independently deployed to meet given
stakeholder demands. Also, it is available in native languages, thanks to the help
of OpenAIRE NOADs, which strengthens common understanding of all researchers
involved in the DMP writing process.
By using Argos, researchers and students are able to create their DMPs in
collaboration with other colleagues, learn basic RDM concepts throughout the process
and publish DMPs as outputs in an open and FAIR manner, among other things by
assigning DOIs and licenses and by maintaining DMPs as living documents through
versioning.
At the same time, Argos can be configured and deployed by funders, institutions and
research communities. They can plug in their own services and/ or make use of
OpenAIRE underlying services that Argos is built with ad-hoc.</p>
<br />
<h4>Using Argos</h4>
<p>
Argos consists of two main functionalities: DMPs and Datasets.
Argos can be used for:
<br /><br /><span style="padding:20px;">
A. Viewing/ consulting publicly released DMPs and Datasets or Projects
corresponding to
DMPs
</span><br /><br />
Argos offers options for publishing DMPs in two modes, private or public. To view
public DMPs and Datasets, there is no need for login to the platform.
<br /><br /><span style="padding:20px;">
B. Writing and publishing a DMP
</span><br /><br />
Argos helps researchers comply with mandates that may be attached to their grant
proposal/ project funding. They can therefore choose from the most suitable to their
needs template from the Datasets collection and proceed with answering the
corresponding questions. Once finalized, researchers can assign a DOI to their DMP,
publish and eventually cite it.
<br /><br /><span style="padding:20px;">
C. Practicing on writing DMPs and Dataset Descriptions
</span><br /><br />
Argos may be used for educational purposes. The process of Data Management Planning
reflects the data management lifecycle, hence the tool can be used in response to
global RDM training demands. Examples may refer to embedding DMPs and DMP tools in
specific curricula or be embedded in library instructions sessions to familiarize
researchers and students the processes of RDM and DMP.
</p>
<br />
<h4>Can I exploit ARGOS DMPs?</h4>
<p>
Of course. If you want to compare DMPs or analyse DMP data, then we advise you to export the records in .xml.
This schema is the most complete as it includes all information held in a DMP: information provided by the Admin
when structuring the template and input provided by researchers when completing their DMPs.
</p>
<br />
<h3>Manage Account</h3>
<h4>Log in and out of Argos</h4>
<p>
You can log in Argos by selecting one of the providers from the Login page. Argos
does not require Sign Up.
</p>
<br />
<h4>Create an administrator account</h4>
<p>
If you are interested in becoming an administrator in Argos and benefit from extra
features relevant to creating tailored templates, please email <a href="mailto:argos@openaire.eu"
target="_blank">argos@openaire.eu</a> .
</p>
<br />
<h4>
Switch from administrator account
</h4>
<p>
There is no need to switch from your administrator account to use Argos. The only
difference between regular users and administrators profiles in Argos is an extra
set of tools at the bottom of the main tool bar that is positioned on the left
handside.
</p>
<br />
<h4>
Change your email
</h4>
<p>
Argos does not have Sign Up. To change email, please see “Switch between accounts”.
Alternatevily, you can add more email addresses to your user account by selecting
the “Add alternative email” from your profile.
</p>
<br />
<h4>
Switch between accounts
</h4>
<p>
You can switch between email accounts by loging in with different providers from the
Login page. The change depends on whether you have used different email addresses to
sign up with those providers. On the occassion that only one email address is used
for all providers offered by Argos, then no change is expected. You can always add
new email accounts in your profile from the “Add alternative email” in your profile
page.
</p>
<br />
<h4>
Delete your account
</h4>
<p>
If you want to delete your Argos profile, please email <a href="mailto:argos@openaire.eu"
target="_blank">argos@openaire.eu</a> .
</p>
<br />
<h3>
Accounts access and safety
</h3>
<h4>
How can I access my account and edit my profile?
</h4>
<p>
You can access your profile page and make desired edits from clicking on the avatar
at the very top of the toolbar located on the right handside.
</p>
<br />
<h4>
Cant login to ARGOS
</h4>
<p>
Please try using a different provider from the Login page and contact us at:
<a href="mailto:argos@openaire.eu" target="_blank">argos@openaire.eu</a> .
</p>
<br />
<h4>
Accessing Argos
</h4>
<p>
If you are reading this right now, you probably know the answer already! One way to
access Argos is through the <a href="http://catalogue.openaire.eu/" target="_blank">OpenAIRE Service
catalogue</a>. Another way is through the
<a href="https://marketplace.eosc-portal.eu/services/argos?fromc=data-management" target="_blank">EOSC
Catalogue</a>. But, you can always find Argos at
argos.openaire.eu .
To access Argos software, please visit
<a href="https://code-repo.d4science.org/MaDgiK-CITE/argos/src/branch/master"
target="_blank">https://code-repo.d4science.org/MaDgiK-CITE/argos/src/branch/master</a>
.
</p>
<br />
<h3>Argos User Roles</h3>
<h4>
Who is the author of a DMP?
</h4>
<p>
Author of the DMP is everyone contributing to writing the DMP. Both Argos owners and
Argos members are DMP authors. Researchers, however, are not DMP authors.
</p>
<br />
<h4>
What is the difference between owners and
members?
</h4>
<p>
Argos DMP owner is the person initiating the DMP. People who are invited to join the
DMP process are members who contribute to writing the DMP. DMP owners have extra
editing rights and they are the ones to finalize the DMP process. Members can view
and edit DMPs and Datasets, but can not perform further actions for its validation
or finalization.
</p>
<br />
<h4>
What is the role of a researcher in Argos?
</h4>
<p>
Researchers in Argos are project contributors and usually those who own or have
managed data described in respective DMPs.
</p>
<br />
<h4>
Can a researcher be a DMP author?
</h4>
<p>
Of course! This depends on whether the researcher has also been involved in the DMP
writing process.
</p>
<br />
<h4>
What does an Admin user do?
</h4>
<p>
Not everyone can become an Admin user in Argos. This happens upon request at
<a href="mailto:argos@openaire.eu" target="_blank">argos@openaire.eu</a>. Admin users are able to create
their own tailored templates from
a specialised editor, configure their own APIs and integrate services with Argos in
collaboration with and support of the Argos development team. Fees may apply
according to the type of requests.
</p>
<br />
<h3>Creating DMPs</h3>
<h4>
I cant find my project in the list. What should
I do?
</h4>
<p>
DMPs that are created as part of the project proposal are not included in Argos.
Only accepted project proposals are listed in the platform. If you cant find your
project in the list (drop-down menu), please use the “Insert manually”
functionality.
</p>
<br />
<h4>
I cant find my grant in the list. What should I
do?
</h4>
<p>
If you cant find your grant in the list (drop-down menu), please use the “Insert
manually” functionality.
</p>
<br />
<h4>
How do I edit and design my own DMP
template?
</h4>
<p>
You have to be an Admin user to design your own template in Argos. To learn more
about Admin users, check “What does an Admin user do?”.
</p>
<br />
<h4>
Can I create my own templates in Argos?
</h4>
<p>
Yes, you can, provided that you are an Admin user. To learn more about Admin users,
check “What does an Admin user do?”.
</p>
<br />
<h4>
What is the difference between “Save”, “Save &
Close”, “Save & Add New”?
</h4>
<div>
<p>They all perform the same action, but the difference lies in where you are directed
after you have saved your DMP or Dataset.</p>
<ul>
<li>
When choosing Save, information that you have added in the editor is kept
and you
can continue adding more from the same page you were working on.
</li>
<li>
When choosing Save & Close, information that you have added is kept, but the
editors window closes and you are redirected to your dashboard.
</li>
<li>
[only for datasets] When choosing Save & Add New, information that you have
added is
kept, and you are redirected to another editor to start a new dataset.
</li>
</ul>
</div>
<br />
<h4>
Can I modify things once I have finalized
them?
</h4>
<p>
Yes, you can, as long as you havent assigned a DOI to your DMP. You just select
“Undo Finalization”.
</p>
<br />
<h4>
How do I invite collaborators?
</h4>
<p>
You may use the “Invite” button to share DMPs with your colleagues and start working
on them together.
</p>
<br />
<h4>
Can scientists collaborate on the same DMP even though they may belong to different institutions (e.g. a hospital, a University, etc, collaborating on a project) and the dataset also "belongs" to different institutions?
</h4>
<p>
Of course. Argos supports collaborations across diverse teams. There are two most frequent ways that can address this question:
<br /><br /><span style="padding:20px;">
A. Everyone works on the same DMP, but on different dataset descriptions
</span><br /><br />
In this case, each organisation makes its own dataset description(s) in a single DMP.
That means that the manager (i.e. person responsible for the DMP activity) creates a DMP in ARGOS
and shares it with everyone. If the DMP is shared with co-ownership rights,
then the people will be able to edit it and add their dataset descriptions at any time during the project.
If there is the need to control editing rights of people writing the DMPs, then the manager can create the dataset description(s)
and share these each time with the team members that are responsible for adding input for the specified datasets.
<br /><br /><span style="padding:20px;">
B. Everyone works on their own DMP and content is later merged into one single DMP
</span><br /><br />
In this case, each organisation might work on their own DMP for the same project.
At one point, you need to decide which DMP is going to be the core for the work you perform, share co-ownership
between managers of all DMPs so they can copy all dataset descriptions of their DMPs in this single DMP document.
</p>
<br />
<h4>
How do I create an identical DMP or Dataset as a
copy?
</h4>
<p>
DMPs and Datasets can be cloned and used in different research contexts.
Existing DMPs presenting similarities with new ones, can be cloned, changed name and
then edited according to the new project data requirements.
Existing Datasets can be cloned and used in new DMPs that are reusing data described
in their context.
</p>
<br />
<h4>
What is the DMP version? How is it set?
</h4>
<p>
Versioning in Argos is both an internal and an external process. That means that
versioning happens both in the Argos environment when editing the DMP, and outside
of Argos when a DMP output is published in Zenodo. At every stage of the DMP
lifecycle, users have the option of keeping versions of the DMPs they are editing.
In Argos, users can create new versions of their DMPs by selecting the “Start New
Version” option to keep track of the evolution of their DMP throughout the writing
process. When published, versioning is associated with a DOI. Published DMPs are
automatically versioned every time a newer version of the same output is uploaded in
Zenodo.
</p>
<br />
<h3>
DMPs and Datasets
</h3>
<h4>
What is the DMP?
</h4>
<p>
A DMP in Argos consists of vital information about the research project on behalf of
which the DMP is created and of more in depth information about the management,
handling and curation of datasets collected, produced or reused during the research
lifetime. A DMP in Argos accommodates documentation of more than one datasets. That
way datasets are provided with the flexibility to be described separately, following
different templates per type of dataset or research community concerned each time,
also possible to be copied and used in multiple DMPs. Datasets are then bundled up
in a DMP and can be shared more broadly. Special attention is given to the handling
of data that are being re-used via OpenAIRE APIs.
</p>
<br />
<h4>
How do I find which Dataset template to use?
</h4>
<p>
This depends on the reason why you are creating a DMP in the first place. If it is
for compliance matters with funders, institutions or research communities RDM
policies, then you may select the dataset template of that particular stakeholder.
If you are creating a DMP for training purposes, you may select and work on any
template from the Argos collection.
</p>
<br />
<h4>
How do I create my own Dataset template?
</h4>
<p>
Currently, it is not possible for all Argos users to create dataset templates of
their own, so they have to work on predefined templates. Additional rights for
editing Dataset templates according to tailored needs have Admin users. This is
expected to change in the near future. To learn more about Admin users, check “What
does an Admin user do?”.
</p>
<br />
<h4>
Can I create smaller versions of a template for project proposals?
</h4>
<p>
Yes, it is possible in Argos to create short versions of templates that can be used
for grant proposals, such as for Horizon Europe.
If you are interested in working with us to create this short version of any ARGOS template,
please contact us: <a href="mailto:argos@openaire.eu" target="_blank">argos@openaire.eu</a>.
</p>
<br />
<h4>
Can I customise an existing template (e.g. for a specific institution)?
</h4>
<p>
Yes, you can. In the current version, this is possible for Admin users who have their own deployment on-premises or cloud.
Please note that this subject to change in the near future as we are working on a feature that will allow all users
to customise (remove/add/extend) specific questions on the template they are working on.
</p>
<br />
<h4>
What is a Dataset?
</h4>
<p>
A Dataset in Argos is an editor with set up questions that support the creation of
descriptions of how data are / have been handled, managed and curated throughout the
research data lifecycle. The editor holds a collection of Dataset templates each one
with different sets of predefined questions as per funders, institutions, research
communities RDM policy requirements. Researchers and students can choose the
template that corresponds to their RDM needs in order to get funding or get their
degree, respectively. A DMP in Argos may consist of one or more datasets.
</p>
<br />
<h4>
Why do I need more than one Dataset?
</h4>
<p>
You dont necessarily need to have many Datasets in a DMP. However, you might be
producing a plethora of data during your research that are diverse in type and/ or
scope of collection/ re-use, thus presenting diverse management needs. Argos gives
you the flexibility to describe all data produced and/ or re-used in your research
separately. That way it is easy to perform the mapping of information provided in a
DMP to the respective data types or data collections they correspond to. Equally,
reuse of particular datasets in different DMPs is easier. For the latter, please
check “How do I create an identical DMP or Dataset as a copy?”.
</p>
<br />
<h4>
It is not very clear to me when one should choose to add a dataset or to describe several "data products" in the same description.
</h4>
<p>
This is something that has to be tackled conceptually, from the author of the DMP.
If those "products" have their own lifetime and rules (IPR, Access rights, etc), they should be described as different datasets.
Alternative formats should not be treated as different datasets, unless they have other differences due to the format, too.
But, for instance, if you have datasets in CSV and JSON formats and under the same terms, they could be seen as one dataset description in the DMP.
</p>
<br />
<h4>
Can I add to my DMP information about datasets published on Zenodo?
</h4>
<p>
Argos offers a search to Zenodo for prefilling the DMP you are working with dataset metadata.
This search has been developed according to the rules set by Zenodo
and therefore has the same behaviour as when you are using the search bar on the Zenodo interface.
However, we understand the need to be able to find records with their PID,
hence we introduced some changes and now support searching DOIs from the Argos interface.
</p>
<br />
<h4>
Is it possible to describe a dataset that is not yet in a repository?
</h4>
<p>
Of course! You can choose to manually describe your dataset, e.g. for a dataset you are planning to produce,
instead of pre-filling the template with available metadata from a dataset that has already been shared and preserved in a repository.
</p>
<br />
<h4>
What are public DMPs and Datasets?
</h4>
<p>
Public DMPs and Public Datasets are collections of openly available Argos outputs.
That means that DMP owners and members are making their DMP and/or Dataset outputs
available to all Argos and non-Argos users who might want to consult or re-use them
under the framework provided by the assigned DMP license. Please also check “Is all
the information I create visible by default?”.
</p>
<br />
<h4>
Is all information I create visible by
default?
</h4>
<p>
No, it is not. You can choose how your DMP is displayed in Argos from the
“Visibility” option. Choosing Public will immediately locate your DMP in the “Public
DMPs” collection and make it available to all Argos and non-Argos users.
Choosing Private will keep the DMP visible only to you and to the people invited to
edit the DMP in collaboration with you. Private DMPs are not publicly displayed to
other users.
</p>
<br />
<h4>
What is the difference between the DMP and the dataset export?
</h4>
<p>
DMP export contains all vital information for a DMP, including funding and dataset details,
while dataset export is a subset of the DMP export containing information only about a dataset described in the DMP.
Both DMP and Dataset exports are available in .pdf, .docx, .xml.
In addition, DMP export is available in the RDA .json format
to increase interoperability of ARGOS exchanged DMPs.
</p>
<br />
<h4>
Is there a storage allowance limitation for the
DMPs and Dataset files?
</h4>
<p>
No, there is no storage limit or fee for either files stored in Argos.
</p>
<br />
<h3>
Publishing DMPs
</h3>
<h4>
Is it possible to publish DMPs in different repositories (so not Zenodo)?
</h4>
<p>
Yes, it is possible.
But, to have different repositories attached to the system, you will need your own on-premises or cloud deployment.
We are already working on that for DSpace and Dataverse repositories.
</p>
<br />
<h4>
Do you know that Zenodo has empty DMPs from ARGOS?
</h4>
<p>
Yes, we are aware of that.
Argos has no control over the DMPs that you generate and publish and thus can not be held accountable for empty DMPs.
Please remember that, as on all other occasions where you publish content, you should do so responsinbly.
If you have any questions regarding publishing DMPs, dont hesitate to contact us at <a href="mailto:argos@openaire.eu" target="_blank">argos@openaire.eu</a>.
</p>
<br />
<h4>
Once I upload a final version of a DMP to Zenodo, do I need to update this first final version from Zenodo or from Argos?
</h4>
<p>
Both options are possible according to how you have deposited the DMP in the first place.
If you have deposited your DMP with a token (i.e. from the ARGOS account on Zenodo),
then you wont have editing rights on the Zenodo record, but you will still be able to make changes
on ARGOS by starting and depositing a new version of the published DMP.
However, if you have deposited your DMP using your own account on Zenodo (i.e. login to Zenodo with your own credentials),
then you are able to also make minor changes, e.g. on the title of the DMP, directly from the Zenodo interface.
</p>
<br />
<h3>Troubleshooting</h3>
<h4>
Cant finalize a DMP
</h4>
<p>
You might be experiencing this problem because there are incomplete mandatory fields
in your DMP. Please check for those fields, fill in with appropriate information and
try again. Should the problem persists, please contact <a href="mailto:argos@openaire.eu"
target="_blank">argos@openaire.eu</a> .
</p>
<br />
<h4>
Cant co-edit a DMP
</h4>
<p>
DMPs can be shared with many colleagues in support of collaborative writing, but
DMPs should be worked by one person at a time. Argos will inform you if another
colleague has the DMP you are trying to edit open, so that your team avoids
information loss.
</p>
<br />
<h4>
Deposit is not working
</h4>
<p>
You need to have a Zenodo login to perform a deposit. Please sign up in Zenodo or
use the token option to publish your DMPs and get a DOI.
</p>
<br />
<h3>Legal and privacy</h3>
<h4>
Is Argos open source?
</h4>
<p>
Yes, it is. The OpenDMP software that Argos has deployed upon is open source code
available under Apache 2.0 license. You may find more information about the software
<a href="https://code-repo.d4science.org/MaDgiK-CITE/argos/src/branch/master"
target="_blank">here</a>.
</p>
<br />
<h4>
Can I contribute to Argos development?
</h4>
<p>
Of course! Please feel free to suggest new features and to actively contribute to
Argos development via pull requests in <a
href="https://code-repo.d4science.org/MaDgiK-CITE/argos/src/branch/master"
target="_blank">Gitea</a>.
</p>
<br />
<h4>
Is Argos GDPR compliant?
</h4>
<p>
Argos takes all necessary steps in handling and protecting personal and sensitive
information. Please check the <a href="https://argos.openaire.eu/terms-and-conditions"
target="_blank">Argos Terms of Service and Privacy Policy</a>.
</p>
<br />
<h4>
Which is the Argos data policy?
</h4>
<p>
Please find all information about Argos Terms of Service and Privacy, <a
href="https://argos.openaire.eu/terms-and-conditions" target="_blank">here</a>.
Additionally, you may find Argos Cookies policy, <a href="https://argos.openaire.eu/cookies-policy"
target="_blank">here</a>.
</p>
<br />
<h4>
What is the work ownership of information
created in Argos?
</h4>
<p>
Unless there are any contractual or institutional agreements stating ownership of
outputs produced in the context of a project/ collaboration, owners of Argos outputs
are DMP contributors, i.e. DMP owners and DMP members, who have been involved with
writing the DMP.
</p>
<br />
<h4>
Which are the terms and policies of Argos?
</h4>
<p>
Please find all information about Argos Terms of Service and Privacy, <a
href="https://argos.openaire.eu/terms-and-conditions" target="_blank">here</a>.
Additionally, you may find Argos Cookies policy, <a href="https://argos.openaire.eu/cookies-policy"
target="_blank">here</a>.
</p>
<!-- <h4>What is ARGOS?</h4>
<p>ARGOS is an open and collaborative platform for creating Data Management Plans according to funders or institutions open science policy requirements. ARGOS technology provides solutions and workflows that connect the DMP to the actual data where they are stored and link to other useful information such as publications and funding information, thus enabling the association between research outputs and processes and leading to the creation of coherent/ complete research entities. ARGOS is comprised of two major features: the ARGOS template and the Dataset Description.</p>
<br />
<h4>Who is it for?</h4>
<p>ARGOS is inclusive to all researchers and research coordinators who may use the tool to create machine actionable DMPs. Funding and Research Performing Organizations as well as research communities may use the tool and create Dataset Description templates according to their preferences or requirements. ARGOS may be used for purposes other than research projects, such as on the occasion of trainings that familiarise scientists with the data management planning process.</p>
<br />
<h4>How can I use it?</h4>
<p>ARGOS is comprised of two main functionalities: DMP templates and Dataset Descriptions. Additional entities are Projects that link to funders and grants information.<br />ARGOS can be used for:
<br /><br /><u style="padding:20px;"> A. viewing/ consulting publicly released DMPs and Dataset Descriptions or Projects corresponding to DMPs</u><br /><br />
The tool offers options for publishing DMPs in two modes, private or public. To view public DMPs and Dataset Descriptions, there is no need for login to the platform.
<br /><br /><u style="padding:20px;"> B. writing and publishing a DMP</u><br /><br />
The tool helps researchers comply with mandates that may be attached to their grant proposal/ project funding. They can therefore choose from the most suitable to their needs template from the Dataset Descriptions collection and proceed with answering the corresponding questions. Once finalized, researchers can assign a DOI to their DMP, publish and eventually cite it.
<br /><br /><u style="padding:20px;"> C. practicing in writing DMPs and Dataset Descriptions</u><br /><br />
Given that Data Management Planning reflects the data management lifecycle and in accordance/ response to the increasing demand of the global scientific/ research community for training in Research Data Management (RDM), ARGOS may be used for educational purposes. Examples may refer to embedding DMP and DMP tools in specific curricula or even utilization of the tool for researchers and students familiarization with the concept and process, as part of library instructions sessions.
</p>
<br />
<h4>What is the difference between the “Wizard” and the “Expert” modes/ features?</h4>
<p>There are two ways of creating a DMP: the “Wizard” and the “Expert”. The DMP Wizard combines the most necessary fields of the DMP template and the Data Description template. It is an easy way of starting a DMP and completing a Dataset Description. The downside when using the Wizard is that it only supports one Dataset Description. To add more datasets documentation, someone must open the DMP from DMP Expert.
<br />DMP expert contains extra fields for describing the project, grant, funding, contributors and associations between DMP authors, etc. DMP Expert is advised for use when further modification and personalization is to take place.
</p> -->
</div>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,94 @@
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="content-type">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-KK94CHFLLe+nY2dmCWGMq91rCGa5gtU4mk92HdvYe+M/SXH301p5ILy+dN9+nJOZ" crossorigin="anonymous">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;500&display=swap" rel="stylesheet">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ENjdO4Dr2bkBIFxQpeoTz1HIcje39Wm4jDKdf19U8gI4ddQ3GYNS7NTKfAdVQSZe" crossorigin="anonymous"></script>
<style type="text/css">
h1 {
text-align: center;
margin: 2rem 0 1rem 0;
font-size: 3.3125rem;
line-height: 1.15;
font-weight: 300;
color: rgba(0,0,0,.87);
}
h4 {
font-size: 1rem;
line-height: 1em;
font-weight: 500;
color: rgba(0,0,0,.87);
}
@media (min-width: 576px) {
.container {
max-width:540px
}
}
@media (min-width: 768px) {
.container {
max-width:720px
}
}
@media (min-width: 992px) {
.container {
max-width:960px
}
}
@media (min-width: 1244px) {
.container {
max-width:1204px!important
}
}
body {
font-family: Roboto,Helvetica,Arial,sans-serif;
font-size: 1rem;
font-weight: 300;
line-height: 1.5;
color: #212121;
text-align: left;
background: transparent;
}
</style>
</head>
<body>
<div class="container">
<div class="row">
<div class="col-md-12">
<h1>Glossary</h1>
</div>
</div>
<div class="row">
<div class="col-md-12">
<h4>DMP</h4>
<p>A DMP - short for Data Management Plan - is a document describing the processes that the data have undergone and the tools used for their handling and storage during a research lifecycle. Most importantly, DMPs secure provenance and enable re-use of data by appointing data managers and by including information on how data can be re-used by others in the future. Therefore, a DMP is a living document which is modified according to the data developments of a project before its completed and handed over at the end of the project.
Public funders increasingly contain DMPs in their grant proposals or policy funding requirements. A good paradigm is the European Commission demands for the production and delivery of DMPs for projects funded under the Horizon 2020 Funding Programme. On that note, and to encourage good data management practices uptake, many European institutions include DMPs in post-graduate researchers policies and offer relevant support to staff and students.
</p>
<h4>DMP template</h4>
<p>DMP template contains general but vital information about the name and the duration of the project that the DMP corresponds to, the contributing organisations and individuals as well as the datasets that are under the Dataset Description section. It also offers the possibility of describing datasets other than primary data generated, under “External References” section. A DMP template can have many Dataset Descriptions.
</p>
<h4>Dataset Description</h4>
<p>Dataset Description documents the management processes of datasets following funders or institutions requirements. A dataset description is essentially a questionnaire template with underlying added value services for interoperability and machine readability of information which is developed based on the given requirements. Management requirements differ from funder to funder and from institution to institution, hence the growing collection of Dataset Descriptions to select from.
Moreover, a Dataset Description links to the documentation of one dataset, hence a DMP template may contain more than one dataset descriptions on the occasion when multiple datasets were used during the project. When documentation of some of the projects datasets falls under additional requirements (e.g. projects receiving multiple grants from different sources), there is the possibility of describing datasets with more than one Dataset Description template.
</p>
</div>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,115 @@
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="content-type">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-KK94CHFLLe+nY2dmCWGMq91rCGa5gtU4mk92HdvYe+M/SXH301p5ILy+dN9+nJOZ" crossorigin="anonymous">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300&display=swap" rel="stylesheet">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ENjdO4Dr2bkBIFxQpeoTz1HIcje39Wm4jDKdf19U8gI4ddQ3GYNS7NTKfAdVQSZe" crossorigin="anonymous"></script>
<style type="text/css">
h1 {
text-align: center;
margin: 2rem 0 1rem 0;
font-size: 3.3125rem;
line-height: 1.15;
font-weight: 300;
color: rgba(0,0,0,.87);
}
ol {
padding-left: 2.5rem;
}
a {
color: #6aa4d9;
text-decoration: none;
background-color: transparent;
}
a:hover {
color: #2e75b6;
}
p a {
color: #23bcba;
}
@media (min-width: 576px) {
.container {
max-width:540px
}
}
@media (min-width: 768px) {
.container {
max-width:720px
}
}
@media (min-width: 992px) {
.container {
max-width:960px
}
}
@media (min-width: 1244px) {
.container {
max-width:1204px!important
}
}
body {
font-family: Roboto,Helvetica,Arial,sans-serif;
font-size: 1rem;
font-weight: 300;
line-height: 1.5;
color: #212121;
text-align: left;
background: transparent;
}
</style>
</head>
<body>
<div class="container terms-component">
<div class="row">
<div class="col-md-12">
<h1>Terms of Service</h1>
</div>
</div>
<div class="row">
<div class="col-md-12">
<p><span>The </span><span>OpenDMP</span><span>&nbsp;service was developed to provide a more flexible, </span><span>collaborative </span><span>environment with machine actionable solutions in writing, sharing and publishing Data Management Plans (DMPs). It is a product of </span><span>cooperation between </span><span>OpenAIRE </span><span>AMKE</span><span class="c0">&nbsp;and EUDAT CDI and is offered both as a software &ldquo;OpenDMP &#39;&#39; and as an online service under the name &ldquo;ARGOS&rdquo;. </span></p>
<p><span></span></p>
<ol>
<li><span><a href="https://code-repo.d4science.org/MaDgiK-CITE/argos">OpenDMP software</a></span><span>&nbsp;is offered under the Free Open Source Software license &nbsp;</span><span>Apache 2.0</span><span class="c0">, for further development and use by institutions and interested parties.</span></li>
<li><span><a href="https://argos.openaire.eu/">ARGOS</a></span><span>&nbsp;service</span><span>&nbsp;is offered by</span><span>&nbsp;</span><span>OpenAIRE</span><span>&nbsp;as </span><span>part of its mission to support Open Science in the European Research Area, focusing on information linking and contextualisation that enriches its </span><span class="c5"><a href="https://zenodo.org/record/2600275#.XZpJgUYzY2w">Research Graph</a></span><span>.</span><span class="c0">&nbsp;Use of ARGOS denotes agreement with the following terms:</span>
<ol>
<li><span>ARGOS is a software interface and a database with no storage capacity to store or preserve research data. The DMPs created are hosted in the </span><span>OpenAIRE </span><span>production environment for the sole purpose of exposing the DMP records once finalised (&ldquo;published&rdquo;). If assigned a DOI, the DMP records are linked to and preserved in Zenodo, the OpenAIRE&rsquo;s repository service. The ARGOS service is made available for use free-of-charge for research, educational and informational purposes.</span></li>
<li><span>Login to ARGOS is possible through a variety of external providers, among which Google, Facebook, Twitter, B2Access </span><span>and OpenAIRE Login</span><span>, that share information of their user profiles with ARGOS, </span><span>according to the rights that have been granted to the given provider by the user.</span><span>&nbsp;External email addresses that are used in invitations for collaborations are held in ARGOS database that stores information about only the </span><span class="c11">name</span><span>, </span><span class="c11">surname</span><span>&nbsp;</span><span>and </span><span class="c11">email address</span><span>&nbsp;</span><span>of the DMP creator and collaborator. &nbsp;Personal data is collected via the login option and via email invitations sent to external DMP contributors. This personal information as well as the activity of ARGOS users is used only for deriving usage metrics and assessing the service quality. They are stored in ARGOS database for as long as the account is active and they are accessible only from people in the team in charge of </span><span>quality and risk assessment</span><span>. </span><span>They will not be used for other purposes other than the ones stated in this document and they can be deleted at any time should the user claim a relevant request. </span><span>The aforementioned processes are also facilitated by the use of c</span><span>ookies</span><span>&nbsp;(see below the &ldquo;Cookie policy&rdquo;). </span></li>
<li><span>Data concerning DMP information will be used by OpenAIRE for research and development </span><span>purposes, </span><span>such as identifying DMP models, and for ensuring compliance with policy requirements and monitoring of DMPs uptake linked to OpenAIRE&rsquo;s Monitoring Dashboards and the Open Science Observatory.</span></li>
<li><span>The DMP Manager</span><span>, i.e. the person who creates and manages a DMP, and/ or the </span><span>contributor, i.e. the person who is invited to collaborate on a DMP, shall ensure that content is accurate and presented in a way that adheres to these </span><span>Terms of Service</span><span>&nbsp;and applicable laws, including, but not limited to, privacy, data protection and intellectual property rights.</span></li>
<li><span>ARGOS service is provided by OpenAIRE &ldquo;as is&rdquo;. Although OpenAIRE and its partners take measures for the availability, dependability, and accuracy of the service, access to ARGOS, utilisation of its features and preservation of the data deposited or produced by the service are not guaranteed. OpenAIRE cannot be held responsible </span><span>for any data loss regarding DMPs,</span><span>&nbsp;ethical or financial damage or any other direct or indirect impact that any failure of ARGOS service may have on its users. &nbsp;</span></li>
<li><span>ARGOS </span><span>users are exclusively responsible for their use of content, and shall hold OpenAIRE free and harmless in connection with their download and/or use.</span></li>
<li><span>OpenAIRE may not be held responsible for the content provided </span><span>or statements</span><span>&nbsp;made in Data Management Plans created and managed by its users. </span></li>
<li><span>All content is provided &ldquo;as-is&rdquo;. Users of content (&ldquo;Users&rdquo;) shall respect applicable license conditions. Download and use of content from ARGOS does not transfer any intellectual property rights in the content to the User.</span></li>
<li><span>In the case any content is reported as violating third party rights or other legal provisions, ARGOS reserves the right to remove the content from the service until the dispute is legally settled. Any such incidents should be reported at </span><span class="c5"><a href="mailto:noticeandtakedown@openaire.eu">noticeandtakedown@openaire.eu</a></span><span class="c0">&nbsp;</span></li>
<li><span>ARGOS users are held responsible for the data and information they provide in the service. Users may not add information, data or any other type of artifact that may be </span><span>malicious</span><span>, intentionally erroneous and potentially harmful for other ARGOS users, IPR owners and/or the general public.</span></li>
<li><span>In case a user of ARGOS identifies a potential </span><span>infringement</span><span>&nbsp;of copyright, </span><span>harmful</span><span>&nbsp;or </span><span>malicious </span><span>operation, function, code, information or data, shall inform OpenAIRE providing sufficient evidence for the identification of the case and the information and/or data challenged.</span></li>
<li><span>OpenAIRE reserves the right, without notice, at its sole discretion and without liability, (i) to alter or delete inappropriate content, and (ii) to restrict or remove User access where it considers that use of ARGOS interferes with its operations or violates these Terms of Service or applicable laws.</span></li>
<li><span>These Terms of Service are subject to change by OpenAIRE at any time and without notice, other than through posting the updated Terms of Service on the OpenAIRE website and indicating the version and date of last update.</span></li>
</ol>
</li>
</ol>
<p><span>For any questions or comments you may have about the current Terms of Service, please contact us: </span><span class="c5"><a href="mailto:argos@openaire.eu">argos@openaire.eu</a></span><span class="c0">&nbsp;</span></p>
</div>
</div>
</div>
</body>
</html>

Some files were not shown because too many files have changed in this diff Show More