From 1a353d4bd5b2dad6a89cefcffe515f9bec1d00b0 Mon Sep 17 00:00:00 2001 From: Michael Spalti Date: Thu, 25 Mar 2021 15:48:31 -0700 Subject: [PATCH] Added classes for parsing the info.json object. --- .../rest/iiif/model/info/AnnotationModel.java | 30 +++++++++++ .../app/rest/iiif/model/info/CanvasModel.java | 50 ++++++++++++++++++ .../rest/iiif/model/info/GlobalDefaults.java | 51 +++++++++++++++++++ .../dspace/app/rest/iiif/model/info/Info.java | 42 +++++++++++++++ .../app/rest/iiif/model/info/RangeModel.java | 31 +++++++++++ 5 files changed, 204 insertions(+) create mode 100644 dspace-server-webapp/src/main/java/org/dspace/app/rest/iiif/model/info/AnnotationModel.java create mode 100644 dspace-server-webapp/src/main/java/org/dspace/app/rest/iiif/model/info/CanvasModel.java create mode 100644 dspace-server-webapp/src/main/java/org/dspace/app/rest/iiif/model/info/GlobalDefaults.java create mode 100644 dspace-server-webapp/src/main/java/org/dspace/app/rest/iiif/model/info/Info.java create mode 100644 dspace-server-webapp/src/main/java/org/dspace/app/rest/iiif/model/info/RangeModel.java diff --git a/dspace-server-webapp/src/main/java/org/dspace/app/rest/iiif/model/info/AnnotationModel.java b/dspace-server-webapp/src/main/java/org/dspace/app/rest/iiif/model/info/AnnotationModel.java new file mode 100644 index 0000000000..3bfcf5efca --- /dev/null +++ b/dspace-server-webapp/src/main/java/org/dspace/app/rest/iiif/model/info/AnnotationModel.java @@ -0,0 +1,30 @@ +/** + * The contents of this file are subject to the license and copyright + * detailed in the LICENSE and NOTICE files at the root of the source + * tree and available online at + * + * http://www.dspace.org/license/ + */ +package org.dspace.app.rest.iiif.model.info; + +public class AnnotationModel { + + private String motivation; + private String id; + + public void setMotivation(String motivation) { + this.motivation = motivation; + } + + public String getMotivation() { + return motivation; + } + + public void setID(String id) { + this.id = id; + } + + public String getId() { + return id; + } +} diff --git a/dspace-server-webapp/src/main/java/org/dspace/app/rest/iiif/model/info/CanvasModel.java b/dspace-server-webapp/src/main/java/org/dspace/app/rest/iiif/model/info/CanvasModel.java new file mode 100644 index 0000000000..8dc6cac0ca --- /dev/null +++ b/dspace-server-webapp/src/main/java/org/dspace/app/rest/iiif/model/info/CanvasModel.java @@ -0,0 +1,50 @@ +/** + * The contents of this file are subject to the license and copyright + * detailed in the LICENSE and NOTICE files at the root of the source + * tree and available online at + * + * http://www.dspace.org/license/ + */ +package org.dspace.app.rest.iiif.model.info; + +public class CanvasModel { + + private String label; + private int width; + private int height; + private int pos; + + public void setLabel(String label) { + this.label = label; + } + + public String getLabel() { + return label; + } + + public void setWidth(int width) { + this.width = width; + } + + public int getWidth() { + return width; + } + + public void setHeight(int height) { + this.height = height; + } + + public int getHeight() { + return height; + } + + // TODO: These can be removed. + public void setPos(int pos) { + this.pos = pos; + } + + public int getPos() { + return pos; + } + +} diff --git a/dspace-server-webapp/src/main/java/org/dspace/app/rest/iiif/model/info/GlobalDefaults.java b/dspace-server-webapp/src/main/java/org/dspace/app/rest/iiif/model/info/GlobalDefaults.java new file mode 100644 index 0000000000..b8455e6332 --- /dev/null +++ b/dspace-server-webapp/src/main/java/org/dspace/app/rest/iiif/model/info/GlobalDefaults.java @@ -0,0 +1,51 @@ +/** + * The contents of this file are subject to the license and copyright + * detailed in the LICENSE and NOTICE files at the root of the source + * tree and available online at + * + * http://www.dspace.org/license/ + */ +package org.dspace.app.rest.iiif.model.info; + +public class GlobalDefaults { + + private boolean activated; + private String label; + private int width; + private int height; + + public boolean isActivated() { + return activated; + } + + public void setActivated(boolean activated) { + this.activated = activated; + } + + + public String getLabel() { + return label; + } + + public void setLabel(String label) { + this.label = label; + } + + public int getWidth() { + return width; + } + + public void setWidth(int width) { + this.width = width; + } + + public int getHeight() { + return height; + } + + public void setHeight(int height) { + this.height = height; + } + + +} diff --git a/dspace-server-webapp/src/main/java/org/dspace/app/rest/iiif/model/info/Info.java b/dspace-server-webapp/src/main/java/org/dspace/app/rest/iiif/model/info/Info.java new file mode 100644 index 0000000000..898576639f --- /dev/null +++ b/dspace-server-webapp/src/main/java/org/dspace/app/rest/iiif/model/info/Info.java @@ -0,0 +1,42 @@ +/** + * The contents of this file are subject to the license and copyright + * detailed in the LICENSE and NOTICE files at the root of the source + * tree and available online at + * + * http://www.dspace.org/license/ + */ +package org.dspace.app.rest.iiif.model.info; + +import java.util.List; + +public class Info { + + private List canvases; + private List structures; + private GlobalDefaults globalDefaults; + + public GlobalDefaults getGlobalDefaults() { + return globalDefaults; + } + + public void setGlobalDefaults(GlobalDefaults globalDefaults) { + this.globalDefaults = globalDefaults; + } + + public void setCanvases(List canvases) { + this.canvases = canvases; + } + + public List getCanvases() { + return this.canvases; + } + + public void setStructures(List structures) { + this.structures = structures; + } + + public List getStructures() { + return structures; + } + +} diff --git a/dspace-server-webapp/src/main/java/org/dspace/app/rest/iiif/model/info/RangeModel.java b/dspace-server-webapp/src/main/java/org/dspace/app/rest/iiif/model/info/RangeModel.java new file mode 100644 index 0000000000..b1ef0503bf --- /dev/null +++ b/dspace-server-webapp/src/main/java/org/dspace/app/rest/iiif/model/info/RangeModel.java @@ -0,0 +1,31 @@ +/** + * The contents of this file are subject to the license and copyright + * detailed in the LICENSE and NOTICE files at the root of the source + * tree and available online at + * + * http://www.dspace.org/license/ + */ +package org.dspace.app.rest.iiif.model.info; + +public class RangeModel { + + private String label; + private int start; + + public void setLabel(String label) { + this.label = label; + } + + public String getLabel() { + return label; + } + + public void setStart(int start) { + this.start = start; + } + + public int getStart() { + return start; + } + +}