diff --git a/apps/dnet-orgs-database-application/src/main/java/eu/dnetlib/organizations/model/view/OpenaireDuplicateView.java b/apps/dnet-orgs-database-application/src/main/java/eu/dnetlib/organizations/model/view/OpenaireDuplicateView.java index 3fb24132..a5e1e8d1 100644 --- a/apps/dnet-orgs-database-application/src/main/java/eu/dnetlib/organizations/model/view/OpenaireDuplicateView.java +++ b/apps/dnet-orgs-database-application/src/main/java/eu/dnetlib/organizations/model/view/OpenaireDuplicateView.java @@ -46,6 +46,9 @@ public class OpenaireDuplicateView implements Serializable { @Column(name = "reltype") private String relType; + @Column(name = "created_by") + private String createdBy; + public String getLocalId() { return localId; } @@ -110,4 +113,12 @@ public class OpenaireDuplicateView implements Serializable { this.relType = relType; } + public String getCreatedBy() { + return createdBy; + } + + public void setCreatedBy(final String createdBy) { + this.createdBy = createdBy; + } + } diff --git a/apps/dnet-orgs-database-application/src/main/java/eu/dnetlib/organizations/repository/OpenaireDuplicateRepository.java b/apps/dnet-orgs-database-application/src/main/java/eu/dnetlib/organizations/repository/OpenaireDuplicateRepository.java index 85fd7d4e..9b3b752a 100644 --- a/apps/dnet-orgs-database-application/src/main/java/eu/dnetlib/organizations/repository/OpenaireDuplicateRepository.java +++ b/apps/dnet-orgs-database-application/src/main/java/eu/dnetlib/organizations/repository/OpenaireDuplicateRepository.java @@ -20,4 +20,8 @@ public interface OpenaireDuplicateRepository extends JpaRepository openaireDuplicateRepository.updateModificationDate(d.getLocalId(), d.getOaOriginalId(), user, now)); + dups.forEach(d -> { + openaireDuplicateRepository.updateCreatedByIfMissing(d.getLocalId(), d.getOaOriginalId(), user); + openaireDuplicateRepository.updateModificationDate(d.getLocalId(), d.getOaOriginalId(), user, now); + }); organizationRepository.updateStatus(oldId, OrganizationStatus.duplicate.toString()); organizationRepository.updateModificationDate(oldId, user, now); @@ -168,6 +171,7 @@ public class DatabaseUtils { final List list = openaireDuplicateRepository.saveAll(simrels); list.forEach(d -> { + openaireDuplicateRepository.updateCreatedByIfMissing(d.getLocalId(), d.getOaOriginalId(), user); openaireDuplicateRepository.updateModificationDate(d.getLocalId(), d.getOaOriginalId(), user, now); if (d.getRelType().equals(SimilarityType.is_different.toString())) { diff --git a/apps/dnet-orgs-database-application/src/main/resources/sql/schema.sql b/apps/dnet-orgs-database-application/src/main/resources/sql/schema.sql index 1456fcd0..b7011f2a 100644 --- a/apps/dnet-orgs-database-application/src/main/resources/sql/schema.sql +++ b/apps/dnet-orgs-database-application/src/main/resources/sql/schema.sql @@ -405,7 +405,8 @@ CREATE VIEW oa_duplicates_view AS o.country as oa_country, array_to_string(array_agg(u.url), ', ') as oa_url, d.oa_collectedfrom as oa_collectedfrom, - d.reltype as reltype + d.reltype as reltype, + d.created_by as created_by FROM oa_duplicates d LEFT OUTER JOIN organizations o ON (o.id = d.oa_original_id) @@ -414,6 +415,7 @@ FROM GROUP BY d.local_id, d.oa_original_id, + d.created_by, o.name, o.country, d.oa_collectedfrom, diff --git a/apps/dnet-orgs-database-application/src/main/resources/static/resources/html/parts/org_duplicates.html b/apps/dnet-orgs-database-application/src/main/resources/static/resources/html/parts/org_duplicates.html index acc76f65..81ee02a8 100644 --- a/apps/dnet-orgs-database-application/src/main/resources/static/resources/html/parts/org_duplicates.html +++ b/apps/dnet-orgs-database-application/src/main/resources/static/resources/html/parts/org_duplicates.html @@ -15,12 +15,16 @@ - {{sr.oaName}}
- URL: {{sr.oaUrl}}
+ {{sr.oaName}}
+ URL: {{sr.oaUrl}}
{{sr.oaAcronym}} {{sr.oaCountry}} - Collected from: {{sr.oaCollectedFrom}}
Original Id: {{sr.oaOriginalId}} + + Original Id: {{sr.oaOriginalId}} +
Provenance: {{sr.oaCollectedFrom}}
+
Added by: {{sr.createdBy}}
+