DescriptionTemplate refactor
This commit is contained in:
parent
3c799063cc
commit
ac15e33a87
|
@ -40,6 +40,10 @@
|
||||||
<artifactId>repositorydepositbase</artifactId>
|
<artifactId>repositorydepositbase</artifactId>
|
||||||
<version>1.0.4</version>
|
<version>1.0.4</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.eclipse.angus</groupId>
|
||||||
|
<artifactId>jakarta.mail</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|
|
@ -29,6 +29,7 @@ public final class Permission {
|
||||||
public static String DeleteDescriptionTemplate = "DeleteDescriptionTemplate";
|
public static String DeleteDescriptionTemplate = "DeleteDescriptionTemplate";
|
||||||
public static String CloneDescriptionTemplate = "CloneDescriptionTemplate";
|
public static String CloneDescriptionTemplate = "CloneDescriptionTemplate";
|
||||||
public static String CreateNewVersionDescriptionTemplate = "CreateNewVersionDescriptionTemplate";
|
public static String CreateNewVersionDescriptionTemplate = "CreateNewVersionDescriptionTemplate";
|
||||||
|
public static String ImportDescriptionTemplate = "ImportDescriptionTemplate";
|
||||||
|
|
||||||
//DescriptionTemplateType
|
//DescriptionTemplateType
|
||||||
public static String BrowseDescriptionTemplateType = "BrowseDescriptionTemplateType";
|
public static String BrowseDescriptionTemplateType = "BrowseDescriptionTemplateType";
|
||||||
|
|
|
@ -0,0 +1,112 @@
|
||||||
|
package eu.eudat.commons.types.descriptiontemplate.importmodel;
|
||||||
|
|
||||||
|
|
||||||
|
import eu.eudat.commons.enums.DescriptionTemplateStatus;
|
||||||
|
|
||||||
|
import eu.eudat.model.persist.DescriptionTemplatePersist;
|
||||||
|
import eu.eudat.model.persist.NewVersionDescriptionTemplatePersist;
|
||||||
|
import eu.eudat.model.persist.descriptiontemplatedefinition.DefinitionPersist;
|
||||||
|
import eu.eudat.model.persist.descriptiontemplatedefinition.PagePersist;
|
||||||
|
import eu.eudat.model.persist.descriptiontemplatedefinition.SectionPersist;
|
||||||
|
import eu.eudat.service.fielddatahelper.FieldDataHelperServiceProvider;
|
||||||
|
import jakarta.xml.bind.annotation.XmlAttribute;
|
||||||
|
import jakarta.xml.bind.annotation.XmlElement;
|
||||||
|
import jakarta.xml.bind.annotation.XmlRootElement;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@XmlRootElement(name = "pages")
|
||||||
|
public class DescriptionTemplateImportXml {
|
||||||
|
|
||||||
|
private String description;
|
||||||
|
private String language;
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
private List<PageImportXml> page;
|
||||||
|
|
||||||
|
@XmlElement(name = "page")
|
||||||
|
public List<PageImportXml> getPage() {
|
||||||
|
return page;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPage(List<PageImportXml> page) {
|
||||||
|
this.page = page;
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlAttribute(name = "description")
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlAttribute(name = "language")
|
||||||
|
public String getLanguage() {
|
||||||
|
return language;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLanguage(String language) {
|
||||||
|
this.language = language;
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlAttribute(name = "type")
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(String type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DescriptionTemplatePersist toPersistModel(String label, FieldDataHelperServiceProvider fieldDataHelperServiceProvider){
|
||||||
|
DescriptionTemplatePersist newDatasetEntityProfile = new DescriptionTemplatePersist();
|
||||||
|
newDatasetEntityProfile.setLabel(label);
|
||||||
|
newDatasetEntityProfile.setStatus(DescriptionTemplateStatus.Draft);
|
||||||
|
newDatasetEntityProfile.setDescription(description);
|
||||||
|
newDatasetEntityProfile.setLanguage(language);
|
||||||
|
newDatasetEntityProfile.setType(UUID.fromString(type));
|
||||||
|
DefinitionPersist definitionPersist = new DefinitionPersist();
|
||||||
|
|
||||||
|
List<PagePersist> pagesDatasetEntity = new LinkedList<>();
|
||||||
|
List<SectionPersist> sectionDatasetEntity = new LinkedList<>();
|
||||||
|
for (PageImportXml xmlPage: page) {
|
||||||
|
pagesDatasetEntity.add(xmlPage.toPersistModel());
|
||||||
|
for (int i = 0; i < xmlPage.getSections().size(); i++) {
|
||||||
|
sectionDatasetEntity.add(xmlPage.toPersistModel(i, fieldDataHelperServiceProvider));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
definitionPersist.setPages(pagesDatasetEntity);
|
||||||
|
definitionPersist.setSections(sectionDatasetEntity);
|
||||||
|
newDatasetEntityProfile.setDefinition(definitionPersist);
|
||||||
|
|
||||||
|
return newDatasetEntityProfile;
|
||||||
|
}
|
||||||
|
|
||||||
|
public NewVersionDescriptionTemplatePersist toNewVersionPersistModel(UUID id, String label, FieldDataHelperServiceProvider fieldDataHelperServiceProvider){
|
||||||
|
NewVersionDescriptionTemplatePersist newDatasetEntityProfile = new NewVersionDescriptionTemplatePersist();
|
||||||
|
newDatasetEntityProfile.setId(id);
|
||||||
|
newDatasetEntityProfile.setLabel(label);
|
||||||
|
newDatasetEntityProfile.setStatus(DescriptionTemplateStatus.Draft);
|
||||||
|
newDatasetEntityProfile.setDescription(description);
|
||||||
|
newDatasetEntityProfile.setLanguage(language);
|
||||||
|
newDatasetEntityProfile.setType(UUID.fromString(type));
|
||||||
|
DefinitionPersist definitionPersist = new DefinitionPersist();
|
||||||
|
|
||||||
|
List<PagePersist> pagesDatasetEntity = new LinkedList<>();
|
||||||
|
List<SectionPersist> sectionDatasetEntity = new LinkedList<>();
|
||||||
|
for (PageImportXml xmlPage: page) {
|
||||||
|
pagesDatasetEntity.add(xmlPage.toPersistModel());
|
||||||
|
for (int i = 0; i < xmlPage.getSections().size(); i++) {
|
||||||
|
sectionDatasetEntity.add(xmlPage.toPersistModel(i, fieldDataHelperServiceProvider));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
definitionPersist.setPages(pagesDatasetEntity);
|
||||||
|
definitionPersist.setSections(sectionDatasetEntity);
|
||||||
|
newDatasetEntityProfile.setDefinition(definitionPersist);
|
||||||
|
|
||||||
|
return newDatasetEntityProfile;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,20 +1,22 @@
|
||||||
package eu.eudat.logic.utilities.documents.xml.datasetProfileXml.datasetProfileModel;
|
package eu.eudat.commons.types.descriptiontemplate.importmodel;
|
||||||
|
|
||||||
import eu.eudat.logic.utilities.documents.xml.datasetProfileXml.datasetProfileModel.Fields.Fields;
|
import eu.eudat.commons.types.descriptiontemplate.importmodel.fields.FieldsImportXml;
|
||||||
|
|
||||||
|
import eu.eudat.model.persist.descriptiontemplatedefinition.FieldSetPersist;
|
||||||
|
import eu.eudat.service.fielddatahelper.FieldDataHelperServiceProvider;
|
||||||
import jakarta.xml.bind.annotation.XmlAttribute;
|
import jakarta.xml.bind.annotation.XmlAttribute;
|
||||||
import jakarta.xml.bind.annotation.XmlElement;
|
import jakarta.xml.bind.annotation.XmlElement;
|
||||||
import jakarta.xml.bind.annotation.XmlRootElement;
|
import jakarta.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
@XmlRootElement(name = "field-Set")
|
@XmlRootElement(name = "field-Set")
|
||||||
public class FieldSet {
|
public class FieldSetImportXml {
|
||||||
|
|
||||||
private String id;
|
private String id;
|
||||||
private int ordinal;
|
private int ordinal;
|
||||||
private Fields fields;
|
private FieldsImportXml fields;
|
||||||
private String numbering;
|
private String numbering;
|
||||||
private Boolean commentField;
|
private Boolean commentField;
|
||||||
private Multiplicity multiplicity;
|
private MultiplicityImportXml multiplicity;
|
||||||
private String description;
|
private String description;
|
||||||
private String extendedDescription;
|
private String extendedDescription;
|
||||||
private String additionalInformation;
|
private String additionalInformation;
|
||||||
|
@ -39,11 +41,11 @@ public class FieldSet {
|
||||||
}
|
}
|
||||||
|
|
||||||
@XmlElement(name = "fields")
|
@XmlElement(name = "fields")
|
||||||
public Fields getFields() {
|
public FieldsImportXml getFields() {
|
||||||
return fields;
|
return fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFields(Fields fields) {
|
public void setFields(FieldsImportXml fields) {
|
||||||
this.fields = fields;
|
this.fields = fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,11 +68,11 @@ public class FieldSet {
|
||||||
}
|
}
|
||||||
|
|
||||||
@XmlElement(name = "multiplicity")
|
@XmlElement(name = "multiplicity")
|
||||||
public Multiplicity getMultiplicity() {
|
public MultiplicityImportXml getMultiplicity() {
|
||||||
return multiplicity;
|
return multiplicity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMultiplicity(Multiplicity multiplicity) {
|
public void setMultiplicity(MultiplicityImportXml multiplicity) {
|
||||||
this.multiplicity = multiplicity;
|
this.multiplicity = multiplicity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,18 +112,18 @@ public class FieldSet {
|
||||||
this.title = title;
|
this.title = title;
|
||||||
}
|
}
|
||||||
|
|
||||||
public eu.eudat.models.data.admin.components.datasetprofile.FieldSet toAdminCompositeModelSection() {
|
public FieldSetPersist toPersistModel(FieldDataHelperServiceProvider fieldDataHelperServiceProvider) {
|
||||||
eu.eudat.models.data.admin.components.datasetprofile.FieldSet fieldSet1Entity = new eu.eudat.models.data.admin.components.datasetprofile.FieldSet();
|
FieldSetPersist fieldSet1Entity = new FieldSetPersist();
|
||||||
fieldSet1Entity.setId(this.id);
|
fieldSet1Entity.setId(this.id);
|
||||||
fieldSet1Entity.setOrdinal(this.ordinal);
|
fieldSet1Entity.setOrdinal(this.ordinal);
|
||||||
fieldSet1Entity.setHasCommentField(this.commentField != null ? this.commentField : false);
|
fieldSet1Entity.setHasCommentField(this.commentField != null ? this.commentField : false);
|
||||||
fieldSet1Entity.setMultiplicity(this.multiplicity != null ? this.multiplicity.toAdminCompositeModelSection() : null);
|
fieldSet1Entity.setMultiplicity(this.multiplicity != null ? this.multiplicity.toPersistModel() : null);
|
||||||
fieldSet1Entity.setTitle(this.title);
|
fieldSet1Entity.setTitle(this.title);
|
||||||
fieldSet1Entity.setDescription(this.description);
|
fieldSet1Entity.setDescription(this.description);
|
||||||
fieldSet1Entity.setExtendedDescription(this.extendedDescription);
|
fieldSet1Entity.setExtendedDescription(this.extendedDescription);
|
||||||
fieldSet1Entity.setAdditionalInformation(this.additionalInformation);
|
fieldSet1Entity.setAdditionalInformation(this.additionalInformation);
|
||||||
|
|
||||||
fieldSet1Entity.setFields(this.fields.toAdminCompositeModelSection());
|
fieldSet1Entity.setFields(this.fields.toPersistModel(fieldDataHelperServiceProvider));
|
||||||
return fieldSet1Entity;
|
return fieldSet1Entity;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
package eu.eudat.commons.types.descriptiontemplate.importmodel;
|
||||||
|
|
||||||
|
import eu.eudat.model.persist.descriptiontemplatedefinition.FieldSetPersist;
|
||||||
|
import eu.eudat.service.fielddatahelper.FieldDataHelperServiceProvider;
|
||||||
|
import jakarta.xml.bind.annotation.XmlElement;
|
||||||
|
import jakarta.xml.bind.annotation.XmlRootElement;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@XmlRootElement(name = "field-Sets")
|
||||||
|
public class FieldSetsImportXml {
|
||||||
|
|
||||||
|
List<FieldSetImportXml> fieldSet;
|
||||||
|
|
||||||
|
@XmlElement(name = "field-Set")
|
||||||
|
public List<FieldSetImportXml> getFieldSet() {
|
||||||
|
return fieldSet;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFieldSet(List<FieldSetImportXml> fieldSet) {
|
||||||
|
this.fieldSet = fieldSet;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<FieldSetPersist> toPersistModel(FieldDataHelperServiceProvider fieldDataHelperServiceProvider){
|
||||||
|
List<FieldSetPersist> fieldSetEntity = new LinkedList<>();
|
||||||
|
if(this.fieldSet!=null) {
|
||||||
|
for (FieldSetImportXml xmlFieldSet : this.fieldSet) {
|
||||||
|
fieldSetEntity.add(xmlFieldSet.toPersistModel(fieldDataHelperServiceProvider));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return fieldSetEntity;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,12 +1,12 @@
|
||||||
package eu.eudat.logic.utilities.documents.xml.datasetProfileXml.datasetProfileModel;
|
package eu.eudat.commons.types.descriptiontemplate.importmodel;
|
||||||
|
|
||||||
import eu.eudat.commons.types.descriptiontemplate.MultiplicityEntity;
|
import eu.eudat.model.persist.descriptiontemplatedefinition.MultiplicityPersist;
|
||||||
import jakarta.xml.bind.annotation.XmlAttribute;
|
import jakarta.xml.bind.annotation.XmlAttribute;
|
||||||
import jakarta.xml.bind.annotation.XmlRootElement;
|
import jakarta.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
|
|
||||||
@XmlRootElement(name = "multiplicity")
|
@XmlRootElement(name = "multiplicity")
|
||||||
public class Multiplicity {
|
public class MultiplicityImportXml {
|
||||||
private int max;
|
private int max;
|
||||||
private int min;
|
private int min;
|
||||||
private String placeholder;
|
private String placeholder;
|
||||||
|
@ -48,8 +48,8 @@ public class Multiplicity {
|
||||||
this.tableView = tableView;
|
this.tableView = tableView;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MultiplicityEntity toAdminCompositeModelSection() {
|
public MultiplicityPersist toPersistModel() {
|
||||||
MultiplicityEntity multiplicityEntity = new MultiplicityEntity();
|
MultiplicityPersist multiplicityEntity = new MultiplicityPersist();
|
||||||
multiplicityEntity.setMax(max);
|
multiplicityEntity.setMax(max);
|
||||||
multiplicityEntity.setMin(min);
|
multiplicityEntity.setMin(min);
|
||||||
multiplicityEntity.setPlaceholder(placeholder);
|
multiplicityEntity.setPlaceholder(placeholder);
|
|
@ -0,0 +1,65 @@
|
||||||
|
package eu.eudat.commons.types.descriptiontemplate.importmodel;
|
||||||
|
|
||||||
|
import eu.eudat.model.persist.descriptiontemplatedefinition.PagePersist;
|
||||||
|
import eu.eudat.model.persist.descriptiontemplatedefinition.SectionPersist;
|
||||||
|
import eu.eudat.service.fielddatahelper.FieldDataHelperServiceProvider;
|
||||||
|
import jakarta.xml.bind.annotation.XmlAttribute;
|
||||||
|
import jakarta.xml.bind.annotation.XmlElement;
|
||||||
|
import jakarta.xml.bind.annotation.XmlRootElement;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@XmlRootElement(name = "page")
|
||||||
|
public class PageImportXml {
|
||||||
|
private String id;
|
||||||
|
private int ordinal;
|
||||||
|
private String title;
|
||||||
|
private List<SectionsImportXml> sections;
|
||||||
|
|
||||||
|
@XmlAttribute(name = "id")
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlAttribute(name = "ordinal")
|
||||||
|
public int getOrdinal() {
|
||||||
|
return ordinal;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOrdinal(int ordinal) {
|
||||||
|
this.ordinal = ordinal;
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlAttribute(name = "title")
|
||||||
|
public String getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTitle(String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlElement(name = "sections")
|
||||||
|
public List<SectionsImportXml> getSections() {
|
||||||
|
return sections;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSections(List<SectionsImportXml> sections) {
|
||||||
|
this.sections = sections;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PagePersist toPersistModel(){
|
||||||
|
PagePersist pageEntity = new PagePersist();
|
||||||
|
pageEntity.setId(this.id);
|
||||||
|
pageEntity.setOrdinal(this.ordinal);
|
||||||
|
pageEntity.setTitle(this.title);
|
||||||
|
return pageEntity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SectionPersist toPersistModel(int i, FieldDataHelperServiceProvider fieldDataHelperServiceProvider){
|
||||||
|
return sections.get(i).toPersistModel(fieldDataHelperServiceProvider);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,5 +1,7 @@
|
||||||
package eu.eudat.logic.utilities.documents.xml.datasetProfileXml.datasetProfileModel;
|
package eu.eudat.commons.types.descriptiontemplate.importmodel;
|
||||||
|
|
||||||
|
import eu.eudat.model.persist.descriptiontemplatedefinition.SectionPersist;
|
||||||
|
import eu.eudat.service.fielddatahelper.FieldDataHelperServiceProvider;
|
||||||
import jakarta.xml.bind.annotation.XmlAttribute;
|
import jakarta.xml.bind.annotation.XmlAttribute;
|
||||||
import jakarta.xml.bind.annotation.XmlElement;
|
import jakarta.xml.bind.annotation.XmlElement;
|
||||||
import jakarta.xml.bind.annotation.XmlRootElement;
|
import jakarta.xml.bind.annotation.XmlRootElement;
|
||||||
|
@ -7,17 +9,17 @@ import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@XmlRootElement(name = "section")
|
@XmlRootElement(name = "section")
|
||||||
public class Section {
|
public class SectionImportXml {
|
||||||
private String id;
|
private String id;
|
||||||
private int ordinal;
|
private int ordinal;
|
||||||
private String page;
|
private String page;
|
||||||
private Boolean defaultVisibility;
|
private Boolean defaultVisibility;
|
||||||
private FieldSets fieldSets;
|
private FieldSetsImportXml fieldSets;
|
||||||
private String numbering;
|
private String numbering;
|
||||||
private String description;
|
private String description;
|
||||||
private String extendedDescription;
|
private String extendedDescription;
|
||||||
private String title;
|
private String title;
|
||||||
private List<Section> section;
|
private List<SectionImportXml> section;
|
||||||
private Boolean multiplicity;
|
private Boolean multiplicity;
|
||||||
|
|
||||||
@XmlAttribute(name = "id")
|
@XmlAttribute(name = "id")
|
||||||
|
@ -57,11 +59,11 @@ public class Section {
|
||||||
}
|
}
|
||||||
|
|
||||||
@XmlElement(name = "field-Sets")
|
@XmlElement(name = "field-Sets")
|
||||||
public FieldSets getFieldSets() {
|
public FieldSetsImportXml getFieldSets() {
|
||||||
return fieldSets;
|
return fieldSets;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFieldSets(FieldSets fieldSets) {
|
public void setFieldSets(FieldSetsImportXml fieldSets) {
|
||||||
this.fieldSets = fieldSets;
|
this.fieldSets = fieldSets;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,13 +103,31 @@ public class Section {
|
||||||
this.title = title;
|
this.title = title;
|
||||||
}
|
}
|
||||||
|
|
||||||
public eu.eudat.models.data.admin.components.datasetprofile.Section toAdminCompositeModelSection() {
|
@XmlElement(name = "section")
|
||||||
eu.eudat.models.data.admin.components.datasetprofile.Section sectionEntity = new eu.eudat.models.data.admin.components.datasetprofile.Section();
|
public List<SectionImportXml> getSection() {
|
||||||
List<eu.eudat.models.data.admin.components.datasetprofile.Section> sectionsListEntity = new LinkedList<>();
|
return section;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSection(List<SectionImportXml> section) {
|
||||||
|
this.section = section;
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlAttribute(name = "multiplicity")
|
||||||
|
public Boolean getMultiplicity() {
|
||||||
|
return multiplicity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMultiplicity(Boolean multiplicity) {
|
||||||
|
this.multiplicity = multiplicity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SectionPersist toPersistModel(FieldDataHelperServiceProvider fieldDataHelperServiceProvider) {
|
||||||
|
SectionPersist sectionEntity = new SectionPersist();
|
||||||
|
List<SectionPersist> sectionsListEntity = new LinkedList<>();
|
||||||
|
|
||||||
if (this.section != null) {
|
if (this.section != null) {
|
||||||
for (Section xmlsection : this.section) {
|
for (SectionImportXml xmlsection : this.section) {
|
||||||
sectionsListEntity.add(xmlsection.toAdminCompositeModelSection());
|
sectionsListEntity.add(xmlsection.toPersistModel(fieldDataHelperServiceProvider));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sectionEntity.setId(this.id);
|
sectionEntity.setId(this.id);
|
||||||
|
@ -120,28 +140,10 @@ public class Section {
|
||||||
// for (FieldSets xmpFieldSets: this.fieldSets) {
|
// for (FieldSets xmpFieldSets: this.fieldSets) {
|
||||||
// fieldSetsEntity.add(xmpFieldSets.toAdminCompositeModelSection());
|
// fieldSetsEntity.add(xmpFieldSets.toAdminCompositeModelSection());
|
||||||
// }
|
// }
|
||||||
sectionEntity.setFieldSets(this.fieldSets.toAdminCompositeModelSection());
|
sectionEntity.setFieldSets(this.fieldSets.toPersistModel(fieldDataHelperServiceProvider));
|
||||||
|
|
||||||
sectionEntity.setSections(sectionsListEntity);
|
sectionEntity.setSections(sectionsListEntity);
|
||||||
sectionEntity.setDefaultVisibility(this.defaultVisibility);
|
sectionEntity.setDefaultVisibility(this.defaultVisibility);
|
||||||
return sectionEntity;
|
return sectionEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
@XmlElement(name = "section")
|
|
||||||
public List<Section> getSection() {
|
|
||||||
return section;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSection(List<Section> section) {
|
|
||||||
this.section = section;
|
|
||||||
}
|
|
||||||
|
|
||||||
@XmlAttribute(name = "multiplicity")
|
|
||||||
public Boolean getMultiplicity() {
|
|
||||||
return multiplicity;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMultiplicity(Boolean multiplicity) {
|
|
||||||
this.multiplicity = multiplicity;
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -1,6 +1,9 @@
|
||||||
package eu.eudat.logic.utilities.documents.xml.datasetProfileXml.datasetProfileModel;
|
package eu.eudat.commons.types.descriptiontemplate.importmodel;
|
||||||
|
|
||||||
|
|
||||||
|
import eu.eudat.model.persist.descriptiontemplatedefinition.FieldSetPersist;
|
||||||
|
import eu.eudat.model.persist.descriptiontemplatedefinition.SectionPersist;
|
||||||
|
import eu.eudat.service.fielddatahelper.FieldDataHelperServiceProvider;
|
||||||
import jakarta.xml.bind.annotation.XmlAttribute;
|
import jakarta.xml.bind.annotation.XmlAttribute;
|
||||||
import jakarta.xml.bind.annotation.XmlElement;
|
import jakarta.xml.bind.annotation.XmlElement;
|
||||||
import jakarta.xml.bind.annotation.XmlRootElement;
|
import jakarta.xml.bind.annotation.XmlRootElement;
|
||||||
|
@ -8,7 +11,7 @@ import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@XmlRootElement(name = "sections")
|
@XmlRootElement(name = "sections")
|
||||||
public class Sections {
|
public class SectionsImportXml {
|
||||||
private String id;
|
private String id;
|
||||||
private int ordinal;
|
private int ordinal;
|
||||||
private String page;
|
private String page;
|
||||||
|
@ -16,8 +19,8 @@ public class Sections {
|
||||||
private String numbering;
|
private String numbering;
|
||||||
private String description;
|
private String description;
|
||||||
private String title;
|
private String title;
|
||||||
private List<Section> section;
|
private List<SectionImportXml> section;
|
||||||
private FieldSets fieldSets;
|
private FieldSetsImportXml fieldSets;
|
||||||
private Boolean multiplicity;
|
private Boolean multiplicity;
|
||||||
|
|
||||||
@XmlAttribute(name = "id")
|
@XmlAttribute(name = "id")
|
||||||
|
@ -84,20 +87,20 @@ public class Sections {
|
||||||
}
|
}
|
||||||
|
|
||||||
@XmlElement(name = "section")
|
@XmlElement(name = "section")
|
||||||
public List<Section> getSection() {
|
public List<SectionImportXml> getSection() {
|
||||||
return section;
|
return section;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSection(List<Section> section) {
|
public void setSection(List<SectionImportXml> section) {
|
||||||
this.section = section;
|
this.section = section;
|
||||||
}
|
}
|
||||||
|
|
||||||
@XmlElement(name = "field-Sets")
|
@XmlElement(name = "field-Sets")
|
||||||
public FieldSets getFieldSets() {
|
public FieldSetsImportXml getFieldSets() {
|
||||||
return fieldSets;
|
return fieldSets;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFieldSets(FieldSets fieldSets) {
|
public void setFieldSets(FieldSetsImportXml fieldSets) {
|
||||||
this.fieldSets = fieldSets;
|
this.fieldSets = fieldSets;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,24 +113,22 @@ public class Sections {
|
||||||
this.multiplicity = multiplicity;
|
this.multiplicity = multiplicity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public eu.eudat.models.data.admin.components.datasetprofile.Section toAdminCompositeModelSection() {
|
public SectionPersist toPersistModel(FieldDataHelperServiceProvider fieldDataHelperServiceProvider) {
|
||||||
eu.eudat.models.data.admin.components.datasetprofile.Section sectionEntity = new eu.eudat.models.data.admin.components.datasetprofile.Section();
|
SectionPersist sectionEntity = new SectionPersist();
|
||||||
List<eu.eudat.models.data.admin.components.datasetprofile.Section> sectionsListEntity = new LinkedList<>();
|
List<SectionPersist> sectionsListEntity = new LinkedList<>();
|
||||||
|
|
||||||
if (this.section != null) {
|
if (this.section != null) {
|
||||||
for (Section xmlsection : this.section) {
|
for (SectionImportXml xmlsection : this.section) {
|
||||||
sectionsListEntity.add(xmlsection.toAdminCompositeModelSection());
|
sectionsListEntity.add(xmlsection.toPersistModel(fieldDataHelperServiceProvider));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} /*else {
|
|
||||||
sectionsListEntity.add(new eu.eudat.models.data.admin.components.datasetprofile.Section());
|
|
||||||
}*/
|
|
||||||
sectionEntity.setId(this.id);
|
sectionEntity.setId(this.id);
|
||||||
sectionEntity.setOrdinal(this.ordinal);
|
sectionEntity.setOrdinal(this.ordinal);
|
||||||
sectionEntity.setTitle(this.title);
|
sectionEntity.setTitle(this.title);
|
||||||
sectionEntity.setDefaultVisibility(this.defaultVisibility);
|
sectionEntity.setDefaultVisibility(this.defaultVisibility);
|
||||||
sectionEntity.setDescription(description);
|
sectionEntity.setDescription(description);
|
||||||
sectionEntity.setPage(this.page);
|
sectionEntity.setPage(this.page);
|
||||||
sectionEntity.setFieldSets(toAdminCompositeModelSectionFieldSets());
|
sectionEntity.setFieldSets(toFieldSetPersistModel(fieldDataHelperServiceProvider));
|
||||||
sectionEntity.setMultiplicity(this.multiplicity);
|
sectionEntity.setMultiplicity(this.multiplicity);
|
||||||
|
|
||||||
|
|
||||||
|
@ -135,8 +136,8 @@ public class Sections {
|
||||||
return sectionEntity;
|
return sectionEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<eu.eudat.models.data.admin.components.datasetprofile.FieldSet> toAdminCompositeModelSectionFieldSets() {
|
public List<FieldSetPersist> toFieldSetPersistModel(FieldDataHelperServiceProvider fieldDataHelperServiceProvider) {
|
||||||
return fieldSets.toAdminCompositeModelSection();
|
return fieldSets.toPersistModel(fieldDataHelperServiceProvider);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
package eu.eudat.logic.utilities.documents.xml.datasetProfileXml.datasetProfileModel.Fields;
|
package eu.eudat.commons.types.descriptiontemplate.importmodel.fields;
|
||||||
|
|
||||||
import eu.eudat.commons.types.descriptiontemplate.todelete.DefaultValueEntity;
|
|
||||||
import jakarta.xml.bind.annotation.XmlAttribute;
|
import jakarta.xml.bind.annotation.XmlAttribute;
|
||||||
import jakarta.xml.bind.annotation.XmlRootElement;
|
import jakarta.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
@XmlRootElement(name = "defaultValue")
|
@XmlRootElement(name = "defaultValue")
|
||||||
public class DefaultValue {
|
public class DefaultValueImportXml {
|
||||||
|
|
||||||
private String type;
|
private String type;
|
||||||
private String value;
|
private String value;
|
||||||
|
@ -28,10 +27,7 @@ public class DefaultValue {
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DefaultValueEntity toAdminCompositeModelSection(){
|
public String toPersistModel(){
|
||||||
DefaultValueEntity defaultValueEntity =new DefaultValueEntity();
|
return value;
|
||||||
defaultValueEntity.setValue(value);
|
|
||||||
defaultValueEntity.setType(type);
|
|
||||||
return defaultValueEntity;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,8 +1,11 @@
|
||||||
package eu.eudat.logic.utilities.documents.xml.datasetProfileXml.datasetProfileModel.Fields;
|
package eu.eudat.commons.types.descriptiontemplate.importmodel.fields;
|
||||||
|
|
||||||
import eu.eudat.commons.enums.FieldType;
|
import eu.eudat.commons.enums.FieldType;
|
||||||
|
import eu.eudat.commons.enums.FieldValidationType;
|
||||||
import eu.eudat.commons.types.descriptiontemplate.fielddata.BaseFieldDataEntity;
|
import eu.eudat.commons.types.descriptiontemplate.fielddata.BaseFieldDataEntity;
|
||||||
import eu.eudat.commons.types.descriptiontemplate.fielddata.FieldDataHelper;
|
import eu.eudat.commons.types.descriptiontemplate.fielddata.FieldDataHelper;
|
||||||
|
import eu.eudat.model.persist.descriptiontemplatedefinition.FieldPersist;
|
||||||
|
import eu.eudat.service.fielddatahelper.FieldDataHelperService;
|
||||||
|
import eu.eudat.service.fielddatahelper.FieldDataHelperServiceProvider;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
|
|
||||||
import jakarta.xml.bind.annotation.XmlAttribute;
|
import jakarta.xml.bind.annotation.XmlAttribute;
|
||||||
|
@ -12,7 +15,7 @@ import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@XmlRootElement(name = "field")
|
@XmlRootElement(name = "field")
|
||||||
public class Field {
|
public class FieldImportXml {
|
||||||
|
|
||||||
private String id;
|
private String id;
|
||||||
|
|
||||||
|
@ -20,17 +23,17 @@ public class Field {
|
||||||
|
|
||||||
private String numbering;
|
private String numbering;
|
||||||
|
|
||||||
private List<validations> validations;
|
private List<ValidationsImportXml> validations;
|
||||||
|
|
||||||
private DefaultValue defaultValue;
|
private DefaultValueImportXml defaultValue;
|
||||||
|
|
||||||
private Visible visible;
|
private VisibleImportXml visible;
|
||||||
|
|
||||||
private ViewStyle viewStyle;
|
private ViewStyleImportXml viewStyle;
|
||||||
|
|
||||||
private Object data;
|
private Element data;
|
||||||
|
|
||||||
private Schematics schematics;
|
private SchematicsImportXml schematics;
|
||||||
|
|
||||||
@XmlAttribute(name = "id")
|
@XmlAttribute(name = "id")
|
||||||
public String getId() {
|
public String getId() {
|
||||||
|
@ -60,80 +63,82 @@ public class Field {
|
||||||
}
|
}
|
||||||
|
|
||||||
@XmlElement(name = "validations")
|
@XmlElement(name = "validations")
|
||||||
public List<eu.eudat.logic.utilities.documents.xml.datasetProfileXml.datasetProfileModel.Fields.validations> getValidations() {
|
public List<ValidationsImportXml> getValidations() {
|
||||||
return validations;
|
return validations;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setValidations(List<eu.eudat.logic.utilities.documents.xml.datasetProfileXml.datasetProfileModel.Fields.validations> validations) {
|
public void setValidations(List<ValidationsImportXml> validations) {
|
||||||
this.validations = validations;
|
this.validations = validations;
|
||||||
}
|
}
|
||||||
|
|
||||||
@XmlElement(name = "defaultValue")
|
@XmlElement(name = "defaultValue")
|
||||||
public DefaultValue getDefaultValue() {
|
public DefaultValueImportXml getDefaultValue() {
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDefaultValue(DefaultValue defaultValue) {
|
public void setDefaultValue(DefaultValueImportXml defaultValue) {
|
||||||
this.defaultValue = defaultValue;
|
this.defaultValue = defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@XmlElement(name = "visible")
|
@XmlElement(name = "visible")
|
||||||
public Visible getVisible() {
|
public VisibleImportXml getVisible() {
|
||||||
return visible;
|
return visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setVisible(Visible visible) {
|
public void setVisible(VisibleImportXml visible) {
|
||||||
this.visible = visible;
|
this.visible = visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
@XmlElement(name = "viewStyle")
|
@XmlElement(name = "viewStyle")
|
||||||
public ViewStyle getViewStyle() {
|
public ViewStyleImportXml getViewStyle() {
|
||||||
return viewStyle;
|
return viewStyle;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setViewStyle(ViewStyle viewStyle) {
|
public void setViewStyle(ViewStyleImportXml viewStyle) {
|
||||||
this.viewStyle = viewStyle;
|
this.viewStyle = viewStyle;
|
||||||
}
|
}
|
||||||
|
|
||||||
@XmlElement(name = "data")
|
@XmlElement(name = "data")
|
||||||
public Object getData() {
|
public Element getData() {
|
||||||
return this.data;
|
return this.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setData(Object data) {
|
public void setData(Element data) {
|
||||||
this.data = data;
|
this.data = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@XmlElement(name = "schematics")
|
@XmlElement(name = "schematics")
|
||||||
public Schematics getSchematics() {
|
public SchematicsImportXml getSchematics() {
|
||||||
return schematics;
|
return schematics;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSchematics(Schematics schematics) {
|
public void setSchematics(SchematicsImportXml schematics) {
|
||||||
this.schematics = schematics;
|
this.schematics = schematics;
|
||||||
}
|
}
|
||||||
|
|
||||||
public eu.eudat.models.data.admin.components.datasetprofile.Field toAdminCompositeModelSection() {
|
public FieldPersist toPersistModel(FieldDataHelperServiceProvider fieldDataHelperServiceProvider) {
|
||||||
eu.eudat.models.data.admin.components.datasetprofile.Field fieldEntity =new eu.eudat.models.data.admin.components.datasetprofile.Field();
|
FieldPersist fieldEntity =new FieldPersist();
|
||||||
fieldEntity.setId(this.id);
|
fieldEntity.setId(this.id);
|
||||||
fieldEntity.setOrdinal(this.ordinal);
|
fieldEntity.setOrdinal(this.ordinal);
|
||||||
List<Integer> validationList = new LinkedList<>();
|
List<FieldValidationType> validationList = new LinkedList<>();
|
||||||
for(validations validation:this.validations){
|
for(ValidationsImportXml validation:this.validations){
|
||||||
if(validation.getValidation()!=null)
|
if(validation.getValidation()!=null) {
|
||||||
validationList.add(validation.toAdminCompositeModelSection());
|
validationList.add(validation.toPersistModel());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
fieldEntity.setValidations(validationList);
|
fieldEntity.setValidations(validationList);
|
||||||
fieldEntity.setDefaultValue(this.defaultValue.toAdminCompositeModelSection());
|
fieldEntity.setDefaultValue(this.defaultValue.toPersistModel());
|
||||||
fieldEntity.setVisible(this.visible.toAdminCompositeModelSection());
|
fieldEntity.setVisibilityRules(this.visible.toPersistModel());
|
||||||
fieldEntity.setViewStyle(this.viewStyle.toAdminCompositeModelSection());
|
FieldType fieldType = this.viewStyle.toPersistModel();
|
||||||
BaseFieldDataEntity data = new FieldDataHelper().toFieldData(null, FieldType.of(this.viewStyle.getRenderStyle()), (Element) this.data);
|
|
||||||
// fieldEntity.setData( data.fromXml((Element) this.data));
|
BaseFieldDataEntity<?> data = new FieldDataHelper().toFieldData(null, fieldType, (Element) this.data);
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
fieldEntity.setData(data.toMap((Element) this.data));
|
FieldDataHelperService fieldDataHelperService = fieldDataHelperServiceProvider.get(fieldType);
|
||||||
|
fieldEntity.setData(fieldDataHelperService.mapDataToPersist((BaseFieldDataEntity<?>)fieldDataHelperService.newDataInstance().fromXml(this.data)));
|
||||||
}
|
}
|
||||||
List<String> schematicsList = new LinkedList<>();
|
List<String> schematicsList = new LinkedList<>();
|
||||||
if (this.schematics != null && this.schematics.getSchematics() != null) {
|
if (this.schematics != null && this.schematics.getSchematics() != null) {
|
||||||
for (Schematic schematic : this.schematics.getSchematics()) {
|
for (SchematicImportXml schematic : this.schematics.getSchematics()) {
|
||||||
if (schematic != null && schematic.getSchematic() != null && !schematic.getSchematic().isEmpty())
|
if (schematic != null && schematic.getSchematic() != null && !schematic.getSchematic().isEmpty())
|
||||||
schematicsList.add(schematic.getSchematic());
|
schematicsList.add(schematic.getSchematic());
|
||||||
}
|
}
|
|
@ -0,0 +1,40 @@
|
||||||
|
package eu.eudat.commons.types.descriptiontemplate.importmodel.fields;
|
||||||
|
|
||||||
|
import eu.eudat.model.persist.descriptiontemplatedefinition.FieldPersist;
|
||||||
|
import eu.eudat.service.fielddatahelper.FieldDataHelperServiceProvider;
|
||||||
|
import jakarta.xml.bind.annotation.XmlElement;
|
||||||
|
import jakarta.xml.bind.annotation.XmlRootElement;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@XmlRootElement(name = "fields")
|
||||||
|
public class FieldsImportXml {
|
||||||
|
|
||||||
|
private List<FieldImportXml> field;
|
||||||
|
|
||||||
|
@XmlElement(name = "field")
|
||||||
|
public List<FieldImportXml> getField() {
|
||||||
|
return field;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setField(List<FieldImportXml> field) {
|
||||||
|
this.field = field;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<FieldPersist> toPersistModel(FieldDataHelperServiceProvider fieldDataHelperServiceProvider) {
|
||||||
|
List<FieldPersist> fieldsEntity = new LinkedList<>();
|
||||||
|
if (this.field != null)
|
||||||
|
for (FieldImportXml xmlField : this.field) {
|
||||||
|
fieldsEntity.add(xmlField.toPersistModel(fieldDataHelperServiceProvider));
|
||||||
|
}
|
||||||
|
return fieldsEntity;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
package eu.eudat.logic.utilities.documents.xml.datasetProfileXml.datasetProfileModel.Fields;
|
package eu.eudat.commons.types.descriptiontemplate.importmodel.fields;
|
||||||
|
|
||||||
import eu.eudat.commons.types.descriptiontemplate.RuleEntity;
|
import eu.eudat.model.persist.descriptiontemplatedefinition.RulePersist;
|
||||||
import jakarta.xml.bind.annotation.XmlAttribute;
|
import jakarta.xml.bind.annotation.XmlAttribute;
|
||||||
import jakarta.xml.bind.annotation.XmlElement;
|
import jakarta.xml.bind.annotation.XmlElement;
|
||||||
import jakarta.xml.bind.annotation.XmlRootElement;
|
import jakarta.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
@XmlRootElement(name = "rule")
|
@XmlRootElement(name = "rule")
|
||||||
public class Rule {
|
public class RuleImportXml {
|
||||||
|
|
||||||
private String ruleStyle;
|
private String ruleStyle;
|
||||||
private String target;
|
private String target;
|
||||||
private String type;
|
private String type;
|
||||||
private Value value;
|
private ValueImportXml value;
|
||||||
|
|
||||||
@XmlAttribute(name = "ruleStyle")
|
@XmlAttribute(name = "ruleStyle")
|
||||||
public String getRuleStyle() {
|
public String getRuleStyle() {
|
||||||
|
@ -38,16 +38,16 @@ public class Rule {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
@XmlElement(name = "value")
|
@XmlElement(name = "value")
|
||||||
public Value getValue() {
|
public ValueImportXml getValue() {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setValue(Value value) {
|
public void setValue(ValueImportXml value) {
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public RuleEntity toAdminCompositeModelSection(){
|
public RulePersist toPersistModel(){
|
||||||
RuleEntity ruleEntity = new RuleEntity();
|
RulePersist ruleEntity = new RulePersist();
|
||||||
ruleEntity.setTarget(target);
|
ruleEntity.setTarget(target);
|
||||||
ruleEntity.setValue(value.getValue());
|
ruleEntity.setValue(value.getValue());
|
||||||
return ruleEntity;
|
return ruleEntity;
|
|
@ -1,10 +1,10 @@
|
||||||
package eu.eudat.logic.utilities.documents.xml.datasetProfileXml.datasetProfileModel.Fields;
|
package eu.eudat.commons.types.descriptiontemplate.importmodel.fields;
|
||||||
|
|
||||||
import jakarta.xml.bind.annotation.XmlRootElement;
|
import jakarta.xml.bind.annotation.XmlRootElement;
|
||||||
import jakarta.xml.bind.annotation.XmlValue;
|
import jakarta.xml.bind.annotation.XmlValue;
|
||||||
|
|
||||||
@XmlRootElement(name = "schematic")
|
@XmlRootElement(name = "schematic")
|
||||||
public class Schematic {
|
public class SchematicImportXml {
|
||||||
|
|
||||||
private String schematic;
|
private String schematic;
|
||||||
|
|
|
@ -1,20 +1,20 @@
|
||||||
package eu.eudat.logic.utilities.documents.xml.datasetProfileXml.datasetProfileModel.Fields;
|
package eu.eudat.commons.types.descriptiontemplate.importmodel.fields;
|
||||||
|
|
||||||
import jakarta.xml.bind.annotation.XmlElement;
|
import jakarta.xml.bind.annotation.XmlElement;
|
||||||
import jakarta.xml.bind.annotation.XmlRootElement;
|
import jakarta.xml.bind.annotation.XmlRootElement;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@XmlRootElement(name = "schematics")
|
@XmlRootElement(name = "schematics")
|
||||||
public class Schematics {
|
public class SchematicsImportXml {
|
||||||
|
|
||||||
private List<Schematic> schematics;
|
private List<SchematicImportXml> schematics;
|
||||||
|
|
||||||
@XmlElement(name = "schematic")
|
@XmlElement(name = "schematic")
|
||||||
public List<Schematic> getSchematics() {
|
public List<SchematicImportXml> getSchematics() {
|
||||||
return schematics;
|
return schematics;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSchematics(List<Schematic> schematics) {
|
public void setSchematics(List<SchematicImportXml> schematics) {
|
||||||
this.schematics = schematics;
|
this.schematics = schematics;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,10 +1,10 @@
|
||||||
package eu.eudat.logic.utilities.documents.xml.datasetProfileXml.datasetProfileModel.Fields;
|
package eu.eudat.commons.types.descriptiontemplate.importmodel.fields;
|
||||||
|
|
||||||
import jakarta.xml.bind.annotation.XmlAttribute;
|
import jakarta.xml.bind.annotation.XmlAttribute;
|
||||||
import jakarta.xml.bind.annotation.XmlRootElement;
|
import jakarta.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
@XmlRootElement(name = "validation")
|
@XmlRootElement(name = "validation")
|
||||||
public class Validation {
|
public class ValidationImportXml {
|
||||||
|
|
||||||
private int type;
|
private int type;
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
package eu.eudat.commons.types.descriptiontemplate.importmodel.fields;
|
||||||
|
|
||||||
|
import eu.eudat.commons.enums.FieldValidationType;
|
||||||
|
import jakarta.xml.bind.annotation.XmlElement;
|
||||||
|
import jakarta.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
|
@XmlRootElement(name = "validations")
|
||||||
|
public class ValidationsImportXml {
|
||||||
|
|
||||||
|
ValidationImportXml validation;
|
||||||
|
|
||||||
|
@XmlElement(name = "validation")
|
||||||
|
public ValidationImportXml getValidation() {
|
||||||
|
return validation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValidation(ValidationImportXml validation) {
|
||||||
|
this.validation = validation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FieldValidationType toPersistModel() {
|
||||||
|
return FieldValidationType.of((short)validation.getType());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package eu.eudat.logic.utilities.documents.xml.datasetProfileXml.datasetProfileModel.Fields;
|
package eu.eudat.commons.types.descriptiontemplate.importmodel.fields;
|
||||||
|
|
||||||
import jakarta.xml.bind.annotation.XmlAttribute;
|
import jakarta.xml.bind.annotation.XmlAttribute;
|
||||||
import jakarta.xml.bind.annotation.XmlRootElement;
|
import jakarta.xml.bind.annotation.XmlRootElement;
|
||||||
import jakarta.xml.bind.annotation.XmlValue;
|
import jakarta.xml.bind.annotation.XmlValue;
|
||||||
|
|
||||||
@XmlRootElement(name = "value")
|
@XmlRootElement(name = "value")
|
||||||
public class Value {
|
public class ValueImportXml {
|
||||||
|
|
||||||
private String type;
|
private String type;
|
||||||
private String value;
|
private String value;
|
|
@ -1,13 +1,12 @@
|
||||||
package eu.eudat.logic.utilities.documents.xml.datasetProfileXml.datasetProfileModel.Fields;
|
package eu.eudat.commons.types.descriptiontemplate.importmodel.fields;
|
||||||
|
|
||||||
|
|
||||||
import eu.eudat.commons.enums.FieldType;
|
import eu.eudat.commons.enums.FieldType;
|
||||||
import eu.eudat.commons.types.descriptiontemplate.todelete.FieldDescriptionEntity;
|
|
||||||
import jakarta.xml.bind.annotation.XmlAttribute;
|
import jakarta.xml.bind.annotation.XmlAttribute;
|
||||||
import jakarta.xml.bind.annotation.XmlRootElement;
|
import jakarta.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
@XmlRootElement(name = "viewStyle")
|
@XmlRootElement(name = "viewStyle")
|
||||||
public class ViewStyle {
|
public class ViewStyleImportXml {
|
||||||
|
|
||||||
private String cssClass;
|
private String cssClass;
|
||||||
private String renderStyle;
|
private String renderStyle;
|
||||||
|
@ -29,10 +28,7 @@ public class ViewStyle {
|
||||||
this.renderStyle = renderStyle;
|
this.renderStyle = renderStyle;
|
||||||
}
|
}
|
||||||
|
|
||||||
public FieldDescriptionEntity toAdminCompositeModelSection(){
|
public FieldType toPersistModel(){
|
||||||
FieldDescriptionEntity fieldDescriptionEntity = new FieldDescriptionEntity();
|
return FieldType.of(this.renderStyle);
|
||||||
fieldDescriptionEntity.setCssClass(this.cssClass);
|
|
||||||
fieldDescriptionEntity.setFieldType(FieldType.of(this.renderStyle));
|
|
||||||
return fieldDescriptionEntity;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,43 @@
|
||||||
|
package eu.eudat.commons.types.descriptiontemplate.importmodel.fields;
|
||||||
|
|
||||||
|
import eu.eudat.model.persist.descriptiontemplatedefinition.RulePersist;
|
||||||
|
import jakarta.xml.bind.annotation.XmlAttribute;
|
||||||
|
import jakarta.xml.bind.annotation.XmlElement;
|
||||||
|
import jakarta.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@XmlRootElement(name = "visible")
|
||||||
|
public class VisibleImportXml {
|
||||||
|
|
||||||
|
private String style;
|
||||||
|
private List<RuleImportXml> rule;
|
||||||
|
|
||||||
|
@XmlAttribute(name = "style")
|
||||||
|
public String getStyle() {
|
||||||
|
return style;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStyle(String style) {
|
||||||
|
this.style = style;
|
||||||
|
}
|
||||||
|
@XmlElement(name = "rule")
|
||||||
|
public List<RuleImportXml> getRule() {
|
||||||
|
return rule;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRule(List<RuleImportXml> rule) {
|
||||||
|
this.rule = rule;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<RulePersist> toPersistModel(){
|
||||||
|
List<RulePersist> rulePersists = new ArrayList<>();
|
||||||
|
if(this.rule!=null) {
|
||||||
|
for (RuleImportXml xmlRule : this.rule) {
|
||||||
|
rulePersists.add(xmlRule.toPersistModel());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return rulePersists;
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,7 +3,7 @@ package eu.eudat.model.persist.descriptiontemplatedefinition;
|
||||||
import jakarta.validation.constraints.NotEmpty;
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
|
||||||
public abstract class MultiplicityPersist {
|
public class MultiplicityPersist {
|
||||||
|
|
||||||
@NotNull(message = "{validation.empty}")
|
@NotNull(message = "{validation.empty}")
|
||||||
private Integer min = null;
|
private Integer min = null;
|
||||||
|
|
|
@ -10,10 +10,12 @@ import gr.cite.tools.exception.MyNotFoundException;
|
||||||
import gr.cite.tools.exception.MyValidationException;
|
import gr.cite.tools.exception.MyValidationException;
|
||||||
import gr.cite.tools.fieldset.FieldSet;
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
import jakarta.xml.bind.JAXBException;
|
import jakarta.xml.bind.JAXBException;
|
||||||
|
import org.xml.sax.SAXException;
|
||||||
|
|
||||||
import javax.management.InvalidApplicationException;
|
import javax.management.InvalidApplicationException;
|
||||||
import javax.xml.parsers.ParserConfigurationException;
|
import javax.xml.parsers.ParserConfigurationException;
|
||||||
import javax.xml.transform.TransformerException;
|
import javax.xml.transform.TransformerException;
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public interface DescriptionTemplateService {
|
public interface DescriptionTemplateService {
|
||||||
|
@ -22,5 +24,5 @@ public interface DescriptionTemplateService {
|
||||||
void deleteAndSave(UUID id) throws MyForbiddenException, InvalidApplicationException;
|
void deleteAndSave(UUID id) throws MyForbiddenException, InvalidApplicationException;
|
||||||
DescriptionTemplate buildClone(UUID id, FieldSet fields) throws MyForbiddenException, MyValidationException, MyApplicationException, MyNotFoundException;
|
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 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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,9 +10,11 @@ import eu.eudat.commons.enums.UserDescriptionTemplateRole;
|
||||||
import eu.eudat.commons.scope.user.UserScope;
|
import eu.eudat.commons.scope.user.UserScope;
|
||||||
import eu.eudat.commons.types.descriptiontemplate.*;
|
import eu.eudat.commons.types.descriptiontemplate.*;
|
||||||
import eu.eudat.commons.types.descriptiontemplate.fielddata.BaseFieldDataEntity;
|
import eu.eudat.commons.types.descriptiontemplate.fielddata.BaseFieldDataEntity;
|
||||||
|
import eu.eudat.commons.types.descriptiontemplate.importmodel.DescriptionTemplateImportXml;
|
||||||
import eu.eudat.convention.ConventionService;
|
import eu.eudat.convention.ConventionService;
|
||||||
import eu.eudat.data.DescriptionTemplateEntity;
|
import eu.eudat.data.DescriptionTemplateEntity;
|
||||||
import eu.eudat.data.UserDescriptionTemplateEntity;
|
import eu.eudat.data.UserDescriptionTemplateEntity;
|
||||||
|
import eu.eudat.data.old.UserInfo;
|
||||||
import eu.eudat.errorcode.ErrorThesaurusProperties;
|
import eu.eudat.errorcode.ErrorThesaurusProperties;
|
||||||
import eu.eudat.model.DescriptionTemplate;
|
import eu.eudat.model.DescriptionTemplate;
|
||||||
import eu.eudat.model.builder.DescriptionTemplateBuilder;
|
import eu.eudat.model.builder.DescriptionTemplateBuilder;
|
||||||
|
@ -29,6 +31,8 @@ import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.BaseFieldD
|
||||||
import eu.eudat.query.DescriptionTemplateQuery;
|
import eu.eudat.query.DescriptionTemplateQuery;
|
||||||
import eu.eudat.query.UserDescriptionTemplateQuery;
|
import eu.eudat.query.UserDescriptionTemplateQuery;
|
||||||
import eu.eudat.service.fielddatahelper.FieldDataHelperServiceProvider;
|
import eu.eudat.service.fielddatahelper.FieldDataHelperServiceProvider;
|
||||||
|
import eu.eudat.service.mail.MailService;
|
||||||
|
import eu.eudat.service.mail.SimpleMail;
|
||||||
import gr.cite.commons.web.authz.service.AuthorizationService;
|
import gr.cite.commons.web.authz.service.AuthorizationService;
|
||||||
import gr.cite.tools.data.builder.BuilderFactory;
|
import gr.cite.tools.data.builder.BuilderFactory;
|
||||||
import gr.cite.tools.data.deleter.DeleterFactory;
|
import gr.cite.tools.data.deleter.DeleterFactory;
|
||||||
|
@ -42,6 +46,7 @@ import gr.cite.tools.fieldset.BaseFieldSet;
|
||||||
import gr.cite.tools.fieldset.FieldSet;
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
import gr.cite.tools.logging.LoggerService;
|
import gr.cite.tools.logging.LoggerService;
|
||||||
import gr.cite.tools.logging.MapLogEntry;
|
import gr.cite.tools.logging.MapLogEntry;
|
||||||
|
import gr.cite.tools.validation.ValidationService;
|
||||||
import jakarta.persistence.EntityManager;
|
import jakarta.persistence.EntityManager;
|
||||||
import jakarta.xml.bind.JAXBException;
|
import jakarta.xml.bind.JAXBException;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
@ -49,14 +54,19 @@ import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.MessageSource;
|
import org.springframework.context.MessageSource;
|
||||||
import org.springframework.context.i18n.LocaleContextHolder;
|
import org.springframework.context.i18n.LocaleContextHolder;
|
||||||
|
import org.springframework.core.env.Environment;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.w3c.dom.Document;
|
||||||
|
import org.w3c.dom.Element;
|
||||||
|
import org.xml.sax.SAXException;
|
||||||
|
|
||||||
import javax.management.InvalidApplicationException;
|
import javax.management.InvalidApplicationException;
|
||||||
import javax.xml.parsers.ParserConfigurationException;
|
import javax.xml.parsers.ParserConfigurationException;
|
||||||
import javax.xml.transform.TransformerException;
|
import javax.xml.transform.TransformerException;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
@ -80,6 +90,9 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
|
||||||
private final FieldDataHelperServiceProvider fieldDataHelperServiceProvider;
|
private final FieldDataHelperServiceProvider fieldDataHelperServiceProvider;
|
||||||
private final QueryFactory queryFactory;
|
private final QueryFactory queryFactory;
|
||||||
private final ErrorThesaurusProperties errors;
|
private final ErrorThesaurusProperties errors;
|
||||||
|
private final ValidationService validationService;
|
||||||
|
private final MailService mailService;
|
||||||
|
private final Environment environment;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public DescriptionTemplateServiceImpl(
|
public DescriptionTemplateServiceImpl(
|
||||||
|
@ -90,7 +103,7 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
|
||||||
ConventionService conventionService,
|
ConventionService conventionService,
|
||||||
MessageSource messageSource,
|
MessageSource messageSource,
|
||||||
XmlHandlingService xmlHandlingService,
|
XmlHandlingService xmlHandlingService,
|
||||||
FieldDataHelperServiceProvider fieldDataHelperServiceProvider, QueryFactory queryFactory, ErrorThesaurusProperties errors) {
|
FieldDataHelperServiceProvider fieldDataHelperServiceProvider, QueryFactory queryFactory, ErrorThesaurusProperties errors, ValidationService validationService, MailService mailService, Environment environment) {
|
||||||
this.entityManager = entityManager;
|
this.entityManager = entityManager;
|
||||||
this.userScope = userScope;
|
this.userScope = userScope;
|
||||||
this.authorizationService = authorizationService;
|
this.authorizationService = authorizationService;
|
||||||
|
@ -102,6 +115,9 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
|
||||||
this.fieldDataHelperServiceProvider = fieldDataHelperServiceProvider;
|
this.fieldDataHelperServiceProvider = fieldDataHelperServiceProvider;
|
||||||
this.queryFactory = queryFactory;
|
this.queryFactory = queryFactory;
|
||||||
this.errors = errors;
|
this.errors = errors;
|
||||||
|
this.validationService = validationService;
|
||||||
|
this.mailService = mailService;
|
||||||
|
this.environment = environment;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DescriptionTemplate persist(DescriptionTemplatePersist model, FieldSet fields) throws MyForbiddenException, MyValidationException, MyApplicationException, MyNotFoundException, InvalidApplicationException, JAXBException, ParserConfigurationException, JsonProcessingException, TransformerException {
|
public DescriptionTemplate persist(DescriptionTemplatePersist model, FieldSet fields) throws MyForbiddenException, MyValidationException, MyApplicationException, MyNotFoundException, InvalidApplicationException, JAXBException, ParserConfigurationException, JsonProcessingException, TransformerException {
|
||||||
|
@ -160,15 +176,34 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
|
||||||
data.setUser(userId);
|
data.setUser(userId);
|
||||||
data.setRole(UserDescriptionTemplateRole.Member);
|
data.setRole(UserDescriptionTemplateRole.Member);
|
||||||
this.entityManager.persist(data);
|
this.entityManager.persist(data);
|
||||||
|
this.sendJoinMail(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
List<UUID> finalUsers = users;
|
List<UUID> finalUsers = users;
|
||||||
List<UserDescriptionTemplateEntity> toDelete = items.stream().filter(x-> finalUsers.stream().noneMatch(y-> y.equals(x.getUser()))).collect(Collectors.toList());
|
List<UserDescriptionTemplateEntity> toDelete = items.stream().filter(x-> finalUsers.stream().noneMatch(y-> y.equals(x.getUser()))).collect(Collectors.toList());
|
||||||
|
|
||||||
this.deleterFactory.deleter(UserDescriptionTemplateDeleter.class).delete(toDelete);
|
this.deleterFactory.deleter(UserDescriptionTemplateDeleter.class).delete(toDelete);
|
||||||
|
}
|
||||||
|
private void sendJoinMail(UserDescriptionTemplateEntity userDatasetProfile) {
|
||||||
|
SimpleMail mail = new SimpleMail();
|
||||||
|
UserInfo user = this.entityManager.find(UserInfo.class, userDatasetProfile.getUser());
|
||||||
|
DescriptionTemplateEntity descriptionTemplate = this.queryFactory.query(DescriptionTemplateQuery.class).isActive(IsActive.Active).ids(userDatasetProfile.getDescriptionTemplate()).first();
|
||||||
|
|
||||||
|
mail.setSubject(environment.getProperty("admin.mail.subject").replace( "{templateName}", descriptionTemplate.getLabel()));
|
||||||
|
String content = this.mailService.getMailTemplateContent(environment.getProperty("email.dataset.template"));
|
||||||
|
content = content.replace("{recipient}", user.getName());
|
||||||
|
content = content.replace("{templateName}", descriptionTemplate.getLabel());
|
||||||
|
content = content.replace("{host}", this.environment.getProperty("dmp.domain"));
|
||||||
|
content = content.replace("{templateID}", descriptionTemplate.getId().toString());
|
||||||
|
mail.setContent(content);
|
||||||
|
mail.setTo(user.getEmail());
|
||||||
|
try {
|
||||||
|
this.mailService.sendSimpleMail(mail);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
logger.error(ex.getMessage(), ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
private void addOwner(DescriptionTemplateEntity descriptionTemplateEntity) throws InvalidApplicationException {
|
private void addOwner(DescriptionTemplateEntity descriptionTemplateEntity) throws InvalidApplicationException {
|
||||||
UserDescriptionTemplateEntity data = new UserDescriptionTemplateEntity();
|
UserDescriptionTemplateEntity data = new UserDescriptionTemplateEntity();
|
||||||
data.setId(UUID.randomUUID());
|
data.setId(UUID.randomUUID());
|
||||||
|
@ -428,5 +463,25 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
|
||||||
return this.builderFactory.builder(DescriptionTemplateBuilder.class).authorize(AuthorizationFlags.OwnerOrPermission).build(BaseFieldSet.build(fields, DescriptionTemplate._id), data);
|
return this.builderFactory.builder(DescriptionTemplateBuilder.class).authorize(AuthorizationFlags.OwnerOrPermission).build(BaseFieldSet.build(fields, DescriptionTemplate._id), data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DescriptionTemplate importXml(byte[] bytes, UUID id, String label, FieldSet fields) throws MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, TransformerException, InvalidApplicationException, IOException, InstantiationException, IllegalAccessException, SAXException {
|
||||||
|
logger.debug(new MapLogEntry("import data").And("bytes", bytes).And("fields", fields));
|
||||||
|
|
||||||
|
this.authorizationService.authorizeForce(Permission.ImportDescriptionTemplate);
|
||||||
|
|
||||||
|
if (id != null) {
|
||||||
|
DescriptionTemplateImportXml importXml = this.xmlHandlingService.fromXml(DescriptionTemplateImportXml.class, new String(bytes, StandardCharsets.UTF_8));
|
||||||
|
DescriptionTemplatePersist persist = importXml.toPersistModel(label, this.fieldDataHelperServiceProvider);
|
||||||
|
this.validationService.validateForce(persist);
|
||||||
|
return this.persist(persist, fields);
|
||||||
|
} else {
|
||||||
|
DescriptionTemplateImportXml importXml = this.xmlHandlingService.fromXml(DescriptionTemplateImportXml.class, new String(bytes, StandardCharsets.UTF_8));
|
||||||
|
NewVersionDescriptionTemplatePersist persist = importXml.toNewVersionPersistModel(id, label, this.fieldDataHelperServiceProvider);
|
||||||
|
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()));
|
||||||
|
persist.setHash(this.conventionService.hashValue(oldDescriptionTemplateEntity.getUpdatedAt()));
|
||||||
|
this.validationService.validateForce(persist);
|
||||||
|
return this.createNewVersion(persist, fields);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@ import org.jetbrains.annotations.NotNull;
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.w3c.dom.Element;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
|
@ -42,17 +43,17 @@ public class AutoCompleteFieldDataHelperService extends BaseFieldDataHelperServi
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldDataEntity<?> newDataInstance() {
|
public AutoCompleteDataEntity newDataInstanceInternal() {
|
||||||
return new AutoCompleteDataEntity();
|
return new AutoCompleteDataEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldData newModelInstance() {
|
public AutoCompleteData newModelInstanceInternal() {
|
||||||
return new AutoCompleteData();
|
return new AutoCompleteData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldDataPersist newPersistModelInstance() {
|
public AutoCompleteDataPersist newPersistModelInstanceInternal() {
|
||||||
return new AutoCompleteDataPersist();
|
return new AutoCompleteDataPersist();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,4 +127,56 @@ public class AutoCompleteFieldDataHelperService extends BaseFieldDataHelperServi
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected AutoCompleteDataPersist mapDataToPersist(AutoCompleteDataEntity data, AutoCompleteDataPersist persist) {
|
||||||
|
persist.setMultiAutoComplete(data.getMultiAutoComplete());
|
||||||
|
if (!this.conventionService.isListNullOrEmpty(data.getAutoCompleteSingleDataList())){
|
||||||
|
persist.setAutoCompleteSingleDataList(new ArrayList<>());
|
||||||
|
for (AutoCompleteDataEntity.AutoCompleteSingleData autoCompleteSingleData: data.getAutoCompleteSingleDataList()) {
|
||||||
|
persist.getAutoCompleteSingleDataList().add(this.buildAutoCompleteSingleData(autoCompleteSingleData));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return persist;
|
||||||
|
}
|
||||||
|
|
||||||
|
private @NotNull AutoCompleteSingleDataPersist buildAutoCompleteSingleData(AutoCompleteDataEntity.AutoCompleteSingleData data){
|
||||||
|
AutoCompleteSingleDataPersist persist = new AutoCompleteSingleDataPersist();
|
||||||
|
if (data == null) return persist;
|
||||||
|
|
||||||
|
persist.setUrl(data.getUrl());
|
||||||
|
persist.setAutocompleteType(data.getAutocompleteType());
|
||||||
|
persist.setOptionsRoot(data.getOptionsRoot());
|
||||||
|
persist.setHasAuth(data.getHasAuth());
|
||||||
|
if(data.getAutoCompleteOptions() != null) persist.setAutoCompleteOptions(this.buildOption(data.getAutoCompleteOptions()));
|
||||||
|
if(data.getAuth() != null) persist.setAuth(this.buildAuthAutoCompleteData(data.getAuth()));
|
||||||
|
persist.setMethod(data.getMethod());
|
||||||
|
|
||||||
|
return persist;
|
||||||
|
}
|
||||||
|
|
||||||
|
private @NotNull ComboBoxOptionPersist buildOption(ComboBoxDataEntity.Option data){
|
||||||
|
ComboBoxOptionPersist persist = new ComboBoxOptionPersist();
|
||||||
|
if (data == null) return persist;
|
||||||
|
|
||||||
|
persist.setLabel(data.getLabel());
|
||||||
|
persist.setValue(data.getValue());
|
||||||
|
persist.setUri(data.getUri());
|
||||||
|
persist.setSource(data.getSource());
|
||||||
|
|
||||||
|
return persist;
|
||||||
|
}
|
||||||
|
|
||||||
|
private @NotNull AuthAutoCompleteDataPersist buildAuthAutoCompleteData(AutoCompleteDataEntity.AuthAutoCompleteData data){
|
||||||
|
AuthAutoCompleteDataPersist persist = new AuthAutoCompleteDataPersist();
|
||||||
|
if (data == null) return persist;
|
||||||
|
|
||||||
|
persist.setBody(data.getBody());
|
||||||
|
persist.setUrl(data.getUrl());
|
||||||
|
persist.setMethod(data.getMethod());
|
||||||
|
persist.setPath(data.getPath());
|
||||||
|
persist.setType(data.getType());
|
||||||
|
|
||||||
|
return persist;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,20 +2,48 @@ package eu.eudat.service.fielddatahelper;
|
||||||
|
|
||||||
import eu.eudat.authorization.AuthorizationFlags;
|
import eu.eudat.authorization.AuthorizationFlags;
|
||||||
import eu.eudat.commons.types.descriptiontemplate.fielddata.BaseFieldDataEntity;
|
import eu.eudat.commons.types.descriptiontemplate.fielddata.BaseFieldDataEntity;
|
||||||
|
import eu.eudat.commons.types.descriptiontemplate.fielddata.BooleanDecisionDataEntity;
|
||||||
import eu.eudat.model.descriptiontemplatedefinition.fielddata.BaseFieldData;
|
import eu.eudat.model.descriptiontemplatedefinition.fielddata.BaseFieldData;
|
||||||
|
import eu.eudat.model.descriptiontemplatedefinition.fielddata.BooleanDecisionData;
|
||||||
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.BaseFieldDataPersist;
|
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.BaseFieldDataPersist;
|
||||||
|
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.BooleanDecisionDataPersist;
|
||||||
import gr.cite.tools.fieldset.FieldSet;
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
|
import org.w3c.dom.Element;
|
||||||
|
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public abstract class BaseFieldDataHelperService<M extends BaseFieldData, PM extends BaseFieldDataPersist, D extends BaseFieldDataEntity<?>> implements FieldDataHelperService {
|
public abstract class BaseFieldDataHelperService<M extends BaseFieldData, PM extends BaseFieldDataPersist, D extends BaseFieldDataEntity<?>> implements FieldDataHelperService {
|
||||||
protected String subType;
|
protected abstract D newDataInstanceInternal();
|
||||||
|
protected abstract M newModelInstanceInternal();
|
||||||
|
protected abstract PM newPersistModelInstanceInternal();
|
||||||
|
|
||||||
protected abstract List<M> buildInternal(FieldSet fieldSet, List<D> datas, EnumSet<AuthorizationFlags> authorizationFlags);
|
protected abstract List<M> buildInternal(FieldSet fieldSet, List<D> datas, EnumSet<AuthorizationFlags> authorizationFlags);
|
||||||
protected abstract D applyPersistInternal(PM persist, D data);
|
protected abstract D applyPersistInternal(PM persist, D data);
|
||||||
|
protected abstract PM mapDataToPersist(D data, PM persist);
|
||||||
|
@Override
|
||||||
|
public BaseFieldDataEntity<?> newDataInstance() {
|
||||||
|
return this.newDataInstanceInternal();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BaseFieldData newModelInstance() {
|
||||||
|
return this.newModelInstanceInternal();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BaseFieldDataPersist newPersistModelInstance() {
|
||||||
|
return this.newPersistModelInstanceInternal();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BaseFieldDataPersist mapDataToPersist(BaseFieldDataEntity<?> data) {
|
||||||
|
PM model = this.newPersistModelInstanceInternal();
|
||||||
|
model.setFieldType(this.getFormType());
|
||||||
|
model.setLabel(data.getLabel());
|
||||||
|
return this.mapDataToPersist((D)data, model);
|
||||||
|
}
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldDataEntity<?> applyPersist(BaseFieldDataPersist persist){
|
public BaseFieldDataEntity<?> applyPersist(BaseFieldDataPersist persist){
|
||||||
BaseFieldDataEntity<?> instance = this.newDataInstance();
|
BaseFieldDataEntity<?> instance = this.newDataInstance();
|
||||||
|
|
|
@ -17,6 +17,7 @@ import gr.cite.tools.fieldset.FieldSet;
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.w3c.dom.Element;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
|
@ -36,17 +37,17 @@ public class BooleanDecisionFieldDataHelperService extends BaseFieldDataHelperSe
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldDataEntity<?> newDataInstance() {
|
public BooleanDecisionDataEntity newDataInstanceInternal() {
|
||||||
return new BooleanDecisionDataEntity();
|
return new BooleanDecisionDataEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldData newModelInstance() {
|
public BooleanDecisionData newModelInstanceInternal() {
|
||||||
return new BooleanDecisionData();
|
return new BooleanDecisionData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldDataPersist newPersistModelInstance() {
|
public BooleanDecisionDataPersist newPersistModelInstanceInternal() {
|
||||||
return new BooleanDecisionDataPersist();
|
return new BooleanDecisionDataPersist();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,7 +59,6 @@ public class BooleanDecisionFieldDataHelperService extends BaseFieldDataHelperSe
|
||||||
public Class<?> getModelClass() {
|
public Class<?> getModelClass() {
|
||||||
return BooleanDecisionData.class;
|
return BooleanDecisionData.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<?> getPersistModelClass() {
|
public Class<?> getPersistModelClass() {
|
||||||
return BooleanDecisionDataPersist.class;
|
return BooleanDecisionDataPersist.class;
|
||||||
|
@ -73,4 +73,10 @@ public class BooleanDecisionFieldDataHelperService extends BaseFieldDataHelperSe
|
||||||
protected BooleanDecisionDataEntity applyPersistInternal(BooleanDecisionDataPersist persist, BooleanDecisionDataEntity data) {
|
protected BooleanDecisionDataEntity applyPersistInternal(BooleanDecisionDataPersist persist, BooleanDecisionDataEntity data) {
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected BooleanDecisionDataPersist mapDataToPersist(BooleanDecisionDataEntity data, BooleanDecisionDataPersist persist) {
|
||||||
|
return persist;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,17 +36,17 @@ public class CheckBoxFieldDataHelperService extends BaseFieldDataHelperService<C
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldDataEntity<?> newDataInstance() {
|
public CheckBoxDataEntity newDataInstanceInternal() {
|
||||||
return new CheckBoxDataEntity();
|
return new CheckBoxDataEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldData newModelInstance() {
|
public CheckBoxData newModelInstanceInternal() {
|
||||||
return new CheckBoxData();
|
return new CheckBoxData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldDataPersist newPersistModelInstance() {
|
public CheckBoxDataPersist newPersistModelInstanceInternal() {
|
||||||
return new CheckBoxDataPersist();
|
return new CheckBoxDataPersist();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,4 +73,9 @@ public class CheckBoxFieldDataHelperService extends BaseFieldDataHelperService<C
|
||||||
protected CheckBoxDataEntity applyPersistInternal(CheckBoxDataPersist persist, CheckBoxDataEntity data) {
|
protected CheckBoxDataEntity applyPersistInternal(CheckBoxDataPersist persist, CheckBoxDataEntity data) {
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected CheckBoxDataPersist mapDataToPersist(CheckBoxDataEntity data, CheckBoxDataPersist persist) {
|
||||||
|
return persist;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,17 +34,17 @@ public class CurrencyFieldDataHelperService extends BaseFieldDataHelperService<C
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldDataEntity<?> newDataInstance() {
|
public CurrencyDataEntity newDataInstanceInternal() {
|
||||||
return new CurrencyDataEntity();
|
return new CurrencyDataEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldData newModelInstance() {
|
public CurrencyData newModelInstanceInternal() {
|
||||||
return new CurrencyData();
|
return new CurrencyData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldDataPersist newPersistModelInstance() {
|
public CurrencyDataPersist newPersistModelInstanceInternal() {
|
||||||
return new CurrencyDataPersist();
|
return new CurrencyDataPersist();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,4 +70,9 @@ public class CurrencyFieldDataHelperService extends BaseFieldDataHelperService<C
|
||||||
protected CurrencyDataEntity applyPersistInternal(CurrencyDataPersist persist, CurrencyDataEntity data) {
|
protected CurrencyDataEntity applyPersistInternal(CurrencyDataPersist persist, CurrencyDataEntity data) {
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected CurrencyDataPersist mapDataToPersist(CurrencyDataEntity data, CurrencyDataPersist persist) {
|
||||||
|
return persist;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,17 +38,17 @@ public class DataRepositoryFieldDataHelperService extends BaseFieldDataHelperSer
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldDataEntity<?> newDataInstance() {
|
public DataRepositoryDataEntity newDataInstanceInternal() {
|
||||||
return new DataRepositoryDataEntity();
|
return new DataRepositoryDataEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldData newModelInstance() {
|
public DataRepositoryData newModelInstanceInternal() {
|
||||||
return new DataRepositoryData();
|
return new DataRepositoryData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldDataPersist newPersistModelInstance() {
|
public DataRepositoryDataPersist newPersistModelInstanceInternal() {
|
||||||
return new DataRepositoryDataPersist();
|
return new DataRepositoryDataPersist();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,4 +75,10 @@ public class DataRepositoryFieldDataHelperService extends BaseFieldDataHelperSer
|
||||||
data.setMultiAutoComplete(persist.getMultiAutoComplete());
|
data.setMultiAutoComplete(persist.getMultiAutoComplete());
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected DataRepositoryDataPersist mapDataToPersist(DataRepositoryDataEntity data, DataRepositoryDataPersist persist) {
|
||||||
|
persist.setMultiAutoComplete(data.getMultiAutoComplete());
|
||||||
|
return persist;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,17 +36,17 @@ public class DatasetAutoCompleteFieldDataHelperService extends BaseFieldDataHelp
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldDataEntity<?> newDataInstance() {
|
public DatasetAutoCompleteDataEntity newDataInstanceInternal() {
|
||||||
return new DatasetAutoCompleteDataEntity();
|
return new DatasetAutoCompleteDataEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldData newModelInstance() {
|
public DatasetAutoCompleteData newModelInstanceInternal() {
|
||||||
return new DatasetAutoCompleteData();
|
return new DatasetAutoCompleteData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldDataPersist newPersistModelInstance() {
|
public DatasetAutoCompleteDataPersist newPersistModelInstanceInternal() {
|
||||||
return new DatasetAutoCompleteDataPersist();
|
return new DatasetAutoCompleteDataPersist();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,4 +74,10 @@ public class DatasetAutoCompleteFieldDataHelperService extends BaseFieldDataHelp
|
||||||
data.setMultiAutoComplete(persist.getMultiAutoComplete());
|
data.setMultiAutoComplete(persist.getMultiAutoComplete());
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected DatasetAutoCompleteDataPersist mapDataToPersist(DatasetAutoCompleteDataEntity data, DatasetAutoCompleteDataPersist persist) {
|
||||||
|
persist.setMultiAutoComplete(data.getMultiAutoComplete());
|
||||||
|
return persist;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,24 +29,23 @@ public class DatasetIdentifierFieldDataHelperService extends BaseFieldDataHelper
|
||||||
this.builderFactory = builderFactory;
|
this.builderFactory = builderFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FieldType getFormType() {
|
public FieldType getFormType() {
|
||||||
return FieldType.DATASET_IDENTIFIER;
|
return FieldType.DATASET_IDENTIFIER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldDataEntity<?> newDataInstance() {
|
public DatasetIdentifierDataEntity newDataInstanceInternal() {
|
||||||
return new DatasetIdentifierDataEntity();
|
return new DatasetIdentifierDataEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldData newModelInstance() {
|
public DatasetIdentifierData newModelInstanceInternal() {
|
||||||
return new DatasetIdentifierData();
|
return new DatasetIdentifierData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldDataPersist newPersistModelInstance() {
|
public DatasetIdentifierDataPersist newPersistModelInstanceInternal() {
|
||||||
return new DatasetIdentifierDataPersist();
|
return new DatasetIdentifierDataPersist();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,4 +71,9 @@ public class DatasetIdentifierFieldDataHelperService extends BaseFieldDataHelper
|
||||||
protected DatasetIdentifierDataEntity applyPersistInternal(DatasetIdentifierDataPersist persist, DatasetIdentifierDataEntity data) {
|
protected DatasetIdentifierDataEntity applyPersistInternal(DatasetIdentifierDataPersist persist, DatasetIdentifierDataEntity data) {
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected DatasetIdentifierDataPersist mapDataToPersist(DatasetIdentifierDataEntity data, DatasetIdentifierDataPersist persist) {
|
||||||
|
return persist;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,16 +36,16 @@ public class DatePickerFieldDataHelperService extends BaseFieldDataHelperService
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldDataEntity<?> newDataInstance() {
|
public DatePickerDataEntity newDataInstanceInternal() {
|
||||||
return new DatePickerDataEntity();
|
return new DatePickerDataEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldData newModelInstance() {
|
public DatePickerData newModelInstanceInternal() {
|
||||||
return new DatePickerData();
|
return new DatePickerData();
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldDataPersist newPersistModelInstance() {
|
public DatePickerDataPersist newPersistModelInstanceInternal() {
|
||||||
return new DatePickerDataPersist();
|
return new DatePickerDataPersist();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,4 +71,9 @@ public class DatePickerFieldDataHelperService extends BaseFieldDataHelperService
|
||||||
protected DatePickerDataEntity applyPersistInternal(DatePickerDataPersist persist, DatePickerDataEntity data) {
|
protected DatePickerDataEntity applyPersistInternal(DatePickerDataPersist persist, DatePickerDataEntity data) {
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected DatePickerDataPersist mapDataToPersist(DatePickerDataEntity data, DatePickerDataPersist persist) {
|
||||||
|
return persist;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,17 +36,17 @@ public class DmpAutoCompleteFieldDataHelperService extends BaseFieldDataHelperSe
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldDataEntity<?> newDataInstance() {
|
public DmpAutoCompleteDataEntity newDataInstanceInternal() {
|
||||||
return new DmpAutoCompleteDataEntity();
|
return new DmpAutoCompleteDataEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldData newModelInstance() {
|
public DmpAutoCompleteData newModelInstanceInternal() {
|
||||||
return new DmpAutoCompleteData();
|
return new DmpAutoCompleteData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldDataPersist newPersistModelInstance() {
|
public DmpAutoCompleteDataPersist newPersistModelInstanceInternal() {
|
||||||
return new DmpAutoCompleteDataPersist();
|
return new DmpAutoCompleteDataPersist();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,4 +74,10 @@ public class DmpAutoCompleteFieldDataHelperService extends BaseFieldDataHelperSe
|
||||||
data.setMultiAutoComplete(persist.getMultiAutoComplete());
|
data.setMultiAutoComplete(persist.getMultiAutoComplete());
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected DmpAutoCompleteDataPersist mapDataToPersist(DmpAutoCompleteDataEntity data, DmpAutoCompleteDataPersist persist) {
|
||||||
|
persist.setMultiAutoComplete(data.getMultiAutoComplete());
|
||||||
|
return persist;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,17 +36,17 @@ public class ExternalDatasetFieldDataHelperService extends BaseFieldDataHelperSe
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldDataEntity<?> newDataInstance() {
|
public ExternalDatasetDataEntity newDataInstanceInternal() {
|
||||||
return new ExternalDatasetDataEntity();
|
return new ExternalDatasetDataEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldData newModelInstance() {
|
public ExternalDatasetData newModelInstanceInternal() {
|
||||||
return new ExternalDatasetData();
|
return new ExternalDatasetData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldDataPersist newPersistModelInstance() {
|
public ExternalDatasetDataPersist newPersistModelInstanceInternal() {
|
||||||
return new ExternalDatasetDataPersist();
|
return new ExternalDatasetDataPersist();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,4 +74,11 @@ public class ExternalDatasetFieldDataHelperService extends BaseFieldDataHelperSe
|
||||||
data.setType(persist.getType());
|
data.setType(persist.getType());
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected ExternalDatasetDataPersist mapDataToPersist(ExternalDatasetDataEntity data, ExternalDatasetDataPersist persist) {
|
||||||
|
persist.setMultiAutoComplete(data.getMultiAutoComplete());
|
||||||
|
persist.setType(data.getType());
|
||||||
|
return persist;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ import eu.eudat.commons.types.descriptiontemplate.fielddata.BaseFieldDataEntity;
|
||||||
import eu.eudat.model.descriptiontemplatedefinition.fielddata.BaseFieldData;
|
import eu.eudat.model.descriptiontemplatedefinition.fielddata.BaseFieldData;
|
||||||
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.BaseFieldDataPersist;
|
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.BaseFieldDataPersist;
|
||||||
import gr.cite.tools.fieldset.FieldSet;
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
|
import org.w3c.dom.Element;
|
||||||
|
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -22,4 +23,5 @@ public interface FieldDataHelperService {
|
||||||
BaseFieldData buildOne(FieldSet fieldSet, BaseFieldDataEntity<?> data, EnumSet<AuthorizationFlags> authorizationFlags);
|
BaseFieldData buildOne(FieldSet fieldSet, BaseFieldDataEntity<?> data, EnumSet<AuthorizationFlags> authorizationFlags);
|
||||||
BaseFieldDataEntity<?> applyPersist(BaseFieldDataPersist persist);
|
BaseFieldDataEntity<?> applyPersist(BaseFieldDataPersist persist);
|
||||||
BaseFieldDataEntity<?> applyPersist(BaseFieldDataPersist persist, BaseFieldDataEntity<?> data);
|
BaseFieldDataEntity<?> applyPersist(BaseFieldDataPersist persist, BaseFieldDataEntity<?> data);
|
||||||
|
BaseFieldDataPersist mapDataToPersist(BaseFieldDataEntity<?> data);
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,17 +36,17 @@ public class FreeTextFieldDataHelperService extends BaseFieldDataHelperService<F
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldDataEntity<?> newDataInstance() {
|
public FreeTextDataEntity newDataInstanceInternal() {
|
||||||
return new FreeTextDataEntity();
|
return new FreeTextDataEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldData newModelInstance() {
|
public FreeTextData newModelInstanceInternal() {
|
||||||
return new FreeTextData();
|
return new FreeTextData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldDataPersist newPersistModelInstance() {
|
public FreeTextDataPersist newPersistModelInstanceInternal() {
|
||||||
return new FreeTextDataPersist();
|
return new FreeTextDataPersist();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,4 +73,9 @@ public class FreeTextFieldDataHelperService extends BaseFieldDataHelperService<F
|
||||||
protected FreeTextDataEntity applyPersistInternal(FreeTextDataPersist persist, FreeTextDataEntity data) {
|
protected FreeTextDataEntity applyPersistInternal(FreeTextDataPersist persist, FreeTextDataEntity data) {
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected FreeTextDataPersist mapDataToPersist(FreeTextDataEntity data, FreeTextDataPersist persist) {
|
||||||
|
return persist;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,17 +38,17 @@ public class JournalRepositoryFieldDataHelperService extends BaseFieldDataHelper
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldDataEntity<?> newDataInstance() {
|
public JournalRepositoryDataEntity newDataInstanceInternal() {
|
||||||
return new JournalRepositoryDataEntity();
|
return new JournalRepositoryDataEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldData newModelInstance() {
|
public JournalRepositoryData newModelInstanceInternal() {
|
||||||
return new JournalRepositoryData();
|
return new JournalRepositoryData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldDataPersist newPersistModelInstance() {
|
public JournalRepositoryDataPersist newPersistModelInstanceInternal() {
|
||||||
return new JournalRepositoryDataPersist();
|
return new JournalRepositoryDataPersist();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,4 +75,10 @@ public class JournalRepositoryFieldDataHelperService extends BaseFieldDataHelper
|
||||||
data.setMultiAutoComplete(persist.getMultiAutoComplete());
|
data.setMultiAutoComplete(persist.getMultiAutoComplete());
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected JournalRepositoryDataPersist mapDataToPersist(JournalRepositoryDataEntity data, JournalRepositoryDataPersist persist) {
|
||||||
|
persist.setMultiAutoComplete(data.getMultiAutoComplete());
|
||||||
|
return persist;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,17 +36,17 @@ public class LicenseFieldDataHelperService extends BaseFieldDataHelperService<Li
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldDataEntity<?> newDataInstance() {
|
public LicenseDataEntity newDataInstanceInternal() {
|
||||||
return new LicenseDataEntity();
|
return new LicenseDataEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldData newModelInstance() {
|
public LicenseData newModelInstanceInternal() {
|
||||||
return new LicenseData();
|
return new LicenseData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldDataPersist newPersistModelInstance() {
|
public LicenseDataPersist newPersistModelInstanceInternal() {
|
||||||
return new LicenseDataPersist();
|
return new LicenseDataPersist();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,4 +73,10 @@ public class LicenseFieldDataHelperService extends BaseFieldDataHelperService<Li
|
||||||
data.setMultiAutoComplete(persist.getMultiAutoComplete());
|
data.setMultiAutoComplete(persist.getMultiAutoComplete());
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected LicenseDataPersist mapDataToPersist(LicenseDataEntity data, LicenseDataPersist persist) {
|
||||||
|
persist.setMultiAutoComplete(data.getMultiAutoComplete());
|
||||||
|
return persist;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,17 +36,17 @@ public class OrganizationFieldDataHelperService extends BaseFieldDataHelperServi
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldDataEntity<?> newDataInstance() {
|
public OrganizationDataEntity newDataInstanceInternal() {
|
||||||
return new OrganizationDataEntity();
|
return new OrganizationDataEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldData newModelInstance() {
|
public OrganizationData newModelInstanceInternal() {
|
||||||
return new OrganizationData();
|
return new OrganizationData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldDataPersist newPersistModelInstance() {
|
public OrganizationDataPersist newPersistModelInstanceInternal() {
|
||||||
return new OrganizationDataPersist();
|
return new OrganizationDataPersist();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,4 +73,10 @@ public class OrganizationFieldDataHelperService extends BaseFieldDataHelperServi
|
||||||
data.setMultiAutoComplete(persist.getMultiAutoComplete());
|
data.setMultiAutoComplete(persist.getMultiAutoComplete());
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected OrganizationDataPersist mapDataToPersist(OrganizationDataEntity data, OrganizationDataPersist persist) {
|
||||||
|
persist.setMultiAutoComplete(data.getMultiAutoComplete());
|
||||||
|
return persist;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,17 +36,17 @@ public class PublicationFieldDataHelperService extends BaseFieldDataHelperServic
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldDataEntity<?> newDataInstance() {
|
public PublicationDataEntity newDataInstanceInternal() {
|
||||||
return new PublicationDataEntity();
|
return new PublicationDataEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldData newModelInstance() {
|
public PublicationData newModelInstanceInternal() {
|
||||||
return new PublicationData();
|
return new PublicationData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldDataPersist newPersistModelInstance() {
|
public PublicationDataPersist newPersistModelInstanceInternal() {
|
||||||
return new PublicationDataPersist();
|
return new PublicationDataPersist();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,4 +73,10 @@ public class PublicationFieldDataHelperService extends BaseFieldDataHelperServic
|
||||||
data.setMultiAutoComplete(persist.getMultiAutoComplete());
|
data.setMultiAutoComplete(persist.getMultiAutoComplete());
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected PublicationDataPersist mapDataToPersist(PublicationDataEntity data, PublicationDataPersist persist) {
|
||||||
|
persist.setMultiAutoComplete(data.getMultiAutoComplete());
|
||||||
|
return persist;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,17 +38,17 @@ public class PublicationRepositoryFieldDataHelperService extends BaseFieldDataHe
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldDataEntity<?> newDataInstance() {
|
public PublicationRepositoryDataEntity newDataInstanceInternal() {
|
||||||
return new PublicationRepositoryDataEntity();
|
return new PublicationRepositoryDataEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldData newModelInstance() {
|
public PublicationRepositoryData newModelInstanceInternal() {
|
||||||
return new PublicationRepositoryData();
|
return new PublicationRepositoryData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldDataPersist newPersistModelInstance() {
|
public PublicationRepositoryDataPersist newPersistModelInstanceInternal() {
|
||||||
return new PublicationRepositoryDataPersist();
|
return new PublicationRepositoryDataPersist();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,4 +75,10 @@ public class PublicationRepositoryFieldDataHelperService extends BaseFieldDataHe
|
||||||
data.setMultiAutoComplete(persist.getMultiAutoComplete());
|
data.setMultiAutoComplete(persist.getMultiAutoComplete());
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected PublicationRepositoryDataPersist mapDataToPersist(PublicationRepositoryDataEntity data, PublicationRepositoryDataPersist persist) {
|
||||||
|
persist.setMultiAutoComplete(data.getMultiAutoComplete());
|
||||||
|
return persist;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,17 +42,17 @@ public class RadioBoxFieldDataHelperService extends BaseFieldDataHelperService<R
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldDataEntity<?> newDataInstance() {
|
public RadioBoxDataEntity newDataInstanceInternal() {
|
||||||
return new RadioBoxDataEntity();
|
return new RadioBoxDataEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldData newModelInstance() {
|
public RadioBoxData newModelInstanceInternal() {
|
||||||
return new RadioBoxData();
|
return new RadioBoxData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldDataPersist newPersistModelInstance() {
|
public RadioBoxDataPersist newPersistModelInstanceInternal() {
|
||||||
return new RadioBoxDataPersist();
|
return new RadioBoxDataPersist();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,7 +84,6 @@ public class RadioBoxFieldDataHelperService extends BaseFieldDataHelperService<R
|
||||||
}
|
}
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
private @NotNull RadioBoxDataEntity.Option buildOption(RadioBoxOptionPersist persist){
|
private @NotNull RadioBoxDataEntity.Option buildOption(RadioBoxOptionPersist persist){
|
||||||
RadioBoxDataEntity.Option data = new RadioBoxDataEntity.Option();
|
RadioBoxDataEntity.Option data = new RadioBoxDataEntity.Option();
|
||||||
if (persist == null) return data;
|
if (persist == null) return data;
|
||||||
|
@ -94,4 +93,26 @@ public class RadioBoxFieldDataHelperService extends BaseFieldDataHelperService<R
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected RadioBoxDataPersist mapDataToPersist(RadioBoxDataEntity data, RadioBoxDataPersist persist) {
|
||||||
|
if (!this.conventionService.isListNullOrEmpty(data.getOptions())){
|
||||||
|
persist.setOptions(new ArrayList<>());
|
||||||
|
for (RadioBoxDataEntity.Option radioBoxOption: data.getOptions()) {
|
||||||
|
persist.getOptions().add(this.buildOption(radioBoxOption));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return persist;
|
||||||
|
}
|
||||||
|
|
||||||
|
private @NotNull RadioBoxOptionPersist buildOption(RadioBoxDataEntity.Option data){
|
||||||
|
RadioBoxOptionPersist persist = new RadioBoxOptionPersist();
|
||||||
|
if (data == null) return persist;
|
||||||
|
|
||||||
|
persist.setLabel(data.getLabel());
|
||||||
|
persist.setValue(data.getValue());
|
||||||
|
|
||||||
|
return persist;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,17 +36,17 @@ public class RegistryFieldDataHelperService extends BaseFieldDataHelperService<R
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldDataEntity<?> newDataInstance() {
|
public RegistryDataEntity newDataInstanceInternal() {
|
||||||
return new RegistryDataEntity();
|
return new RegistryDataEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldData newModelInstance() {
|
public RegistryData newModelInstanceInternal() {
|
||||||
return new RegistryData();
|
return new RegistryData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldDataPersist newPersistModelInstance() {
|
public RegistryDataPersist newPersistModelInstanceInternal() {
|
||||||
return new RegistryDataPersist();
|
return new RegistryDataPersist();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,4 +73,10 @@ public class RegistryFieldDataHelperService extends BaseFieldDataHelperService<R
|
||||||
data.setMultiAutoComplete(persist.getMultiAutoComplete());
|
data.setMultiAutoComplete(persist.getMultiAutoComplete());
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected RegistryDataPersist mapDataToPersist(RegistryDataEntity data, RegistryDataPersist persist) {
|
||||||
|
persist.setMultiAutoComplete(data.getMultiAutoComplete());
|
||||||
|
return persist;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,17 +36,17 @@ public class ResearcherAutoCompleteFieldDataHelperService extends BaseFieldDataH
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldDataEntity<?> newDataInstance() {
|
public ResearcherAutoCompleteDataEntity newDataInstanceInternal() {
|
||||||
return new ResearcherAutoCompleteDataEntity();
|
return new ResearcherAutoCompleteDataEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldData newModelInstance() {
|
public ResearcherAutoCompleteData newModelInstanceInternal() {
|
||||||
return new ResearcherAutoCompleteData();
|
return new ResearcherAutoCompleteData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldDataPersist newPersistModelInstance() {
|
public ResearcherAutoCompleteDataPersist newPersistModelInstanceInternal() {
|
||||||
return new ResearcherAutoCompleteDataPersist();
|
return new ResearcherAutoCompleteDataPersist();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,4 +73,10 @@ public class ResearcherAutoCompleteFieldDataHelperService extends BaseFieldDataH
|
||||||
data.setMultiAutoComplete(persist.getMultiAutoComplete());
|
data.setMultiAutoComplete(persist.getMultiAutoComplete());
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected ResearcherAutoCompleteDataPersist mapDataToPersist(ResearcherAutoCompleteDataEntity data, ResearcherAutoCompleteDataPersist persist) {
|
||||||
|
persist.setMultiAutoComplete(data.getMultiAutoComplete());
|
||||||
|
return persist;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,17 +36,17 @@ public class ResearcherFieldDataHelperService extends BaseFieldDataHelperService
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldDataEntity<?> newDataInstance() {
|
public ResearcherDataEntity newDataInstanceInternal() {
|
||||||
return new ResearcherDataEntity();
|
return new ResearcherDataEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldData newModelInstance() {
|
public ResearcherData newModelInstanceInternal() {
|
||||||
return new ResearcherData();
|
return new ResearcherData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldDataPersist newPersistModelInstance() {
|
public ResearcherDataPersist newPersistModelInstanceInternal() {
|
||||||
return new ResearcherDataPersist();
|
return new ResearcherDataPersist();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,4 +73,10 @@ public class ResearcherFieldDataHelperService extends BaseFieldDataHelperService
|
||||||
data.setMultiAutoComplete(persist.getMultiAutoComplete());
|
data.setMultiAutoComplete(persist.getMultiAutoComplete());
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected ResearcherDataPersist mapDataToPersist(ResearcherDataEntity data, ResearcherDataPersist persist) {
|
||||||
|
persist.setMultiAutoComplete(data.getMultiAutoComplete());
|
||||||
|
return persist;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,17 +36,17 @@ public class RichTextAreaDataFieldDataHelperService extends BaseFieldDataHelperS
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldDataEntity<?> newDataInstance() {
|
public RichTextAreaDataEntity newDataInstanceInternal() {
|
||||||
return new RichTextAreaDataEntity();
|
return new RichTextAreaDataEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldData newModelInstance() {
|
public RichTextAreaData newModelInstanceInternal() {
|
||||||
return new RichTextAreaData();
|
return new RichTextAreaData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldDataPersist newPersistModelInstance() {
|
public RichTextAreaDataPersist newPersistModelInstanceInternal() {
|
||||||
return new RichTextAreaDataPersist();
|
return new RichTextAreaDataPersist();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,4 +73,9 @@ public class RichTextAreaDataFieldDataHelperService extends BaseFieldDataHelperS
|
||||||
protected RichTextAreaDataEntity applyPersistInternal(RichTextAreaDataPersist persist, RichTextAreaDataEntity data) {
|
protected RichTextAreaDataEntity applyPersistInternal(RichTextAreaDataPersist persist, RichTextAreaDataEntity data) {
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected RichTextAreaDataPersist mapDataToPersist(RichTextAreaDataEntity data, RichTextAreaDataPersist persist) {
|
||||||
|
return persist;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,17 +36,17 @@ public class ServiceFieldDataHelperService extends BaseFieldDataHelperService<Se
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldDataEntity<?> newDataInstance() {
|
public ServiceDataEntity newDataInstanceInternal() {
|
||||||
return new ServiceDataEntity();
|
return new ServiceDataEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldData newModelInstance() {
|
public ServiceData newModelInstanceInternal() {
|
||||||
return new ServiceData();
|
return new ServiceData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldDataPersist newPersistModelInstance() {
|
public ServiceDataPersist newPersistModelInstanceInternal() {
|
||||||
return new ServiceDataPersist();
|
return new ServiceDataPersist();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,4 +73,10 @@ public class ServiceFieldDataHelperService extends BaseFieldDataHelperService<Se
|
||||||
data.setMultiAutoComplete(persist.getMultiAutoComplete());
|
data.setMultiAutoComplete(persist.getMultiAutoComplete());
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected ServiceDataPersist mapDataToPersist(ServiceDataEntity data, ServiceDataPersist persist) {
|
||||||
|
persist.setMultiAutoComplete(data.getMultiAutoComplete());
|
||||||
|
return persist;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,17 +36,17 @@ public class TagFieldDataHelperService extends BaseFieldDataHelperService<TagDat
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldDataEntity<?> newDataInstance() {
|
public TagDataEntity newDataInstanceInternal() {
|
||||||
return new TagDataEntity();
|
return new TagDataEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldDataPersist newPersistModelInstance() {
|
public TagDataPersist newPersistModelInstanceInternal() {
|
||||||
return new TagDataPersist();
|
return new TagDataPersist();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldData newModelInstance() {
|
public TagData newModelInstanceInternal() {
|
||||||
return new TagData();
|
return new TagData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,4 +73,9 @@ public class TagFieldDataHelperService extends BaseFieldDataHelperService<TagDat
|
||||||
protected TagDataEntity applyPersistInternal(TagDataPersist persist, TagDataEntity data) {
|
protected TagDataEntity applyPersistInternal(TagDataPersist persist, TagDataEntity data) {
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected TagDataPersist mapDataToPersist(TagDataEntity data, TagDataPersist persist) {
|
||||||
|
return persist;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,17 +36,17 @@ public class TaxonomyFieldDataHelperService extends BaseFieldDataHelperService<T
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldDataEntity<?> newDataInstance() {
|
public TaxonomyDataEntity newDataInstanceInternal() {
|
||||||
return new TaxonomyDataEntity();
|
return new TaxonomyDataEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldData newModelInstance() {
|
public TaxonomyData newModelInstanceInternal() {
|
||||||
return new TaxonomyData();
|
return new TaxonomyData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldDataPersist newPersistModelInstance() {
|
public TaxonomyDataPersist newPersistModelInstanceInternal() {
|
||||||
return new TaxonomyDataPersist();
|
return new TaxonomyDataPersist();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,4 +73,10 @@ public class TaxonomyFieldDataHelperService extends BaseFieldDataHelperService<T
|
||||||
data.setMultiAutoComplete(persist.getMultiAutoComplete());
|
data.setMultiAutoComplete(persist.getMultiAutoComplete());
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected TaxonomyDataPersist mapDataToPersist(TaxonomyDataEntity data, TaxonomyDataPersist persist) {
|
||||||
|
persist.setMultiAutoComplete(data.getMultiAutoComplete());
|
||||||
|
return persist;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,17 +36,17 @@ public class TextAreaFieldDataHelperService extends BaseFieldDataHelperService<T
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldDataEntity<?> newDataInstance() {
|
public TextAreaDataEntity newDataInstanceInternal() {
|
||||||
return new TextAreaDataEntity();
|
return new TextAreaDataEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldData newModelInstance() {
|
public TextAreaData newModelInstanceInternal() {
|
||||||
return new TextAreaData();
|
return new TextAreaData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldDataPersist newPersistModelInstance() {
|
public TextAreaDataPersist newPersistModelInstanceInternal() {
|
||||||
return new TextAreaDataPersist();
|
return new TextAreaDataPersist();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,4 +72,9 @@ public class TextAreaFieldDataHelperService extends BaseFieldDataHelperService<T
|
||||||
protected TextAreaDataEntity applyPersistInternal(TextAreaDataPersist persist, TextAreaDataEntity data) {
|
protected TextAreaDataEntity applyPersistInternal(TextAreaDataPersist persist, TextAreaDataEntity data) {
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected TextAreaDataPersist mapDataToPersist(TextAreaDataEntity data, TextAreaDataPersist persist) {
|
||||||
|
return persist;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,17 +39,17 @@ public class UploadFieldDataHelperService extends BaseFieldDataHelperService<Upl
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldDataEntity<?> newDataInstance() {
|
public UploadDataEntity newDataInstanceInternal() {
|
||||||
return new UploadDataEntity();
|
return new UploadDataEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldData newModelInstance() {
|
public UploadData newModelInstanceInternal() {
|
||||||
return new UploadData();
|
return new UploadData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldDataPersist newPersistModelInstance() {
|
public UploadDataPersist newPersistModelInstanceInternal() {
|
||||||
return new UploadDataPersist();
|
return new UploadDataPersist();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,4 +91,25 @@ public class UploadFieldDataHelperService extends BaseFieldDataHelperService<Upl
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected UploadDataPersist mapDataToPersist(UploadDataEntity data, UploadDataPersist persist) {
|
||||||
|
if (!this.conventionService.isListNullOrEmpty(data.getTypes())){
|
||||||
|
persist.setTypes(new ArrayList<>());
|
||||||
|
for (UploadDataEntity.Option option: data.getTypes()) {
|
||||||
|
persist.getTypes().add(this.buildOption(option));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return persist;
|
||||||
|
}
|
||||||
|
|
||||||
|
private @NotNull UploadOptionPersist buildOption(UploadDataEntity.Option data){
|
||||||
|
UploadOptionPersist persist = new UploadOptionPersist();
|
||||||
|
if (data == null) return persist;
|
||||||
|
|
||||||
|
persist.setLabel(data.getLabel());
|
||||||
|
persist.setValue(data.getValue());
|
||||||
|
|
||||||
|
return persist;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,17 +36,17 @@ public class ValidationFieldDataHelperService extends BaseFieldDataHelperService
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldDataEntity<?> newDataInstance() {
|
public ValidationDataEntity newDataInstanceInternal() {
|
||||||
return new ValidationDataEntity();
|
return new ValidationDataEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldData newModelInstance() {
|
public ValidationData newModelInstanceInternal() {
|
||||||
return new ValidationData();
|
return new ValidationData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldDataPersist newPersistModelInstance() {
|
public ValidationDataPersist newPersistModelInstanceInternal() {
|
||||||
return new ValidationDataPersist();
|
return new ValidationDataPersist();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,4 +72,9 @@ public class ValidationFieldDataHelperService extends BaseFieldDataHelperService
|
||||||
protected ValidationDataEntity applyPersistInternal(ValidationDataPersist persist, ValidationDataEntity data) {
|
protected ValidationDataEntity applyPersistInternal(ValidationDataPersist persist, ValidationDataEntity data) {
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected ValidationDataPersist mapDataToPersist(ValidationDataEntity data, ValidationDataPersist persist) {
|
||||||
|
return persist;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,17 +38,17 @@ public class WordListFieldDataHelperService extends BaseFieldDataHelperService<W
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldDataEntity<?> newDataInstance() {
|
public WordListDataEntity newDataInstanceInternal() {
|
||||||
return new WordListDataEntity();
|
return new WordListDataEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldData newModelInstance() {
|
public WordListData newModelInstanceInternal() {
|
||||||
return new WordListData();
|
return new WordListData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseFieldDataPersist newPersistModelInstance() {
|
public WordListDataPersist newPersistModelInstanceInternal() {
|
||||||
return new WordListDataPersist();
|
return new WordListDataPersist();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,6 +81,7 @@ public class WordListFieldDataHelperService extends BaseFieldDataHelperService<W
|
||||||
}
|
}
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
private @NotNull ComboBoxDataEntity.Option buildOption(ComboBoxOptionPersist persist){
|
private @NotNull ComboBoxDataEntity.Option buildOption(ComboBoxOptionPersist persist){
|
||||||
ComboBoxDataEntity.Option data = new ComboBoxDataEntity.Option();
|
ComboBoxDataEntity.Option data = new ComboBoxDataEntity.Option();
|
||||||
if (persist == null) return data;
|
if (persist == null) return data;
|
||||||
|
@ -93,4 +94,28 @@ public class WordListFieldDataHelperService extends BaseFieldDataHelperService<W
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected WordListDataPersist mapDataToPersist(WordListDataEntity data, WordListDataPersist persist) {
|
||||||
|
persist.setMultiList(data.getMultiList());
|
||||||
|
if (!this.conventionService.isListNullOrEmpty(data.getOptions())){
|
||||||
|
persist.setOptions(new ArrayList<>());
|
||||||
|
for (ComboBoxDataEntity.Option option: data.getOptions()) {
|
||||||
|
persist.getOptions().add(this.buildOption(option));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return persist;
|
||||||
|
}
|
||||||
|
|
||||||
|
private @NotNull ComboBoxOptionPersist buildOption(ComboBoxDataEntity.Option data){
|
||||||
|
ComboBoxOptionPersist persist = new ComboBoxOptionPersist();
|
||||||
|
if (data == null) return persist;
|
||||||
|
|
||||||
|
persist.setLabel(data.getLabel());
|
||||||
|
persist.setValue(data.getValue());
|
||||||
|
persist.setUri(data.getUri());
|
||||||
|
persist.setSource(data.getSource());
|
||||||
|
|
||||||
|
return persist;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
package eu.eudat.service.mail;
|
||||||
|
|
||||||
|
import jakarta.mail.MessagingException;
|
||||||
|
|
||||||
|
|
||||||
|
public interface MailService {
|
||||||
|
void sendSimpleMail(SimpleMail mail) throws MessagingException;
|
||||||
|
|
||||||
|
String getMailTemplateContent(String resourceTemplate);
|
||||||
|
|
||||||
|
String getMailTemplateSubject();
|
||||||
|
}
|
|
@ -0,0 +1,140 @@
|
||||||
|
package eu.eudat.service.mail;
|
||||||
|
|
||||||
|
import jakarta.mail.BodyPart;
|
||||||
|
import jakarta.mail.Message;
|
||||||
|
import jakarta.mail.MessagingException;
|
||||||
|
import jakarta.mail.internet.MimeBodyPart;
|
||||||
|
import jakarta.mail.internet.MimeMessage;
|
||||||
|
import jakarta.mail.internet.MimeMultipart;
|
||||||
|
import org.apache.commons.io.IOUtils;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.ApplicationContext;
|
||||||
|
import org.springframework.core.env.Environment;
|
||||||
|
import org.springframework.core.io.Resource;
|
||||||
|
import org.springframework.mail.javamail.JavaMailSender;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.StringWriter;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
|
||||||
|
@Service("mailService")
|
||||||
|
public class MailServiceImpl implements MailService {
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(MailServiceImpl.class);
|
||||||
|
|
||||||
|
private Environment env;
|
||||||
|
|
||||||
|
private JavaMailSender emailSender;
|
||||||
|
|
||||||
|
private ApplicationContext applicationContext;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public MailServiceImpl(Environment env, JavaMailSender emailSender, ApplicationContext applicationContext) {
|
||||||
|
this.env = env;
|
||||||
|
this.emailSender = emailSender;
|
||||||
|
this.applicationContext = applicationContext;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sendSimpleMail(SimpleMail mail) throws MessagingException {
|
||||||
|
List<String> imageSources = parseImages(mail.getContent());
|
||||||
|
List<String> cids = new ArrayList<>();
|
||||||
|
if (!imageSources.isEmpty()) {
|
||||||
|
for (int i = 0; i < imageSources.size(); i++) {
|
||||||
|
cids.add(UUID.randomUUID().toString());
|
||||||
|
}
|
||||||
|
mail.setContent(replaceImageSources(mail.getContent(), cids));
|
||||||
|
}
|
||||||
|
MimeMultipart content = new MimeMultipart("related");
|
||||||
|
BodyPart messageBodyPart = new MimeBodyPart();
|
||||||
|
messageBodyPart.setContent(mail.getContent(), "text/html; charset=UTF-8");
|
||||||
|
content.addBodyPart(messageBodyPart);
|
||||||
|
if (!imageSources.isEmpty()) {
|
||||||
|
for (int i =0; i < imageSources.size(); i++) {
|
||||||
|
MimeBodyPart imagePart = new MimeBodyPart();
|
||||||
|
try {
|
||||||
|
imagePart.attachFile(applicationContext.getResource(imageSources.get(i)).getFile());
|
||||||
|
imagePart.setContentID("<" + cids.get(i) + ">");
|
||||||
|
imagePart.setDisposition(MimeBodyPart.INLINE);
|
||||||
|
content.addBodyPart(imagePart);
|
||||||
|
} catch (IOException | MessagingException e) {
|
||||||
|
logger.error(e.getMessage(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
MimeMessage message = this.emailSender.createMimeMessage();
|
||||||
|
message.setSubject(mail.getSubject());
|
||||||
|
message.setContent(content);
|
||||||
|
message.addRecipients(Message.RecipientType.TO, mail.getTo());
|
||||||
|
message.setFrom(env.getProperty("mail.from"));
|
||||||
|
this.emailSender.send(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Environment getEnv() {
|
||||||
|
return env;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getMailTemplateContent(String resourceTemplate) {
|
||||||
|
Resource resource = applicationContext.getResource(resourceTemplate);
|
||||||
|
try {
|
||||||
|
InputStream inputStream = resource.getInputStream();
|
||||||
|
StringWriter writer = new StringWriter();
|
||||||
|
IOUtils.copy(inputStream, writer, "UTF-8");
|
||||||
|
inputStream.close();
|
||||||
|
return writer.toString();
|
||||||
|
} catch (IOException e) {
|
||||||
|
logger.error(e.getMessage(), e);
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getMailTemplateSubject() {
|
||||||
|
return env.getProperty("mail.subject");
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<String> parseImages(String content) {
|
||||||
|
List<String> imagePaths = new ArrayList<>();
|
||||||
|
|
||||||
|
int lastIndex = 0;
|
||||||
|
|
||||||
|
while (lastIndex != -1) {
|
||||||
|
lastIndex = content.indexOf("img src=\"", lastIndex);
|
||||||
|
|
||||||
|
if (lastIndex != -1) {
|
||||||
|
String imagePath = content.substring(lastIndex + 9, content.indexOf("\"", lastIndex + 9));
|
||||||
|
if (!imagePath.contains("data:image/png;base64")) {
|
||||||
|
imagePaths.add(imagePath);
|
||||||
|
}
|
||||||
|
lastIndex++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return imagePaths;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String replaceImageSources(String content, List<String> cids) {
|
||||||
|
|
||||||
|
int lastIndex = 0;
|
||||||
|
int cidIndex = 0;
|
||||||
|
|
||||||
|
while (lastIndex != -1) {
|
||||||
|
lastIndex = content.indexOf("img src=\"", lastIndex);
|
||||||
|
|
||||||
|
if (lastIndex != -1) {
|
||||||
|
content = content.replace(content.substring(lastIndex + 9, content.indexOf("\"", lastIndex + 9)), "cid:" + cids.get(cidIndex));
|
||||||
|
lastIndex ++;
|
||||||
|
cidIndex ++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return content;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.eudat.models.data.mail;
|
package eu.eudat.service.mail;
|
||||||
|
|
||||||
|
|
||||||
public class SimpleMail {
|
public class SimpleMail {
|
|
@ -1,9 +1,9 @@
|
||||||
package eu.eudat.controllers;
|
package eu.eudat.controllers;
|
||||||
|
|
||||||
import eu.eudat.authorization.Permission;
|
import eu.eudat.authorization.Permission;
|
||||||
import eu.eudat.commons.enums.DescriptionTemplateStatus;
|
|
||||||
import eu.eudat.commons.enums.UserDescriptionTemplateRole;
|
import eu.eudat.commons.enums.UserDescriptionTemplateRole;
|
||||||
import eu.eudat.commons.scope.user.UserScope;
|
import eu.eudat.commons.scope.user.UserScope;
|
||||||
|
import eu.eudat.commons.types.descriptiontemplate.importmodel.DescriptionTemplateImportXml;
|
||||||
import eu.eudat.data.DescriptionTemplateEntity;
|
import eu.eudat.data.DescriptionTemplateEntity;
|
||||||
import eu.eudat.data.UserDescriptionTemplateEntity;
|
import eu.eudat.data.UserDescriptionTemplateEntity;
|
||||||
import eu.eudat.data.old.UserInfo;
|
import eu.eudat.data.old.UserInfo;
|
||||||
|
@ -17,8 +17,8 @@ import eu.eudat.models.data.admin.composite.DatasetProfile;
|
||||||
import eu.eudat.models.data.helpers.responses.ResponseItem;
|
import eu.eudat.models.data.helpers.responses.ResponseItem;
|
||||||
import eu.eudat.query.DescriptionTemplateTypeQuery;
|
import eu.eudat.query.DescriptionTemplateTypeQuery;
|
||||||
import eu.eudat.service.descriptiontemplatetype.DescriptionTemplateTypeService;
|
import eu.eudat.service.descriptiontemplatetype.DescriptionTemplateTypeService;
|
||||||
|
import eu.eudat.service.fielddatahelper.FieldDataHelperService;
|
||||||
import eu.eudat.types.ApiMessageCode;
|
import eu.eudat.types.ApiMessageCode;
|
||||||
import eu.eudat.types.MetricNames;
|
|
||||||
import gr.cite.commons.web.authz.service.AuthorizationService;
|
import gr.cite.commons.web.authz.service.AuthorizationService;
|
||||||
import gr.cite.tools.data.query.QueryFactory;
|
import gr.cite.tools.data.query.QueryFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -28,7 +28,6 @@ import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import jakarta.transaction.Transactional;
|
import jakarta.transaction.Transactional;
|
||||||
import jakarta.validation.Valid;
|
|
||||||
|
|
||||||
import javax.management.InvalidApplicationException;
|
import javax.management.InvalidApplicationException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -50,8 +49,10 @@ public class Admin extends BaseController {
|
||||||
|
|
||||||
private final DescriptionTemplateTypeService descriptionTemplateTypeService;
|
private final DescriptionTemplateTypeService descriptionTemplateTypeService;
|
||||||
|
|
||||||
|
private final FieldDataHelperService fieldDataHelperService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public Admin(ApiContext apiContext, DatasetProfileManager datasetProfileManager, UserManager userManager/*, Logger logger*/, ConfigLoader configLoader, MetricsManager metricsManager, AuthorizationService authorizationService, UserScope userScope, QueryFactory queryFactory, DescriptionTemplateTypeService descriptionTemplateTypeService) {
|
public Admin(ApiContext apiContext, DatasetProfileManager datasetProfileManager, UserManager userManager/*, Logger logger*/, ConfigLoader configLoader, MetricsManager metricsManager, AuthorizationService authorizationService, UserScope userScope, QueryFactory queryFactory, DescriptionTemplateTypeService descriptionTemplateTypeService, FieldDataHelperService fieldDataHelperService) {
|
||||||
super(apiContext);
|
super(apiContext);
|
||||||
this.datasetProfileManager = datasetProfileManager;
|
this.datasetProfileManager = datasetProfileManager;
|
||||||
this.userManager = userManager;
|
this.userManager = userManager;
|
||||||
|
@ -61,6 +62,7 @@ public class Admin extends BaseController {
|
||||||
this.userScope = userScope;
|
this.userScope = userScope;
|
||||||
this.queryFactory = queryFactory;
|
this.queryFactory = queryFactory;
|
||||||
this.descriptionTemplateTypeService = descriptionTemplateTypeService;
|
this.descriptionTemplateTypeService = descriptionTemplateTypeService;
|
||||||
|
this.fieldDataHelperService = fieldDataHelperService;
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Transactional
|
// @Transactional
|
||||||
|
@ -195,29 +197,29 @@ public class Admin extends BaseController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(method = RequestMethod.POST, value = {"/upload", "/upload/{id}"})
|
// @RequestMapping(method = RequestMethod.POST, value = {"/upload", "/upload/{id}"})
|
||||||
public ResponseEntity<Object> setDatasetProfileXml(@RequestParam("file") MultipartFile file,
|
// public ResponseEntity<Object> setDatasetProfileXml(@RequestParam("file") MultipartFile file,
|
||||||
@PathVariable(value = "id", required = false) String id) throws Exception {
|
// @PathVariable(value = "id", required = false) String id) throws Exception {
|
||||||
this.authorizationService.authorizeForce(Permission.AdminRole, Permission.DatasetProfileManagerRole);
|
// this.authorizationService.authorizeForce(Permission.AdminRole, Permission.DatasetProfileManagerRole);
|
||||||
|
//
|
||||||
eu.eudat.logic.utilities.documents.xml.datasetProfileXml.datasetProfileModel.DatasetProfile descriptionTemplateImportXmlModel = this.datasetProfileManager.createDatasetProfileFromXml(file);
|
// DescriptionTemplateImportXml descriptionTemplateImportXmlModel = this.datasetProfileManager.createDatasetProfileFromXml(file);
|
||||||
eu.eudat.models.data.admin.composite.DatasetProfile datasetProfileEntity = descriptionTemplateImportXmlModel.toAdminCompositeModel(file.getOriginalFilename());
|
// eu.eudat.models.data.admin.composite.DatasetProfile datasetProfileEntity = descriptionTemplateImportXmlModel.toPersistModel(file.getOriginalFilename(), this.fieldDataHelperService);
|
||||||
DescriptionTemplateEntity modelDefinition;
|
// DescriptionTemplateEntity modelDefinition;
|
||||||
if (id == null) {
|
// if (id == null) {
|
||||||
modelDefinition = AdminManager.generateViewStyleDefinition(datasetProfileEntity, getApiContext(), descriptionTemplateTypeService);
|
// modelDefinition = AdminManager.generateViewStyleDefinition(datasetProfileEntity, getApiContext(), descriptionTemplateTypeService);
|
||||||
DescriptionTemplateEntity descriptionTemplateEntity = this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetProfileDao().createOrUpdate(modelDefinition);
|
// DescriptionTemplateEntity descriptionTemplateEntity = this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetProfileDao().createOrUpdate(modelDefinition);
|
||||||
UserDescriptionTemplateEntity userDatasetProfile = new UserDescriptionTemplateEntity();
|
// UserDescriptionTemplateEntity userDatasetProfile = new UserDescriptionTemplateEntity();
|
||||||
userDatasetProfile.setDescriptionTemplate(descriptionTemplateEntity.getId());
|
// userDatasetProfile.setDescriptionTemplate(descriptionTemplateEntity.getId());
|
||||||
UserInfo userInfo = getApiContext().getOperationsContext().getDatabaseRepository().getUserInfoDao().find(userScope.getUserId());
|
// UserInfo userInfo = getApiContext().getOperationsContext().getDatabaseRepository().getUserInfoDao().find(userScope.getUserId());
|
||||||
userDatasetProfile.setUser(userInfo.getId());
|
// userDatasetProfile.setUser(userInfo.getId());
|
||||||
userDatasetProfile.setRole(UserDescriptionTemplateRole.Owner);
|
// userDatasetProfile.setRole(UserDescriptionTemplateRole.Owner);
|
||||||
getApiContext().getOperationsContext().getDatabaseRepository().getUserDatasetProfileDao().createOrUpdate(userDatasetProfile);
|
// getApiContext().getOperationsContext().getDatabaseRepository().getUserDatasetProfileDao().createOrUpdate(userDatasetProfile);
|
||||||
} else {
|
// } else {
|
||||||
modelDefinition = datasetProfileManager.createNewVersionDatasetProfile(id, datasetProfileEntity);
|
// modelDefinition = datasetProfileManager.createNewVersionDatasetProfile(id, datasetProfileEntity);
|
||||||
}
|
// }
|
||||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<List<DescriptionTemplateEntity>>()
|
// return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<List<DescriptionTemplateEntity>>()
|
||||||
.status(ApiMessageCode.SUCCESS_MESSAGE).message(""));
|
// .status(ApiMessageCode.SUCCESS_MESSAGE).message(""));
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
@RequestMapping(method = RequestMethod.GET, value = {"/getSemantics"}, produces = "application/json")
|
@RequestMapping(method = RequestMethod.GET, value = {"/getSemantics"}, produces = "application/json")
|
||||||
|
|
|
@ -32,10 +32,13 @@ import org.springframework.context.MessageSource;
|
||||||
import org.springframework.context.i18n.LocaleContextHolder;
|
import org.springframework.context.i18n.LocaleContextHolder;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
import org.xml.sax.SAXException;
|
||||||
|
|
||||||
import javax.management.InvalidApplicationException;
|
import javax.management.InvalidApplicationException;
|
||||||
import javax.xml.parsers.ParserConfigurationException;
|
import javax.xml.parsers.ParserConfigurationException;
|
||||||
import javax.xml.transform.TransformerException;
|
import javax.xml.transform.TransformerException;
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
|
@ -164,4 +167,22 @@ public class DescriptionTemplateController {
|
||||||
//this.auditService.trackIdentity(AuditableAction.IdentityTracking_Action);
|
//this.auditService.trackIdentity(AuditableAction.IdentityTracking_Action);
|
||||||
return persisted;
|
return persisted;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequestMapping(method = RequestMethod.POST, value = {"/xml/import/{id}", "/xml/import"})
|
||||||
|
public DescriptionTemplate importXml(@RequestParam("file") MultipartFile file, @PathVariable(value = "id", required = false) UUID id, FieldSet fieldSet) throws IOException, JAXBException, InvalidApplicationException, ParserConfigurationException, TransformerException, InstantiationException, IllegalAccessException, SAXException {
|
||||||
|
logger.debug(new MapLogEntry("import" + DescriptionTemplate.class.getSimpleName()).And("file", file).And("id", id));
|
||||||
|
|
||||||
|
this.censorFactory.censor(DescriptionTemplateCensor.class).censor(fieldSet, null);
|
||||||
|
|
||||||
|
DescriptionTemplate model = this.descriptionTemplateTypeService.importXml(file.getBytes(), id, file.getOriginalFilename(), fieldSet);
|
||||||
|
|
||||||
|
this.auditService.track(AuditableAction.DmpBlueprint_Clone, Map.ofEntries(
|
||||||
|
new AbstractMap.SimpleEntry<String, Object>("file", file),
|
||||||
|
new AbstractMap.SimpleEntry<String, Object>("id", id),
|
||||||
|
new AbstractMap.SimpleEntry<String, Object>("fields", fieldSet)
|
||||||
|
));
|
||||||
|
//this.auditService.trackIdentity(AuditableAction.IdentityTracking_Action);
|
||||||
|
|
||||||
|
return model;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import eu.eudat.data.old.UserInfo;
|
||||||
import eu.eudat.logic.services.ApiContext;
|
import eu.eudat.logic.services.ApiContext;
|
||||||
import eu.eudat.models.data.ContactEmail.ContactEmailModel;
|
import eu.eudat.models.data.ContactEmail.ContactEmailModel;
|
||||||
import eu.eudat.models.data.ContactEmail.PublicContactEmailModel;
|
import eu.eudat.models.data.ContactEmail.PublicContactEmailModel;
|
||||||
import eu.eudat.models.data.mail.SimpleMail;
|
import eu.eudat.service.mail.SimpleMail;
|
||||||
import org.springframework.core.env.Environment;
|
import org.springframework.core.env.Environment;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
|
@ -1,15 +1,10 @@
|
||||||
package eu.eudat.logic.managers;
|
package eu.eudat.logic.managers;
|
||||||
|
|
||||||
import eu.eudat.commons.enums.IsActive;
|
import eu.eudat.commons.enums.IsActive;
|
||||||
import eu.eudat.commons.enums.UserDescriptionTemplateRole;
|
|
||||||
import eu.eudat.commons.scope.user.UserScope;
|
import eu.eudat.commons.scope.user.UserScope;
|
||||||
import eu.eudat.data.UserDescriptionTemplateEntity;
|
import eu.eudat.data.UserDescriptionTemplateEntity;
|
||||||
import eu.eudat.data.DescriptionTemplateEntity;
|
import eu.eudat.data.DescriptionTemplateEntity;
|
||||||
import eu.eudat.data.dao.criteria.DatasetProfileCriteria;
|
|
||||||
import eu.eudat.data.old.UserInfo;
|
import eu.eudat.data.old.UserInfo;
|
||||||
import eu.eudat.data.query.items.item.datasetprofile.DatasetProfileAutocompleteRequest;
|
|
||||||
import eu.eudat.data.query.items.table.datasetprofile.DatasetProfileTableRequestItem;
|
|
||||||
import eu.eudat.exceptions.datasetprofile.DatasetProfileNewVersionException;
|
|
||||||
import eu.eudat.logic.proxy.config.*;
|
import eu.eudat.logic.proxy.config.*;
|
||||||
import eu.eudat.logic.proxy.config.configloaders.ConfigLoader;
|
import eu.eudat.logic.proxy.config.configloaders.ConfigLoader;
|
||||||
import eu.eudat.logic.proxy.config.entities.GeneralUrls;
|
import eu.eudat.logic.proxy.config.entities.GeneralUrls;
|
||||||
|
@ -19,22 +14,15 @@ import eu.eudat.logic.services.operations.DatabaseRepository;
|
||||||
import eu.eudat.commons.types.xml.XmlBuilder;
|
import eu.eudat.commons.types.xml.XmlBuilder;
|
||||||
import eu.eudat.logic.utilities.documents.helpers.FileEnvelope;
|
import eu.eudat.logic.utilities.documents.helpers.FileEnvelope;
|
||||||
import eu.eudat.logic.utilities.documents.xml.datasetProfileXml.ExportXmlBuilderDatasetProfile;
|
import eu.eudat.logic.utilities.documents.xml.datasetProfileXml.ExportXmlBuilderDatasetProfile;
|
||||||
import eu.eudat.logic.utilities.documents.xml.datasetProfileXml.ImportXmlBuilderDatasetProfile;
|
|
||||||
import eu.eudat.commons.types.descriptiontemplate.fielddata.AutoCompleteDataEntity;
|
import eu.eudat.commons.types.descriptiontemplate.fielddata.AutoCompleteDataEntity;
|
||||||
import eu.eudat.logic.utilities.documents.xml.datasetProfileXml.datasetProfileModel.DatasetProfile;
|
|
||||||
import eu.eudat.model.deleter.UserDescriptionTemplateDeleter;
|
|
||||||
import eu.eudat.models.data.datasetprofile.DatasetProfileAutocompleteItem;
|
|
||||||
import eu.eudat.models.data.datasetprofile.DatasetProfileListingModel;
|
|
||||||
import eu.eudat.commons.types.descriptiontemplate.FieldEntity;
|
import eu.eudat.commons.types.descriptiontemplate.FieldEntity;
|
||||||
import eu.eudat.models.data.externaldataset.ExternalAutocompleteFieldModel;
|
import eu.eudat.models.data.externaldataset.ExternalAutocompleteFieldModel;
|
||||||
import eu.eudat.models.data.listingmodels.UserInfoListingModel;
|
import eu.eudat.models.data.listingmodels.UserInfoListingModel;
|
||||||
import eu.eudat.models.data.mail.SimpleMail;
|
import eu.eudat.service.mail.SimpleMail;
|
||||||
import eu.eudat.query.DescriptionTemplateQuery;
|
import eu.eudat.query.DescriptionTemplateQuery;
|
||||||
import eu.eudat.query.DescriptionTemplateTypeQuery;
|
import eu.eudat.query.DescriptionTemplateTypeQuery;
|
||||||
import eu.eudat.query.UserDescriptionTemplateQuery;
|
import eu.eudat.query.UserDescriptionTemplateQuery;
|
||||||
import eu.eudat.queryable.QueryableList;
|
|
||||||
import eu.eudat.service.descriptiontemplatetype.DescriptionTemplateTypeService;
|
import eu.eudat.service.descriptiontemplatetype.DescriptionTemplateTypeService;
|
||||||
import eu.eudat.types.MetricNames;
|
|
||||||
import gr.cite.commons.web.authz.service.AuthorizationService;
|
import gr.cite.commons.web.authz.service.AuthorizationService;
|
||||||
import gr.cite.tools.data.deleter.DeleterFactory;
|
import gr.cite.tools.data.deleter.DeleterFactory;
|
||||||
import gr.cite.tools.data.query.QueryFactory;
|
import gr.cite.tools.data.query.QueryFactory;
|
||||||
|
@ -44,7 +32,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.core.env.Environment;
|
import org.springframework.core.env.Environment;
|
||||||
import org.springframework.http.*;
|
import org.springframework.http.*;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
import org.w3c.dom.Node;
|
import org.w3c.dom.Node;
|
||||||
|
@ -339,102 +326,102 @@ public class DatasetProfileManager {
|
||||||
return fileEnvelope;
|
return fileEnvelope;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DatasetProfile createDatasetProfileFromXml(MultipartFile multiPartFile) {
|
// public DescriptionTemplateImportXml createDatasetProfileFromXml(MultipartFile multiPartFile) {
|
||||||
ImportXmlBuilderDatasetProfile xmlBuilder = new ImportXmlBuilderDatasetProfile();
|
// ImportXmlBuilderDatasetProfile xmlBuilder = new ImportXmlBuilderDatasetProfile();
|
||||||
try {
|
// try {
|
||||||
File localFile = convert(multiPartFile);
|
// File localFile = convert(multiPartFile);
|
||||||
eu.eudat.logic.utilities.documents.xml.datasetProfileXml.datasetProfileModel.DatasetProfile profile = xmlBuilder.build(localFile);
|
// DescriptionTemplateImportXml profile = xmlBuilder.build(localFile);
|
||||||
Files.deleteIfExists(localFile.toPath());
|
// Files.deleteIfExists(localFile.toPath());
|
||||||
metricsManager.increaseValue(MetricNames.DATASET_TEMPLATE, 1, MetricNames.DRAFT);
|
// metricsManager.increaseValue(MetricNames.DATASET_TEMPLATE, 1, MetricNames.DRAFT);
|
||||||
return profile;
|
// return profile;
|
||||||
} catch (IOException e) {
|
// } catch (IOException e) {
|
||||||
logger.error(e.getMessage(), e);
|
// logger.error(e.getMessage(), e);
|
||||||
}
|
// }
|
||||||
return null;
|
// return null;
|
||||||
}
|
// }
|
||||||
|
|
||||||
private File convert(MultipartFile file) throws IOException {
|
// private File convert(MultipartFile file) throws IOException {
|
||||||
File convFile = new File(this.environment.getProperty("temp.temp") + file.getOriginalFilename());
|
// File convFile = new File(this.environment.getProperty("temp.temp") + file.getOriginalFilename());
|
||||||
convFile.createNewFile();
|
// convFile.createNewFile();
|
||||||
FileOutputStream fos = new FileOutputStream(convFile);
|
// FileOutputStream fos = new FileOutputStream(convFile);
|
||||||
fos.write(file.getBytes());
|
// fos.write(file.getBytes());
|
||||||
fos.close();
|
// fos.close();
|
||||||
return convFile;
|
// return convFile;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
|
// public DescriptionTemplateEntity createNewVersionDatasetProfile(String id, eu.eudat.models.data.admin.composite.DatasetProfile profile) throws Exception {
|
||||||
|
// // Getting the DescriptionTemplate which we will create its new version.
|
||||||
|
// DescriptionTemplateEntity oldDescriptionTemplateEntity = apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().find(UUID.fromString(id));
|
||||||
|
//
|
||||||
|
// // Getting the DescriptionTemplate with the latest Version.
|
||||||
|
// DatasetProfileCriteria criteria = new DatasetProfileCriteria();
|
||||||
|
// LinkedList<UUID> list = new LinkedList<>();
|
||||||
|
// list.push(oldDescriptionTemplateEntity.getGroupId());
|
||||||
|
// criteria.setGroupIds(list);
|
||||||
|
// criteria.setAllVersions(false);
|
||||||
|
// QueryableList<DescriptionTemplateEntity> datasetProfileQueryableList = apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().getWithCriteria(criteria);
|
||||||
|
// DescriptionTemplateEntity latestVersionDescriptionTemplateEntity = datasetProfileQueryableList.getSingle();
|
||||||
|
//
|
||||||
|
// if (latestVersionDescriptionTemplateEntity.getVersion().equals(oldDescriptionTemplateEntity.getVersion())){
|
||||||
|
// eu.eudat.models.data.admin.composite.DatasetProfile sortedProfile = profile.toShort();
|
||||||
|
// DescriptionTemplateEntity modelDefinition = AdminManager.generateViewStyleDefinition(sortedProfile, apiContext, descriptionTemplateTypeService);
|
||||||
|
//// modelDefinition.setLabel(oldDescriptionTemplate.getLabel());
|
||||||
|
// modelDefinition.setVersion((short) (oldDescriptionTemplateEntity.getVersion() + 1));
|
||||||
|
// modelDefinition.setGroupId(oldDescriptionTemplateEntity.getGroupId());
|
||||||
|
//// modelDefinition.setLanguage(oldDescriptionTemplate.getLanguage());
|
||||||
|
// apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().createOrUpdate(modelDefinition);
|
||||||
|
// DescriptionTemplateEntity descriptionTemplateEntity = apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().createOrUpdate(modelDefinition);
|
||||||
|
// this.storeDatasetProfileUsers(descriptionTemplateEntity, profile);
|
||||||
|
// return modelDefinition;
|
||||||
|
// } else {
|
||||||
|
// throw new DatasetProfileNewVersionException("Version to update not the latest.");
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
public DescriptionTemplateEntity createNewVersionDatasetProfile(String id, eu.eudat.models.data.admin.composite.DatasetProfile profile) throws Exception {
|
// public void storeDatasetProfileUsers(DescriptionTemplateEntity entity, eu.eudat.models.data.admin.composite.DatasetProfile model) {
|
||||||
// Getting the DescriptionTemplate which we will create its new version.
|
// final List<UserDescriptionTemplateEntity> userDescriptionTemplateEntities = this.queryFactory.query(UserDescriptionTemplateQuery.class).isActive(IsActive.Active).descriptionTemplateIds(entity.getId()).collect();
|
||||||
DescriptionTemplateEntity oldDescriptionTemplateEntity = apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().find(UUID.fromString(id));
|
// if (model.getUsers() != null && !model.getUsers().isEmpty()) {
|
||||||
|
// model.getUsers().stream().filter(userInfoListingModel -> userDescriptionTemplateEntities.stream()
|
||||||
// Getting the DescriptionTemplate with the latest Version.
|
// .filter(userDatasetProfile -> userDatasetProfile.getUser().equals(userInfoListingModel.getId())).count() == 0)
|
||||||
DatasetProfileCriteria criteria = new DatasetProfileCriteria();
|
// .forEach(userInfoListingModel -> {
|
||||||
LinkedList<UUID> list = new LinkedList<>();
|
// UserDescriptionTemplateEntity userDatasetProfile1 = new UserDescriptionTemplateEntity();
|
||||||
list.push(oldDescriptionTemplateEntity.getGroupId());
|
// userDatasetProfile1.setDescriptionTemplate(entity.getId());
|
||||||
criteria.setGroupIds(list);
|
// UserInfo userInfo1 = null;
|
||||||
criteria.setAllVersions(false);
|
// try {
|
||||||
QueryableList<DescriptionTemplateEntity> datasetProfileQueryableList = apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().getWithCriteria(criteria);
|
// userInfo1 = apiContext.getOperationsContext().getDatabaseRepository().getUserInfoDao().find(userInfoListingModel.getId());
|
||||||
DescriptionTemplateEntity latestVersionDescriptionTemplateEntity = datasetProfileQueryableList.getSingle();
|
// } catch (InvalidApplicationException e) {
|
||||||
|
// throw new RuntimeException(e);
|
||||||
if (latestVersionDescriptionTemplateEntity.getVersion().equals(oldDescriptionTemplateEntity.getVersion())){
|
// }
|
||||||
eu.eudat.models.data.admin.composite.DatasetProfile sortedProfile = profile.toShort();
|
// userDatasetProfile1.setUser(userInfo1.getId());
|
||||||
DescriptionTemplateEntity modelDefinition = AdminManager.generateViewStyleDefinition(sortedProfile, apiContext, descriptionTemplateTypeService);
|
// userDatasetProfile1.setRole(UserDescriptionTemplateRole.Member);
|
||||||
// modelDefinition.setLabel(oldDescriptionTemplate.getLabel());
|
// apiContext.getOperationsContext().getDatabaseRepository().getUserDatasetProfileDao().createOrUpdate(userDatasetProfile1);
|
||||||
modelDefinition.setVersion((short) (oldDescriptionTemplateEntity.getVersion() + 1));
|
// sendJoinMail(userDatasetProfile1);
|
||||||
modelDefinition.setGroupId(oldDescriptionTemplateEntity.getGroupId());
|
|
||||||
// modelDefinition.setLanguage(oldDescriptionTemplate.getLanguage());
|
|
||||||
apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().createOrUpdate(modelDefinition);
|
|
||||||
DescriptionTemplateEntity descriptionTemplateEntity = apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().createOrUpdate(modelDefinition);
|
|
||||||
this.storeDatasetProfileUsers(descriptionTemplateEntity, profile);
|
|
||||||
return modelDefinition;
|
|
||||||
} else {
|
|
||||||
throw new DatasetProfileNewVersionException("Version to update not the latest.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void storeDatasetProfileUsers(DescriptionTemplateEntity entity, eu.eudat.models.data.admin.composite.DatasetProfile model) {
|
|
||||||
final List<UserDescriptionTemplateEntity> userDescriptionTemplateEntities = this.queryFactory.query(UserDescriptionTemplateQuery.class).isActive(IsActive.Active).descriptionTemplateIds(entity.getId()).collect();
|
|
||||||
if (model.getUsers() != null && !model.getUsers().isEmpty()) {
|
|
||||||
model.getUsers().stream().filter(userInfoListingModel -> userDescriptionTemplateEntities.stream()
|
|
||||||
.filter(userDatasetProfile -> userDatasetProfile.getUser().equals(userInfoListingModel.getId())).count() == 0)
|
|
||||||
.forEach(userInfoListingModel -> {
|
|
||||||
UserDescriptionTemplateEntity userDatasetProfile1 = new UserDescriptionTemplateEntity();
|
|
||||||
userDatasetProfile1.setDescriptionTemplate(entity.getId());
|
|
||||||
UserInfo userInfo1 = null;
|
|
||||||
try {
|
|
||||||
userInfo1 = apiContext.getOperationsContext().getDatabaseRepository().getUserInfoDao().find(userInfoListingModel.getId());
|
|
||||||
} catch (InvalidApplicationException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
userDatasetProfile1.setUser(userInfo1.getId());
|
|
||||||
userDatasetProfile1.setRole(UserDescriptionTemplateRole.Member);
|
|
||||||
apiContext.getOperationsContext().getDatabaseRepository().getUserDatasetProfileDao().createOrUpdate(userDatasetProfile1);
|
|
||||||
sendJoinMail(userDatasetProfile1);
|
|
||||||
});
|
|
||||||
// userDescriptionTemplateEntities.stream().filter(userDatasetProfile -> model.getUsers().stream()
|
|
||||||
// .filter(userInfoListingModel -> userDatasetProfile.getUser().equals(userInfoListingModel.getId())).count() > 0
|
|
||||||
// && userDatasetProfile.getRole() == UserDescriptionTemplateRole.Saved2).forEach(userDatasetProfile -> {
|
|
||||||
// userDatasetProfile.setRole(UserDescriptionTemplateRole.Member);
|
|
||||||
// apiContext.getOperationsContext().getDatabaseRepository().getUserDatasetProfileDao().createOrUpdate(userDatasetProfile);
|
|
||||||
// sendJoinMail(userDatasetProfile);
|
|
||||||
// });
|
// });
|
||||||
}
|
//// userDescriptionTemplateEntities.stream().filter(userDatasetProfile -> model.getUsers().stream()
|
||||||
if (userDescriptionTemplateEntities != null && !userDescriptionTemplateEntities.isEmpty()) {
|
//// .filter(userInfoListingModel -> userDatasetProfile.getUser().equals(userInfoListingModel.getId())).count() > 0
|
||||||
List<UserDescriptionTemplateEntity> toDelete = new ArrayList<>();
|
//// && userDatasetProfile.getRole() == UserDescriptionTemplateRole.Saved2).forEach(userDatasetProfile -> {
|
||||||
|
//// userDatasetProfile.setRole(UserDescriptionTemplateRole.Member);
|
||||||
userDescriptionTemplateEntities.stream().filter(userDatasetProfile -> model.getUsers().stream()
|
//// apiContext.getOperationsContext().getDatabaseRepository().getUserDatasetProfileDao().createOrUpdate(userDatasetProfile);
|
||||||
.filter(userInfoListingModel -> userDatasetProfile.getUser().equals(userInfoListingModel.getId())).count() == 0)
|
//// sendJoinMail(userDatasetProfile);
|
||||||
.forEach(userDatasetProfile -> {
|
//// });
|
||||||
toDelete.add(userDatasetProfile);
|
// }
|
||||||
apiContext.getOperationsContext().getDatabaseRepository().getUserDatasetProfileDao().createOrUpdate(userDatasetProfile);
|
// if (userDescriptionTemplateEntities != null && !userDescriptionTemplateEntities.isEmpty()) {
|
||||||
});
|
// List<UserDescriptionTemplateEntity> toDelete = new ArrayList<>();
|
||||||
try {
|
//
|
||||||
this.deleterFactory.deleter(UserDescriptionTemplateDeleter.class).delete(toDelete);
|
// userDescriptionTemplateEntities.stream().filter(userDatasetProfile -> model.getUsers().stream()
|
||||||
} catch (InvalidApplicationException e) {
|
// .filter(userInfoListingModel -> userDatasetProfile.getUser().equals(userInfoListingModel.getId())).count() == 0)
|
||||||
throw new RuntimeException(e);
|
// .forEach(userDatasetProfile -> {
|
||||||
}
|
// toDelete.add(userDatasetProfile);
|
||||||
|
// apiContext.getOperationsContext().getDatabaseRepository().getUserDatasetProfileDao().createOrUpdate(userDatasetProfile);
|
||||||
}
|
// });
|
||||||
}
|
// try {
|
||||||
|
// this.deleterFactory.deleter(UserDescriptionTemplateDeleter.class).delete(toDelete);
|
||||||
|
// } catch (InvalidApplicationException e) {
|
||||||
|
// throw new RuntimeException(e);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public void retrieveUsers(DescriptionTemplateEntity entity, eu.eudat.models.data.admin.composite.DatasetProfile model) {
|
public void retrieveUsers(DescriptionTemplateEntity entity, eu.eudat.models.data.admin.composite.DatasetProfile model) {
|
||||||
|
@ -457,31 +444,31 @@ public class DatasetProfileManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendJoinMail(UserDescriptionTemplateEntity userDatasetProfile) {
|
// private void sendJoinMail(UserDescriptionTemplateEntity userDatasetProfile) {
|
||||||
SimpleMail mail = new SimpleMail();
|
// SimpleMail mail = new SimpleMail();
|
||||||
UserInfo user = null;
|
// UserInfo user = null;
|
||||||
try {
|
// try {
|
||||||
user = this.apiContext.getOperationsContext().getDatabaseRepository().getUserInfoDao().find(userDatasetProfile.getUser());
|
// user = this.apiContext.getOperationsContext().getDatabaseRepository().getUserInfoDao().find(userDatasetProfile.getUser());
|
||||||
} catch (InvalidApplicationException e) {
|
// } catch (InvalidApplicationException e) {
|
||||||
throw new RuntimeException(e);
|
// throw new RuntimeException(e);
|
||||||
}
|
// }
|
||||||
DescriptionTemplateEntity descriptionTemplate = this.queryFactory.query(DescriptionTemplateQuery.class).isActive(IsActive.Active).ids(userDatasetProfile.getDescriptionTemplate()).first();
|
// DescriptionTemplateEntity descriptionTemplate = this.queryFactory.query(DescriptionTemplateQuery.class).isActive(IsActive.Active).ids(userDatasetProfile.getDescriptionTemplate()).first();
|
||||||
|
//
|
||||||
mail.setSubject(environment.getProperty("admin.mail.subject").replace( "{templateName}", descriptionTemplate.getLabel()));
|
// mail.setSubject(environment.getProperty("admin.mail.subject").replace( "{templateName}", descriptionTemplate.getLabel()));
|
||||||
String content = apiContext.getUtilitiesService().getMailService().getMailTemplateContent(environment.getProperty("email.dataset.template"));
|
// String content = apiContext.getUtilitiesService().getMailService().getMailTemplateContent(environment.getProperty("email.dataset.template"));
|
||||||
content = content.replace("{recipient}", user.getName());
|
// content = content.replace("{recipient}", user.getName());
|
||||||
content = content.replace("{templateName}", descriptionTemplate.getLabel());
|
// content = content.replace("{templateName}", descriptionTemplate.getLabel());
|
||||||
content = content.replace("{host}", this.environment.getProperty("dmp.domain"));
|
// content = content.replace("{host}", this.environment.getProperty("dmp.domain"));
|
||||||
content = content.replace("{templateID}", descriptionTemplate.getId().toString());
|
// content = content.replace("{templateID}", descriptionTemplate.getId().toString());
|
||||||
mail.setContent(content);
|
// mail.setContent(content);
|
||||||
mail.setTo(user.getEmail());
|
// mail.setTo(user.getEmail());
|
||||||
try {
|
// try {
|
||||||
apiContext.getUtilitiesService().getMailService().sendSimpleMail(mail);
|
// apiContext.getUtilitiesService().getMailService().sendSimpleMail(mail);
|
||||||
} catch (Exception ex) {
|
// } catch (Exception ex) {
|
||||||
logger.error(ex.getMessage(), ex);
|
// logger.error(ex.getMessage(), ex);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
|
|
||||||
public List<String> getSemantics(String query) {
|
public List<String> getSemantics(String query) {
|
||||||
List<Semantic> semantics = configLoader.getSemantics();
|
List<Semantic> semantics = configLoader.getSemantics();
|
||||||
|
|
|
@ -7,7 +7,7 @@ import eu.eudat.commons.enums.old.notification.ActiveStatus;
|
||||||
import eu.eudat.commons.enums.old.notification.NotifyState;
|
import eu.eudat.commons.enums.old.notification.NotifyState;
|
||||||
import eu.eudat.logic.services.ApiContext;
|
import eu.eudat.logic.services.ApiContext;
|
||||||
import eu.eudat.logic.services.utilities.MailService;
|
import eu.eudat.logic.services.utilities.MailService;
|
||||||
import eu.eudat.models.data.mail.SimpleMail;
|
import eu.eudat.service.mail.SimpleMail;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
|
@ -7,8 +7,7 @@ import eu.eudat.commons.scope.user.UserScope;
|
||||||
import eu.eudat.data.dao.entities.EmailConfirmationDao;
|
import eu.eudat.data.dao.entities.EmailConfirmationDao;
|
||||||
import eu.eudat.data.old.EmailConfirmation;
|
import eu.eudat.data.old.EmailConfirmation;
|
||||||
import eu.eudat.data.old.UserInfo;
|
import eu.eudat.data.old.UserInfo;
|
||||||
import eu.eudat.logic.services.ApiContext;
|
import eu.eudat.service.mail.SimpleMail;
|
||||||
import eu.eudat.models.data.mail.SimpleMail;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.core.env.Environment;
|
import org.springframework.core.env.Environment;
|
||||||
|
|
|
@ -8,7 +8,7 @@ import eu.eudat.data.old.Invitation;
|
||||||
import eu.eudat.data.old.UserDMP;
|
import eu.eudat.data.old.UserDMP;
|
||||||
import eu.eudat.data.old.UserInfo;
|
import eu.eudat.data.old.UserInfo;
|
||||||
import eu.eudat.models.data.invitation.Properties;
|
import eu.eudat.models.data.invitation.Properties;
|
||||||
import eu.eudat.models.data.mail.SimpleMail;
|
import eu.eudat.service.mail.SimpleMail;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package eu.eudat.logic.services.utilities;
|
package eu.eudat.logic.services.utilities;
|
||||||
|
|
||||||
import eu.eudat.models.data.mail.SimpleMail;
|
import eu.eudat.service.mail.SimpleMail;
|
||||||
|
|
||||||
import jakarta.mail.MessagingException;
|
import jakarta.mail.MessagingException;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package eu.eudat.logic.services.utilities;
|
package eu.eudat.logic.services.utilities;
|
||||||
|
|
||||||
import eu.eudat.models.data.mail.SimpleMail;
|
import eu.eudat.service.mail.SimpleMail;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
package eu.eudat.logic.utilities.documents.xml.datasetProfileXml;
|
package eu.eudat.logic.utilities.documents.xml.datasetProfileXml;
|
||||||
import eu.eudat.logic.utilities.documents.xml.datasetProfileXml.datasetProfileModel.DatasetProfile;
|
import eu.eudat.commons.types.descriptiontemplate.importmodel.DescriptionTemplateImportXml;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -11,18 +11,18 @@ import java.io.*;
|
||||||
public class ImportXmlBuilderDatasetProfile {
|
public class ImportXmlBuilderDatasetProfile {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(ImportXmlBuilderDatasetProfile.class);
|
private static final Logger logger = LoggerFactory.getLogger(ImportXmlBuilderDatasetProfile.class);
|
||||||
|
|
||||||
public DatasetProfile build(File xmlFile) throws IOException {
|
public DescriptionTemplateImportXml build(File xmlFile) throws IOException {
|
||||||
DatasetProfile datasetProfile = new DatasetProfile();
|
DescriptionTemplateImportXml descriptionTemplateImportXml = new DescriptionTemplateImportXml();
|
||||||
JAXBContext jaxbContext = null;
|
JAXBContext jaxbContext = null;
|
||||||
try {
|
try {
|
||||||
jaxbContext = JAXBContext.newInstance(DatasetProfile.class);
|
jaxbContext = JAXBContext.newInstance(DescriptionTemplateImportXml.class);
|
||||||
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
|
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
|
||||||
datasetProfile = (DatasetProfile) unmarshaller.unmarshal(xmlFile);
|
descriptionTemplateImportXml = (DescriptionTemplateImportXml) unmarshaller.unmarshal(xmlFile);
|
||||||
} catch (JAXBException e) {
|
} catch (JAXBException e) {
|
||||||
logger.error(e.getMessage(), e);
|
logger.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return datasetProfile;
|
return descriptionTemplateImportXml;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,77 +0,0 @@
|
||||||
package eu.eudat.logic.utilities.documents.xml.datasetProfileXml.datasetProfileModel;
|
|
||||||
|
|
||||||
|
|
||||||
import eu.eudat.commons.enums.DescriptionTemplateStatus;
|
|
||||||
|
|
||||||
import jakarta.xml.bind.annotation.XmlAttribute;
|
|
||||||
import jakarta.xml.bind.annotation.XmlElement;
|
|
||||||
import jakarta.xml.bind.annotation.XmlRootElement;
|
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@XmlRootElement(name = "pages")
|
|
||||||
public class DatasetProfile {
|
|
||||||
|
|
||||||
private String description;
|
|
||||||
private String language;
|
|
||||||
private String type;
|
|
||||||
|
|
||||||
private List<Page> page;
|
|
||||||
|
|
||||||
@XmlElement(name = "page")
|
|
||||||
public List<Page> getPage() {
|
|
||||||
return page;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPage(List<Page> page) {
|
|
||||||
this.page = page;
|
|
||||||
}
|
|
||||||
|
|
||||||
@XmlAttribute(name = "description")
|
|
||||||
public String getDescription() {
|
|
||||||
return description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDescription(String description) {
|
|
||||||
this.description = description;
|
|
||||||
}
|
|
||||||
|
|
||||||
@XmlAttribute(name = "language")
|
|
||||||
public String getLanguage() {
|
|
||||||
return language;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLanguage(String language) {
|
|
||||||
this.language = language;
|
|
||||||
}
|
|
||||||
|
|
||||||
@XmlAttribute(name = "type")
|
|
||||||
public String getType() {
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setType(String type) {
|
|
||||||
this.type = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public eu.eudat.models.data.admin.composite.DatasetProfile toAdminCompositeModel(String label){
|
|
||||||
eu.eudat.models.data.admin.composite.DatasetProfile newDatasetEntityProfile = new eu.eudat.models.data.admin.composite.DatasetProfile();
|
|
||||||
newDatasetEntityProfile.setLabel(label);
|
|
||||||
newDatasetEntityProfile.setStatus(DescriptionTemplateStatus.Draft.getValue());
|
|
||||||
newDatasetEntityProfile.setDescription(description);
|
|
||||||
newDatasetEntityProfile.setLanguage(language);
|
|
||||||
newDatasetEntityProfile.setType(type);
|
|
||||||
List<eu.eudat.models.data.admin.components.datasetprofile.Page> pagesDatasetEntity = new LinkedList<>();
|
|
||||||
List<eu.eudat.models.data.admin.components.datasetprofile.Section> sectionDatasetEntity = new LinkedList<>();
|
|
||||||
for (Page xmlPage: page) {
|
|
||||||
pagesDatasetEntity.add(xmlPage.toAdminCompositeModelPage());
|
|
||||||
for (int i = 0; i < xmlPage.getSections().size(); i++) {
|
|
||||||
sectionDatasetEntity.add(xmlPage.toAdminCompositeModelSection(i));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
newDatasetEntityProfile.setPages(pagesDatasetEntity);
|
|
||||||
newDatasetEntityProfile.setSections(sectionDatasetEntity);
|
|
||||||
|
|
||||||
return newDatasetEntityProfile;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,30 +0,0 @@
|
||||||
package eu.eudat.logic.utilities.documents.xml.datasetProfileXml.datasetProfileModel;
|
|
||||||
|
|
||||||
import jakarta.xml.bind.annotation.XmlElement;
|
|
||||||
import jakarta.xml.bind.annotation.XmlRootElement;
|
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@XmlRootElement(name = "field-Sets")
|
|
||||||
public class FieldSets {
|
|
||||||
|
|
||||||
List<FieldSet> fieldSet;
|
|
||||||
|
|
||||||
@XmlElement(name = "field-Set")
|
|
||||||
public List<FieldSet> getFieldSet() {
|
|
||||||
return fieldSet;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFieldSet(List<FieldSet> fieldSet) {
|
|
||||||
this.fieldSet = fieldSet;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<eu.eudat.models.data.admin.components.datasetprofile.FieldSet> toAdminCompositeModelSection(){
|
|
||||||
List<eu.eudat.models.data.admin.components.datasetprofile.FieldSet> fieldSetEntity = new LinkedList<>();
|
|
||||||
if(this.fieldSet!=null)
|
|
||||||
for (FieldSet xmlFieldSet:this.fieldSet){
|
|
||||||
fieldSetEntity.add(xmlFieldSet.toAdminCompositeModelSection());
|
|
||||||
}
|
|
||||||
return fieldSetEntity;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,38 +0,0 @@
|
||||||
package eu.eudat.logic.utilities.documents.xml.datasetProfileXml.datasetProfileModel.Fields;
|
|
||||||
|
|
||||||
import jakarta.xml.bind.annotation.XmlElement;
|
|
||||||
import jakarta.xml.bind.annotation.XmlRootElement;
|
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@XmlRootElement(name = "fields")
|
|
||||||
public class Fields {
|
|
||||||
|
|
||||||
private List<Field> field;
|
|
||||||
|
|
||||||
@XmlElement(name = "field")
|
|
||||||
public List<Field> getField() {
|
|
||||||
return field;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setField(List<Field> field) {
|
|
||||||
this.field = field;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<eu.eudat.models.data.admin.components.datasetprofile.Field> toAdminCompositeModelSection() {
|
|
||||||
List<eu.eudat.models.data.admin.components.datasetprofile.Field> fieldsEntity = new LinkedList<>();
|
|
||||||
if (this.field != null)
|
|
||||||
for (Field xmlField : this.field) {
|
|
||||||
fieldsEntity.add(xmlField.toAdminCompositeModelSection());
|
|
||||||
}
|
|
||||||
return fieldsEntity;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,46 +0,0 @@
|
||||||
package eu.eudat.logic.utilities.documents.xml.datasetProfileXml.datasetProfileModel.Fields;
|
|
||||||
|
|
||||||
import eu.eudat.commons.types.descriptiontemplate.RuleEntity;
|
|
||||||
import eu.eudat.commons.types.descriptiontemplate.todelete.VisibilityEntity;
|
|
||||||
import jakarta.xml.bind.annotation.XmlAttribute;
|
|
||||||
import jakarta.xml.bind.annotation.XmlElement;
|
|
||||||
import jakarta.xml.bind.annotation.XmlRootElement;
|
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@XmlRootElement(name = "visible")
|
|
||||||
public class Visible {
|
|
||||||
|
|
||||||
private String style;
|
|
||||||
private List<Rule> rule;
|
|
||||||
|
|
||||||
@XmlAttribute(name = "style")
|
|
||||||
public String getStyle() {
|
|
||||||
return style;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStyle(String style) {
|
|
||||||
this.style = style;
|
|
||||||
}
|
|
||||||
@XmlElement(name = "rule")
|
|
||||||
public List<Rule> getRule() {
|
|
||||||
return rule;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRule(List<Rule> rule) {
|
|
||||||
this.rule = rule;
|
|
||||||
}
|
|
||||||
|
|
||||||
public VisibilityEntity toAdminCompositeModelSection(){
|
|
||||||
VisibilityEntity visibilityEntity = new VisibilityEntity();
|
|
||||||
visibilityEntity.setStyle(this.style);
|
|
||||||
if(this.rule!=null) {
|
|
||||||
List<RuleEntity> ruleListEntity = new LinkedList<>();
|
|
||||||
for (Rule xmlRule : this.rule) {
|
|
||||||
ruleListEntity.add(xmlRule.toAdminCompositeModelSection());
|
|
||||||
}
|
|
||||||
visibilityEntity.setRules(ruleListEntity);
|
|
||||||
}
|
|
||||||
return visibilityEntity;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,25 +0,0 @@
|
||||||
package eu.eudat.logic.utilities.documents.xml.datasetProfileXml.datasetProfileModel.Fields;
|
|
||||||
|
|
||||||
import jakarta.xml.bind.annotation.XmlElement;
|
|
||||||
import jakarta.xml.bind.annotation.XmlRootElement;
|
|
||||||
|
|
||||||
@XmlRootElement(name = "validations")
|
|
||||||
public class validations {
|
|
||||||
|
|
||||||
Validation validation;
|
|
||||||
|
|
||||||
@XmlElement(name = "validation")
|
|
||||||
public Validation getValidation() {
|
|
||||||
return validation;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setValidation(Validation validation) {
|
|
||||||
this.validation = validation;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int toAdminCompositeModelSection() {
|
|
||||||
return validation.getType();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -1,74 +0,0 @@
|
||||||
package eu.eudat.logic.utilities.documents.xml.datasetProfileXml.datasetProfileModel;
|
|
||||||
|
|
||||||
import jakarta.xml.bind.annotation.XmlAttribute;
|
|
||||||
import jakarta.xml.bind.annotation.XmlElement;
|
|
||||||
import jakarta.xml.bind.annotation.XmlRootElement;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@XmlRootElement(name = "page")
|
|
||||||
public class Page {
|
|
||||||
private String id;
|
|
||||||
private int ordinal;
|
|
||||||
private String title;
|
|
||||||
private List<Sections> sections;
|
|
||||||
|
|
||||||
@XmlAttribute(name = "id")
|
|
||||||
public String getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(String id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
@XmlAttribute(name = "ordinal")
|
|
||||||
public int getOrdinal() {
|
|
||||||
return ordinal;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOrdinal(int ordinal) {
|
|
||||||
this.ordinal = ordinal;
|
|
||||||
}
|
|
||||||
|
|
||||||
@XmlAttribute(name = "title")
|
|
||||||
public String getTitle() {
|
|
||||||
return title;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTitle(String title) {
|
|
||||||
this.title = title;
|
|
||||||
}
|
|
||||||
|
|
||||||
@XmlElement(name = "sections")
|
|
||||||
public List<Sections> getSections() {
|
|
||||||
return sections;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSections(List<Sections> sections) {
|
|
||||||
this.sections = sections;
|
|
||||||
}
|
|
||||||
|
|
||||||
public eu.eudat.models.data.admin.components.datasetprofile.Page toAdminCompositeModelPage(){
|
|
||||||
eu.eudat.models.data.admin.components.datasetprofile.Page pageEntity = new eu.eudat.models.data.admin.components.datasetprofile.Page();
|
|
||||||
pageEntity.setId(this.id);
|
|
||||||
pageEntity.setOrdinal(this.ordinal);
|
|
||||||
pageEntity.setTitle(this.title);
|
|
||||||
return pageEntity;
|
|
||||||
}
|
|
||||||
|
|
||||||
public eu.eudat.models.data.admin.components.datasetprofile.Section toAdminCompositeModelSection(int i){
|
|
||||||
/* eu.eudat.models.data.admin.components.datasetprofile.Section sectionEntity =new eu.eudat.models.data.admin.components.datasetprofile.Section();
|
|
||||||
// List<eu.eudat.models.data.admin.components.datasetprofile.Section> sectionsListEntity = new LinkedList<>();
|
|
||||||
// for (Section xmlsection:this.sections.section) {
|
|
||||||
// sectionsListEntity.add(xmlsection.toAdminCompositeModelSection());
|
|
||||||
// }
|
|
||||||
if(this.sections.section!=null)
|
|
||||||
sectionEntity.setSections(this.sections.toAdminCompositeModelSection());
|
|
||||||
if(this.sections.fieldSets.fieldSet!=null)
|
|
||||||
sectionEntity.setFieldSets(this.sections.toAdminCompositeModelSectionFieldSets());
|
|
||||||
sectionEntity.setId(this.id);
|
|
||||||
sectionEntity.setOrdinal(this.ordinal);
|
|
||||||
sectionEntity.setTitle(this.title);*/
|
|
||||||
return sections.get(i).toAdminCompositeModelSection();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -147,6 +147,14 @@ permissions:
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
allowAnonymous: false
|
allowAnonymous: false
|
||||||
allowAuthenticated: false
|
allowAuthenticated: false
|
||||||
|
ImportDescriptionTemplate:
|
||||||
|
roles:
|
||||||
|
- Admin
|
||||||
|
- DatasetProfileManager
|
||||||
|
claims: [ ]
|
||||||
|
clients: [ ]
|
||||||
|
allowAnonymous: false
|
||||||
|
allowAuthenticated: false
|
||||||
# Dmp
|
# Dmp
|
||||||
BrowseDmp:
|
BrowseDmp:
|
||||||
roles:
|
roles:
|
||||||
|
|
Loading…
Reference in New Issue