diff --git a/dmp-backend/core/src/main/java/eu/eudat/model/persist/DmpPersist.java b/dmp-backend/core/src/main/java/eu/eudat/model/persist/DmpPersist.java index b3b8c7571..c5cce3a4a 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/model/persist/DmpPersist.java +++ b/dmp-backend/core/src/main/java/eu/eudat/model/persist/DmpPersist.java @@ -2,6 +2,7 @@ package eu.eudat.model.persist; import eu.eudat.commons.enums.DmpStatus; import eu.eudat.commons.validation.ValidId; +import eu.eudat.model.persist.dmpproperties.DmpPropertiesPersist; import java.time.Instant; import java.util.UUID; @@ -15,7 +16,7 @@ public class DmpPersist { private DmpStatus status; - private String properties; + private DmpPropertiesPersist properties; private String description; @@ -45,11 +46,11 @@ public class DmpPersist { this.status = status; } - public String getProperties() { + public DmpPropertiesPersist getProperties() { return properties; } - public void setProperties(String properties) { + public void setProperties(DmpPropertiesPersist properties) { this.properties = properties; } diff --git a/dmp-backend/core/src/main/java/eu/eudat/model/persist/dmpproperties/DmpBlueprintValue.java b/dmp-backend/core/src/main/java/eu/eudat/model/persist/dmpproperties/DmpBlueprintValue.java new file mode 100644 index 000000000..f255fc7cd --- /dev/null +++ b/dmp-backend/core/src/main/java/eu/eudat/model/persist/dmpproperties/DmpBlueprintValue.java @@ -0,0 +1,24 @@ +package eu.eudat.model.persist.dmpproperties; + +public class DmpBlueprintValue { + + private String fieldId; + + private String fieldValue; + + public String getFieldId() { + return fieldId; + } + + public void setFieldId(String fieldId) { + this.fieldId = fieldId; + } + + public String getFieldValue() { + return fieldValue; + } + + public void setFieldValue(String fieldValue) { + this.fieldValue = fieldValue; + } +} diff --git a/dmp-backend/core/src/main/java/eu/eudat/model/persist/dmpproperties/DmpContact.java b/dmp-backend/core/src/main/java/eu/eudat/model/persist/dmpproperties/DmpContact.java new file mode 100644 index 000000000..c60fe0c08 --- /dev/null +++ b/dmp-backend/core/src/main/java/eu/eudat/model/persist/dmpproperties/DmpContact.java @@ -0,0 +1,44 @@ +package eu.eudat.model.persist.dmpproperties; + +public class DmpContact { + + String userId; + + String firstName; + + String lastName; + + String email; + + public String getUserId() { + return userId; + } + + public void setUserId(String userId) { + this.userId = userId; + } + + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } +} diff --git a/dmp-backend/core/src/main/java/eu/eudat/model/persist/dmpproperties/DmpPropertiesPersist.java b/dmp-backend/core/src/main/java/eu/eudat/model/persist/dmpproperties/DmpPropertiesPersist.java new file mode 100644 index 000000000..849af6404 --- /dev/null +++ b/dmp-backend/core/src/main/java/eu/eudat/model/persist/dmpproperties/DmpPropertiesPersist.java @@ -0,0 +1,27 @@ +package eu.eudat.model.persist.dmpproperties; + +import java.util.List; + +public class DmpPropertiesPersist { + + private List dmpBlueprintValues; + + private List contacts; + + public List getDmpBlueprintValues() { + return dmpBlueprintValues; + } + + public void setDmpBlueprintValues(List dmpBlueprintValues) { + this.dmpBlueprintValues = dmpBlueprintValues; + } + + public List getContacts() { + return contacts; + } + + public void setContacts(List contacts) { + this.contacts = contacts; + } + +} diff --git a/dmp-backend/core/src/main/java/eu/eudat/service/dmp/DmpServiceImpl.java b/dmp-backend/core/src/main/java/eu/eudat/service/dmp/DmpServiceImpl.java index 044a79c48..f5572dd4d 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/service/dmp/DmpServiceImpl.java +++ b/dmp-backend/core/src/main/java/eu/eudat/service/dmp/DmpServiceImpl.java @@ -1,5 +1,6 @@ package eu.eudat.service.dmp; +import com.fasterxml.jackson.core.JsonProcessingException; import eu.eudat.authorization.AuthorizationFlags; import eu.eudat.authorization.Permission; import eu.eudat.commons.JsonHandlingService; @@ -56,6 +57,8 @@ public class DmpServiceImpl implements DmpService { private final MessageSource messageSource; + private final JsonHandlingService jsonHandlingService; + private final EventBroker eventBroker; @Autowired @@ -67,6 +70,7 @@ public class DmpServiceImpl implements DmpService { ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource, + JsonHandlingService jsonHandlingService, EventBroker eventBroker) { this.entityManager = entityManager; this.authorizationService = authorizationService; @@ -75,6 +79,7 @@ public class DmpServiceImpl implements DmpService { this.conventionService = conventionService; this.errors = errors; this.messageSource = messageSource; + this.jsonHandlingService = jsonHandlingService; this.eventBroker = eventBroker; } @@ -101,7 +106,11 @@ public class DmpServiceImpl implements DmpService { data.setLabel(model.getLabel()); data.setStatus(model.getStatus()); - data.setProperties(model.getProperties()); + try { + data.setProperties(this.jsonHandlingService.toJson(model.getProperties())); + } catch (JsonProcessingException e) { + logger.error(e.getMessage(), e); + } data.setDescription(model.getDescription()); data.setUpdatedAt(Instant.now()); if (isUpdate)