From 80a336f94d024c2a4d35ea6109f6b0e8eec8a2f9 Mon Sep 17 00:00:00 2001 From: Alan Orth Date: Fri, 7 Oct 2022 14:49:58 +0300 Subject: [PATCH] src: fix context commit in scripts I was wondering why the same bitstreams appeared to be getting de- leted on every single run. It turns out that the only mode we were committing the context in was in single item mode. If the argument was a site, community, or collection we were updating the item but not actually committing the changes! --- .../io/github/ilri/cgspace/scripts/FixJpgJpgThumbnails.java | 3 +++ .../github/ilri/cgspace/scripts/FixLowQualityThumbnails.java | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/main/java/io/github/ilri/cgspace/scripts/FixJpgJpgThumbnails.java b/src/main/java/io/github/ilri/cgspace/scripts/FixJpgJpgThumbnails.java index fd19386..5017c48 100644 --- a/src/main/java/io/github/ilri/cgspace/scripts/FixJpgJpgThumbnails.java +++ b/src/main/java/io/github/ilri/cgspace/scripts/FixJpgJpgThumbnails.java @@ -61,6 +61,7 @@ public class FixJpgJpgThumbnails { switch (parent.getType()) { case Constants.SITE: process(context, itemService.findAll(context)); + context.commit(); break; case Constants.COMMUNITY: List collections = ((Community) parent).getCollections(); @@ -69,11 +70,13 @@ public class FixJpgJpgThumbnails { context, itemService.findAllByCollection(context, collection)); } + context.commit(); break; case Constants.COLLECTION: process( context, itemService.findByCollection(context, (Collection) parent)); + context.commit(); break; case Constants.ITEM: processItem(context, (Item) parent); diff --git a/src/main/java/io/github/ilri/cgspace/scripts/FixLowQualityThumbnails.java b/src/main/java/io/github/ilri/cgspace/scripts/FixLowQualityThumbnails.java index dc8d97c..6f63913 100644 --- a/src/main/java/io/github/ilri/cgspace/scripts/FixLowQualityThumbnails.java +++ b/src/main/java/io/github/ilri/cgspace/scripts/FixLowQualityThumbnails.java @@ -78,6 +78,7 @@ public class FixLowQualityThumbnails { switch (parent.getType()) { case Constants.SITE: process(context, itemService.findAll(context)); + context.commit(); break; case Constants.COMMUNITY: List collections = ((Community) parent).getCollections(); @@ -86,11 +87,13 @@ public class FixLowQualityThumbnails { context, itemService.findAllByCollection(context, collection)); } + context.commit(); break; case Constants.COLLECTION: process( context, itemService.findByCollection(context, (Collection) parent)); + context.commit(); break; case Constants.ITEM: processItem(context, (Item) parent);