mirror of
https://github.com/ilri/cgspace-java-helpers.git
synced 2025-07-06 06:21:39 +02:00
Compare commits
22 Commits
b396fba043
...
dspace6
Author | SHA1 | Date | |
---|---|---|---|
546101bc92
|
|||
0a7cf7bf59
|
|||
8c0a8fbcd1
|
|||
c05a2e4f96
|
|||
cf2af393c0
|
|||
1f6ba4af67
|
|||
5ceaebaeae
|
|||
f3dcc6e261
|
|||
3eddbc3e22
|
|||
dbf59f784c
|
|||
0ffa4c8d37
|
|||
970d0c074e
|
|||
6b2b899957
|
|||
dfaa234a90
|
|||
f46e81b8cd
|
|||
dbd8721579
|
|||
a234b39064
|
|||
80a336f94d
|
|||
5ebf4930cf
|
|||
8e01595cc1
|
|||
8b3aac610d
|
|||
c2d7535d01
|
12
.github/workflows/maven.yml
vendored
12
.github/workflows/maven.yml
vendored
@ -12,13 +12,15 @@ on:
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up JDK 1.8
|
||||
uses: actions/setup-java@v1
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set up JDK 8
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: 1.8
|
||||
java-version: 8
|
||||
distribution: 'temurin'
|
||||
cache: 'maven'
|
||||
- name: Build with Maven
|
||||
run: mvn -B package --file pom.xml
|
||||
|
12
CHANGELOG.md
12
CHANGELOG.md
@ -6,10 +6,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
## Unreleased
|
||||
### Updated
|
||||
- `iso_3166-1.json` from iso-codes 4.13.0-SNAPSHOT, which [adds common names for Iran, Laos, and Syria](https://salsa.debian.org/iso-codes-team/iso-codes/-/merge_requests/32)
|
||||
|
||||
## [6.2] - 2023-02-20
|
||||
### Updated
|
||||
- `iso_3166-1.json` from iso-codes 4.12.0, which updates the name for TR to "Türkiye"
|
||||
|
||||
## [6.1] - 2022-10-31
|
||||
### Updated
|
||||
- Update dependencies in `pom.xml`
|
||||
- `iso_3166-1.json` from iso-codes 4.11.0
|
||||
|
||||
### Changed
|
||||
- Java compiler and target from JDK 7 to JDK 8
|
||||
|
||||
### Added
|
||||
- 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
|
||||
|
16
README.md
16
README.md
@ -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
|
||||
- **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
|
||||
|
||||
@ -16,7 +16,7 @@ To use these curation tasks in a DSpace project add the following dependency to
|
||||
<dependency>
|
||||
<groupId>io.github.ilri.cgspace</groupId>
|
||||
<artifactId>cgspace-java-helpers</artifactId>
|
||||
<version>6.1-SNAPSHOT</version>
|
||||
<version>6.2-SNAPSHOT</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
@ -32,7 +32,7 @@ $ mvn package
|
||||
Copy the resulting jar to the DSpace `lib` directory:
|
||||
|
||||
```console
|
||||
$ cp target/cgspace-java-helpers-6.1-SNAPSHOT.jar ~/dspace/lib/
|
||||
$ cp target/cgspace-java-helpers-6.2-SNAPSHOT.jar ~/dspace/lib/
|
||||
```
|
||||
|
||||
## Configuration
|
||||
@ -44,6 +44,8 @@ Please refer to the appropriate README.md file:
|
||||
## TODO
|
||||
|
||||
- Add a curation task to normalize DOIs to "https://doi.org" format
|
||||
- Migrate from maven-deploy-plugin to nexus-staging-maven-plugin, see: https://central.sonatype.org/publish/publish-maven/#nexus-staging-maven-plugin-for-deployment-and-release
|
||||
- Stop using oss-parent, see: https://central.sonatype.org/publish/publish-maven/#create-a-ticket-with-sonatype
|
||||
|
||||
## Notes
|
||||
This project was initially created according to the [Maven Getting Started Guide](https://maven.apache.org/guides/getting-started/):
|
||||
@ -52,6 +54,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
|
||||
```
|
||||
|
||||
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
|
||||
This work is licensed under the [GPLv3](https://www.gnu.org/licenses/gpl-3.0.en.html).
|
||||
|
||||
|
4
pom.xml
4
pom.xml
@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>io.github.ilri.cgspace</groupId>
|
||||
<artifactId>cgspace-java-helpers</artifactId>
|
||||
<version>6.1-SNAPSHOT</version>
|
||||
<version>6.2-SNAPSHOT</version>
|
||||
|
||||
<name>cgspace-java-helpers</name>
|
||||
<url>https://github.com/ilri/cgspace-java-helpers</url>
|
||||
@ -94,7 +94,7 @@
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<version>3.3.0</version>
|
||||
<version>3.0.0</version>
|
||||
</plugin>
|
||||
<!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
|
||||
<plugin>
|
||||
|
@ -14,7 +14,7 @@ To use these curation tasks in a DSpace project add the following dependency to
|
||||
<dependency>
|
||||
<groupId>io.github.ilri.cgspace</groupId>
|
||||
<artifactId>cgspace-java-helpers</artifactId>
|
||||
<version>6.1-SNAPSHOT</version>
|
||||
<version>6.2-SNAPSHOT</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
@ -30,7 +30,7 @@ $ mvn package
|
||||
Copy the resulting jar to the DSpace `lib` directory:
|
||||
|
||||
```
|
||||
$ cp target/cgspace-java-helpers-6.1-SNAPSHOT.jar ~/dspace/lib/
|
||||
$ cp target/cgspace-java-helpers-6.2-SNAPSHOT.jar ~/dspace/lib/
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
@ -59,10 +59,9 @@ public class FixJpgJpgThumbnails {
|
||||
DSpaceObject parent = handleService.resolveToObject(context, parentHandle);
|
||||
if (parent != null) {
|
||||
switch (parent.getType()) {
|
||||
case Constants.COLLECTION:
|
||||
process(
|
||||
context,
|
||||
itemService.findByCollection(context, (Collection) parent));
|
||||
case Constants.SITE:
|
||||
process(context, itemService.findAll(context));
|
||||
context.commit();
|
||||
break;
|
||||
case Constants.COMMUNITY:
|
||||
List<Collection> collections = ((Community) parent).getCollections();
|
||||
@ -71,9 +70,13 @@ public class FixJpgJpgThumbnails {
|
||||
context,
|
||||
itemService.findAllByCollection(context, collection));
|
||||
}
|
||||
context.commit();
|
||||
break;
|
||||
case Constants.SITE:
|
||||
process(context, itemService.findAll(context));
|
||||
case Constants.COLLECTION:
|
||||
process(
|
||||
context,
|
||||
itemService.findByCollection(context, (Collection) parent));
|
||||
context.commit();
|
||||
break;
|
||||
case Constants.ITEM:
|
||||
processItem(context, (Item) parent);
|
||||
|
@ -76,10 +76,9 @@ public class FixLowQualityThumbnails {
|
||||
DSpaceObject parent = handleService.resolveToObject(context, parentHandle);
|
||||
if (parent != null) {
|
||||
switch (parent.getType()) {
|
||||
case Constants.COLLECTION:
|
||||
process(
|
||||
context,
|
||||
itemService.findByCollection(context, (Collection) parent));
|
||||
case Constants.SITE:
|
||||
process(context, itemService.findAll(context));
|
||||
context.commit();
|
||||
break;
|
||||
case Constants.COMMUNITY:
|
||||
List<Collection> collections = ((Community) parent).getCollections();
|
||||
@ -88,9 +87,13 @@ public class FixLowQualityThumbnails {
|
||||
context,
|
||||
itemService.findAllByCollection(context, collection));
|
||||
}
|
||||
context.commit();
|
||||
break;
|
||||
case Constants.SITE:
|
||||
process(context, itemService.findAll(context));
|
||||
case Constants.COLLECTION:
|
||||
process(
|
||||
context,
|
||||
itemService.findByCollection(context, (Collection) parent));
|
||||
context.commit();
|
||||
break;
|
||||
case Constants.ITEM:
|
||||
processItem(context, (Item) parent);
|
||||
@ -119,6 +122,8 @@ public class FixLowQualityThumbnails {
|
||||
|
||||
private static void processItem(Context context, Item item)
|
||||
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
|
||||
boolean itemHasImThumbnail = false;
|
||||
|
||||
@ -159,7 +164,7 @@ public class FixLowQualityThumbnails {
|
||||
// ption will *always* be "Generated Thumbnail".
|
||||
if ("Generated Thumbnail".equals(thumbnailDescription)) {
|
||||
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("> Description: »" + thumbnailDescription + "«");
|
||||
System.out.print("\u001b[0m");
|
||||
@ -173,7 +178,7 @@ public class FixLowQualityThumbnails {
|
||||
} else if (thumbnailDescription.toLowerCase().contains("thumbnail")
|
||||
&& !"IM Thumbnail".equals(thumbnailDescription)) {
|
||||
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("> Description: »" + thumbnailDescription + "«");
|
||||
System.out.print("\u001b[0m");
|
||||
@ -185,7 +190,7 @@ public class FixLowQualityThumbnails {
|
||||
// a thumbnail for a journal or a limited access item.
|
||||
} else {
|
||||
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("> Description: »" + thumbnailDescription + "«");
|
||||
System.out.print("\u001b[0m");
|
||||
@ -250,7 +255,7 @@ public class FixLowQualityThumbnails {
|
||||
&& (originalName.toLowerCase().contains("thumbnail")
|
||||
|| originalDescription.toLowerCase().contains("thumbnail"))) {
|
||||
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("> Description: »" + originalDescription + "«");
|
||||
System.out.print("\u001b[0m");
|
||||
@ -260,7 +265,7 @@ public class FixLowQualityThumbnails {
|
||||
|
||||
} else {
|
||||
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("> Description: »" + originalDescription + "«");
|
||||
System.out.print("\u001b[0m");
|
||||
|
@ -15,7 +15,7 @@ To use these curation tasks in a DSpace project add the following dependency to
|
||||
<dependency>
|
||||
<groupId>io.github.ilri.cgspace</groupId>
|
||||
<artifactId>cgspace-java-helpers</artifactId>
|
||||
<version>6.1-SNAPSHOT</version>
|
||||
<version>6.2-SNAPSHOT</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
@ -31,7 +31,7 @@ $ mvn package
|
||||
Copy the resulting jar to the DSpace `lib` directory:
|
||||
|
||||
```console
|
||||
$ cp target/cgspace-java-helpers-6.1-SNAPSHOT.jar ~/dspace/lib/
|
||||
$ cp target/cgspace-java-helpers-6.2-SNAPSHOT.jar ~/dspace/lib/
|
||||
```
|
||||
|
||||
## Invocation
|
||||
|
@ -16,29 +16,15 @@
|
||||
"name": "Congo, The Democratic Republic of the",
|
||||
"numeric": "180"
|
||||
},
|
||||
{
|
||||
"alpha_2": "IR",
|
||||
"alpha_3": "IRN",
|
||||
"name": "Iran, Islamic Republic of",
|
||||
"cgspace_name": "Iran",
|
||||
"numeric": "364",
|
||||
"official_name": "Islamic Republic of Iran"
|
||||
},
|
||||
{
|
||||
"alpha_2": "KP",
|
||||
"alpha_3": "PRK",
|
||||
"common_name": "North Korea",
|
||||
"name": "Korea, Democratic People's Republic of",
|
||||
"cgspace_name": "Korea, DPR",
|
||||
"numeric": "408",
|
||||
"official_name": "Democratic People's Republic of Korea"
|
||||
},
|
||||
{
|
||||
"alpha_2": "LA",
|
||||
"alpha_3": "LAO",
|
||||
"name": "Lao People's Democratic Republic",
|
||||
"cgspace_name": "Laos",
|
||||
"numeric": "418"
|
||||
},
|
||||
{
|
||||
"alpha_2": "FM",
|
||||
"alpha_3": "FSM",
|
||||
@ -54,12 +40,5 @@
|
||||
"cgspace_name": "Russia",
|
||||
"numeric": "643"
|
||||
},
|
||||
{
|
||||
"alpha_2": "SY",
|
||||
"alpha_3": "SYR",
|
||||
"name": "Syrian Arab Republic",
|
||||
"cgspace_name": "Syria",
|
||||
"numeric": "760"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user