Skip to content

Commit

Permalink
V2 update deps (#188)
Browse files Browse the repository at this point in the history
* Update dependencies
* Update jackson dependency
* Reformat to newer parent project's formatting rules
  • Loading branch information
ksclarke authored Sep 13, 2023
1 parent 7bf5bf2 commit ae733d4
Show file tree
Hide file tree
Showing 57 changed files with 365 additions and 153 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
MAVEN_CACHE_KEY: ${{ secrets.MAVEN_CACHE_KEY }}
strategy:
matrix:
java: [ 11, 17 ]
java: [ 17 ]

steps:
- name: Check out code
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
name: Maven Release

# Performs a Maven release using JDK 11 when a new GitHub release has been published
# Performs a Maven release using JDK 17 when a new GitHub release has been published
on:
release:
types: [ published ]

jobs:
publish:
name: Maven Artifact Publisher (JDK 11)
name: Maven Artifact Publisher (JDK 17)
runs-on: ubuntu-latest
env:
AUTORELEASE_ARTIFACT: ${{ secrets.AUTORELEASE_ARTIFACT }}
MAVEN_CACHE_KEY: ${{ secrets.MAVEN_CACHE_KEY }}
steps:
- name: Check out source code
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2
- name: Install JDK 11 and Maven
- name: Install JDK 17 and Maven
uses: actions/setup-java@d202f5dbf7256730fb690ec59f6381650114feb2 # v1
with:
java-version: 11
java-version: 17
# If running locally in act, install Maven
- name: Set up Maven if needed
if: ${{ env.ACT }}
Expand Down
9 changes: 5 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,17 @@
</roles>
<timezone>America/New_York</timezone>
</developer>
<!-- Also https://github.com/ksclarke/jiiify-presentation/graphs/contributors -->
</developers>

<properties>
<revision>0.0.0-SNAPSHOT</revision>

<!-- Project dependencies -->
<jackson.version>2.13.4</jackson.version>
<jackson.databind.version>2.13.4.2</jackson.databind.version>
<jackson.version>2.15.2</jackson.version>
<jackson.databind.version>2.15.2</jackson.databind.version>
<guava.version>32.0.0-jre</guava.version>
<freelib.utils.version>3.2.4</freelib.utils.version>
<freelib.utils.version>4.0.2</freelib.utils.version>
<vertx.version>4.4.5</vertx.version>

<!-- Test related versions -->
Expand Down Expand Up @@ -216,7 +217,7 @@
<parent>
<artifactId>freelib-parent</artifactId>
<groupId>info.freelibrary</groupId>
<version>7.4.2</version>
<version>8.0.3</version>
</parent>

</project>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonSetter;

import info.freelibrary.util.IllegalArgumentI18nException;

import info.freelibrary.iiif.presentation.v2.properties.Attribution;
import info.freelibrary.iiif.presentation.v2.properties.Description;
import info.freelibrary.iiif.presentation.v2.properties.Label;
Expand All @@ -27,7 +29,6 @@
import info.freelibrary.iiif.presentation.v2.services.Service;
import info.freelibrary.iiif.presentation.v2.utils.Constants;
import info.freelibrary.iiif.presentation.v2.utils.MessageCodes;
import info.freelibrary.util.IllegalArgumentI18nException;

/**
* A virtual container that represents a page or view and has content resources associated with it or with parts of it.
Expand Down Expand Up @@ -238,6 +239,7 @@ public Canvas setOtherContent(final OtherContent... aOtherContentArray) {
*
* @param aImageContent Image content to be added to the canvas
* @return The canvas
* @throws UnsupportedOperationException If a supplied {@link ImageContent} could not be added
*/
public Canvas addImageContent(final ImageContent... aImageContent) {
if (!Collections.addAll(getImageContent(), aImageContent)) {
Expand All @@ -252,6 +254,7 @@ public Canvas addImageContent(final ImageContent... aImageContent) {
*
* @param aOtherContent Other content to be added to the canvas
* @return The canvas
* @throws UnsupportedOperationException If a supplied {@link OtherContent} could not be added
*/
public Canvas addOtherContent(final OtherContent... aOtherContent) {
if (Collections.addAll(getOtherContent(), aOtherContent)) {
Expand Down Expand Up @@ -419,6 +422,7 @@ public Canvas setSeeAlso(final String aSeeAlso) {
*
* @param aWidth A canvas width
* @param aHeight A canvas height
* @throws IllegalArgumentI18nException If the height or width is less than zero
*/
@JsonIgnore
private void setWidthHeight(final int aWidth, final int aHeight) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonSetter;

import info.freelibrary.util.I18nRuntimeException;
import info.freelibrary.util.Logger;
import info.freelibrary.util.LoggerFactory;
import info.freelibrary.util.StringUtils;
Expand Down Expand Up @@ -112,10 +111,16 @@ public String getMotivation() {
return MOTIVATION;
}

/**
* Sets the image content's motivation.
*
* @param aMotivation A motivation value
* @throws IllegalArgumentException If the wrong motivation is supplied
*/
@JsonSetter(Constants.MOTIVATION)
private void setMotivation(final String aMotivation) {
if (!MOTIVATION.equals(aMotivation)) {
throw new I18nRuntimeException();
throw new IllegalArgumentException();
}
}

Expand Down Expand Up @@ -416,44 +421,13 @@ private ImageResource buildImageResource(final Object aImageResourceMap) {
return null;
}

/**
* A image resource map.
*/
final Map<?, ?> map = (Map<?, ?>) aImageResourceMap;

/**
* A new image resource.
*/
final ImageResource resource = new ImageResource(URI.create((String) map.get(Constants.ID)));

/**
* The image resource label.
*/
final String label = (String) map.get(Constants.LABEL);

/**
* The image resource service map.
*/
final Map<?, ?> service = (Map<?, ?>) map.get(Constants.SERVICE);

/**
* The image resource map's width object.
*/
final Object widthObj = map.get(Constants.WIDTH);

/**
* The image resource map's height object.
*/
final Object heightObj = map.get(Constants.HEIGHT);

/**
* The image resource's width.
*/
final int width;

/**
* The image resource's height.
*/
final int height;

if (widthObj == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public class Manifest extends Resource<Manifest> {
private static final String TYPE = "sc:Manifest";

/**
* The manifest's context
* The manifest's context.
*/
private static final URI CONTEXT = URI.create("http://iiif.io/api/presentation/2/context.json");

Expand Down Expand Up @@ -181,7 +181,7 @@ public URI getContext() {
}

/**
* Adds a new context URI to the manifest
* Adds a new context URI to the manifest.
*
* @param aContext Manifest context URIs(s)
* @return The manifest
Expand All @@ -192,7 +192,7 @@ public Manifest addContext(final URI... aContext) {
}

/**
* Adds a new context URI to the manifest
* Adds a new context URI to the manifest.
*
* @param aContext Manifest context URI(s)
* @return The manifest
Expand Down Expand Up @@ -268,6 +268,7 @@ public ViewingDirection getViewingDirection() {
*
* @param aSequence Sequence(s) to add to the manifest
* @return The manifest
* @throws UnsupportedOperationException If a supplied sequence couldn't be added to the manifest
*/
public Manifest addSequence(final Sequence... aSequence) {
Objects.requireNonNull(aSequence, LOGGER.getMessage(MessageCodes.JPA_008));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.annotation.JsonUnwrapped;

import info.freelibrary.util.Logger;
import info.freelibrary.util.LoggerFactory;

import info.freelibrary.iiif.presentation.v2.properties.Attribution;
import info.freelibrary.iiif.presentation.v2.properties.Description;
import info.freelibrary.iiif.presentation.v2.properties.Label;
Expand All @@ -27,8 +30,6 @@
import info.freelibrary.iiif.presentation.v2.services.Service;
import info.freelibrary.iiif.presentation.v2.utils.Constants;
import info.freelibrary.iiif.presentation.v2.utils.MessageCodes;
import info.freelibrary.util.Logger;
import info.freelibrary.util.LoggerFactory;

/**
* A resource that can be used as a base for more specific IIIF presentation resources.
Expand Down Expand Up @@ -709,11 +710,14 @@ protected Resource<T> setSeeAlso(final String aSeeAlso) {
* @param aArgs An array of arguments passed to the constructor
* @param aNames An array of names corresponding to the arguments passed to the constructor
* @param aNumber The number of required arguments
* @throws IndexOutOfBoundsException If the supplied number is out of bounds
* @throws IllegalArgumentException If the supplied object and string arrays aren't the same length
*/
private void checkArgs(final Object[] aArgs, final String[] aNames, final int aNumber) {
if (aArgs.length < aNumber) {
throw new IndexOutOfBoundsException(String.valueOf(aNumber));
}

if (aArgs.length != aNames.length) {
throw new IllegalArgumentException("Number of arguments is not equal to the number of names");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ public Sequence setCanvases(final Canvas... aCanvas) {
*
* @param aCanvas A canvas to add to this sequence
* @return The sequence
* @throws UnsupportedOperationException If a supplied canvas could not be added
*/
public Sequence addCanvas(final Canvas... aCanvas) {
if (!Collections.addAll(myCanvases, aCanvas)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,16 @@
import com.fasterxml.jackson.annotation.JsonSetter;
import com.google.common.net.MediaType;

import info.freelibrary.util.FileUtils;
import info.freelibrary.util.Logger;
import info.freelibrary.util.LoggerFactory;

import info.freelibrary.iiif.presentation.v2.properties.Logo;
import info.freelibrary.iiif.presentation.v2.properties.Thumbnail;
import info.freelibrary.iiif.presentation.v2.services.ImageInfoService;
import info.freelibrary.iiif.presentation.v2.services.Service;
import info.freelibrary.iiif.presentation.v2.utils.Constants;
import info.freelibrary.iiif.presentation.v2.utils.MessageCodes;
import info.freelibrary.util.FileUtils;
import info.freelibrary.util.Logger;
import info.freelibrary.util.LoggerFactory;

/**
* An image resource from a {@link Service} that is used as an {@link ImageResource}, and in {@link Logo}s and
Expand Down Expand Up @@ -68,7 +69,7 @@ public class ServiceImage {
private Optional<ImageInfoService> myService;

/**
* Creates an image
* Creates an image.
*
* @param aURI An image ID
*/
Expand All @@ -82,7 +83,7 @@ public ServiceImage(final String aURI) {
}

/**
* Creates an image
* Creates an image.
*
* @param aID An image ID
*/
Expand Down Expand Up @@ -260,7 +261,7 @@ public int getHeight() {
}

/**
* Gets the image ID
* Gets the image ID.
*
* @return The image ID
*/
Expand Down Expand Up @@ -306,7 +307,7 @@ public Optional<ImageInfoService> getService() {
}

/**
* Sets the image's service
* Sets the image's service.
*
* @param aService The image's service
* @return The image
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@

import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Objects;

import com.fasterxml.jackson.annotation.JsonValue;

import info.freelibrary.iiif.presentation.v2.utils.Constants;
import info.freelibrary.iiif.presentation.v2.utils.MessageCodes;
import info.freelibrary.util.Logger;
import info.freelibrary.util.LoggerFactory;

import info.freelibrary.iiif.presentation.v2.utils.Constants;
import info.freelibrary.iiif.presentation.v2.utils.MessageCodes;

/**
* A property value that can be used in the label, description, attribution and the label and value fields.
*/
Expand Down Expand Up @@ -92,6 +92,7 @@ public String getString() {
*
* @param aValue A String property value
* @return A String value to the property
* @throws UnsupportedOperationException If a supplied value could not be added
*/
protected I18nProperty<T> addValue(final String... aValue) {
Objects.requireNonNull(aValue, LOGGER.getMessage(MessageCodes.JPA_001));
Expand All @@ -112,6 +113,7 @@ protected I18nProperty<T> addValue(final String... aValue) {
*
* @param aValue A I18N property value
* @return A String value to the property
* @throws UnsupportedOperationException If a supplied value could not be added
*/
protected I18nProperty<T> addValue(final Value... aValue) {
Objects.requireNonNull(aValue, LOGGER.getMessage(MessageCodes.JPA_001));
Expand Down Expand Up @@ -158,21 +160,20 @@ public int hashCode() {
*/
@JsonValue
protected Object getJsonValue() {
final List<Object> list = new ArrayList<>();

if (!hasValues()) {
return null;
}

if (myValues.size() == Constants.SINGLE_INSTANCE) {
if (myValues.get(0).getLang().isPresent()) {
return myValues.get(0);
}
return myValues.get(0).getValue();
}
final List<Object> list = new ArrayList<>();
final Iterator<Value> iterator = myValues.iterator();

while (iterator.hasNext()) {
final Value entry = iterator.next();

for (final Value entry : myValues) {
if (entry.getLang().isPresent()) {
list.add(entry);
} else {
Expand Down
Loading

0 comments on commit ae733d4

Please sign in to comment.