From f538db50f86038b0d9d4d8b5c720c6cae47a73d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kai=20P=C3=B6yki=C3=B6?= Date: Wed, 27 Nov 2024 11:32:13 +0100 Subject: [PATCH] generic elib deleted remover per sigel --- .../11/remove_deleted_elib_sigel_holds.groovy | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 whelktool/scripts/cleanups/2024/11/remove_deleted_elib_sigel_holds.groovy diff --git a/whelktool/scripts/cleanups/2024/11/remove_deleted_elib_sigel_holds.groovy b/whelktool/scripts/cleanups/2024/11/remove_deleted_elib_sigel_holds.groovy new file mode 100755 index 0000000000..c823b0b340 --- /dev/null +++ b/whelktool/scripts/cleanups/2024/11/remove_deleted_elib_sigel_holds.groovy @@ -0,0 +1,25 @@ +//241127 KP, removes all fake deleted holds for 'sigel' with 'origin:Elib' +// add -Dsigel=SIGEL to command line + +def sigel = System.getProperty("sigel") + +if ( sigel == null ) { + println('set sigel with -Dsigel=SIGEL') + System.exit(0) +} + +def sigel_elib_holds = """ + collection = 'hold' + and data#>>'{@graph,1,heldBy,@id}' = 'https://libris.kb.se/library/${sigel}' + and data#>'{@graph,1,cataloguersNote}' @> '["origin:Elib"]'::jsonb + and data#>'{@graph,1,cataloguersNote}' @> '["deleted"]'::jsonb + and deleted = false + """ + +selectBySqlWhere(sigel_elib_holds) { d -> + //def hold = d.getGraph() + //def id = hold[0].'@id' + //println('I: ' + id) + //println(hold) + d.scheduleDelete(loud: true) +}