From 5ad8c556e96f7c686c780fb16f646e3db6d68534 Mon Sep 17 00:00:00 2001 From: Alan Orth Date: Thu, 25 Apr 2024 12:53:15 +0300 Subject: [PATCH] src/main/java: simplify curation task results We don't need to print the Handle because some items can be in the workflow still so this will be null, but also because DSpace will already show the Handle in the log before printing the result. --- .../ilri/cgspace/ctasks/CountryCodeTagger.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/main/java/io/github/ilri/cgspace/ctasks/CountryCodeTagger.java b/src/main/java/io/github/ilri/cgspace/ctasks/CountryCodeTagger.java index e215f4d..b1a12d2 100644 --- a/src/main/java/io/github/ilri/cgspace/ctasks/CountryCodeTagger.java +++ b/src/main/java/io/github/ilri/cgspace/ctasks/CountryCodeTagger.java @@ -85,14 +85,13 @@ public class CountryCodeTagger extends AbstractCurationTask { public CountryCodeTaggerResult performAlpha2(Item item, CountryCodeTaggerConfig config) throws IOException, SQLException { CountryCodeTaggerResult alpha2Result = new CountryCodeTaggerResult(); - String itemHandle = item.getHandle(); List itemCountries = itemService.getMetadataByMetadataString(item, config.iso3166Field); // skip items that don't have country metadata if (itemCountries.isEmpty()) { - alpha2Result.setResult(itemHandle + ": no countries, skipping."); + alpha2Result.setResult("No countries, skipping."); alpha2Result.setStatus(Curator.CURATE_SKIP); } else { Gson gson = new Gson(); @@ -171,21 +170,20 @@ public class CountryCodeTagger extends AbstractCurationTask { itemService.update(Curator.curationContext(), item); } catch (SQLException | AuthorizeException sqle) { config.log.debug(sqle.getMessage()); - alpha2Result.setResult(itemHandle + ": error"); + alpha2Result.setResult("Error"); alpha2Result.setStatus(Curator.CURATE_ERROR); } alpha2Result.setResult( - itemHandle - + ": added " + "Added " + newAlpha2Codes.size() + " alpha2 country code(s)"); } else { - alpha2Result.setResult(itemHandle + ": no matching countries found"); + alpha2Result.setResult("No matching countries found"); } alpha2Result.setStatus(Curator.CURATE_SUCCESS); } else { - alpha2Result.setResult(itemHandle + ": item has country codes, skipping"); + alpha2Result.setResult("Item already has country codes, skipping unless forced"); alpha2Result.setStatus(Curator.CURATE_SKIP); } }