From 41d18a54d1d2b133555f5c4c6766b1f5e6304f55 Mon Sep 17 00:00:00 2001 From: kwahlin Date: Wed, 11 Dec 2024 16:13:11 +0100 Subject: [PATCH 1/2] Exclude only bulk:deprecate from relinking --- .../src/main/resources/bulk-change-scripts/merge.groovy | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/whelktool/src/main/resources/bulk-change-scripts/merge.groovy b/whelktool/src/main/resources/bulk-change-scripts/merge.groovy index 281820b697..8a14ea058e 100644 --- a/whelktool/src/main/resources/bulk-change-scripts/merge.groovy +++ b/whelktool/src/main/resources/bulk-change-scripts/merge.groovy @@ -27,15 +27,14 @@ selectByIds([deprecateId]) { obsolete -> } selectByIds(dependsOnObsolete) { depender -> - if (depender.doc.getThingType() == JOB_TYPE) { - return - } - List modifiedListPaths = [] def modified = DocumentUtil.traverse(depender.graph) { value, path -> // TODO: What if there are links to a record uri? if (path && path.last() == ID_KEY && obsoleteThingUris.contains(value)) { path.dropRight(1).with { + if (it.last() == DEPRECATE_KEY) { + return + } if (it.last() instanceof Integer) { modifiedListPaths.add(it.dropRight(1)) } From cc77e99d3c30c9cb26a03820c84f32d2afb3b418 Mon Sep 17 00:00:00 2001 From: kwahlin Date: Wed, 11 Dec 2024 16:21:54 +0100 Subject: [PATCH 2/2] Remove confusing error message --- .../src/main/groovy/whelk/component/PostgreSQLComponent.groovy | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/whelk-core/src/main/groovy/whelk/component/PostgreSQLComponent.groovy b/whelk-core/src/main/groovy/whelk/component/PostgreSQLComponent.groovy index c7ca1c7c51..fa0dac4321 100644 --- a/whelk-core/src/main/groovy/whelk/component/PostgreSQLComponent.groovy +++ b/whelk-core/src/main/groovy/whelk/component/PostgreSQLComponent.groovy @@ -2773,8 +2773,7 @@ class PostgreSQLComponent { def allow = JsonLd.ALLOW_LINK_TO_DELETED + (jsonld?.cascadingDeleteRelations() ?: Collections.EMPTY_SET) def referencedBy = followDependers(identifier, allow) if (!referencedBy.isEmpty()) { - def referencedByStr = referencedBy.collect { shortId, path -> "$shortId at $path" }.join(', ') - throw new RuntimeException("Deleting depended upon records is not allowed. Referenced by: $referencedByStr") + throw new RuntimeException("Deleting depended upon records is not allowed.") } }