# HG changeset patch # User Robert Casties # Date 1539794699 -7200 # Node ID 452d02798054af5c7f62ddec5c5572467e4cc1dc # Parent 2c49ddbe95ac806c47455bdf3be9295d92bef094 more error checking for UpdateMpiwgDigitalizations. diff -r 2c49ddbe95ac -r 452d02798054 src/main/java/org/mpi/openmind/scripts/UpdateMpiwgDigitalizations.java --- a/src/main/java/org/mpi/openmind/scripts/UpdateMpiwgDigitalizations.java Wed Oct 17 18:44:25 2018 +0200 +++ b/src/main/java/org/mpi/openmind/scripts/UpdateMpiwgDigitalizations.java Wed Oct 17 18:44:59 2018 +0200 @@ -17,6 +17,9 @@ * MPIWG library directory names and access information ("free", or other) * and updates DIGITALIZATION objects with matching public_manifest_url * Attribute. + * + * CSV file name: mcgill-mpiwg-mapping.csv + * CSV columns: "mcgilldir, mpiwgdir, access" * * @author casties * @@ -44,6 +47,10 @@ List filterList = new ArrayList(); filterList.add(new AttributeFilter("name", mcgillDir, "DIGITALIZATION")); Map resultMap = ws.searchEntityByAttributeFilter(filterList, 1); + if (resultMap.isEmpty()) { + System.out.println("WARNING: DIGITALIZATION not found for " + mcgillDir); + continue; + } Entity digi = resultMap.keySet().iterator().next(); /* // find CODEX @@ -57,7 +64,7 @@ if (digi != null) { ws.getEntityContent(digi); String pubUrl = null; - String privUrl = null; + //String privUrl = null; // set public url if (access.equalsIgnoreCase("free")) { pubUrl = "https://digilib.mpiwg-berlin.mpg.de/digitallibrary/Manifester/IIIF/permanent!library!" @@ -68,7 +75,11 @@ pubUrlAtt = new Attribute(PUB_URL_ATT_NAME, "text", pubUrl); digi.addAttribute(pubUrlAtt); } else { - pubUrlAtt.setValue(pubUrl); + String oldUrl = pubUrlAtt.getValue(); + if (!pubUrl.equals(oldUrl)) { + System.out.println("WARNING: URL changed! old="+oldUrl+" new="+pubUrl); + pubUrlAtt.setValue(pubUrl); + } } } // save