Fix issue with DMP json export if it have been imported from json

This commit is contained in:
George Kalampokis 2022-03-29 10:55:49 +03:00
parent 35ea0b5d6c
commit 72507dd1b8
1 changed files with 4 additions and 0 deletions

View File

@ -96,6 +96,7 @@ import java.util.stream.Stream;
@Component
public class DataManagementPlanManager {
private static final Logger logger = LoggerFactory.getLogger(DataManagementPlanManager.class);
private static final ObjectMapper objectMapper = new ObjectMapper();
private final Map<NotificationType, String> notificationPaths = Stream.of(new Object[][] {
{NotificationType.DMP_MODIFIED, "/plans/edit"},
@ -1739,6 +1740,9 @@ public class DataManagementPlanManager {
UserInfo me = apiContext.getOperationsContext().getDatabaseRepository().getUserInfoDao().find(principal.getId());
dmp.setModified(new Date());
dmp.setCreator(me);
Map<String, String> extraProperties = objectMapper.readValue(dmp.getExtraProperties(), HashMap.class);
extraProperties.put("contact", me.getId().toString());
dmp.setExtraProperties(objectMapper.writeValueAsString(extraProperties));
dmp.setVersion(0);
dmp.setStatus((short)0);
dmp.setGroupId(UUID.randomUUID());