Import shared constants into IIIFUtils.

This commit is contained in:
Michael Spalti
2022-01-14 10:57:29 -08:00
parent 206d98e54d
commit b74dce1170
2 changed files with 13 additions and 5 deletions

View File

@@ -34,6 +34,7 @@ public class IIIFSharedUtils {
protected static final String OTHER_CONTENT_BUNDLE = "OtherContent"; protected static final String OTHER_CONTENT_BUNDLE = "OtherContent";
// The IIIF image server url from configuration // The IIIF image server url from configuration
protected static final String IMAGE_SERVER_PATH = "iiif.image.server"; protected static final String IMAGE_SERVER_PATH = "iiif.image.server";
// IIIF metadata definitions
public static final String METADATA_IIIF_SCHEMA = "iiif"; public static final String METADATA_IIIF_SCHEMA = "iiif";
public static final String METADATA_IIIF_IMAGE = "image"; public static final String METADATA_IIIF_IMAGE = "image";
public static final String METADATA_IIIF_HEIGHT = "height"; public static final String METADATA_IIIF_HEIGHT = "height";

View File

@@ -7,6 +7,11 @@
*/ */
package org.dspace.app.iiif.service.utils; package org.dspace.app.iiif.service.utils;
import static org.dspace.iiif.IIIFSharedUtils.METADATA_IIIF_HEIGHT;
import static org.dspace.iiif.IIIFSharedUtils.METADATA_IIIF_IMAGE;
import static org.dspace.iiif.IIIFSharedUtils.METADATA_IIIF_SCHEMA;
import static org.dspace.iiif.IIIFSharedUtils.METADATA_IIIF_WIDTH;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@@ -58,9 +63,11 @@ public class IIIFUtils {
// metadata used to set the iiif viewing hint // metadata used to set the iiif viewing hint
public static final String METADATA_IIIF_VIEWING_HINT = "iiif.viewing.hint"; public static final String METADATA_IIIF_VIEWING_HINT = "iiif.viewing.hint";
// metadata used to set the width of the canvas that has not an explicit name // metadata used to set the width of the canvas that has not an explicit name
public static final String METADATA_IMAGE_WIDTH = "iiif.image.width"; public static final String METADATA_IMAGE_WIDTH = METADATA_IIIF_SCHEMA + "." + METADATA_IIIF_IMAGE
+ "." + METADATA_IIIF_WIDTH;
// metadata used to set the height of the canvas that has not an explicit name // metadata used to set the height of the canvas that has not an explicit name
public static final String METADATA_IMAGE_HEIGTH = "iiif.image.height"; public static final String METADATA_IMAGE_HEIGHT = METADATA_IIIF_SCHEMA + "." + METADATA_IIIF_IMAGE
+ "." + METADATA_IIIF_HEIGHT;
// string used in the metadata toc as separator among the different levels // string used in the metadata toc as separator among the different levels
public static final String TOC_SEPARATOR = "|||"; public static final String TOC_SEPARATOR = "|||";
@@ -348,9 +355,9 @@ public class IIIFUtils {
* @return the height in pixel for the canvas associated with the bitstream * @return the height in pixel for the canvas associated with the bitstream
*/ */
public int getCanvasHeight(Bitstream bitstream, Bundle bundle, Item item, int defaultHeight) { public int getCanvasHeight(Bitstream bitstream, Bundle bundle, Item item, int defaultHeight) {
return getSizeFromMetadata(bitstream, METADATA_IMAGE_HEIGTH, return getSizeFromMetadata(bitstream, METADATA_IMAGE_HEIGHT,
getSizeFromMetadata(bundle, METADATA_IMAGE_HEIGTH, getSizeFromMetadata(bundle, METADATA_IMAGE_HEIGHT,
getSizeFromMetadata(item, METADATA_IMAGE_HEIGTH, defaultHeight))); getSizeFromMetadata(item, METADATA_IMAGE_HEIGHT, defaultHeight)));
} }
/** /**