14 Commits

Author SHA1 Message Date
3eddbc3e22 Version 6.1 2022-10-31 11:43:54 +03:00
dbf59f784c README.md: add notes on deploying to Maven Central 2022-10-31 11:40:59 +03:00
0ffa4c8d37 pom.xml: fix version of maven-deploy-plugin 2022-10-31 11:37:25 +03:00
970d0c074e README.md: reference DSpace 6 docs 2022-10-31 11:11:50 +03:00
6b2b899957 CHANGELOG.md: add note about iso-codes 4.11.0 2022-10-14 20:51:04 +03:00
dfaa234a90 src/main/resources: sync cgspace-countries.json with iso-codes
Not sure this is needed, but we copy the JSON object from iso-codes
so we should keep it in sync when there are changes to countries we
override.
2022-10-14 20:49:23 +03:00
f46e81b8cd src/main/resources: import iso-codes 4.11.0
This is a bit old by now even, but there are two changes:

- South Korea
- North Korea
2022-10-14 20:47:26 +03:00
dbd8721579 src: add better status messages to FixLowQualityThumbnails 2022-10-07 15:33:13 +03:00
a234b39064 CHANGELOG.md: add note about script commit fix 2022-10-07 14:56:58 +03:00
80a336f94d 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!
2022-10-07 14:49:58 +03:00
5ebf4930cf src: re-organize switch statements in scripts
It makes more sense to me to start from the top level of the hier-
archy.
2022-10-07 13:11:03 +03:00
8e01595cc1 .github: fix distribution key 2022-10-06 20:47:14 +03:00
8b3aac610d .github: specify Java distribution 2022-10-06 20:39:31 +03:00
c2d7535d01 .github: update maven GitHub actions workflow
- Switch to Ubuntu 22.04 because `ubuntu-latest` is still 20.04
- Update actions to latest versions
- Specify Java 8 instead of 1.8
- Enable Maven caching
2022-10-06 20:36:08 +03:00
8 changed files with 300 additions and 26 deletions

View File

@ -12,13 +12,15 @@ on:
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-22.04
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: Set up JDK 1.8 - name: Set up JDK 8
uses: actions/setup-java@v1 uses: actions/setup-java@v3
with: with:
java-version: 1.8 java-version: 8
distribution: 'temurin'
cache: 'maven'
- name: Build with Maven - name: Build with Maven
run: mvn -B package --file pom.xml run: mvn -B package --file pom.xml

View File

@ -4,12 +4,16 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## Unreleased ## [6.1] - 2022-10-31
### Updated ### Updated
- Update dependencies in `pom.xml` - Update dependencies in `pom.xml`
- `iso_3166-1.json` from iso-codes 4.11.0
### Changed ### Changed
- Java compiler and target from JDK 7 to JDK 8 - Java compiler and target from JDK 7 to JDK 8
### Added ### Added
- New `FixLowQualityThumbnails` script to detect and remove more low-quality thumbnails - New `FixLowQualityThumbnails` script to detect and remove more low-quality thumbnails
### Fixed
- `FixJpgJpgThumbnails` and `FixLowQualityThumbnails` scripts not commiting changes when operating on a site, community, or collection

View File

@ -5,7 +5,7 @@ DSpace curation tasks and other Java-based helpers used on the [CGSpace](https:/
- **FixJpgJpgThumbnails**: fix low-quality ".jpg.jpg" thumbnails by replacing them with their originals - **FixJpgJpgThumbnails**: fix low-quality ".jpg.jpg" thumbnails by replacing them with their originals
- **FixLowQualityThumbnails**: remove low-quality thumbnails when PDF bitstreams are present - **FixLowQualityThumbnails**: remove low-quality thumbnails when PDF bitstreams are present
Tested on DSpace 6.3. Read more about the [DSpace curation system](https://wiki.lyrasis.org/display/DSDOC5x/Curation+System). Tested on DSpace 6.3. Read more about the [DSpace curation system](https://wiki.lyrasis.org/display/DSDOC6x/Curation+System).
## Build and Install ## Build and Install
@ -52,6 +52,14 @@ This project was initially created according to the [Maven Getting Started Guide
$ mvn -B archetype:generate -DgroupId=io.github.ilri.cgspace -DartifactId=cgspace-java-helpers -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.4 $ mvn -B archetype:generate -DgroupId=io.github.ilri.cgspace -DartifactId=cgspace-java-helpers -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.4
``` ```
To deploy a new `-SNAPSHOT` release to Maven Central (make sure OSSHRH credentials are in `~/.m2/settings.xml`):
```console
$ mvn clean deploy
```
See: <a href="https://central.sonatype.org/publish/publish-maven/#performing-a-snapshot-deployment">Performing a Snapshot Deployment</a>
## License ## License
This work is licensed under the [GPLv3](https://www.gnu.org/licenses/gpl-3.0.en.html). This work is licensed under the [GPLv3](https://www.gnu.org/licenses/gpl-3.0.en.html).

View File

@ -6,7 +6,7 @@
<groupId>io.github.ilri.cgspace</groupId> <groupId>io.github.ilri.cgspace</groupId>
<artifactId>cgspace-java-helpers</artifactId> <artifactId>cgspace-java-helpers</artifactId>
<version>6.1-SNAPSHOT</version> <version>6.1</version>
<name>cgspace-java-helpers</name> <name>cgspace-java-helpers</name>
<url>https://github.com/ilri/cgspace-java-helpers</url> <url>https://github.com/ilri/cgspace-java-helpers</url>
@ -94,7 +94,7 @@
</plugin> </plugin>
<plugin> <plugin>
<artifactId>maven-deploy-plugin</artifactId> <artifactId>maven-deploy-plugin</artifactId>
<version>3.3.0</version> <version>3.0.0</version>
</plugin> </plugin>
<!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle --> <!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
<plugin> <plugin>

View File

@ -59,10 +59,9 @@ public class FixJpgJpgThumbnails {
DSpaceObject parent = handleService.resolveToObject(context, parentHandle); DSpaceObject parent = handleService.resolveToObject(context, parentHandle);
if (parent != null) { if (parent != null) {
switch (parent.getType()) { switch (parent.getType()) {
case Constants.COLLECTION: case Constants.SITE:
process( process(context, itemService.findAll(context));
context, context.commit();
itemService.findByCollection(context, (Collection) parent));
break; break;
case Constants.COMMUNITY: case Constants.COMMUNITY:
List<Collection> collections = ((Community) parent).getCollections(); List<Collection> collections = ((Community) parent).getCollections();
@ -71,9 +70,13 @@ public class FixJpgJpgThumbnails {
context, context,
itemService.findAllByCollection(context, collection)); itemService.findAllByCollection(context, collection));
} }
context.commit();
break; break;
case Constants.SITE: case Constants.COLLECTION:
process(context, itemService.findAll(context)); process(
context,
itemService.findByCollection(context, (Collection) parent));
context.commit();
break; break;
case Constants.ITEM: case Constants.ITEM:
processItem(context, (Item) parent); processItem(context, (Item) parent);

View File

@ -76,10 +76,9 @@ public class FixLowQualityThumbnails {
DSpaceObject parent = handleService.resolveToObject(context, parentHandle); DSpaceObject parent = handleService.resolveToObject(context, parentHandle);
if (parent != null) { if (parent != null) {
switch (parent.getType()) { switch (parent.getType()) {
case Constants.COLLECTION: case Constants.SITE:
process( process(context, itemService.findAll(context));
context, context.commit();
itemService.findByCollection(context, (Collection) parent));
break; break;
case Constants.COMMUNITY: case Constants.COMMUNITY:
List<Collection> collections = ((Community) parent).getCollections(); List<Collection> collections = ((Community) parent).getCollections();
@ -88,9 +87,13 @@ public class FixLowQualityThumbnails {
context, context,
itemService.findAllByCollection(context, collection)); itemService.findAllByCollection(context, collection));
} }
context.commit();
break; break;
case Constants.SITE: case Constants.COLLECTION:
process(context, itemService.findAll(context)); process(
context,
itemService.findByCollection(context, (Collection) parent));
context.commit();
break; break;
case Constants.ITEM: case Constants.ITEM:
processItem(context, (Item) parent); processItem(context, (Item) parent);
@ -119,6 +122,8 @@ public class FixLowQualityThumbnails {
private static void processItem(Context context, Item item) private static void processItem(Context context, Item item)
throws SQLException, AuthorizeException, IOException { throws SQLException, AuthorizeException, IOException {
System.out.println("FixLowQualityThumbnails: processing item: " + item.getHandle());
// Set some state for the item before we iterate over the THUMBNAIL bundle // Set some state for the item before we iterate over the THUMBNAIL bundle
boolean itemHasImThumbnail = false; boolean itemHasImThumbnail = false;
@ -159,7 +164,7 @@ public class FixLowQualityThumbnails {
// ption will *always* be "Generated Thumbnail". // ption will *always* be "Generated Thumbnail".
if ("Generated Thumbnail".equals(thumbnailDescription)) { if ("Generated Thumbnail".equals(thumbnailDescription)) {
System.out.print("\u001b[33m"); System.out.print("\u001b[33m");
System.out.println("Deleting (" + item.getHandle() + "):"); System.out.println("> Action: remove old thumbnail from THUMBNAIL bundle");
System.out.println("> Name: »" + thumbnailName + "«"); System.out.println("> Name: »" + thumbnailName + "«");
System.out.println("> Description: »" + thumbnailDescription + "«"); System.out.println("> Description: »" + thumbnailDescription + "«");
System.out.print("\u001b[0m"); System.out.print("\u001b[0m");
@ -173,7 +178,7 @@ public class FixLowQualityThumbnails {
} else if (thumbnailDescription.toLowerCase().contains("thumbnail") } else if (thumbnailDescription.toLowerCase().contains("thumbnail")
&& !"IM Thumbnail".equals(thumbnailDescription)) { && !"IM Thumbnail".equals(thumbnailDescription)) {
System.out.print("\u001b[33m"); System.out.print("\u001b[33m");
System.out.println("Deleting (" + item.getHandle() + "):"); System.out.println("> Action: remove manually uploaded thumbnail from THUMBNAIL bundle");
System.out.println("> Name: »" + thumbnailName + "«"); System.out.println("> Name: »" + thumbnailName + "«");
System.out.println("> Description: »" + thumbnailDescription + "«"); System.out.println("> Description: »" + thumbnailDescription + "«");
System.out.print("\u001b[0m"); System.out.print("\u001b[0m");
@ -185,7 +190,7 @@ public class FixLowQualityThumbnails {
// a thumbnail for a journal or a limited access item. // a thumbnail for a journal or a limited access item.
} else { } else {
System.out.print("\u001b[34m"); System.out.print("\u001b[34m");
System.out.println("Skipping (" + item.getHandle() + "):"); System.out.println("> Action: skip other thumbnail in THUMBNAIL bundle");
System.out.println("> Name: »" + thumbnailName + "«"); System.out.println("> Name: »" + thumbnailName + "«");
System.out.println("> Description: »" + thumbnailDescription + "«"); System.out.println("> Description: »" + thumbnailDescription + "«");
System.out.print("\u001b[0m"); System.out.print("\u001b[0m");
@ -250,7 +255,7 @@ public class FixLowQualityThumbnails {
&& (originalName.toLowerCase().contains("thumbnail") && (originalName.toLowerCase().contains("thumbnail")
|| originalDescription.toLowerCase().contains("thumbnail"))) { || originalDescription.toLowerCase().contains("thumbnail"))) {
System.out.print("\u001b[33m"); System.out.print("\u001b[33m");
System.out.println("Removing (" + item.getHandle() + "):"); System.out.println("> Action: remove thumbnail from ORIGINAL bundle");
System.out.println("> Name: »" + originalName + "«"); System.out.println("> Name: »" + originalName + "«");
System.out.println("> Description: »" + originalDescription + "«"); System.out.println("> Description: »" + originalDescription + "«");
System.out.print("\u001b[0m"); System.out.print("\u001b[0m");
@ -260,7 +265,7 @@ public class FixLowQualityThumbnails {
} else { } else {
System.out.print("\u001b[34m"); System.out.print("\u001b[34m");
System.out.println("Skipping (" + item.getHandle() + "):"); System.out.println("> Action: skip other bitstream in ORIGINAL bundle");
System.out.println("> Name: »" + originalName + "«"); System.out.println("> Name: »" + originalName + "«");
System.out.println("> Description: »" + originalDescription + "«"); System.out.println("> Description: »" + originalDescription + "«");
System.out.print("\u001b[0m"); System.out.print("\u001b[0m");

View File

@ -27,6 +27,7 @@
{ {
"alpha_2": "KP", "alpha_2": "KP",
"alpha_3": "PRK", "alpha_3": "PRK",
"common_name": "North Korea",
"name": "Korea, Democratic People's Republic of", "name": "Korea, Democratic People's Republic of",
"cgspace_name": "Korea, DPR", "cgspace_name": "Korea, DPR",
"numeric": "408", "numeric": "408",