From f6feef1942dfdc658e975ec7ed255decca7b67ef Mon Sep 17 00:00:00 2001 From: "michele.artini" Date: Thu, 29 Oct 2020 13:32:09 +0100 Subject: [PATCH] creted and modified by and --- .../eu/dnetlib/organizations/utils/DatabaseUtils.java | 8 ++++++-- .../src/test/java/SimpleTest.java | 5 ----- 2 files changed, 6 insertions(+), 7 deletions(-) delete mode 100644 apps/dnet-orgs-database-application/src/test/java/SimpleTest.java diff --git a/apps/dnet-orgs-database-application/src/main/java/eu/dnetlib/organizations/utils/DatabaseUtils.java b/apps/dnet-orgs-database-application/src/main/java/eu/dnetlib/organizations/utils/DatabaseUtils.java index 475c856d..490f3bb9 100644 --- a/apps/dnet-orgs-database-application/src/main/java/eu/dnetlib/organizations/utils/DatabaseUtils.java +++ b/apps/dnet-orgs-database-application/src/main/java/eu/dnetlib/organizations/utils/DatabaseUtils.java @@ -345,6 +345,8 @@ public class DatabaseUtils { @Transactional public String fixConflict(final List similarIds, final String user) { + final OffsetDateTime now = OffsetDateTime.now(); + final List views = similarIds.stream().map(organizationViewRepository::findById).filter(Optional::isPresent).map(Optional::get).collect(Collectors.toList()); @@ -385,8 +387,10 @@ public class DatabaseUtils { .collect(Collectors.toList()); openaireDuplicateRepository.saveAll(newDuplicates); - - final OffsetDateTime now = OffsetDateTime.now(); + newDuplicates.forEach(d -> { + openaireDuplicateRepository.updateCreatedByIfMissing(d.getLocalId(), d.getOaOriginalId(), user); + openaireDuplicateRepository.updateModificationDate(d.getLocalId(), d.getOaOriginalId(), user, now); + }); for (final String similarId : similarIds) { openaireConflictRepository.updateMultipleStatusAndResetGroup(similarId, SimilarityType.is_different.toString(), user, now); diff --git a/apps/dnet-orgs-database-application/src/test/java/SimpleTest.java b/apps/dnet-orgs-database-application/src/test/java/SimpleTest.java deleted file mode 100644 index f4bd4d71..00000000 --- a/apps/dnet-orgs-database-application/src/test/java/SimpleTest.java +++ /dev/null @@ -1,5 +0,0 @@ - - -public class SimpleTest { - -}