diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index a2a0d6294f65..7d63f45982c1 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -24,7 +24,7 @@ jobs:
# NOTE: Unit Tests include a retry for occasionally failing tests
# - surefire.rerunFailingTestsCount => try again for flakey tests, and keep track of/report on number of retries
- type: "Unit Tests"
- java: 11
+ java: 17
mvnflags: "-DskipUnitTests=false -Dsurefire.rerunFailingTestsCount=2"
resultsdir: "**/target/surefire-reports/**"
# NOTE: ITs skip all code validation checks, as they are already done by Unit Test job.
@@ -34,7 +34,7 @@ jobs:
# - xml.skip => Skip all XML/XSLT validation by xml-maven-plugin
# - failsafe.rerunFailingTestsCount => try again for flakey tests, and keep track of/report on number of retries
- type: "Integration Tests"
- java: 11
+ java: 17
mvnflags: "-DskipIntegrationTests=false -Denforcer.skip=true -Dcheckstyle.skip=true -Dlicense.skip=true -Dxml.skip=true -Dfailsafe.rerunFailingTestsCount=2"
resultsdir: "**/target/failsafe-reports/**"
# Do NOT exit immediately if one matrix job fails
diff --git a/.github/workflows/codescan.yml b/.github/workflows/codescan.yml
index 13bb0d2278ad..2a5abfceb1d8 100644
--- a/.github/workflows/codescan.yml
+++ b/.github/workflows/codescan.yml
@@ -41,7 +41,7 @@ jobs:
- name: Install JDK
uses: actions/setup-java@v3
with:
- java-version: 11
+ java-version: 17
distribution: 'temurin'
# Initializes the CodeQL tools for scanning.
diff --git a/.lgtm.yml b/.lgtm.yml
deleted file mode 100644
index 132de8a6de5a..000000000000
--- a/.lgtm.yml
+++ /dev/null
@@ -1,9 +0,0 @@
-# LGTM Settings (https://lgtm.com/)
-# For reference, see https://lgtm.com/help/lgtm/lgtm.yml-configuration-file
-# or template at https://lgtm.com/static/downloads/lgtm.template.yml
-
-extraction:
- java:
- index:
- # Specify the Java version required to build the project
- java_version: 11
diff --git a/Dockerfile b/Dockerfile
index 5bcd68376887..73697483aef8 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -3,9 +3,9 @@
#
# - note: default tag for branch: dspace/dspace: dspace/dspace:latest
-# This Dockerfile uses JDK11 by default, but has also been tested with JDK17.
-# To build with JDK17, use "--build-arg JDK_VERSION=17"
-ARG JDK_VERSION=11
+# This Dockerfile uses JDK17 by default.
+# To build with other versions, use "--build-arg JDK_VERSION=[value]"
+ARG JDK_VERSION=17
ARG DSPACE_VERSION=latest
# Step 1 - Run Maven Build
@@ -51,7 +51,7 @@ RUN ant init_installation update_configs update_code update_webapps
# Step 3 - Run tomcat
# Create a new tomcat image that does not retain the the build directory contents
-FROM tomcat:9-jdk${JDK_VERSION}
+FROM tomcat:10-jdk${JDK_VERSION}
# NOTE: DSPACE_INSTALL must align with the "dspace.dir" default configuration.
ENV DSPACE_INSTALL=/dspace
# Copy the /dspace directory from 'ant_build' container to /dspace in this container
diff --git a/Dockerfile.cli b/Dockerfile.cli
index d54978375e54..19049735de32 100644
--- a/Dockerfile.cli
+++ b/Dockerfile.cli
@@ -3,9 +3,9 @@
#
# - note: default tag for branch: dspace/dspace-cli: dspace/dspace-cli:latest
-# This Dockerfile uses JDK11 by default, but has also been tested with JDK17.
-# To build with JDK17, use "--build-arg JDK_VERSION=17"
-ARG JDK_VERSION=11
+# This Dockerfile uses JDK17 by default.
+# To build with other versions, use "--build-arg JDK_VERSION=[value]"
+ARG JDK_VERSION=17
ARG DSPACE_VERSION=latest
# Step 1 - Run Maven Build
diff --git a/Dockerfile.dependencies b/Dockerfile.dependencies
index 6f72ab058536..c5b8cbdfb287 100644
--- a/Dockerfile.dependencies
+++ b/Dockerfile.dependencies
@@ -2,9 +2,9 @@
# The purpose of this image is to make the build for dspace/dspace run faster
#
-# This Dockerfile uses JDK11 by default, but has also been tested with JDK17.
-# To build with JDK17, use "--build-arg JDK_VERSION=17"
-ARG JDK_VERSION=11
+# This Dockerfile uses JDK17 by default.
+# To build with other versions, use "--build-arg JDK_VERSION=[value]"
+ARG JDK_VERSION=17
# Step 1 - Run Maven Build
FROM maven:3-openjdk-${JDK_VERSION}-slim as build
diff --git a/Dockerfile.test b/Dockerfile.test
index 6fcc4eda6be1..09d22432dcf5 100644
--- a/Dockerfile.test
+++ b/Dockerfile.test
@@ -5,9 +5,9 @@
#
# This image is meant for TESTING/DEVELOPMENT ONLY as it deploys the old v6 REST API under HTTP (not HTTPS)
-# This Dockerfile uses JDK11 by default, but has also been tested with JDK17.
-# To build with JDK17, use "--build-arg JDK_VERSION=17"
-ARG JDK_VERSION=11
+# This Dockerfile uses JDK17 by default.
+# To build with other versions, use "--build-arg JDK_VERSION=[value]"
+ARG JDK_VERSION=17
ARG DSPACE_VERSION=latest
# Step 1 - Run Maven Build
@@ -50,7 +50,7 @@ RUN ant init_installation update_configs update_code update_webapps
# Step 3 - Run tomcat
# Create a new tomcat image that does not retain the the build directory contents
-FROM tomcat:9-jdk${JDK_VERSION}
+FROM tomcat:10-jdk${JDK_VERSION}
ENV DSPACE_INSTALL=/dspace
ENV TOMCAT_INSTALL=/usr/local/tomcat
# Copy the /dspace directory from 'ant_build' containger to /dspace in this container
diff --git a/dspace-api/pom.xml b/dspace-api/pom.xml
index 0aafa5df73fb..e9544d3274fa 100644
--- a/dspace-api/pom.xml
+++ b/dspace-api/pom.xml
@@ -54,21 +54,21 @@
- org.hibernate
+ org.hibernate.orm
hibernate-jpamodelgen
${hibernate.version}
- javax.xml.bind
- jaxb-api
+ jakarta.xml.bind
+ jakarta.xml.bind-api
${jaxb-api.version}
- javax.annotation
- javax.annotation-api
- ${javax-annotation.version}
+ jakarta.annotation
+ jakarta.annotation-api
+ ${jakarta-annotation.version}
@@ -177,7 +177,7 @@
org.codehaus.mojo
jaxb2-maven-plugin
- 2.5.0
+ 3.1.0
workflow-curation
@@ -265,7 +265,7 @@
- ${agnostic.build.dir}/testing/dspace/
+ ${agnostic.build.dir}/testing/dspace
true
${agnostic.build.dir}/testing/dspace/solr/
@@ -324,7 +324,7 @@
- ${agnostic.build.dir}/testing/dspace/
+ ${agnostic.build.dir}/testing/dspace
true
${agnostic.build.dir}/testing/dspace/solr/
@@ -342,18 +342,15 @@
log4j-api
- org.hibernate
+ org.hibernate.orm
hibernate-core
-
-
-
- org.javassist
- javassist
-
-
- org.hibernate
+ org.hibernate.orm
+ hibernate-jpamodelgen
+
+
+ org.hibernate.orm
hibernate-jcache
@@ -377,26 +374,16 @@
com.fasterxml.jackson.datatype
jackson-datatype-jsr310
- 2.13.5
javax.cache
cache-api
-
- org.hibernate
- hibernate-jpamodelgen
-
org.hibernate.validator
hibernate-validator-cdi
${hibernate-validator.version}
-
- org.hibernate.javax.persistence
- hibernate-jpa-2.1-api
- 1.0.2.Final
-
org.springframework
@@ -407,30 +394,26 @@
net.handle
handle
+
net.cnri
cnri-servlet-container
+ runtime
-
+
- org.ow2.asm
- asm-commons
-
-
-
- org.bouncycastle
- bcpkix-jdk15on
-
-
- org.bouncycastle
- bcprov-jdk15on
+ org.mortbay.jasper
+ apache-jsp
-
+
+
org.eclipse.jetty
jetty-server
+ runtime
org.dspace
@@ -440,12 +423,6 @@
org.apache.jena
apache-jena-libs
pom
-
-
- log4j
- log4j
-
-
commons-cli
@@ -463,10 +440,6 @@
org.apache.commons
commons-dbcp2
-
- commons-fileupload
- commons-fileupload
-
commons-io
@@ -486,16 +459,20 @@
com.sun.mail
- javax.mail
+ jakarta.mail
- javax.servlet
- javax.servlet-api
+ jakarta.servlet
+ jakarta.servlet-api
provided
- javax.annotation
- javax.annotation-api
+ jakarta.annotation
+ jakarta.annotation-api
+
+
+ jakarta.el
+ jakarta.el-api
jaxen
@@ -591,6 +568,13 @@
solr-core
test
${solr.client.version}
+
+
+
+ org.antlr
+ antlr4-runtime
+
+
org.apache.lucene
@@ -670,7 +654,12 @@
org.flywaydb
flyway-core
- 8.5.13
+ ${flyway.version}
+
+
+ org.flywaydb
+ flyway-database-postgresql
+ ${flyway.version}
@@ -706,23 +695,22 @@
- javax.inject
- javax.inject
- 1
- jar
+ jakarta.inject
+ jakarta.inject-api
+ 2.0.1
- javax.xml.bind
- jaxb-api
+ jakarta.xml.bind
+ jakarta.xml.bind-api
org.glassfish.jaxb
jaxb-runtime
-
+
org.glassfish.jersey.core
jersey-client
@@ -743,18 +731,16 @@
1.12.261
+
org.orcid
- orcid-model
- 3.0.2
+ orcid-model-jakarta
+ 3.3.0
- javax.validation
- validation-api
-
-
- com.fasterxml.jackson.jaxrs
- jackson-jaxrs-json-provider
+ com.fasterxml.jackson.jarkarta.rs
+ jackson-jakarta-rs-json-provider
org.yaml
@@ -765,8 +751,8 @@
javassist
- io.swagger
- swagger-jersey-jaxrs
+ io.swagger.core.v3
+ swagger-jaxrs2-jakarta
@@ -844,7 +830,17 @@
com.fasterxml.jackson.datatype
- jackson-datatype-jsr310
+ jackson-datatype-jsr310
+
+
+
+ javax.xml.bind
+ jaxb-api
+
+
+
+ javax.servlet
+ javax.servlet-api
@@ -865,7 +861,6 @@
-
@@ -920,14 +915,9 @@
2.2.14
- jakarta.xml.bind
- jakarta.xml.bind-api
- 2.3.3
-
-
- javax.validation
- validation-api
- 2.0.1.Final
+ jakarta.validation
+ jakarta.validation-api
+ 3.0.2
io.swagger
diff --git a/dspace-api/src/main/java/org/dspace/alerts/SystemWideAlert.java b/dspace-api/src/main/java/org/dspace/alerts/SystemWideAlert.java
index f56cbdcce9e9..432c633ea591 100644
--- a/dspace-api/src/main/java/org/dspace/alerts/SystemWideAlert.java
+++ b/dspace-api/src/main/java/org/dspace/alerts/SystemWideAlert.java
@@ -8,17 +8,17 @@
package org.dspace.alerts;
import java.util.Date;
-import javax.persistence.Cacheable;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.SequenceGenerator;
-import javax.persistence.Table;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
+import jakarta.persistence.Cacheable;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.SequenceGenerator;
+import jakarta.persistence.Table;
+import jakarta.persistence.Temporal;
+import jakarta.persistence.TemporalType;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.dspace.core.ReloadableEntity;
diff --git a/dspace-api/src/main/java/org/dspace/alerts/dao/impl/SystemWideAlertDAOImpl.java b/dspace-api/src/main/java/org/dspace/alerts/dao/impl/SystemWideAlertDAOImpl.java
index 13a0e0af236a..79dc1bcf27a3 100644
--- a/dspace-api/src/main/java/org/dspace/alerts/dao/impl/SystemWideAlertDAOImpl.java
+++ b/dspace-api/src/main/java/org/dspace/alerts/dao/impl/SystemWideAlertDAOImpl.java
@@ -9,10 +9,10 @@
import java.sql.SQLException;
import java.util.List;
-import javax.persistence.criteria.CriteriaBuilder;
-import javax.persistence.criteria.CriteriaQuery;
-import javax.persistence.criteria.Root;
+import jakarta.persistence.criteria.CriteriaBuilder;
+import jakarta.persistence.criteria.CriteriaQuery;
+import jakarta.persistence.criteria.Root;
import org.dspace.alerts.SystemWideAlert;
import org.dspace.alerts.SystemWideAlert_;
import org.dspace.alerts.dao.SystemWideAlertDAO;
diff --git a/dspace-api/src/main/java/org/dspace/app/bulkedit/MetadataImport.java b/dspace-api/src/main/java/org/dspace/app/bulkedit/MetadataImport.java
index af6976acb14a..dbec53eee9c4 100644
--- a/dspace-api/src/main/java/org/dspace/app/bulkedit/MetadataImport.java
+++ b/dspace-api/src/main/java/org/dspace/app/bulkedit/MetadataImport.java
@@ -20,8 +20,8 @@
import java.util.Optional;
import java.util.Set;
import java.util.UUID;
-import javax.annotation.Nullable;
+import jakarta.annotation.Nullable;
import org.apache.commons.cli.ParseException;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.Logger;
diff --git a/dspace-api/src/main/java/org/dspace/app/itemexport/ItemExportServiceImpl.java b/dspace-api/src/main/java/org/dspace/app/itemexport/ItemExportServiceImpl.java
index a884f9b07564..c91d25b3d44b 100644
--- a/dspace-api/src/main/java/org/dspace/app/itemexport/ItemExportServiceImpl.java
+++ b/dspace-api/src/main/java/org/dspace/app/itemexport/ItemExportServiceImpl.java
@@ -31,8 +31,8 @@
import java.util.UUID;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
-import javax.mail.MessagingException;
+import jakarta.mail.MessagingException;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.Logger;
import org.dspace.app.itemexport.service.ItemExportService;
diff --git a/dspace-api/src/main/java/org/dspace/app/itemexport/service/ItemExportService.java b/dspace-api/src/main/java/org/dspace/app/itemexport/service/ItemExportService.java
index 6ec1027709bb..cc53d952e79b 100644
--- a/dspace-api/src/main/java/org/dspace/app/itemexport/service/ItemExportService.java
+++ b/dspace-api/src/main/java/org/dspace/app/itemexport/service/ItemExportService.java
@@ -11,8 +11,8 @@
import java.util.Date;
import java.util.Iterator;
import java.util.List;
-import javax.mail.MessagingException;
+import jakarta.mail.MessagingException;
import org.dspace.content.DSpaceObject;
import org.dspace.content.Item;
import org.dspace.core.Context;
diff --git a/dspace-api/src/main/java/org/dspace/app/itemimport/ItemImportServiceImpl.java b/dspace-api/src/main/java/org/dspace/app/itemimport/ItemImportServiceImpl.java
index 255f4bdcbb15..82e26b95e8cf 100644
--- a/dspace-api/src/main/java/org/dspace/app/itemimport/ItemImportServiceImpl.java
+++ b/dspace-api/src/main/java/org/dspace/app/itemimport/ItemImportServiceImpl.java
@@ -46,7 +46,6 @@
import java.util.UUID;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
-import javax.mail.MessagingException;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
@@ -56,6 +55,7 @@
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
+import jakarta.mail.MessagingException;
import org.apache.commons.collections4.ComparatorUtils;
import org.apache.commons.io.FileDeleteStrategy;
import org.apache.commons.io.FileUtils;
diff --git a/dspace-api/src/main/java/org/dspace/app/itemimport/service/ItemImportService.java b/dspace-api/src/main/java/org/dspace/app/itemimport/service/ItemImportService.java
index e99ece31b9bb..90cb6f9b803a 100644
--- a/dspace-api/src/main/java/org/dspace/app/itemimport/service/ItemImportService.java
+++ b/dspace-api/src/main/java/org/dspace/app/itemimport/service/ItemImportService.java
@@ -10,8 +10,8 @@
import java.io.File;
import java.io.IOException;
import java.util.List;
-import javax.mail.MessagingException;
+import jakarta.mail.MessagingException;
import org.dspace.app.itemimport.BatchUpload;
import org.dspace.content.Collection;
import org.dspace.core.Context;
diff --git a/dspace-api/src/main/java/org/dspace/app/ldn/LDNMessageEntity.java b/dspace-api/src/main/java/org/dspace/app/ldn/LDNMessageEntity.java
index 5d96dd3f956c..27257455e0ce 100644
--- a/dspace-api/src/main/java/org/dspace/app/ldn/LDNMessageEntity.java
+++ b/dspace-api/src/main/java/org/dspace/app/ldn/LDNMessageEntity.java
@@ -7,16 +7,17 @@
*/
package org.dspace.app.ldn;
+import java.lang.reflect.Field;
import java.util.Date;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.Table;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.Id;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.Table;
+import jakarta.persistence.Temporal;
+import jakarta.persistence.TemporalType;
import org.dspace.content.DSpaceObject;
import org.dspace.core.ReloadableEntity;
@@ -34,6 +35,12 @@ public class LDNMessageEntity implements ReloadableEntity {
* LDN messages interact with a fictitious queue. Scheduled tasks manage the queue.
*/
+ /*
+ * Notification Type constants
+ */
+ public static final String TYPE_INCOMING = "Incoming";
+ public static final String TYPE_OUTGOING = "Outgoing";
+
/**
* Message must not be processed.
*/
@@ -69,6 +76,11 @@ public class LDNMessageEntity implements ReloadableEntity {
*/
public static final Integer QUEUE_STATUS_UNMAPPED_ACTION = 6;
+ /**
+ * Message queued for retry, it has to be elaborated.
+ */
+ public static final Integer QUEUE_STATUS_QUEUED_FOR_RETRY = 7;
+
@Id
private String id;
@@ -76,7 +88,7 @@ public class LDNMessageEntity implements ReloadableEntity {
@JoinColumn(name = "object", referencedColumnName = "uuid")
private DSpaceObject object;
- @Column(name = "message", nullable = false, columnDefinition = "text")
+ @Column(name = "message", columnDefinition = "text")
private String message;
@Column(name = "type")
@@ -275,4 +287,33 @@ public void setSourceIp(String sourceIp) {
public String toString() {
return "LDNMessage id:" + this.getID() + " typed:" + this.getType();
}
+
+ public static String getNotificationType(LDNMessageEntity ldnMessage) {
+ if (ldnMessage.getInReplyTo() != null || ldnMessage.getOrigin() != null) {
+ return TYPE_INCOMING;
+ }
+ return TYPE_OUTGOING;
+ }
+
+ public static String getServiceNameForNotifyServ(NotifyServiceEntity serviceEntity) {
+ if (serviceEntity != null) {
+ return serviceEntity.getName();
+ }
+ return "self";
+ }
+
+ public static String getQueueStatus(LDNMessageEntity ldnMessage) {
+ Class cl = LDNMessageEntity.class;
+ try {
+ for (Field f : cl.getDeclaredFields()) {
+ String fieldName = f.getName();
+ if (fieldName.startsWith("QUEUE_") && (f.get(null) == ldnMessage.getQueueStatus())) {
+ return fieldName;
+ }
+ }
+ } catch (IllegalArgumentException | IllegalAccessException e) {
+ throw new RuntimeException(e);
+ }
+ return null;
+ }
}
diff --git a/dspace-api/src/main/java/org/dspace/app/ldn/NotifyPatternToTrigger.java b/dspace-api/src/main/java/org/dspace/app/ldn/NotifyPatternToTrigger.java
index b393d8bedbc5..da23471a1c66 100644
--- a/dspace-api/src/main/java/org/dspace/app/ldn/NotifyPatternToTrigger.java
+++ b/dspace-api/src/main/java/org/dspace/app/ldn/NotifyPatternToTrigger.java
@@ -7,16 +7,15 @@
*/
package org.dspace.app.ldn;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.SequenceGenerator;
-import javax.persistence.Table;
-
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.SequenceGenerator;
+import jakarta.persistence.Table;
import org.dspace.content.Item;
import org.dspace.core.ReloadableEntity;
diff --git a/dspace-api/src/main/java/org/dspace/app/ldn/NotifyServiceEntity.java b/dspace-api/src/main/java/org/dspace/app/ldn/NotifyServiceEntity.java
index 206ed16fa00e..c939256b52ba 100644
--- a/dspace-api/src/main/java/org/dspace/app/ldn/NotifyServiceEntity.java
+++ b/dspace-api/src/main/java/org/dspace/app/ldn/NotifyServiceEntity.java
@@ -9,15 +9,15 @@
import java.math.BigDecimal;
import java.util.List;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.OneToMany;
-import javax.persistence.SequenceGenerator;
-import javax.persistence.Table;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.OneToMany;
+import jakarta.persistence.SequenceGenerator;
+import jakarta.persistence.Table;
import org.dspace.core.ReloadableEntity;
/**
diff --git a/dspace-api/src/main/java/org/dspace/app/ldn/NotifyServiceInboundPattern.java b/dspace-api/src/main/java/org/dspace/app/ldn/NotifyServiceInboundPattern.java
index 0c367d505131..329d6cb11cec 100644
--- a/dspace-api/src/main/java/org/dspace/app/ldn/NotifyServiceInboundPattern.java
+++ b/dspace-api/src/main/java/org/dspace/app/ldn/NotifyServiceInboundPattern.java
@@ -7,16 +7,15 @@
*/
package org.dspace.app.ldn;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.SequenceGenerator;
-import javax.persistence.Table;
-
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.SequenceGenerator;
+import jakarta.persistence.Table;
import org.dspace.core.ReloadableEntity;
/**
diff --git a/dspace-api/src/main/java/org/dspace/app/ldn/dao/LDNMessageDao.java b/dspace-api/src/main/java/org/dspace/app/ldn/dao/LDNMessageDao.java
index c3f4907cce11..fcbb485acacc 100644
--- a/dspace-api/src/main/java/org/dspace/app/ldn/dao/LDNMessageDao.java
+++ b/dspace-api/src/main/java/org/dspace/app/ldn/dao/LDNMessageDao.java
@@ -65,4 +65,12 @@ public List findAllMessagesByItem(
*/
public List findAllRelatedMessagesByItem(
Context context, LDNMessageEntity msg, Item item, String... relatedTypes) throws SQLException;
+
+ /**
+ *
+ * @param context
+ * @return the list of messages in need to be reprocessed - with queue_status as QUEUE_STATUS_QUEUED_FOR_RETRY
+ * @throws SQLException
+ */
+ public List findMessagesToBeReprocessed(Context context) throws SQLException;
}
diff --git a/dspace-api/src/main/java/org/dspace/app/ldn/dao/impl/LDNMessageDaoImpl.java b/dspace-api/src/main/java/org/dspace/app/ldn/dao/impl/LDNMessageDaoImpl.java
index 0a0fe672fb0a..d811f6d39f34 100644
--- a/dspace-api/src/main/java/org/dspace/app/ldn/dao/impl/LDNMessageDaoImpl.java
+++ b/dspace-api/src/main/java/org/dspace/app/ldn/dao/impl/LDNMessageDaoImpl.java
@@ -12,12 +12,12 @@
import java.util.Date;
import java.util.LinkedList;
import java.util.List;
-import javax.persistence.criteria.CriteriaBuilder;
-import javax.persistence.criteria.CriteriaQuery;
-import javax.persistence.criteria.Order;
-import javax.persistence.criteria.Predicate;
-import javax.persistence.criteria.Root;
+import jakarta.persistence.criteria.CriteriaBuilder;
+import jakarta.persistence.criteria.CriteriaQuery;
+import jakarta.persistence.criteria.Order;
+import jakarta.persistence.criteria.Predicate;
+import jakarta.persistence.criteria.Root;
import org.apache.logging.log4j.Logger;
import org.dspace.app.ldn.LDNMessageEntity;
import org.dspace.app.ldn.LDNMessageEntity_;
@@ -60,6 +60,29 @@ public List findOldestMessageToProcess(Context context, int ma
return result;
}
+ @Override
+ public List findMessagesToBeReprocessed(Context context) throws SQLException {
+ // looking for LDN Messages to be reprocessed message
+ CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context);
+ CriteriaQuery criteriaQuery = getCriteriaQuery(criteriaBuilder, LDNMessageEntity.class);
+ Root root = criteriaQuery.from(LDNMessageEntity.class);
+ criteriaQuery.select(root);
+ List andPredicates = new ArrayList<>(1);
+ andPredicates
+ .add(criteriaBuilder.equal(root.get(LDNMessageEntity_.queueStatus),
+ LDNMessageEntity.QUEUE_STATUS_QUEUED_FOR_RETRY));
+ criteriaQuery.where(criteriaBuilder.and(andPredicates.toArray(new Predicate[] {})));
+ List orderList = new LinkedList<>();
+ orderList.add(criteriaBuilder.desc(root.get(LDNMessageEntity_.queueAttempts)));
+ orderList.add(criteriaBuilder.asc(root.get(LDNMessageEntity_.queueLastStartTime)));
+ criteriaQuery.orderBy(orderList);
+ List result = list(context, criteriaQuery, false, LDNMessageEntity.class, -1, -1);
+ if (result == null || result.isEmpty()) {
+ log.debug("No LDN messages found to be processed");
+ }
+ return result;
+ }
+
@Override
public List findProcessingTimedoutMessages(Context context, int max_attempts)
throws SQLException {
diff --git a/dspace-api/src/main/java/org/dspace/app/ldn/dao/impl/NotifyPatternToTriggerDaoImpl.java b/dspace-api/src/main/java/org/dspace/app/ldn/dao/impl/NotifyPatternToTriggerDaoImpl.java
index 47c584518b14..53cbeabe005a 100644
--- a/dspace-api/src/main/java/org/dspace/app/ldn/dao/impl/NotifyPatternToTriggerDaoImpl.java
+++ b/dspace-api/src/main/java/org/dspace/app/ldn/dao/impl/NotifyPatternToTriggerDaoImpl.java
@@ -9,10 +9,10 @@
import java.sql.SQLException;
import java.util.List;
-import javax.persistence.criteria.CriteriaBuilder;
-import javax.persistence.criteria.CriteriaQuery;
-import javax.persistence.criteria.Root;
+import jakarta.persistence.criteria.CriteriaBuilder;
+import jakarta.persistence.criteria.CriteriaQuery;
+import jakarta.persistence.criteria.Root;
import org.dspace.app.ldn.NotifyPatternToTrigger;
import org.dspace.app.ldn.NotifyPatternToTrigger_;
import org.dspace.app.ldn.dao.NotifyPatternToTriggerDao;
diff --git a/dspace-api/src/main/java/org/dspace/app/ldn/dao/impl/NotifyServiceDaoImpl.java b/dspace-api/src/main/java/org/dspace/app/ldn/dao/impl/NotifyServiceDaoImpl.java
index cac804ef0c1f..bb4cf791da27 100644
--- a/dspace-api/src/main/java/org/dspace/app/ldn/dao/impl/NotifyServiceDaoImpl.java
+++ b/dspace-api/src/main/java/org/dspace/app/ldn/dao/impl/NotifyServiceDaoImpl.java
@@ -9,11 +9,11 @@
import java.sql.SQLException;
import java.util.List;
-import javax.persistence.criteria.CriteriaBuilder;
-import javax.persistence.criteria.CriteriaQuery;
-import javax.persistence.criteria.Join;
-import javax.persistence.criteria.Root;
+import jakarta.persistence.criteria.CriteriaBuilder;
+import jakarta.persistence.criteria.CriteriaQuery;
+import jakarta.persistence.criteria.Join;
+import jakarta.persistence.criteria.Root;
import org.dspace.app.ldn.NotifyServiceEntity;
import org.dspace.app.ldn.NotifyServiceEntity_;
import org.dspace.app.ldn.NotifyServiceInboundPattern;
diff --git a/dspace-api/src/main/java/org/dspace/app/ldn/dao/impl/NotifyServiceInboundPatternDaoImpl.java b/dspace-api/src/main/java/org/dspace/app/ldn/dao/impl/NotifyServiceInboundPatternDaoImpl.java
index 5168fd0bedf8..dc3dc1c74491 100644
--- a/dspace-api/src/main/java/org/dspace/app/ldn/dao/impl/NotifyServiceInboundPatternDaoImpl.java
+++ b/dspace-api/src/main/java/org/dspace/app/ldn/dao/impl/NotifyServiceInboundPatternDaoImpl.java
@@ -9,10 +9,10 @@
import java.sql.SQLException;
import java.util.List;
-import javax.persistence.criteria.CriteriaBuilder;
-import javax.persistence.criteria.CriteriaQuery;
-import javax.persistence.criteria.Root;
+import jakarta.persistence.criteria.CriteriaBuilder;
+import jakarta.persistence.criteria.CriteriaQuery;
+import jakarta.persistence.criteria.Root;
import org.dspace.app.ldn.NotifyServiceEntity;
import org.dspace.app.ldn.NotifyServiceInboundPattern;
import org.dspace.app.ldn.NotifyServiceInboundPattern_;
diff --git a/dspace-api/src/main/java/org/dspace/app/ldn/service/LDNMessageService.java b/dspace-api/src/main/java/org/dspace/app/ldn/service/LDNMessageService.java
index c7d3f588881f..d200f0ce84ee 100644
--- a/dspace-api/src/main/java/org/dspace/app/ldn/service/LDNMessageService.java
+++ b/dspace-api/src/main/java/org/dspace/app/ldn/service/LDNMessageService.java
@@ -139,9 +139,18 @@ public interface LDNMessageService {
public void delete(Context context, LDNMessageEntity ldnMessage) throws SQLException;
/**
- * check if IP number is included in the configured ip-range on the Notify Service
+ * find the ldn messages to be reprocessed
+ *
+ * @param context the context
+ * @throws SQLException if something goes wrong
+ */
+ public List findMessagesToBeReprocessed(Context context) throws SQLException;
+
+ /**
+ * check if IP number is included in the configured ip-range on the Notify
+ * Service
*
- * @param origin the Notify Service entity
+ * @param origin the Notify Service entity
* @param sourceIp the ip to evaluate
*/
public boolean isValidIp(NotifyServiceEntity origin, String sourceIp);
diff --git a/dspace-api/src/main/java/org/dspace/app/ldn/service/NotifyService.java b/dspace-api/src/main/java/org/dspace/app/ldn/service/NotifyService.java
index 6ff4c34780c5..e6ac0d63b438 100644
--- a/dspace-api/src/main/java/org/dspace/app/ldn/service/NotifyService.java
+++ b/dspace-api/src/main/java/org/dspace/app/ldn/service/NotifyService.java
@@ -43,10 +43,11 @@ public interface NotifyService {
* create new notifyServiceEntity
*
* @param context the context
+ * @param name name of the service
* @return the created NotifyServiceEntity
* @throws SQLException if database error
*/
- public NotifyServiceEntity create(Context context) throws SQLException;
+ public NotifyServiceEntity create(Context context, String name) throws SQLException;
/**
* update the provided notifyServiceEntity
diff --git a/dspace-api/src/main/java/org/dspace/app/ldn/service/impl/LDNMessageServiceImpl.java b/dspace-api/src/main/java/org/dspace/app/ldn/service/impl/LDNMessageServiceImpl.java
index b69ecec6a142..193d8cebaf52 100644
--- a/dspace-api/src/main/java/org/dspace/app/ldn/service/impl/LDNMessageServiceImpl.java
+++ b/dspace-api/src/main/java/org/dspace/app/ldn/service/impl/LDNMessageServiceImpl.java
@@ -19,6 +19,7 @@
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
+import com.google.gson.JsonSyntaxException;
import org.apache.commons.lang.time.DateUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.Logger;
@@ -38,7 +39,10 @@
import org.dspace.content.DSpaceObject;
import org.dspace.content.Item;
import org.dspace.content.service.ItemService;
+import org.dspace.core.Constants;
import org.dspace.core.Context;
+import org.dspace.discovery.indexobject.IndexableLDNNotification;
+import org.dspace.event.Event;
import org.dspace.handle.service.HandleService;
import org.dspace.services.ConfigurationService;
import org.springframework.beans.factory.annotation.Autowired;
@@ -65,6 +69,7 @@ public class LDNMessageServiceImpl implements LDNMessageService {
private LDNRouter ldnRouter;
private static final Logger log = org.apache.logging.log4j.LogManager.getLogger(LDNMessageServiceImpl.class);
+ private static final String LDN_ID_PREFIX = "urn:uuid:";
protected LDNMessageServiceImpl() {
@@ -72,6 +77,12 @@ protected LDNMessageServiceImpl() {
@Override
public LDNMessageEntity find(Context context, String id) throws SQLException {
+
+ if (id == null) {
+ return null;
+ }
+
+ id = id.startsWith(LDN_ID_PREFIX) ? id : LDN_ID_PREFIX + id;
return ldnMessageDao.findByID(context, LDNMessageEntity.class, id);
}
@@ -171,11 +182,19 @@ private long ipToLong(InetAddress ip) {
@Override
public void update(Context context, LDNMessageEntity ldnMessage) throws SQLException {
+ // move the queue_status from UNTRUSTED to QUEUED if origin is a known NotifyService
if (ldnMessage.getOrigin() != null &&
LDNMessageEntity.QUEUE_STATUS_UNTRUSTED.compareTo(ldnMessage.getQueueStatus()) == 0) {
ldnMessage.setQueueStatus(LDNMessageEntity.QUEUE_STATUS_QUEUED);
}
ldnMessageDao.save(context, ldnMessage);
+ UUID notificationUUID = UUID.fromString(ldnMessage.getID().replace(LDN_ID_PREFIX, ""));
+ ArrayList identifiersList = new ArrayList();
+ identifiersList.add(ldnMessage.getID());
+ context.addEvent(
+ new Event(Event.MODIFY, Constants.LDN_MESSAGE,
+ notificationUUID,
+ IndexableLDNNotification.TYPE, identifiersList));
}
private DSpaceObject findDspaceObjectByUrl(Context context, String url) throws SQLException {
@@ -210,6 +229,13 @@ public List findOldestMessagesToProcess(Context context) throw
return result;
}
+ @Override
+ public List findMessagesToBeReprocessed(Context context) throws SQLException {
+ List result = null;
+ result = ldnMessageDao.findMessagesToBeReprocessed(context);
+ return result;
+ }
+
@Override
public List findProcessingTimedoutMessages(Context context) throws SQLException {
List result = null;
@@ -225,9 +251,10 @@ public int extractAndProcessMessageFromQueue(Context context) throws SQLExceptio
if (timeoutInMinutes == 0) {
timeoutInMinutes = 60;
}
- List msgs = null;
+ List msgs = new ArrayList();
try {
- msgs = findOldestMessagesToProcess(context);
+ msgs.addAll(findOldestMessagesToProcess(context));
+ msgs.addAll(findMessagesToBeReprocessed(context));
if (msgs != null && msgs.size() > 0) {
LDNMessageEntity msg = null;
LDNProcessor processor = null;
@@ -253,9 +280,14 @@ public int extractAndProcessMessageFromQueue(Context context) throws SQLExceptio
processor.process(context, notification);
msg.setQueueStatus(LDNMessageEntity.QUEUE_STATUS_PROCESSED);
result = 1;
+ } catch (JsonSyntaxException jse) {
+ result = -1;
+ log.error("Unable to read JSON notification from LdnMessage " + msg, jse);
+ msg.setQueueStatus(LDNMessageEntity.QUEUE_STATUS_FAILED);
} catch (Exception e) {
result = -1;
log.error(e);
+ msg.setQueueStatus(LDNMessageEntity.QUEUE_STATUS_FAILED);
} finally {
msg.setQueueAttempts(msg.getQueueAttempts() + 1);
update(context, msg);
diff --git a/dspace-api/src/main/java/org/dspace/app/ldn/service/impl/NotifyServiceImpl.java b/dspace-api/src/main/java/org/dspace/app/ldn/service/impl/NotifyServiceImpl.java
index d2289fd77a1c..87be008371aa 100644
--- a/dspace-api/src/main/java/org/dspace/app/ldn/service/impl/NotifyServiceImpl.java
+++ b/dspace-api/src/main/java/org/dspace/app/ldn/service/impl/NotifyServiceImpl.java
@@ -37,8 +37,9 @@ public NotifyServiceEntity find(Context context, Integer id) throws SQLException
}
@Override
- public NotifyServiceEntity create(Context context) throws SQLException {
+ public NotifyServiceEntity create(Context context, String name) throws SQLException {
NotifyServiceEntity notifyServiceEntity = new NotifyServiceEntity();
+ notifyServiceEntity.setName(name);
return notifyServiceDao.create(context, notifyServiceEntity);
}
diff --git a/dspace-api/src/main/java/org/dspace/app/requestitem/RequestItem.java b/dspace-api/src/main/java/org/dspace/app/requestitem/RequestItem.java
index cdefd1298c6e..bf2bfb4d60b2 100644
--- a/dspace-api/src/main/java/org/dspace/app/requestitem/RequestItem.java
+++ b/dspace-api/src/main/java/org/dspace/app/requestitem/RequestItem.java
@@ -8,19 +8,19 @@
package org.dspace.app.requestitem;
import java.util.Date;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.FetchType;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.SequenceGenerator;
-import javax.persistence.Table;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.FetchType;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.SequenceGenerator;
+import jakarta.persistence.Table;
+import jakarta.persistence.Temporal;
+import jakarta.persistence.TemporalType;
import org.dspace.content.Bitstream;
import org.dspace.content.Item;
import org.dspace.core.Context;
diff --git a/dspace-api/src/main/java/org/dspace/app/requestitem/RequestItemEmailNotifier.java b/dspace-api/src/main/java/org/dspace/app/requestitem/RequestItemEmailNotifier.java
index 6499c45a7830..c489fb4b3ff0 100644
--- a/dspace-api/src/main/java/org/dspace/app/requestitem/RequestItemEmailNotifier.java
+++ b/dspace-api/src/main/java/org/dspace/app/requestitem/RequestItemEmailNotifier.java
@@ -11,11 +11,11 @@
import java.io.IOException;
import java.sql.SQLException;
import java.util.List;
-import javax.annotation.ManagedBean;
-import javax.inject.Inject;
-import javax.inject.Singleton;
-import javax.mail.MessagingException;
+import jakarta.annotation.ManagedBean;
+import jakarta.inject.Inject;
+import jakarta.inject.Singleton;
+import jakarta.mail.MessagingException;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.dspace.app.requestitem.service.RequestItemService;
diff --git a/dspace-api/src/main/java/org/dspace/app/requestitem/dao/impl/RequestItemDAOImpl.java b/dspace-api/src/main/java/org/dspace/app/requestitem/dao/impl/RequestItemDAOImpl.java
index 008174ded88c..c76bd50d1910 100644
--- a/dspace-api/src/main/java/org/dspace/app/requestitem/dao/impl/RequestItemDAOImpl.java
+++ b/dspace-api/src/main/java/org/dspace/app/requestitem/dao/impl/RequestItemDAOImpl.java
@@ -9,11 +9,11 @@
import java.sql.SQLException;
import java.util.Iterator;
-import javax.persistence.Query;
-import javax.persistence.criteria.CriteriaBuilder;
-import javax.persistence.criteria.CriteriaQuery;
-import javax.persistence.criteria.Root;
+import jakarta.persistence.Query;
+import jakarta.persistence.criteria.CriteriaBuilder;
+import jakarta.persistence.criteria.CriteriaQuery;
+import jakarta.persistence.criteria.Root;
import org.dspace.app.requestitem.RequestItem;
import org.dspace.app.requestitem.RequestItem_;
import org.dspace.app.requestitem.dao.RequestItemDAO;
@@ -44,8 +44,12 @@ public RequestItem findByToken(Context context, String token) throws SQLExceptio
}
@Override
public Iterator findByItem(Context context, Item item) throws SQLException {
- Query query = createQuery(context, "FROM RequestItem WHERE item_id= :uuid");
- query.setParameter("uuid", item.getID());
+ CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context);
+ CriteriaQuery criteriaQuery = getCriteriaQuery(criteriaBuilder, RequestItem.class);
+ Root requestItemRoot = criteriaQuery.from(RequestItem.class);
+ criteriaQuery.select(requestItemRoot);
+ criteriaQuery.where(criteriaBuilder.equal(requestItemRoot.get(RequestItem_.item), item));
+ Query query = createQuery(context, criteriaQuery);
return iterate(query);
}
}
diff --git a/dspace-api/src/main/java/org/dspace/app/sherpa/SHERPAService.java b/dspace-api/src/main/java/org/dspace/app/sherpa/SHERPAService.java
index ead725e842c4..9ee5ca55cc6d 100644
--- a/dspace-api/src/main/java/org/dspace/app/sherpa/SHERPAService.java
+++ b/dspace-api/src/main/java/org/dspace/app/sherpa/SHERPAService.java
@@ -12,8 +12,8 @@
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.charset.StandardCharsets;
-import javax.annotation.PostConstruct;
+import jakarta.annotation.PostConstruct;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpEntity;
@@ -93,7 +93,7 @@ private void init() {
* @param query ISSN string to pass in an "issn equals" API query
* @return SHERPAResponse containing an error or journal policies
*/
- @Cacheable(key = "#query", cacheNames = "sherpa.searchByJournalISSN")
+ @Cacheable(key = "#query", condition = "#query != null", cacheNames = "sherpa.searchByJournalISSN")
public SHERPAResponse searchByJournalISSN(String query) {
return performRequest("publication", "issn", "equals", query, 0, 1);
}
diff --git a/dspace-api/src/main/java/org/dspace/app/suggestion/SuggestionServiceImpl.java b/dspace-api/src/main/java/org/dspace/app/suggestion/SuggestionServiceImpl.java
index 66773fbc128d..57fe42806b12 100644
--- a/dspace-api/src/main/java/org/dspace/app/suggestion/SuggestionServiceImpl.java
+++ b/dspace-api/src/main/java/org/dspace/app/suggestion/SuggestionServiceImpl.java
@@ -13,8 +13,8 @@
import java.util.Map;
import java.util.UUID;
import java.util.stream.Collectors;
-import javax.annotation.Resource;
+import jakarta.annotation.Resource;
import org.apache.logging.log4j.Logger;
import org.dspace.core.Context;
import org.springframework.stereotype.Service;
diff --git a/dspace-api/src/main/java/org/dspace/app/util/AuthorizeUtil.java b/dspace-api/src/main/java/org/dspace/app/util/AuthorizeUtil.java
index b498b693956a..6400820546ce 100644
--- a/dspace-api/src/main/java/org/dspace/app/util/AuthorizeUtil.java
+++ b/dspace-api/src/main/java/org/dspace/app/util/AuthorizeUtil.java
@@ -9,8 +9,8 @@
import java.sql.SQLException;
import java.util.List;
-import javax.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletRequest;
import org.apache.logging.log4j.Logger;
import org.dspace.authenticate.factory.AuthenticateServiceFactory;
import org.dspace.authorize.AuthorizeConfiguration;
diff --git a/dspace-api/src/main/java/org/dspace/app/util/DCInput.java b/dspace-api/src/main/java/org/dspace/app/util/DCInput.java
index c5093d3320a8..dd88390cb856 100644
--- a/dspace-api/src/main/java/org/dspace/app/util/DCInput.java
+++ b/dspace-api/src/main/java/org/dspace/app/util/DCInput.java
@@ -13,8 +13,8 @@
import java.util.Optional;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
-import javax.annotation.Nullable;
+import jakarta.annotation.Nullable;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
diff --git a/dspace-api/src/main/java/org/dspace/app/util/DSpaceContextListener.java b/dspace-api/src/main/java/org/dspace/app/util/DSpaceContextListener.java
index b0289ec4a4e1..51d78ccaba5c 100644
--- a/dspace-api/src/main/java/org/dspace/app/util/DSpaceContextListener.java
+++ b/dspace-api/src/main/java/org/dspace/app/util/DSpaceContextListener.java
@@ -13,9 +13,9 @@
import java.sql.Driver;
import java.sql.DriverManager;
import java.util.Enumeration;
-import javax.servlet.ServletContextEvent;
-import javax.servlet.ServletContextListener;
+import jakarta.servlet.ServletContextEvent;
+import jakarta.servlet.ServletContextListener;
import org.apache.logging.log4j.Logger;
/**
diff --git a/dspace-api/src/main/java/org/dspace/app/util/DSpaceWebappListener.java b/dspace-api/src/main/java/org/dspace/app/util/DSpaceWebappListener.java
index c2817169b21e..32c4ff9c1c71 100644
--- a/dspace-api/src/main/java/org/dspace/app/util/DSpaceWebappListener.java
+++ b/dspace-api/src/main/java/org/dspace/app/util/DSpaceWebappListener.java
@@ -8,8 +8,9 @@
package org.dspace.app.util;
import java.lang.reflect.InvocationTargetException;
-import javax.servlet.ServletContextEvent;
-import javax.servlet.ServletContextListener;
+
+import jakarta.servlet.ServletContextEvent;
+import jakarta.servlet.ServletContextListener;
/**
* Class that registers the web application upon startup of the application.
diff --git a/dspace-api/src/main/java/org/dspace/app/util/SubmissionStepConfig.java b/dspace-api/src/main/java/org/dspace/app/util/SubmissionStepConfig.java
index 28d39d911b95..db45d42e495e 100644
--- a/dspace-api/src/main/java/org/dspace/app/util/SubmissionStepConfig.java
+++ b/dspace-api/src/main/java/org/dspace/app/util/SubmissionStepConfig.java
@@ -13,7 +13,7 @@
import org.apache.commons.lang3.BooleanUtils;
import org.dspace.content.InProgressSubmission;
import org.dspace.content.WorkspaceItem;
-import org.hibernate.proxy.HibernateProxyHelper;
+import org.dspace.core.HibernateProxyHelper;
/**
* Class representing configuration for a single step within an Item Submission
diff --git a/dspace-api/src/main/java/org/dspace/app/util/SyndicationFeed.java b/dspace-api/src/main/java/org/dspace/app/util/SyndicationFeed.java
index c1402499c444..2ab99e54d2e1 100644
--- a/dspace-api/src/main/java/org/dspace/app/util/SyndicationFeed.java
+++ b/dspace-api/src/main/java/org/dspace/app/util/SyndicationFeed.java
@@ -13,7 +13,6 @@
import java.util.Date;
import java.util.List;
import java.util.Map;
-import javax.servlet.http.HttpServletRequest;
import com.rometools.modules.itunes.EntryInformation;
import com.rometools.modules.itunes.EntryInformationImpl;
@@ -35,6 +34,7 @@
import com.rometools.rome.feed.synd.SyndPersonImpl;
import com.rometools.rome.io.FeedException;
import com.rometools.rome.io.SyndFeedOutput;
+import jakarta.servlet.http.HttpServletRequest;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.Logger;
diff --git a/dspace-api/src/main/java/org/dspace/app/util/Util.java b/dspace-api/src/main/java/org/dspace/app/util/Util.java
index 3bc828d6c496..a084e60b634e 100644
--- a/dspace-api/src/main/java/org/dspace/app/util/Util.java
+++ b/dspace-api/src/main/java/org/dspace/app/util/Util.java
@@ -20,8 +20,8 @@
import java.util.Properties;
import java.util.Set;
import java.util.UUID;
-import javax.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletRequest;
import org.apache.commons.collections4.ListUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.Logger;
diff --git a/dspace-api/src/main/java/org/dspace/app/util/WebApp.java b/dspace-api/src/main/java/org/dspace/app/util/WebApp.java
index 2f42c1459f63..c2fc133f41c6 100644
--- a/dspace-api/src/main/java/org/dspace/app/util/WebApp.java
+++ b/dspace-api/src/main/java/org/dspace/app/util/WebApp.java
@@ -8,16 +8,16 @@
package org.dspace.app.util;
import java.util.Date;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.SequenceGenerator;
-import javax.persistence.Table;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.SequenceGenerator;
+import jakarta.persistence.Table;
+import jakarta.persistence.Temporal;
+import jakarta.persistence.TemporalType;
import org.dspace.core.Context;
import org.dspace.core.ReloadableEntity;
diff --git a/dspace-api/src/main/java/org/dspace/authenticate/AuthenticationMethod.java b/dspace-api/src/main/java/org/dspace/authenticate/AuthenticationMethod.java
index 500ee04a979b..d316cb636f87 100644
--- a/dspace-api/src/main/java/org/dspace/authenticate/AuthenticationMethod.java
+++ b/dspace-api/src/main/java/org/dspace/authenticate/AuthenticationMethod.java
@@ -9,9 +9,9 @@
import java.sql.SQLException;
import java.util.List;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
import org.dspace.core.Context;
import org.dspace.eperson.EPerson;
import org.dspace.eperson.Group;
diff --git a/dspace-api/src/main/java/org/dspace/authenticate/AuthenticationServiceImpl.java b/dspace-api/src/main/java/org/dspace/authenticate/AuthenticationServiceImpl.java
index a1e096dc4d64..2b07f73c489c 100644
--- a/dspace-api/src/main/java/org/dspace/authenticate/AuthenticationServiceImpl.java
+++ b/dspace-api/src/main/java/org/dspace/authenticate/AuthenticationServiceImpl.java
@@ -13,8 +13,8 @@
import java.util.Date;
import java.util.Iterator;
import java.util.List;
-import javax.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletRequest;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.dspace.authenticate.service.AuthenticationService;
diff --git a/dspace-api/src/main/java/org/dspace/authenticate/IPAuthentication.java b/dspace-api/src/main/java/org/dspace/authenticate/IPAuthentication.java
index 0c2be211a532..db71ec1c2ff1 100644
--- a/dspace-api/src/main/java/org/dspace/authenticate/IPAuthentication.java
+++ b/dspace-api/src/main/java/org/dspace/authenticate/IPAuthentication.java
@@ -14,9 +14,9 @@
import java.util.List;
import java.util.Map;
import java.util.UUID;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
import org.apache.logging.log4j.Logger;
import org.dspace.core.Context;
import org.dspace.core.LogHelper;
diff --git a/dspace-api/src/main/java/org/dspace/authenticate/LDAPAuthentication.java b/dspace-api/src/main/java/org/dspace/authenticate/LDAPAuthentication.java
index 585eaf9cd8b1..b791df15b5c0 100644
--- a/dspace-api/src/main/java/org/dspace/authenticate/LDAPAuthentication.java
+++ b/dspace-api/src/main/java/org/dspace/authenticate/LDAPAuthentication.java
@@ -29,9 +29,9 @@
import javax.naming.ldap.LdapContext;
import javax.naming.ldap.StartTlsRequest;
import javax.naming.ldap.StartTlsResponse;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.Logger;
import org.dspace.authenticate.factory.AuthenticateServiceFactory;
diff --git a/dspace-api/src/main/java/org/dspace/authenticate/OidcAuthentication.java b/dspace-api/src/main/java/org/dspace/authenticate/OidcAuthentication.java
index 5d4635d48ef5..c7ac1ff55748 100644
--- a/dspace-api/src/main/java/org/dspace/authenticate/OidcAuthentication.java
+++ b/dspace-api/src/main/java/org/dspace/authenticate/OidcAuthentication.java
@@ -9,9 +9,9 @@
import java.sql.SQLException;
import java.util.List;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
import org.dspace.core.Context;
import org.dspace.eperson.EPerson;
import org.dspace.eperson.Group;
diff --git a/dspace-api/src/main/java/org/dspace/authenticate/OidcAuthenticationBean.java b/dspace-api/src/main/java/org/dspace/authenticate/OidcAuthenticationBean.java
index c628f0dce27d..61cbca1e5ed7 100644
--- a/dspace-api/src/main/java/org/dspace/authenticate/OidcAuthenticationBean.java
+++ b/dspace-api/src/main/java/org/dspace/authenticate/OidcAuthenticationBean.java
@@ -20,9 +20,9 @@
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
diff --git a/dspace-api/src/main/java/org/dspace/authenticate/OrcidAuthentication.java b/dspace-api/src/main/java/org/dspace/authenticate/OrcidAuthentication.java
index 3e9ff6638a61..932d963307f6 100644
--- a/dspace-api/src/main/java/org/dspace/authenticate/OrcidAuthentication.java
+++ b/dspace-api/src/main/java/org/dspace/authenticate/OrcidAuthentication.java
@@ -10,9 +10,9 @@
import java.sql.SQLException;
import java.util.Iterator;
import java.util.List;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
import org.dspace.authenticate.factory.AuthenticateServiceFactory;
import org.dspace.core.Context;
import org.dspace.eperson.EPerson;
diff --git a/dspace-api/src/main/java/org/dspace/authenticate/OrcidAuthenticationBean.java b/dspace-api/src/main/java/org/dspace/authenticate/OrcidAuthenticationBean.java
index 6804ad9160dd..590bbf6cf0ef 100644
--- a/dspace-api/src/main/java/org/dspace/authenticate/OrcidAuthenticationBean.java
+++ b/dspace-api/src/main/java/org/dspace/authenticate/OrcidAuthenticationBean.java
@@ -18,9 +18,9 @@
import java.util.Collections;
import java.util.List;
import java.util.Optional;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
diff --git a/dspace-api/src/main/java/org/dspace/authenticate/PasswordAuthentication.java b/dspace-api/src/main/java/org/dspace/authenticate/PasswordAuthentication.java
index 6d1ca862d307..8e030305c957 100644
--- a/dspace-api/src/main/java/org/dspace/authenticate/PasswordAuthentication.java
+++ b/dspace-api/src/main/java/org/dspace/authenticate/PasswordAuthentication.java
@@ -11,9 +11,9 @@
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
diff --git a/dspace-api/src/main/java/org/dspace/authenticate/ShibAuthentication.java b/dspace-api/src/main/java/org/dspace/authenticate/ShibAuthentication.java
index 791634a7dc25..24d8266012d4 100644
--- a/dspace-api/src/main/java/org/dspace/authenticate/ShibAuthentication.java
+++ b/dspace-api/src/main/java/org/dspace/authenticate/ShibAuthentication.java
@@ -20,9 +20,9 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
diff --git a/dspace-api/src/main/java/org/dspace/authenticate/X509Authentication.java b/dspace-api/src/main/java/org/dspace/authenticate/X509Authentication.java
index 12dc5feda583..55843c710760 100644
--- a/dspace-api/src/main/java/org/dspace/authenticate/X509Authentication.java
+++ b/dspace-api/src/main/java/org/dspace/authenticate/X509Authentication.java
@@ -25,10 +25,10 @@
import java.util.Enumeration;
import java.util.List;
import java.util.StringTokenizer;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
+import jakarta.servlet.http.HttpSession;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.logging.log4j.Logger;
import org.dspace.authenticate.factory.AuthenticateServiceFactory;
@@ -505,7 +505,7 @@ public int authenticate(Context context, String username, String password,
X509Certificate[] certs = null;
if (request != null) {
certs = (X509Certificate[]) request
- .getAttribute("javax.servlet.request.X509Certificate");
+ .getAttribute("jakarta.servlet.request.X509Certificate");
}
if ((certs == null) || (certs.length == 0)) {
diff --git a/dspace-api/src/main/java/org/dspace/authenticate/oidc/impl/OidcClientImpl.java b/dspace-api/src/main/java/org/dspace/authenticate/oidc/impl/OidcClientImpl.java
index ddab01e8cb5d..68fffd3fb264 100644
--- a/dspace-api/src/main/java/org/dspace/authenticate/oidc/impl/OidcClientImpl.java
+++ b/dspace-api/src/main/java/org/dspace/authenticate/oidc/impl/OidcClientImpl.java
@@ -14,10 +14,10 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
-import javax.annotation.PostConstruct;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
+import jakarta.annotation.PostConstruct;
import org.apache.commons.io.IOUtils;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
diff --git a/dspace-api/src/main/java/org/dspace/authenticate/service/AuthenticationService.java b/dspace-api/src/main/java/org/dspace/authenticate/service/AuthenticationService.java
index e955302ec3d7..45ad8932daec 100644
--- a/dspace-api/src/main/java/org/dspace/authenticate/service/AuthenticationService.java
+++ b/dspace-api/src/main/java/org/dspace/authenticate/service/AuthenticationService.java
@@ -10,8 +10,8 @@
import java.sql.SQLException;
import java.util.Iterator;
import java.util.List;
-import javax.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletRequest;
import org.dspace.authenticate.AuthenticationMethod;
import org.dspace.core.Context;
import org.dspace.eperson.EPerson;
diff --git a/dspace-api/src/main/java/org/dspace/authority/AuthoritySolrServiceImpl.java b/dspace-api/src/main/java/org/dspace/authority/AuthoritySolrServiceImpl.java
index ca5b4a11b543..2ab2bbf90266 100644
--- a/dspace-api/src/main/java/org/dspace/authority/AuthoritySolrServiceImpl.java
+++ b/dspace-api/src/main/java/org/dspace/authority/AuthoritySolrServiceImpl.java
@@ -11,9 +11,9 @@
import java.net.MalformedURLException;
import java.util.ArrayList;
import java.util.List;
-import javax.inject.Inject;
-import javax.inject.Named;
+import jakarta.inject.Inject;
+import jakarta.inject.Named;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.solr.client.solrj.SolrClient;
diff --git a/dspace-api/src/main/java/org/dspace/authorize/AuthorizeServiceImpl.java b/dspace-api/src/main/java/org/dspace/authorize/AuthorizeServiceImpl.java
index beff6fdc48e8..c303c0ba9dba 100644
--- a/dspace-api/src/main/java/org/dspace/authorize/AuthorizeServiceImpl.java
+++ b/dspace-api/src/main/java/org/dspace/authorize/AuthorizeServiceImpl.java
@@ -697,7 +697,7 @@ public ResourcePolicy createOrModifyPolicy(ResourcePolicy policy, Context contex
if (!duplicates.isEmpty()) {
policy = duplicates.get(0);
}
- } else {
+ } else if (group != null) {
// if an identical policy (same Action and same Group) is already in place modify it...
policyTemp = findByTypeGroupAction(context, dso, group, action);
}
diff --git a/dspace-api/src/main/java/org/dspace/authorize/ResourcePolicy.java b/dspace-api/src/main/java/org/dspace/authorize/ResourcePolicy.java
index c781400bae45..68a59d46ae2f 100644
--- a/dspace-api/src/main/java/org/dspace/authorize/ResourcePolicy.java
+++ b/dspace-api/src/main/java/org/dspace/authorize/ResourcePolicy.java
@@ -9,29 +9,28 @@
import java.util.Date;
import java.util.Objects;
-import javax.persistence.CascadeType;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.FetchType;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.Lob;
-import javax.persistence.ManyToOne;
-import javax.persistence.SequenceGenerator;
-import javax.persistence.Table;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
+import jakarta.persistence.CascadeType;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.FetchType;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.SequenceGenerator;
+import jakarta.persistence.Table;
+import jakarta.persistence.Temporal;
+import jakarta.persistence.TemporalType;
import org.apache.solr.common.StringUtils;
import org.dspace.content.DSpaceObject;
import org.dspace.core.Context;
+import org.dspace.core.HibernateProxyHelper;
import org.dspace.core.ReloadableEntity;
import org.dspace.eperson.EPerson;
import org.dspace.eperson.Group;
-import org.hibernate.annotations.Type;
-import org.hibernate.proxy.HibernateProxyHelper;
+import org.hibernate.Length;
/**
* Database entity representation of the ResourcePolicy table
@@ -99,9 +98,7 @@ public class ResourcePolicy implements ReloadableEntity {
@Column(name = "rptype", length = 30)
private String rptype;
- @Lob
- @Type(type = "org.hibernate.type.TextType")
- @Column(name = "rpdescription")
+ @Column(name = "rpdescription", length = Length.LONG32)
private String rpdescription;
/**
diff --git a/dspace-api/src/main/java/org/dspace/authorize/dao/impl/ResourcePolicyDAOImpl.java b/dspace-api/src/main/java/org/dspace/authorize/dao/impl/ResourcePolicyDAOImpl.java
index 26b6bb1d7345..3b09f9cf300b 100644
--- a/dspace-api/src/main/java/org/dspace/authorize/dao/impl/ResourcePolicyDAOImpl.java
+++ b/dspace-api/src/main/java/org/dspace/authorize/dao/impl/ResourcePolicyDAOImpl.java
@@ -8,16 +8,19 @@
package org.dspace.authorize.dao.impl;
import java.sql.SQLException;
+import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.UUID;
-import javax.persistence.Query;
-import javax.persistence.criteria.CriteriaBuilder;
-import javax.persistence.criteria.CriteriaQuery;
-import javax.persistence.criteria.Join;
-import javax.persistence.criteria.Order;
-import javax.persistence.criteria.Root;
+import jakarta.persistence.Query;
+import jakarta.persistence.criteria.CriteriaBuilder;
+import jakarta.persistence.criteria.CriteriaQuery;
+import jakarta.persistence.criteria.Join;
+import jakarta.persistence.criteria.Order;
+import jakarta.persistence.criteria.Predicate;
+import jakarta.persistence.criteria.Root;
+import org.apache.commons.collections.CollectionUtils;
import org.dspace.authorize.ResourcePolicy;
import org.dspace.authorize.ResourcePolicy_;
import org.dspace.authorize.dao.ResourcePolicyDAO;
@@ -153,16 +156,30 @@ public List findByTypeGroupActionExceptId(Context context, DSpac
public List findByEPersonGroupTypeIdAction(Context context, EPerson e, List groups,
int action, int type_id) throws SQLException {
+ // If groups and eperson are empty, return immediately
+ if (CollectionUtils.isEmpty(groups) && e == null) {
+ return Collections.emptyList();
+ }
+
CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context);
CriteriaQuery criteriaQuery = getCriteriaQuery(criteriaBuilder, ResourcePolicy.class);
Root resourcePolicyRoot = criteriaQuery.from(ResourcePolicy.class);
criteriaQuery.select(resourcePolicyRoot);
+
+ // Determine which predicate to use to match EPerson or Group(s) based on which were specified in params
+ Predicate compareEpersonOrGroups =
+ (CollectionUtils.isNotEmpty(groups) && e != null) ?
+ // Both are non-empty, so check both via an OR clause
+ criteriaBuilder.or(criteriaBuilder.equal(resourcePolicyRoot.get(ResourcePolicy_.eperson), e),
+ resourcePolicyRoot.get(ResourcePolicy_.epersonGroup).in(groups)) :
+ // Otherwise only check one based on which is non-empty
+ (e != null ? criteriaBuilder.equal(resourcePolicyRoot.get(ResourcePolicy_.eperson), e) :
+ resourcePolicyRoot.get(ResourcePolicy_.epersonGroup).in(groups));
+
criteriaQuery.where(
criteriaBuilder.and(criteriaBuilder.equal(resourcePolicyRoot.get(ResourcePolicy_.resourceTypeId), type_id),
criteriaBuilder.equal(resourcePolicyRoot.get(ResourcePolicy_.actionId), action),
- criteriaBuilder
- .or(criteriaBuilder.equal(resourcePolicyRoot.get(ResourcePolicy_.eperson), e),
- (resourcePolicyRoot.get(ResourcePolicy_.epersonGroup).in(groups)))
+ compareEpersonOrGroups
)
);
return list(context, criteriaQuery, false, ResourcePolicy.class, 1, -1);
@@ -286,8 +303,8 @@ public List findByEPerson(Context context, EPerson ePerson, int
@Override
public int countByEPerson(Context context, EPerson ePerson) throws SQLException {
Query query = createQuery(context,
- "SELECT count(*) FROM " + ResourcePolicy.class.getSimpleName() + " WHERE eperson_id = (:epersonUuid) ");
- query.setParameter("epersonUuid", ePerson.getID());
+ "SELECT count(*) FROM " + ResourcePolicy.class.getSimpleName() + " WHERE eperson = :eperson ");
+ query.setParameter("eperson", ePerson);
return count(query);
}
@@ -307,9 +324,9 @@ public List findByEPersonAndResourceUuid(Context context, EPerso
@Override
public int countByEPersonAndResourceUuid(Context context, EPerson eperson, UUID resourceUuid) throws SQLException {
Query query = createQuery(context, "SELECT count(*) FROM " + ResourcePolicy.class.getSimpleName()
- + " WHERE eperson_id = (:epersonUuid) AND dspace_object = (:resourceUuid) ");
+ + " WHERE eperson = :eperson AND dSpaceObject.id = :resourceUuid ");
query.setParameter("resourceUuid", resourceUuid);
- query.setParameter("epersonUuid", eperson.getID());
+ query.setParameter("eperson", eperson);
return count(query);
}
@@ -329,7 +346,7 @@ public List findByResouceUuidAndActionId(Context context, UUID r
@Override
public int countByResouceUuidAndActionId(Context context, UUID resourceUuid, int actionId) throws SQLException {
Query query = createQuery(context, "SELECT count(*) FROM " + ResourcePolicy.class.getSimpleName()
- + " WHERE dspace_object = (:resourceUuid) AND action_id = (:actionId) ");
+ + " WHERE dSpaceObject.id = :resourceUuid AND actionId = :actionId ");
query.setParameter("resourceUuid", resourceUuid);
query.setParameter("actionId", actionId);
return count(query);
@@ -349,7 +366,7 @@ public List findByResouceUuid(Context context, UUID resourceUuid
@Override
public int countByResourceUuid(Context context, UUID resourceUuid) throws SQLException {
Query query = createQuery(context, "SELECT count(*) FROM " + ResourcePolicy.class.getSimpleName()
- + " WHERE dspace_object = (:resourceUuid) ");
+ + " WHERE dSpaceObject.id = :resourceUuid ");
query.setParameter("resourceUuid", resourceUuid);
return count(query);
}
@@ -367,8 +384,8 @@ public List findByGroup(Context context, Group group, int offset
@Override
public int countResourcePolicyByGroup(Context context, Group group) throws SQLException {
Query query = createQuery(context, "SELECT count(*) " + "FROM " + ResourcePolicy.class.getSimpleName()
- + " WHERE epersongroup_id = (:groupUuid) ");
- query.setParameter("groupUuid", group.getID());
+ + " WHERE epersonGroup = :group ");
+ query.setParameter("group", group);
return count(query);
}
@@ -388,9 +405,9 @@ public List findByGroupAndResourceUuid(Context context, Group gr
@Override
public int countByGroupAndResourceUuid(Context context, Group group, UUID resourceUuid) throws SQLException {
Query query = createQuery(context, "SELECT count(*) FROM " + ResourcePolicy.class.getSimpleName()
- + " WHERE dspace_object = (:resourceUuid) AND epersongroup_id = (:groupUuid) ");
+ + " WHERE dSpaceObject.id = :resourceUuid AND epersonGroup = :group ");
query.setParameter("resourceUuid", resourceUuid);
- query.setParameter("groupUuid", group.getID());
+ query.setParameter("group", group);
return count(query);
}
diff --git a/dspace-api/src/main/java/org/dspace/checker/ChecksumHistory.java b/dspace-api/src/main/java/org/dspace/checker/ChecksumHistory.java
index 63779cda02fb..521bf546a4f2 100644
--- a/dspace-api/src/main/java/org/dspace/checker/ChecksumHistory.java
+++ b/dspace-api/src/main/java/org/dspace/checker/ChecksumHistory.java
@@ -8,19 +8,19 @@
package org.dspace.checker;
import java.util.Date;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.FetchType;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.SequenceGenerator;
-import javax.persistence.Table;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.FetchType;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.SequenceGenerator;
+import jakarta.persistence.Table;
+import jakarta.persistence.Temporal;
+import jakarta.persistence.TemporalType;
import org.dspace.content.Bitstream;
import org.dspace.core.Context;
import org.dspace.core.ReloadableEntity;
diff --git a/dspace-api/src/main/java/org/dspace/checker/ChecksumResult.java b/dspace-api/src/main/java/org/dspace/checker/ChecksumResult.java
index 57fcdb8e365e..a63488077703 100644
--- a/dspace-api/src/main/java/org/dspace/checker/ChecksumResult.java
+++ b/dspace-api/src/main/java/org/dspace/checker/ChecksumResult.java
@@ -8,12 +8,13 @@
package org.dspace.checker;
import java.io.Serializable;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.EnumType;
-import javax.persistence.Enumerated;
-import javax.persistence.Id;
-import javax.persistence.Table;
+
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.EnumType;
+import jakarta.persistence.Enumerated;
+import jakarta.persistence.Id;
+import jakarta.persistence.Table;
/**
* Database entity representation of the checksum_results table
diff --git a/dspace-api/src/main/java/org/dspace/checker/DailyReportEmailer.java b/dspace-api/src/main/java/org/dspace/checker/DailyReportEmailer.java
index b291232e8b55..50ef4baa98e3 100644
--- a/dspace-api/src/main/java/org/dspace/checker/DailyReportEmailer.java
+++ b/dspace-api/src/main/java/org/dspace/checker/DailyReportEmailer.java
@@ -13,8 +13,8 @@
import java.sql.SQLException;
import java.util.Date;
import java.util.GregorianCalendar;
-import javax.mail.MessagingException;
+import jakarta.mail.MessagingException;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
import org.apache.commons.cli.DefaultParser;
@@ -63,7 +63,7 @@ public DailyReportEmailer() {
* @throws MessagingException if message cannot be sent.
*/
public void sendReport(File attachment, int numberOfBitstreams)
- throws IOException, javax.mail.MessagingException {
+ throws IOException, jakarta.mail.MessagingException {
if (numberOfBitstreams > 0) {
ConfigurationService configurationService
= DSpaceServicesFactory.getInstance().getConfigurationService();
diff --git a/dspace-api/src/main/java/org/dspace/checker/MostRecentChecksum.java b/dspace-api/src/main/java/org/dspace/checker/MostRecentChecksum.java
index eff8a8be1cde..5cb1851e7c4f 100644
--- a/dspace-api/src/main/java/org/dspace/checker/MostRecentChecksum.java
+++ b/dspace-api/src/main/java/org/dspace/checker/MostRecentChecksum.java
@@ -9,16 +9,16 @@
import java.io.Serializable;
import java.util.Date;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.OneToOne;
-import javax.persistence.Table;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
-import javax.persistence.Transient;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.Id;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.OneToOne;
+import jakarta.persistence.Table;
+import jakarta.persistence.Temporal;
+import jakarta.persistence.TemporalType;
+import jakarta.persistence.Transient;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.dspace.content.Bitstream;
diff --git a/dspace-api/src/main/java/org/dspace/checker/dao/impl/ChecksumHistoryDAOImpl.java b/dspace-api/src/main/java/org/dspace/checker/dao/impl/ChecksumHistoryDAOImpl.java
index 328d4a717eb1..44c594d0eb32 100644
--- a/dspace-api/src/main/java/org/dspace/checker/dao/impl/ChecksumHistoryDAOImpl.java
+++ b/dspace-api/src/main/java/org/dspace/checker/dao/impl/ChecksumHistoryDAOImpl.java
@@ -9,9 +9,9 @@
import java.sql.SQLException;
import java.util.Date;
-import javax.persistence.Query;
-import javax.persistence.TemporalType;
+import jakarta.persistence.Query;
+import jakarta.persistence.TemporalType;
import org.dspace.checker.ChecksumHistory;
import org.dspace.checker.ChecksumResultCode;
import org.dspace.checker.dao.ChecksumHistoryDAO;
diff --git a/dspace-api/src/main/java/org/dspace/checker/dao/impl/ChecksumResultDAOImpl.java b/dspace-api/src/main/java/org/dspace/checker/dao/impl/ChecksumResultDAOImpl.java
index 7552c6d5bb8f..ac882e971dfe 100644
--- a/dspace-api/src/main/java/org/dspace/checker/dao/impl/ChecksumResultDAOImpl.java
+++ b/dspace-api/src/main/java/org/dspace/checker/dao/impl/ChecksumResultDAOImpl.java
@@ -8,10 +8,10 @@
package org.dspace.checker.dao.impl;
import java.sql.SQLException;
-import javax.persistence.criteria.CriteriaBuilder;
-import javax.persistence.criteria.CriteriaQuery;
-import javax.persistence.criteria.Root;
+import jakarta.persistence.criteria.CriteriaBuilder;
+import jakarta.persistence.criteria.CriteriaQuery;
+import jakarta.persistence.criteria.Root;
import org.dspace.checker.ChecksumResult;
import org.dspace.checker.ChecksumResultCode;
import org.dspace.checker.ChecksumResult_;
diff --git a/dspace-api/src/main/java/org/dspace/checker/dao/impl/MostRecentChecksumDAOImpl.java b/dspace-api/src/main/java/org/dspace/checker/dao/impl/MostRecentChecksumDAOImpl.java
index a31e02cbab4a..669621aeeb58 100644
--- a/dspace-api/src/main/java/org/dspace/checker/dao/impl/MostRecentChecksumDAOImpl.java
+++ b/dspace-api/src/main/java/org/dspace/checker/dao/impl/MostRecentChecksumDAOImpl.java
@@ -11,14 +11,14 @@
import java.util.Date;
import java.util.LinkedList;
import java.util.List;
-import javax.persistence.Query;
-import javax.persistence.criteria.CriteriaBuilder;
-import javax.persistence.criteria.CriteriaQuery;
-import javax.persistence.criteria.Join;
-import javax.persistence.criteria.Order;
-import javax.persistence.criteria.Root;
-import javax.persistence.criteria.Subquery;
+import jakarta.persistence.Query;
+import jakarta.persistence.criteria.CriteriaBuilder;
+import jakarta.persistence.criteria.CriteriaQuery;
+import jakarta.persistence.criteria.Join;
+import jakarta.persistence.criteria.Order;
+import jakarta.persistence.criteria.Root;
+import jakarta.persistence.criteria.Subquery;
import org.dspace.checker.ChecksumHistory;
import org.dspace.checker.ChecksumHistory_;
import org.dspace.checker.ChecksumResult;
diff --git a/dspace-api/src/main/java/org/dspace/content/Bitstream.java b/dspace-api/src/main/java/org/dspace/content/Bitstream.java
index 5485735a2816..3fdb6316b210 100644
--- a/dspace-api/src/main/java/org/dspace/content/Bitstream.java
+++ b/dspace-api/src/main/java/org/dspace/content/Bitstream.java
@@ -11,21 +11,21 @@
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.FetchType;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToMany;
-import javax.persistence.ManyToOne;
-import javax.persistence.OneToOne;
-import javax.persistence.Table;
-import javax.persistence.Transient;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.FetchType;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.ManyToMany;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.OneToOne;
+import jakarta.persistence.Table;
+import jakarta.persistence.Transient;
import org.dspace.content.factory.ContentServiceFactory;
import org.dspace.content.service.BitstreamService;
import org.dspace.core.Constants;
import org.dspace.core.Context;
-import org.hibernate.proxy.HibernateProxyHelper;
+import org.dspace.core.HibernateProxyHelper;
/**
* Class representing bitstreams stored in the DSpace system.
diff --git a/dspace-api/src/main/java/org/dspace/content/BitstreamFormat.java b/dspace-api/src/main/java/org/dspace/content/BitstreamFormat.java
index 6d64ee3073e9..4dacea0952a5 100644
--- a/dspace-api/src/main/java/org/dspace/content/BitstreamFormat.java
+++ b/dspace-api/src/main/java/org/dspace/content/BitstreamFormat.java
@@ -11,27 +11,28 @@
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
-import javax.persistence.CollectionTable;
-import javax.persistence.Column;
-import javax.persistence.ElementCollection;
-import javax.persistence.Entity;
-import javax.persistence.FetchType;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.SequenceGenerator;
-import javax.persistence.Table;
-import javax.persistence.Transient;
+import jakarta.persistence.CollectionTable;
+import jakarta.persistence.Column;
+import jakarta.persistence.ElementCollection;
+import jakarta.persistence.Entity;
+import jakarta.persistence.FetchType;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.SequenceGenerator;
+import jakarta.persistence.Table;
+import jakarta.persistence.Transient;
import org.dspace.content.factory.ContentServiceFactory;
import org.dspace.content.service.BitstreamFormatService;
import org.dspace.core.Context;
+import org.dspace.core.HibernateProxyHelper;
import org.dspace.core.ReloadableEntity;
import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CollectionId;
-import org.hibernate.annotations.Type;
-import org.hibernate.proxy.HibernateProxyHelper;
+import org.hibernate.annotations.CollectionIdJavaType;
+import org.hibernate.type.descriptor.java.IntegerJavaType;
/**
* Class representing a particular bitstream format.
@@ -55,8 +56,6 @@ public class BitstreamFormat implements Serializable, ReloadableEntity
@Column(name = "short_description", length = 128, unique = true)
private String shortDescription;
- // @Column(name="description")
-// @Lob //Generates a TEXT or LONGTEXT data type
@Column(name = "description", columnDefinition = "text")
private String description;
@@ -73,10 +72,10 @@ public class BitstreamFormat implements Serializable, ReloadableEntity
@ElementCollection(fetch = FetchType.EAGER)
@CollectionTable(name = "fileextension", joinColumns = @JoinColumn(name = "bitstream_format_id"))
@CollectionId(
- columns = @Column(name = "file_extension_id"),
- type = @Type(type = "integer"),
+ column = @Column(name = "file_extension_id"),
generator = "fileextension_seq"
)
+ @CollectionIdJavaType(IntegerJavaType.class)
@SequenceGenerator(name = "fileextension_seq", sequenceName = "fileextension_seq", allocationSize = 1)
@Column(name = "extension")
@Cascade( {org.hibernate.annotations.CascadeType.ALL, org.hibernate.annotations.CascadeType.DELETE_ORPHAN})
diff --git a/dspace-api/src/main/java/org/dspace/content/BitstreamServiceImpl.java b/dspace-api/src/main/java/org/dspace/content/BitstreamServiceImpl.java
index e23e5ce2c825..bd56ad465163 100644
--- a/dspace-api/src/main/java/org/dspace/content/BitstreamServiceImpl.java
+++ b/dspace-api/src/main/java/org/dspace/content/BitstreamServiceImpl.java
@@ -14,8 +14,8 @@
import java.util.List;
import java.util.UUID;
import java.util.regex.Pattern;
-import javax.annotation.Nullable;
+import jakarta.annotation.Nullable;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.Logger;
diff --git a/dspace-api/src/main/java/org/dspace/content/Bundle.java b/dspace-api/src/main/java/org/dspace/content/Bundle.java
index e5cbdb6ff244..b6fd269f8fc4 100644
--- a/dspace-api/src/main/java/org/dspace/content/Bundle.java
+++ b/dspace-api/src/main/java/org/dspace/content/Bundle.java
@@ -10,22 +10,22 @@
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.FetchType;
-import javax.persistence.JoinColumn;
-import javax.persistence.JoinTable;
-import javax.persistence.ManyToMany;
-import javax.persistence.OneToOne;
-import javax.persistence.OrderColumn;
-import javax.persistence.Table;
-import javax.persistence.Transient;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.FetchType;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.JoinTable;
+import jakarta.persistence.ManyToMany;
+import jakarta.persistence.OneToOne;
+import jakarta.persistence.OrderColumn;
+import jakarta.persistence.Table;
+import jakarta.persistence.Transient;
import org.dspace.content.factory.ContentServiceFactory;
import org.dspace.content.service.BundleService;
import org.dspace.core.Constants;
import org.dspace.core.Context;
-import org.hibernate.proxy.HibernateProxyHelper;
+import org.dspace.core.HibernateProxyHelper;
/**
* Class representing bundles of bitstreams stored in the DSpace system
diff --git a/dspace-api/src/main/java/org/dspace/content/CacheableDSpaceObject.java b/dspace-api/src/main/java/org/dspace/content/CacheableDSpaceObject.java
new file mode 100644
index 000000000000..fa6ec7676a32
--- /dev/null
+++ b/dspace-api/src/main/java/org/dspace/content/CacheableDSpaceObject.java
@@ -0,0 +1,20 @@
+/**
+ * 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.content;
+
+import jakarta.persistence.Cacheable;
+import org.hibernate.annotations.CacheConcurrencyStrategy;
+
+/**
+ * Abstract class for DSpaceObjects which are safe to cache in Hibernate's second level cache.
+ * See hibernate-ehcache-config.xml for caching configurations for each DSpaceObject which extends this class.
+ */
+@Cacheable
+@org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE, include = "non-lazy")
+public abstract class CacheableDSpaceObject extends DSpaceObject {
+}
diff --git a/dspace-api/src/main/java/org/dspace/content/Collection.java b/dspace-api/src/main/java/org/dspace/content/Collection.java
index a13c19d46cf8..17a6b1eb9420 100644
--- a/dspace-api/src/main/java/org/dspace/content/Collection.java
+++ b/dspace-api/src/main/java/org/dspace/content/Collection.java
@@ -15,19 +15,18 @@
import java.util.List;
import java.util.Set;
import java.util.UUID;
-import javax.annotation.Nonnull;
-import javax.persistence.Cacheable;
-import javax.persistence.CascadeType;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.FetchType;
-import javax.persistence.JoinColumn;
-import javax.persistence.JoinTable;
-import javax.persistence.ManyToMany;
-import javax.persistence.OneToOne;
-import javax.persistence.Table;
-import javax.persistence.Transient;
+import jakarta.annotation.Nonnull;
+import jakarta.persistence.CascadeType;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.FetchType;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.JoinTable;
+import jakarta.persistence.ManyToMany;
+import jakarta.persistence.OneToOne;
+import jakarta.persistence.Table;
+import jakarta.persistence.Transient;
import org.dspace.authorize.AuthorizeException;
import org.dspace.browse.ItemCountException;
import org.dspace.content.comparator.NameAscendingComparator;
@@ -35,9 +34,8 @@
import org.dspace.content.service.CollectionService;
import org.dspace.core.Constants;
import org.dspace.core.Context;
+import org.dspace.core.HibernateProxyHelper;
import org.dspace.eperson.Group;
-import org.hibernate.annotations.CacheConcurrencyStrategy;
-import org.hibernate.proxy.HibernateProxyHelper;
/**
* Class representing a collection.
@@ -54,9 +52,7 @@
*/
@Entity
@Table(name = "collection")
-@Cacheable
-@org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE, include = "non-lazy")
-public class Collection extends DSpaceObject implements DSpaceObjectLegacySupport {
+public class Collection extends CacheableDSpaceObject implements DSpaceObjectLegacySupport {
@Column(name = "collection_id", insertable = false, updatable = false)
private Integer legacyId;
diff --git a/dspace-api/src/main/java/org/dspace/content/Community.java b/dspace-api/src/main/java/org/dspace/content/Community.java
index d82e08bab72e..4c417361655c 100644
--- a/dspace-api/src/main/java/org/dspace/content/Community.java
+++ b/dspace-api/src/main/java/org/dspace/content/Community.java
@@ -12,18 +12,17 @@
import java.util.List;
import java.util.Set;
import java.util.UUID;
-import javax.persistence.Cacheable;
-import javax.persistence.CascadeType;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.FetchType;
-import javax.persistence.JoinColumn;
-import javax.persistence.JoinTable;
-import javax.persistence.ManyToMany;
-import javax.persistence.OneToOne;
-import javax.persistence.Table;
-import javax.persistence.Transient;
+import jakarta.persistence.CascadeType;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.FetchType;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.JoinTable;
+import jakarta.persistence.ManyToMany;
+import jakarta.persistence.OneToOne;
+import jakarta.persistence.Table;
+import jakarta.persistence.Transient;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.dspace.browse.ItemCountException;
import org.dspace.content.comparator.NameAscendingComparator;
@@ -31,9 +30,9 @@
import org.dspace.content.service.CommunityService;
import org.dspace.core.Constants;
import org.dspace.core.Context;
+import org.dspace.core.HibernateProxyHelper;
import org.dspace.eperson.Group;
-import org.hibernate.annotations.CacheConcurrencyStrategy;
-import org.hibernate.proxy.HibernateProxyHelper;
+
/**
* Class representing a community
@@ -46,9 +45,7 @@
*/
@Entity
@Table(name = "community")
-@Cacheable
-@org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE, include = "non-lazy")
-public class Community extends DSpaceObject implements DSpaceObjectLegacySupport {
+public class Community extends CacheableDSpaceObject implements DSpaceObjectLegacySupport {
@Column(name = "community_id", insertable = false, updatable = false)
private Integer legacyId;
diff --git a/dspace-api/src/main/java/org/dspace/content/DSpaceObject.java b/dspace-api/src/main/java/org/dspace/content/DSpaceObject.java
index 59217a109f66..b659035dc650 100644
--- a/dspace-api/src/main/java/org/dspace/content/DSpaceObject.java
+++ b/dspace-api/src/main/java/org/dspace/content/DSpaceObject.java
@@ -11,19 +11,19 @@
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
-import javax.persistence.CascadeType;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.FetchType;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-import javax.persistence.Inheritance;
-import javax.persistence.InheritanceType;
-import javax.persistence.OneToMany;
-import javax.persistence.OrderBy;
-import javax.persistence.Table;
-import javax.persistence.Transient;
+import jakarta.persistence.CascadeType;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.FetchType;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.Id;
+import jakarta.persistence.Inheritance;
+import jakarta.persistence.InheritanceType;
+import jakarta.persistence.OneToMany;
+import jakarta.persistence.OrderBy;
+import jakarta.persistence.Table;
+import jakarta.persistence.Transient;
import org.apache.commons.collections4.CollectionUtils;
import org.dspace.authorize.ResourcePolicy;
import org.dspace.core.ReloadableEntity;
diff --git a/dspace-api/src/main/java/org/dspace/content/DuplicateDetectionServiceImpl.java b/dspace-api/src/main/java/org/dspace/content/DuplicateDetectionServiceImpl.java
new file mode 100644
index 000000000000..9f52b7b63ac3
--- /dev/null
+++ b/dspace-api/src/main/java/org/dspace/content/DuplicateDetectionServiceImpl.java
@@ -0,0 +1,362 @@
+/**
+ * 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.content;
+
+import static java.util.Comparator.comparing;
+import static java.util.Comparator.naturalOrder;
+
+import java.sql.SQLException;
+import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Optional;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.velocity.exception.ResourceNotFoundException;
+import org.dspace.app.itemupdate.MetadataUtilities;
+import org.dspace.authorize.AuthorizeException;
+import org.dspace.authorize.service.AuthorizeService;
+import org.dspace.content.service.DuplicateDetectionService;
+import org.dspace.content.service.ItemService;
+import org.dspace.content.service.MetadataFieldService;
+import org.dspace.content.service.MetadataValueService;
+import org.dspace.content.service.WorkspaceItemService;
+import org.dspace.content.virtual.PotentialDuplicate;
+import org.dspace.core.Constants;
+import org.dspace.core.Context;
+import org.dspace.discovery.DiscoverQuery;
+import org.dspace.discovery.DiscoverResult;
+import org.dspace.discovery.IndexableObject;
+import org.dspace.discovery.SearchService;
+import org.dspace.discovery.SearchServiceException;
+import org.dspace.discovery.SearchUtils;
+import org.dspace.discovery.indexobject.IndexableItem;
+import org.dspace.discovery.indexobject.IndexableWorkflowItem;
+import org.dspace.discovery.indexobject.IndexableWorkspaceItem;
+import org.dspace.eperson.service.GroupService;
+import org.dspace.services.ConfigurationService;
+import org.dspace.versioning.VersionHistory;
+import org.dspace.versioning.service.VersionHistoryService;
+import org.dspace.workflow.WorkflowItem;
+import org.dspace.xmlworkflow.storedcomponents.service.XmlWorkflowItemService;
+import org.springframework.beans.factory.annotation.Autowired;
+
+/**
+ * Default implementation of DuplicateDetectionService.
+ * Duplicate Detection Service handles get, search and validation operations for duplicate detection.
+ *
+ * @author Kim Shepherd
+ */
+public class DuplicateDetectionServiceImpl implements DuplicateDetectionService {
+
+ @Autowired
+ ConfigurationService configurationService;
+ @Autowired
+ VersionHistoryService versionHistoryService;
+ @Autowired
+ AuthorizeService authorizeService;
+ @Autowired
+ GroupService groupService;
+ @Autowired
+ MetadataFieldService metadataFieldService;
+ @Autowired
+ MetadataValueService metadataValueService;
+ @Autowired
+ XmlWorkflowItemService workflowItemService;
+ @Autowired
+ WorkspaceItemService workspaceItemService;
+ @Autowired
+ ItemService itemService;
+
+ /**
+ * Get a list of PotentialDuplicate objects (wrappers with some metadata included for previewing) that
+ * are identified as potential duplicates of the given item
+ *
+ * @param context DSpace context
+ * @param item Item to check
+ * @return List of potential duplicates (empty if none found)
+ * @throws SearchServiceException if an error occurs performing the discovery search
+ */
+ @Override
+ public List getPotentialDuplicates(Context context, Item item)
+ throws SearchServiceException {
+ // Instantiate a new list of potential duplicates
+ List potentialDuplicates = new LinkedList<>();
+
+ // Immediately return an empty if this feature is not configured
+ if (!configurationService.getBooleanProperty("duplicate.enable", false)) {
+ return potentialDuplicates;
+ }
+
+ // Search duplicates of this item and get discovery search result
+ DiscoverResult discoverResult = searchDuplicates(context, item);
+
+ // If the search result is valid, iterate results and validate / transform
+ if (discoverResult != null) {
+ for (IndexableObject result : discoverResult.getIndexableObjects()) {
+ if (result != null) {
+ try {
+ // Validate this result and check permissions to read the item
+ Optional potentialDuplicateOptional =
+ validateDuplicateResult(context, result, item);
+ if (potentialDuplicateOptional.isPresent()) {
+ // Add the potential duplicate to the list
+ potentialDuplicates.add(potentialDuplicateOptional.get());
+ }
+ } catch (SQLException e) {
+ log.error("SQL Error obtaining duplicate result: " + e.getMessage());
+ } catch (AuthorizeException e) {
+ log.error("Authorize Error obtaining duplicate result: " + e.getMessage());
+ }
+ }
+ }
+ }
+
+ // Return the list of potential duplicates
+ return potentialDuplicates;
+ }
+
+
+
+ /**
+ * Validate an indexable object (returned by discovery search) to ensure it is permissible, readable and valid
+ * and can be added to a list of results.
+ * An Optional is returned, if it is empty then it was invalid or did not pass validation.
+ *
+ * @param context The DSpace context
+ * @param indexableObject The discovery search result
+ * @param original The original item (to compare IDs, submitters, etc)
+ * @return An Optional potential duplicate
+ * @throws SQLException
+ * @throws AuthorizeException
+ */
+ @Override
+ public Optional validateDuplicateResult(Context context, IndexableObject indexableObject,
+ Item original)
+ throws SQLException,
+ AuthorizeException {
+
+ Item resultItem = null;
+ PotentialDuplicate potentialDuplicate = null;
+ WorkspaceItem workspaceItem = null;
+ WorkflowItem workflowItem = null;
+
+ // Inspect the indexable object, and extract the DSpace item depending on
+ // what submission / archived state it is in
+ if (indexableObject instanceof IndexableWorkspaceItem) {
+ workspaceItem = ((IndexableWorkspaceItem) indexableObject).getIndexedObject();
+ // Only process workspace items that belong to the submitter
+ if (workspaceItem != null && workspaceItem.getSubmitter() != null
+ && workspaceItem.getSubmitter().equals(context.getCurrentUser())) {
+ resultItem = workspaceItem.getItem();
+ }
+ }
+ if (indexableObject instanceof IndexableWorkflowItem) {
+ workflowItem = ((IndexableWorkflowItem) indexableObject).getIndexedObject();
+ if (workflowItem != null) {
+ resultItem = workflowItem.getItem();
+ }
+ }
+ if (indexableObject instanceof IndexableItem) {
+ resultItem = ((IndexableItem) indexableObject).getIndexedObject();
+ // Attempt resolution of workflow or workspace items, tested later
+ workflowItem = workflowItemService.findByItem(context, resultItem);
+ workspaceItem = workspaceItemService.findByItem(context, resultItem);
+ }
+
+ // Result item must not be null, a template item, or actually identical to the original
+ if (resultItem == null) {
+ log.warn("skipping null item in duplicate search results");
+ return Optional.empty();
+ } else if (resultItem.getTemplateItemOf() != null) {
+ log.info("skipping template item in duplicate search results, item={}", resultItem.getID());
+ return Optional.empty();
+ } else if (resultItem.getID().equals(original.getID())) {
+ log.info("skipping a duplicate search result for the original item", resultItem.getID());
+ return Optional.empty();
+ }
+
+ // If our item and the duplicate candidate share the same versionHistory, they are two different
+ // versions of the same item.
+ VersionHistory versionHistory = versionHistoryService.findByItem(context, original);
+ VersionHistory candiateVersionHistory = versionHistoryService.findByItem(context, resultItem);
+ // if the versionHistory is null, either versioning is switched off or the item doesn't have
+ // multiple versions
+ if (versionHistory != null && versionHistory.equals(candiateVersionHistory)) {
+ log.warn("skipping item that is just another version of this item");
+ return Optional.empty();
+ }
+
+ // Construct new potential duplicate object
+ potentialDuplicate = new PotentialDuplicate(resultItem);
+
+ // Get configured list of metadata fields to copy
+ List fields = new ArrayList<>(Arrays.asList(
+ configurationService.getArrayProperty("duplicate.preview.metadata.field", new String[]{})));
+
+ // Get item metadata and if it's configured for mapping, copy it across to the potential duplicate object
+ List metadata = resultItem.getCachedMetadata();
+
+ // Prepare a map of metadata to set on the potential duplicate object
+ for (MetadataValue metadatum : metadata) {
+ String fieldName = metadatum.getMetadataField().toString('.');
+ if (fields.contains(fieldName)) {
+ potentialDuplicate.getMetadataValueList().add(metadatum);
+ }
+ }
+
+ // Only if the current user is also the submitter of the item will we add this information
+ if (workspaceItem != null && workspaceItem.getSubmitter() != null
+ && workspaceItem.getSubmitter().equals(context.getCurrentUser())) {
+ potentialDuplicate.setWorkspaceItemId(workspaceItem.getID());
+ return Optional.of(potentialDuplicate);
+ }
+
+ // More authorisation checks
+ if (workflowItem != null) {
+ Collection c = workflowItem.getCollection();
+ if (groupService.isMember(context, context.getCurrentUser(), c.getWorkflowStep1(context)) ||
+ groupService.isMember(context, context.getCurrentUser(), c.getWorkflowStep2(context)) ||
+ groupService.isMember(context, context.getCurrentUser(), c.getWorkflowStep3(context))) {
+ // Current user is a member of one of the workflow role groups
+ potentialDuplicate.setWorkflowItemId(workflowItem.getID());
+ return Optional.of(potentialDuplicate);
+ }
+ } else if (resultItem.isArchived() && !resultItem.isWithdrawn() && resultItem.isDiscoverable()) {
+ // Not a workspace or workflow item, but is it archived, not withdrawn, and discoverable?
+ // Is it readable by the current user?
+ if (authorizeService.authorizeActionBoolean(context, resultItem, Constants.READ)) {
+ return Optional.of(potentialDuplicate);
+ }
+ } else if (authorizeService.isAdmin(context, resultItem)) {
+ // Admins can always read, return immediately
+ return Optional.of(potentialDuplicate);
+ } else {
+ log.info("Potential duplicate result is not readable by the current user, skipping item={}",
+ potentialDuplicate.getUuid());
+ }
+
+ // By default, return an empty result
+ return Optional.empty();
+ }
+
+ /**
+ * Search discovery for potential duplicates of a given item. The search uses levenshtein distance (configurable)
+ * and a single-term "comparison value" constructed out of the item title
+ *
+ * @param context DSpace context
+ * @param item The item to check
+ * @return DiscoverResult as a result of performing search. Null if invalid.
+ *
+ * @throws SearchServiceException if an error was encountered during the discovery search itself.
+ */
+ @Override
+ public DiscoverResult searchDuplicates(Context context, Item item) throws SearchServiceException {
+
+ // If the item is null or otherwise invalid (template, etc) then throw an appropriate error
+ if (item == null) {
+ throw new ResourceNotFoundException("Duplicate search error: item is null");
+ }
+ if (item.getTemplateItemOf() != null) {
+ throw new IllegalArgumentException("Cannot get duplicates for template item");
+ }
+
+ // Build normalised comparison value
+ String comparisonValue = buildComparisonValue(context, item);
+
+ // Construct query
+ if (StringUtils.isNotBlank(comparisonValue)) {
+ // Get search service
+ SearchService searchService = SearchUtils.getSearchService();
+
+ // Escape reserved solr characters
+ comparisonValue = searchService.escapeQueryChars(comparisonValue);
+
+ // Construct discovery query based on comparison value
+ DiscoverQuery discoverQuery = new DiscoverQuery();
+ discoverQuery.setQuery("(" + configurationService.getProperty("duplicate.comparison.solr.field",
+ "deduplication_keyword") + ":" + comparisonValue + "~" +
+ configurationService.getIntProperty("duplicate.comparison.distance", 0) + ")");
+ // Add filter queries for the resource type
+ discoverQuery.addFilterQueries("(search.resourcetype:Item OR " +
+ "search.resourcetype:WorkspaceItem OR " +
+ "search.resourcetype:XmlWorkflowItem OR search.resourcetype:WorkflowItem)");
+ // Skip this item itself so it isn't a false positive
+ discoverQuery.addFilterQueries("-search.resourceid:" + item.getID());
+
+ // Perform search and populate list with results, update total count integer
+ return searchService.search(context, discoverQuery);
+ } else {
+ log.warn("empty item comparison value, ignoring for duplicate search");
+ }
+
+ // Return null by default
+ return null;
+
+ }
+
+ /**
+ * Build a comparison value string made up of values of configured fields, used when indexing and querying
+ * items for deduplication
+ * @param context DSpace context
+ * @param item The DSpace item
+ * @return a constructed, normalised string
+ */
+ @Override
+ public String buildComparisonValue(Context context, Item item) {
+ // Get configured fields to use for comparison values
+ String[] comparisonFields = configurationService.getArrayProperty("duplicate.comparison.metadata.field",
+ new String[]{"dc.title"});
+ // Get all values, in order, for these fields
+ StringBuilder comparisonValueBuilder = new StringBuilder();
+ String comparisonValue = null;
+ for (String field : comparisonFields) {
+ try {
+ // Get field components
+ String[] fieldParts = MetadataUtilities.parseCompoundForm(field);
+ // Get all values of this field
+ List metadataValues = itemService.getMetadata(item,
+ fieldParts[0], fieldParts[1], (fieldParts.length > 2 ? fieldParts[2] : null), Item.ANY);
+ // Sort metadata values by text value, so their 'position' in db doesn't matter for dedupe purposes
+ metadataValues.sort(comparing(MetadataValue::getValue, naturalOrder()));
+ for (MetadataValue metadataValue : metadataValues) {
+ // Add each found value to the string builder (null values interpreted as empty)
+ if (metadataValue != null) {
+ comparisonValueBuilder.append(metadataValue.getValue());
+ }
+ }
+ } catch (ParseException e) {
+ // Log error and continue processing
+ log.error("Error parsing configured field for deduplication comparison: item={}, field={}",
+ item.getID(), field);
+ } catch (NullPointerException e) {
+ log.error("Null pointer encountered, probably during metadata value sort, when deduping:" +
+ "item={}, field={}", item.getID(), field);
+ }
+ }
+
+ // Build string
+ comparisonValue = comparisonValueBuilder.toString();
+
+ // Normalise according to configuration
+ if (!StringUtils.isBlank(comparisonValue)) {
+ if (configurationService.getBooleanProperty("duplicate.comparison.normalise.lowercase")) {
+ comparisonValue = comparisonValue.toLowerCase(context.getCurrentLocale());
+ }
+ if (configurationService.getBooleanProperty("duplicate.comparison.normalise.whitespace")) {
+ comparisonValue = comparisonValue.replaceAll("\\s+", "");
+ }
+ }
+
+ // Return comparison value
+ return comparisonValue;
+ }
+
+}
diff --git a/dspace-api/src/main/java/org/dspace/content/EntityType.java b/dspace-api/src/main/java/org/dspace/content/EntityType.java
index 20ab758a0b76..720e0c492ca7 100644
--- a/dspace-api/src/main/java/org/dspace/content/EntityType.java
+++ b/dspace-api/src/main/java/org/dspace/content/EntityType.java
@@ -8,14 +8,14 @@
package org.dspace.content;
import java.util.Objects;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.SequenceGenerator;
-import javax.persistence.Table;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.SequenceGenerator;
+import jakarta.persistence.Table;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.dspace.core.ReloadableEntity;
diff --git a/dspace-api/src/main/java/org/dspace/content/FeedbackServiceImpl.java b/dspace-api/src/main/java/org/dspace/content/FeedbackServiceImpl.java
index 7e34af132b0a..13f149f69f64 100644
--- a/dspace-api/src/main/java/org/dspace/content/FeedbackServiceImpl.java
+++ b/dspace-api/src/main/java/org/dspace/content/FeedbackServiceImpl.java
@@ -9,9 +9,9 @@
import java.io.IOException;
import java.util.Date;
import java.util.Objects;
-import javax.mail.MessagingException;
-import javax.servlet.http.HttpServletRequest;
+import jakarta.mail.MessagingException;
+import jakarta.servlet.http.HttpServletRequest;
import org.apache.commons.lang.StringUtils;
import org.dspace.content.service.FeedbackService;
import org.dspace.core.Context;
diff --git a/dspace-api/src/main/java/org/dspace/content/Item.java b/dspace-api/src/main/java/org/dspace/content/Item.java
index 547ff490b84b..5422528f84a3 100644
--- a/dspace-api/src/main/java/org/dspace/content/Item.java
+++ b/dspace-api/src/main/java/org/dspace/content/Item.java
@@ -14,27 +14,28 @@
import java.util.List;
import java.util.Set;
import java.util.UUID;
-import javax.persistence.CascadeType;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.FetchType;
-import javax.persistence.JoinColumn;
-import javax.persistence.JoinTable;
-import javax.persistence.ManyToMany;
-import javax.persistence.ManyToOne;
-import javax.persistence.OneToOne;
-import javax.persistence.Table;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
-import javax.persistence.Transient;
+import jakarta.persistence.CascadeType;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.FetchType;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.JoinTable;
+import jakarta.persistence.ManyToMany;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.OneToOne;
+import jakarta.persistence.Table;
+import jakarta.persistence.Temporal;
+import jakarta.persistence.TemporalType;
+import jakarta.persistence.Transient;
import org.dspace.content.comparator.NameAscendingComparator;
import org.dspace.content.factory.ContentServiceFactory;
import org.dspace.content.service.ItemService;
import org.dspace.core.Constants;
import org.dspace.core.Context;
+import org.dspace.core.HibernateProxyHelper;
import org.dspace.eperson.EPerson;
-import org.hibernate.proxy.HibernateProxyHelper;
+
/**
* Class representing an item in DSpace.
diff --git a/dspace-api/src/main/java/org/dspace/content/ItemServiceImpl.java b/dspace-api/src/main/java/org/dspace/content/ItemServiceImpl.java
index 264685be7432..d60909d28771 100644
--- a/dspace-api/src/main/java/org/dspace/content/ItemServiceImpl.java
+++ b/dspace-api/src/main/java/org/dspace/content/ItemServiceImpl.java
@@ -97,7 +97,7 @@ public class ItemServiceImpl extends DSpaceObjectServiceImpl- implements It
/**
* log4j category
*/
- private static final Logger log = org.apache.logging.log4j.LogManager.getLogger(Item.class);
+ private static final Logger log = org.apache.logging.log4j.LogManager.getLogger();
@Autowired(required = true)
protected ItemDAO itemDAO;
@@ -1435,7 +1435,7 @@ public Iterator
- findByMetadataField(Context context,
public List
- findByMetadataQuery(Context context, List queryPredicates,
List collectionUuids, long offset, int limit)
throws SQLException {
- return itemDAO.findByMetadataQuery(context, queryPredicates, collectionUuids, "text_value ~ ?",
+ return itemDAO.findByMetadataQuery(context, queryPredicates, collectionUuids, "value ~ ?",
offset, limit);
}
@@ -1444,7 +1444,7 @@ public List
- findByMetadataQuery(Context context, List quer
public long countForMetadataQuery(Context context, List queryPredicates,
List collectionUuids)
throws SQLException {
- return itemDAO.countForMetadataQuery(context, queryPredicates, collectionUuids, "text_value ~ ?");
+ return itemDAO.countForMetadataQuery(context, queryPredicates, collectionUuids, "value ~ ?");
}
@Override
@@ -1742,6 +1742,8 @@ public List getMetadata(Item item, String schema, String element,
*/
@Override
protected void moveSingleMetadataValue(Context context, Item dso, int place, MetadataValue rr) {
+ // If this is a (virtual) metadata value representing a relationship,
+ // then we must also update the corresponding Relationship with the new place
if (rr instanceof RelationshipMetadataValue) {
try {
//Retrieve the applicable relationship
@@ -1757,10 +1759,10 @@ protected void moveSingleMetadataValue(Context context, Item dso, int place, Met
//should not occur, otherwise metadata can't be updated either
log.error("An error occurred while moving " + rr.getAuthority() + " for item " + dso.getID(), e);
}
- } else {
- //just move the metadata
- rr.setPlace(place);
}
+
+ // Update the MetadataValue object with the new place setting
+ rr.setPlace(place);
}
@Override
diff --git a/dspace-api/src/main/java/org/dspace/content/MetadataField.java b/dspace-api/src/main/java/org/dspace/content/MetadataField.java
index 8b767011999e..cbe90a374432 100644
--- a/dspace-api/src/main/java/org/dspace/content/MetadataField.java
+++ b/dspace-api/src/main/java/org/dspace/content/MetadataField.java
@@ -7,23 +7,22 @@
*/
package org.dspace.content;
-import javax.persistence.Cacheable;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.FetchType;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.SequenceGenerator;
-import javax.persistence.Table;
-
+import jakarta.persistence.Cacheable;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.FetchType;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.SequenceGenerator;
+import jakarta.persistence.Table;
import org.dspace.core.Context;
+import org.dspace.core.HibernateProxyHelper;
import org.dspace.core.ReloadableEntity;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
-import org.hibernate.proxy.HibernateProxyHelper;
/**
@@ -58,8 +57,6 @@ public class MetadataField implements ReloadableEntity {
@Column(name = "qualifier", length = 64)
private String qualifier = null;
- // @Column(name = "scope_note")
-// @Lob
@Column(name = "scope_note", columnDefinition = "text")
private String scopeNote;
diff --git a/dspace-api/src/main/java/org/dspace/content/MetadataFieldName.java b/dspace-api/src/main/java/org/dspace/content/MetadataFieldName.java
index 8d7f4b027733..32c08dab2b56 100644
--- a/dspace-api/src/main/java/org/dspace/content/MetadataFieldName.java
+++ b/dspace-api/src/main/java/org/dspace/content/MetadataFieldName.java
@@ -8,7 +8,8 @@
package org.dspace.content;
import java.util.Arrays;
-import javax.annotation.Nonnull;
+
+import jakarta.annotation.Nonnull;
/**
* Simple immutable holder for the name of a metadata field.
diff --git a/dspace-api/src/main/java/org/dspace/content/MetadataSchema.java b/dspace-api/src/main/java/org/dspace/content/MetadataSchema.java
index f60e5e1604cf..b9a4665e6672 100644
--- a/dspace-api/src/main/java/org/dspace/content/MetadataSchema.java
+++ b/dspace-api/src/main/java/org/dspace/content/MetadataSchema.java
@@ -7,19 +7,18 @@
*/
package org.dspace.content;
-import javax.persistence.Cacheable;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.SequenceGenerator;
-import javax.persistence.Table;
-
+import jakarta.persistence.Cacheable;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.SequenceGenerator;
+import jakarta.persistence.Table;
import org.dspace.core.Context;
+import org.dspace.core.HibernateProxyHelper;
import org.dspace.core.ReloadableEntity;
import org.hibernate.annotations.CacheConcurrencyStrategy;
-import org.hibernate.proxy.HibernateProxyHelper;
/**
* Class representing a schema in DSpace.
diff --git a/dspace-api/src/main/java/org/dspace/content/MetadataValue.java b/dspace-api/src/main/java/org/dspace/content/MetadataValue.java
index 31479e620618..279bdd67c243 100644
--- a/dspace-api/src/main/java/org/dspace/content/MetadataValue.java
+++ b/dspace-api/src/main/java/org/dspace/content/MetadataValue.java
@@ -7,24 +7,22 @@
*/
package org.dspace.content;
-import javax.persistence.CascadeType;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.FetchType;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.Lob;
-import javax.persistence.ManyToOne;
-import javax.persistence.SequenceGenerator;
-import javax.persistence.Table;
-import javax.persistence.Transient;
-
+import jakarta.persistence.CascadeType;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.FetchType;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.SequenceGenerator;
+import jakarta.persistence.Table;
+import jakarta.persistence.Transient;
import org.dspace.core.Context;
+import org.dspace.core.HibernateProxyHelper;
import org.dspace.core.ReloadableEntity;
-import org.hibernate.annotations.Type;
-import org.hibernate.proxy.HibernateProxyHelper;
+import org.hibernate.Length;
/**
* Database access class representing a Dublin Core metadata value.
@@ -59,9 +57,7 @@ public class MetadataValue implements ReloadableEntity {
/**
* The value of the field
*/
- @Lob
- @Type(type = "org.hibernate.type.TextType")
- @Column(name = "text_value")
+ @Column(name = "text_value", length = Length.LONG32)
private String value;
/**
diff --git a/dspace-api/src/main/java/org/dspace/content/PredefinedUUIDGenerator.java b/dspace-api/src/main/java/org/dspace/content/PredefinedUUIDGenerator.java
index aa4a8ea5429c..15d302ec6152 100644
--- a/dspace-api/src/main/java/org/dspace/content/PredefinedUUIDGenerator.java
+++ b/dspace-api/src/main/java/org/dspace/content/PredefinedUUIDGenerator.java
@@ -7,7 +7,6 @@
*/
package org.dspace.content;
-import java.io.Serializable;
import java.util.UUID;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
@@ -21,7 +20,7 @@
public class PredefinedUUIDGenerator extends UUIDGenerator {
@Override
- public Serializable generate(SharedSessionContractImplementor session, Object object) {
+ public Object generate(SharedSessionContractImplementor session, Object object) {
if (object instanceof DSpaceObject) {
UUID uuid = ((DSpaceObject) object).getPredefinedUUID();
if (uuid != null) {
diff --git a/dspace-api/src/main/java/org/dspace/content/QAEventProcessed.java b/dspace-api/src/main/java/org/dspace/content/QAEventProcessed.java
index 3631a2ff68c6..fcca5b45703a 100644
--- a/dspace-api/src/main/java/org/dspace/content/QAEventProcessed.java
+++ b/dspace-api/src/main/java/org/dspace/content/QAEventProcessed.java
@@ -9,15 +9,15 @@
import java.io.Serializable;
import java.util.Date;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.Table;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.Id;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.Table;
+import jakarta.persistence.Temporal;
+import jakarta.persistence.TemporalType;
import org.dspace.eperson.EPerson;
/**
diff --git a/dspace-api/src/main/java/org/dspace/content/Relationship.java b/dspace-api/src/main/java/org/dspace/content/Relationship.java
index 77c418a23dea..05e4b0071861 100644
--- a/dspace-api/src/main/java/org/dspace/content/Relationship.java
+++ b/dspace-api/src/main/java/org/dspace/content/Relationship.java
@@ -7,19 +7,20 @@
*/
package org.dspace.content;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.FetchType;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.SequenceGenerator;
-import javax.persistence.Table;
-
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.FetchType;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.SequenceGenerator;
+import jakarta.persistence.Table;
import org.dspace.core.Context;
import org.dspace.core.ReloadableEntity;
+import org.hibernate.annotations.JdbcTypeCode;
+import org.hibernate.type.SqlTypes;
/**
* This class represents a relationship
@@ -96,6 +97,7 @@ public class Relationship implements ReloadableEntity {
* This column affects what version of an item appears on search pages or the relationship listings of other items.
*/
@Column(name = "latest_version_status")
+ @JdbcTypeCode(SqlTypes.INTEGER)
private LatestVersionStatus latestVersionStatus = LatestVersionStatus.BOTH;
/**
diff --git a/dspace-api/src/main/java/org/dspace/content/RelationshipType.java b/dspace-api/src/main/java/org/dspace/content/RelationshipType.java
index 5e6941052b83..ba5f0531e97e 100644
--- a/dspace-api/src/main/java/org/dspace/content/RelationshipType.java
+++ b/dspace-api/src/main/java/org/dspace/content/RelationshipType.java
@@ -7,20 +7,21 @@
*/
package org.dspace.content;
-import javax.persistence.CascadeType;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.FetchType;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.SequenceGenerator;
-import javax.persistence.Table;
-
+import jakarta.persistence.CascadeType;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.FetchType;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.SequenceGenerator;
+import jakarta.persistence.Table;
import org.dspace.core.Context;
import org.dspace.core.ReloadableEntity;
+import org.hibernate.annotations.JdbcTypeCode;
+import org.hibernate.type.SqlTypes;
/**
* Class representing a RelationshipType
@@ -118,6 +119,7 @@ public class RelationshipType implements ReloadableEntity {
* The value indicating whether relationships of this type should be ignored on the right/left/neither.
*/
@Column(name = "tilted")
+ @JdbcTypeCode(SqlTypes.INTEGER)
private Tilted tilted;
/**
diff --git a/dspace-api/src/main/java/org/dspace/content/Site.java b/dspace-api/src/main/java/org/dspace/content/Site.java
index 0bdab6ffe564..904c1d3e6b86 100644
--- a/dspace-api/src/main/java/org/dspace/content/Site.java
+++ b/dspace-api/src/main/java/org/dspace/content/Site.java
@@ -7,28 +7,23 @@
*/
package org.dspace.content;
-import javax.persistence.Cacheable;
-import javax.persistence.Entity;
-import javax.persistence.Table;
-import javax.persistence.Transient;
-
+import jakarta.persistence.Entity;
+import jakarta.persistence.Table;
+import jakarta.persistence.Transient;
import org.dspace.content.factory.ContentServiceFactory;
import org.dspace.content.service.SiteService;
import org.dspace.core.Constants;
import org.dspace.core.Context;
import org.dspace.services.ConfigurationService;
import org.dspace.services.factory.DSpaceServicesFactory;
-import org.hibernate.annotations.CacheConcurrencyStrategy;
/**
* Represents the root of the DSpace Archive.
* By default, the handle suffix "0" represents the Site, e.g. "1721.1/0"
*/
@Entity
-@Cacheable
-@org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
@Table(name = "site")
-public class Site extends DSpaceObject {
+public class Site extends CacheableDSpaceObject {
@Transient
private transient SiteService siteService;
diff --git a/dspace-api/src/main/java/org/dspace/content/WorkspaceItem.java b/dspace-api/src/main/java/org/dspace/content/WorkspaceItem.java
index a4c880173bf7..355e18269494 100644
--- a/dspace-api/src/main/java/org/dspace/content/WorkspaceItem.java
+++ b/dspace-api/src/main/java/org/dspace/content/WorkspaceItem.java
@@ -8,23 +8,23 @@
package org.dspace.content;
import java.io.Serializable;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.FetchType;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.OneToOne;
-import javax.persistence.SequenceGenerator;
-import javax.persistence.Table;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.FetchType;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.OneToOne;
+import jakarta.persistence.SequenceGenerator;
+import jakarta.persistence.Table;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.dspace.core.Context;
+import org.dspace.core.HibernateProxyHelper;
import org.dspace.eperson.EPerson;
import org.dspace.workflow.WorkflowItem;
-import org.hibernate.proxy.HibernateProxyHelper;
/**
* Class representing an item in the process of being submitted by a user
diff --git a/dspace-api/src/main/java/org/dspace/content/WorkspaceItemServiceImpl.java b/dspace-api/src/main/java/org/dspace/content/WorkspaceItemServiceImpl.java
index b6e7372af184..b78f6b9f7de8 100644
--- a/dspace-api/src/main/java/org/dspace/content/WorkspaceItemServiceImpl.java
+++ b/dspace-api/src/main/java/org/dspace/content/WorkspaceItemServiceImpl.java
@@ -96,11 +96,18 @@ public WorkspaceItem find(Context context, int id) throws SQLException {
@Override
public WorkspaceItem create(Context context, Collection collection, boolean template)
throws AuthorizeException, SQLException {
- return create(context, collection, null, template);
+ return create(context, collection, null, template, false);
}
@Override
- public WorkspaceItem create(Context context, Collection collection, UUID uuid, boolean template)
+ public WorkspaceItem create(Context context, Collection collection, boolean template, boolean isNewVersion)
+ throws AuthorizeException, SQLException {
+ return create(context, collection, null, template, isNewVersion);
+ }
+
+ @Override
+ public WorkspaceItem create(Context context, Collection collection, UUID uuid, boolean template,
+ boolean isNewVersion)
throws AuthorizeException, SQLException {
// Check the user has permission to ADD to the collection
authorizeService.authorizeAction(context, collection, Constants.ADD);
@@ -174,8 +181,10 @@ public WorkspaceItem create(Context context, Collection collection, UUID uuid, b
// If configured, register identifiers (eg handle, DOI) now. This is typically used with the Show Identifiers
// submission step which previews minted handles and DOIs during the submission process. Default: false
+ // Additional check needed: if we are creating a new version of an existing item we skip the identifier
+ // generation here, as this will be performed when the new version is created in VersioningServiceImpl
if (DSpaceServicesFactory.getInstance().getConfigurationService()
- .getBooleanProperty("identifiers.submission.register", false)) {
+ .getBooleanProperty("identifiers.submission.register", false) && !isNewVersion) {
try {
// Get map of filters to use for identifier types, while the item is in progress
Map, Filter> filters = FilterUtils.getIdentifierFilters(true);
diff --git a/dspace-api/src/main/java/org/dspace/content/dao/ItemDAO.java b/dspace-api/src/main/java/org/dspace/content/dao/ItemDAO.java
index 92dc0fb237c9..417c768882fa 100644
--- a/dspace-api/src/main/java/org/dspace/content/dao/ItemDAO.java
+++ b/dspace-api/src/main/java/org/dspace/content/dao/ItemDAO.java
@@ -88,7 +88,7 @@ Iterator
- findByMetadataField(Context context, MetadataField metadataField,
* @param collectionUuids UUIDs of the collections to search.
* If none are provided, the entire repository will be searched.
* @param regexClause Syntactic expression used to query the database using a regular expression
- * (e.g.: "text_value ~ ?")
+ * (e.g.: "value ~ ?")
* @param offset The offset for the query
* @param limit Maximum number of items to return
* @return A list containing the items that match the provided criteria
diff --git a/dspace-api/src/main/java/org/dspace/content/dao/impl/BitstreamDAOImpl.java b/dspace-api/src/main/java/org/dspace/content/dao/impl/BitstreamDAOImpl.java
index 276ea2b3430a..25f102f6def4 100644
--- a/dspace-api/src/main/java/org/dspace/content/dao/impl/BitstreamDAOImpl.java
+++ b/dspace-api/src/main/java/org/dspace/content/dao/impl/BitstreamDAOImpl.java
@@ -13,16 +13,21 @@
import java.util.List;
import java.util.Map;
import java.util.UUID;
-import javax.persistence.Query;
-import javax.persistence.criteria.CriteriaBuilder;
-import javax.persistence.criteria.CriteriaQuery;
-import javax.persistence.criteria.Root;
+import jakarta.persistence.Query;
+import jakarta.persistence.criteria.CriteriaBuilder;
+import jakarta.persistence.criteria.CriteriaQuery;
+import jakarta.persistence.criteria.Join;
+import jakarta.persistence.criteria.Root;
import org.dspace.content.Bitstream;
import org.dspace.content.Bitstream_;
+import org.dspace.content.Bundle;
+import org.dspace.content.Bundle_;
import org.dspace.content.Collection;
+import org.dspace.content.Collection_;
import org.dspace.content.Community;
import org.dspace.content.Item;
+import org.dspace.content.Item_;
import org.dspace.content.dao.BitstreamDAO;
import org.dspace.core.AbstractHibernateDSODAO;
import org.dspace.core.Constants;
@@ -78,14 +83,21 @@ public List findBitstreamsWithNoRecentChecksum(Context context) throw
@Override
public Iterator findByCommunity(Context context, Community community) throws SQLException {
- Query query = createQuery(context, "select b.id from Bitstream b " +
- "join b.bundles bitBundles " +
- "join bitBundles.items item " +
- "join item.collections itemColl " +
- "join itemColl.communities community " +
- "WHERE :community IN community");
-
- query.setParameter("community", community);
+ // Select UUID of all bitstreams, joining from Bitstream -> Bundle -> Item -> Collection -> Community
+ // to find all that exist under the given community.
+ CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context);
+ CriteriaQuery criteriaQuery = criteriaBuilder.createQuery(UUID.class);
+ Root bitstreamRoot = criteriaQuery.from(Bitstream.class);
+ criteriaQuery.select(bitstreamRoot.get(Bitstream_.id));
+ // Joins from Bitstream -> Bundle -> Item -> Collection
+ Join joinBundle = bitstreamRoot.join(Bitstream_.bundles);
+ Join joinItem = joinBundle.join(Bundle_.items);
+ Join
- joinCollection = joinItem.join(Item_.collections);
+ // Where "community" is a member of the list of Communities linked by the collection(s)
+ criteriaQuery.where(criteriaBuilder.isMember(community, joinCollection.get(Collection_.COMMUNITIES)));
+
+ // Transform into a query object to execute
+ Query query = createQuery(context, criteriaQuery);
@SuppressWarnings("unchecked")
List uuids = query.getResultList();
return new UUIDIterator(context, uuids, Bitstream.class, this);
@@ -93,13 +105,20 @@ public Iterator findByCommunity(Context context, Community community)
@Override
public Iterator findByCollection(Context context, Collection collection) throws SQLException {
- Query query = createQuery(context, "select b.id from Bitstream b " +
- "join b.bundles bitBundles " +
- "join bitBundles.items item " +
- "join item.collections c " +
- "WHERE :collection IN c");
-
- query.setParameter("collection", collection);
+ // Select UUID of all bitstreams, joining from Bitstream -> Bundle -> Item -> Collection
+ // to find all that exist under the given collection.
+ CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context);
+ CriteriaQuery criteriaQuery = criteriaBuilder.createQuery(UUID.class);
+ Root bitstreamRoot = criteriaQuery.from(Bitstream.class);
+ criteriaQuery.select(bitstreamRoot.get(Bitstream_.id));
+ // Joins from Bitstream -> Bundle -> Item
+ Join joinBundle = bitstreamRoot.join(Bitstream_.bundles);
+ Join joinItem = joinBundle.join(Bundle_.items);
+ // Where "collection" is a member of the list of Collections linked by the item(s)
+ criteriaQuery.where(criteriaBuilder.isMember(collection, joinItem.get(Item_.collections)));
+
+ // Transform into a query object to execute
+ Query query = createQuery(context, criteriaQuery);
@SuppressWarnings("unchecked")
List uuids = query.getResultList();
return new UUIDIterator(context, uuids, Bitstream.class, this);
@@ -107,12 +126,19 @@ public Iterator findByCollection(Context context, Collection collecti
@Override
public Iterator findByItem(Context context, Item item) throws SQLException {
- Query query = createQuery(context, "select b.id from Bitstream b " +
- "join b.bundles bitBundles " +
- "join bitBundles.items item " +
- "WHERE :item IN item");
-
- query.setParameter("item", item);
+ // Select UUID of all bitstreams, joining from Bitstream -> Bundle -> Item
+ // to find all that exist under the given item.
+ CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context);
+ CriteriaQuery criteriaQuery = criteriaBuilder.createQuery(UUID.class);
+ Root bitstreamRoot = criteriaQuery.from(Bitstream.class);
+ criteriaQuery.select(bitstreamRoot.get(Bitstream_.id));
+ // Join from Bitstream -> Bundle
+ Join joinBundle = bitstreamRoot.join(Bitstream_.bundles);
+ // Where "item" is a member of the list of Items linked by the bundle(s)
+ criteriaQuery.where(criteriaBuilder.isMember(item, joinBundle.get(Bundle_.items)));
+
+ // Transform into a query object to execute
+ Query query = createQuery(context, criteriaQuery);
@SuppressWarnings("unchecked")
List uuids = query.getResultList();
return new UUIDIterator(context, uuids, Bitstream.class, this);
diff --git a/dspace-api/src/main/java/org/dspace/content/dao/impl/BitstreamFormatDAOImpl.java b/dspace-api/src/main/java/org/dspace/content/dao/impl/BitstreamFormatDAOImpl.java
index 4d9283bbec4d..eaf58fbb887a 100644
--- a/dspace-api/src/main/java/org/dspace/content/dao/impl/BitstreamFormatDAOImpl.java
+++ b/dspace-api/src/main/java/org/dspace/content/dao/impl/BitstreamFormatDAOImpl.java
@@ -10,11 +10,11 @@
import java.sql.SQLException;
import java.util.LinkedList;
import java.util.List;
-import javax.persistence.Query;
-import javax.persistence.criteria.CriteriaBuilder;
-import javax.persistence.criteria.CriteriaQuery;
-import javax.persistence.criteria.Root;
+import jakarta.persistence.Query;
+import jakarta.persistence.criteria.CriteriaBuilder;
+import jakarta.persistence.criteria.CriteriaQuery;
+import jakarta.persistence.criteria.Root;
import org.dspace.content.BitstreamFormat;
import org.dspace.content.BitstreamFormat_;
import org.dspace.content.dao.BitstreamFormatDAO;
@@ -119,7 +119,7 @@ public List findNonInternal(Context context) throws SQLExceptio
);
- List orderList = new LinkedList<>();
+ List orderList = new LinkedList<>();
orderList.add(criteriaBuilder.desc(bitstreamFormatRoot.get(BitstreamFormat_.supportLevel)));
orderList.add(criteriaBuilder.asc(bitstreamFormatRoot.get(BitstreamFormat_.shortDescription)));
criteriaQuery.orderBy(orderList);
@@ -142,13 +142,10 @@ public List findByFileExtension(Context context, String extensi
public List findAll(Context context, Class clazz) throws SQLException {
CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context);
- CriteriaQuery criteriaQuery = getCriteriaQuery(criteriaBuilder, BitstreamFormat.class);
+ CriteriaQuery criteriaQuery = getCriteriaQuery(criteriaBuilder, BitstreamFormat.class);
Root bitstreamFormatRoot = criteriaQuery.from(BitstreamFormat.class);
criteriaQuery.select(bitstreamFormatRoot);
-
- List orderList = new LinkedList<>();
- orderList.add(criteriaBuilder.asc(bitstreamFormatRoot.get(BitstreamFormat_.id)));
- criteriaQuery.orderBy(orderList);
+ criteriaQuery.orderBy(criteriaBuilder.asc(bitstreamFormatRoot.get(BitstreamFormat_.id)));
return list(context, criteriaQuery, false, BitstreamFormat.class, -1, -1);
}
diff --git a/dspace-api/src/main/java/org/dspace/content/dao/impl/CollectionDAOImpl.java b/dspace-api/src/main/java/org/dspace/content/dao/impl/CollectionDAOImpl.java
index c0ef6ea42fce..5ff8ce531850 100644
--- a/dspace-api/src/main/java/org/dspace/content/dao/impl/CollectionDAOImpl.java
+++ b/dspace-api/src/main/java/org/dspace/content/dao/impl/CollectionDAOImpl.java
@@ -12,13 +12,13 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
-import javax.persistence.Query;
-import javax.persistence.criteria.CriteriaBuilder;
-import javax.persistence.criteria.CriteriaQuery;
-import javax.persistence.criteria.Join;
-import javax.persistence.criteria.Predicate;
-import javax.persistence.criteria.Root;
+import jakarta.persistence.Query;
+import jakarta.persistence.criteria.CriteriaBuilder;
+import jakarta.persistence.criteria.CriteriaQuery;
+import jakarta.persistence.criteria.Join;
+import jakarta.persistence.criteria.Predicate;
+import jakarta.persistence.criteria.Root;
import org.dspace.authorize.ResourcePolicy;
import org.dspace.authorize.ResourcePolicy_;
import org.dspace.content.Collection;
@@ -71,12 +71,12 @@ public List findAll(Context context, MetadataField order, Integer li
query.append("SELECT c" +
" FROM Collection c" +
" left join c.metadata title on title.metadataField = :sortField and" +
- " title.dSpaceObject = c.id and" +
+ " title.dSpaceObject = c and" +
" title.place = (select min(internal.place) " +
"from c.metadata internal " +
"where internal.metadataField = :sortField and" +
- " internal.dSpaceObject = c.id)" +
- " ORDER BY LOWER(title.value)");
+ " internal.dSpaceObject = c)" +
+ " ORDER BY LOWER(CAST(title.value as string))");
Query hibernateQuery = createQuery(context, query.toString());
if (offset != null) {
hibernateQuery.setFirstResult(offset);
diff --git a/dspace-api/src/main/java/org/dspace/content/dao/impl/CommunityDAOImpl.java b/dspace-api/src/main/java/org/dspace/content/dao/impl/CommunityDAOImpl.java
index 7a3750485151..5712b898598e 100644
--- a/dspace-api/src/main/java/org/dspace/content/dao/impl/CommunityDAOImpl.java
+++ b/dspace-api/src/main/java/org/dspace/content/dao/impl/CommunityDAOImpl.java
@@ -10,13 +10,13 @@
import java.sql.SQLException;
import java.util.LinkedList;
import java.util.List;
-import javax.persistence.Query;
-import javax.persistence.criteria.CriteriaBuilder;
-import javax.persistence.criteria.CriteriaQuery;
-import javax.persistence.criteria.Join;
-import javax.persistence.criteria.Predicate;
-import javax.persistence.criteria.Root;
+import jakarta.persistence.Query;
+import jakarta.persistence.criteria.CriteriaBuilder;
+import jakarta.persistence.criteria.CriteriaQuery;
+import jakarta.persistence.criteria.Join;
+import jakarta.persistence.criteria.Predicate;
+import jakarta.persistence.criteria.Root;
import org.dspace.authorize.ResourcePolicy;
import org.dspace.authorize.ResourcePolicy_;
import org.dspace.content.Community;
@@ -68,12 +68,12 @@ public List findAll(Context context, MetadataField sortField, Integer
queryBuilder.append("SELECT c" +
" FROM Community c" +
" left join c.metadata title on title.metadataField = :sortField and" +
- " title.dSpaceObject = c.id and" +
+ " title.dSpaceObject = c and" +
" title.place = (select min(internal.place) " +
"from c.metadata internal " +
"where internal.metadataField = :sortField and" +
- " internal.dSpaceObject = c.id)" +
- " ORDER BY LOWER(title.value)");
+ " internal.dSpaceObject = c)" +
+ " ORDER BY LOWER(CAST(title.value as string))");
Query query = createQuery(context, queryBuilder.toString());
if (offset != null) {
query.setFirstResult(offset);
@@ -108,13 +108,13 @@ public List findAllNoParent(Context context, MetadataField sortField)
queryBuilder.append("SELECT c" +
" FROM Community c" +
" left join c.metadata title on title.metadataField = :sortField and" +
- " title.dSpaceObject = c.id and" +
+ " title.dSpaceObject = c and" +
" title.place = (select min(internal.place) " +
"from c.metadata internal " +
"where internal.metadataField = :sortField and" +
- " internal.dSpaceObject = c.id)" +
+ " internal.dSpaceObject = c)" +
" WHERE c.parentCommunities IS EMPTY " +
- " ORDER BY LOWER(title.value)");
+ " ORDER BY LOWER(CAST(title.value as string))");
Query query = createQuery(context, queryBuilder.toString());
query.setParameter("sortField", sortField);
query.setHint("org.hibernate.cacheable", Boolean.TRUE);
diff --git a/dspace-api/src/main/java/org/dspace/content/dao/impl/EntityTypeDAOImpl.java b/dspace-api/src/main/java/org/dspace/content/dao/impl/EntityTypeDAOImpl.java
index 489f4cd0667d..32af7ed35c31 100644
--- a/dspace-api/src/main/java/org/dspace/content/dao/impl/EntityTypeDAOImpl.java
+++ b/dspace-api/src/main/java/org/dspace/content/dao/impl/EntityTypeDAOImpl.java
@@ -10,11 +10,11 @@
import java.sql.SQLException;
import java.util.LinkedList;
import java.util.List;
-import javax.persistence.criteria.CriteriaBuilder;
-import javax.persistence.criteria.CriteriaQuery;
-import javax.persistence.criteria.Order;
-import javax.persistence.criteria.Root;
+import jakarta.persistence.criteria.CriteriaBuilder;
+import jakarta.persistence.criteria.CriteriaQuery;
+import jakarta.persistence.criteria.Order;
+import jakarta.persistence.criteria.Root;
import org.dspace.content.EntityType;
import org.dspace.content.EntityType_;
import org.dspace.content.dao.EntityTypeDAO;
@@ -59,9 +59,9 @@ public List getEntityTypesByNames(Context context, List name
@Override
public int countEntityTypesByNames(Context context, List names) throws SQLException {
CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context);
- CriteriaQuery criteriaQuery = getCriteriaQuery(criteriaBuilder, EntityType.class);
+ CriteriaQuery criteriaQuery = criteriaBuilder.createQuery(Long.class);
Root entityTypeRoot = criteriaQuery.from(EntityType.class);
- criteriaQuery.select(entityTypeRoot);
+ criteriaQuery.select(criteriaBuilder.count(entityTypeRoot));
criteriaQuery.where(entityTypeRoot.get(EntityType_.LABEL).in(names));
return count(context, criteriaQuery, criteriaBuilder, entityTypeRoot);
}
diff --git a/dspace-api/src/main/java/org/dspace/content/dao/impl/ItemDAOImpl.java b/dspace-api/src/main/java/org/dspace/content/dao/impl/ItemDAOImpl.java
index 0a36fdeb2ab0..94d2bb80c447 100644
--- a/dspace-api/src/main/java/org/dspace/content/dao/impl/ItemDAOImpl.java
+++ b/dspace-api/src/main/java/org/dspace/content/dao/impl/ItemDAOImpl.java
@@ -14,15 +14,15 @@
import java.util.Iterator;
import java.util.List;
import java.util.UUID;
-import javax.persistence.Query;
-import javax.persistence.TemporalType;
-import javax.persistence.criteria.CriteriaBuilder;
-import javax.persistence.criteria.CriteriaBuilder.In;
-import javax.persistence.criteria.CriteriaQuery;
-import javax.persistence.criteria.Predicate;
-import javax.persistence.criteria.Root;
-import javax.persistence.criteria.Subquery;
+import jakarta.persistence.Query;
+import jakarta.persistence.TemporalType;
+import jakarta.persistence.criteria.CriteriaBuilder;
+import jakarta.persistence.criteria.CriteriaBuilder.In;
+import jakarta.persistence.criteria.CriteriaQuery;
+import jakarta.persistence.criteria.Predicate;
+import jakarta.persistence.criteria.Root;
+import jakarta.persistence.criteria.Subquery;
import org.apache.logging.log4j.Logger;
import org.dspace.content.Collection;
import org.dspace.content.DSpaceObject_;
@@ -111,7 +111,7 @@ public Iterator
- findAll(Context context, boolean archived,
queryStr.append(" AND discoverable = :discoverable");
if (lastModified != null) {
- queryStr.append(" AND last_modified > :last_modified");
+ queryStr.append(" AND lastModified > :last_modified");
}
queryStr.append(" ORDER BY i.id");
@@ -203,7 +203,6 @@ public List
- findByMetadataQuery(Context context, List quer
queryPredicates, collectionUuids, regexClause);
criteriaQuery.where(criteriaBuilder.and(predicates.stream().toArray(Predicate[]::new)));
criteriaQuery.orderBy(criteriaBuilder.asc(itemRoot.get(DSpaceObject_.id)));
- criteriaQuery.groupBy(itemRoot.get(DSpaceObject_.id));
try {
return list(context, criteriaQuery, false, Item.class, limit, (int) offset);
} catch (Exception e) {
@@ -217,7 +216,7 @@ public long countForMetadataQuery(Context context, List queryPre
List collectionUuids, String regexClause) throws SQLException {
// Build the query infrastructure
CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context);
- CriteriaQuery
- criteriaQuery = getCriteriaQuery(criteriaBuilder, Item.class);
+ CriteriaQuery criteriaQuery = criteriaBuilder.createQuery(Long.class);
// Select
Root
- itemRoot = criteriaQuery.from(Item.class);
// Apply the selected predicates
@@ -266,7 +265,7 @@ private List toPredicates(CriteriaBuilder criteriaBuilder, Criter
Subquery mvQuery = query.subquery(MetadataValue.class);
Root mvRoot = mvQuery.from(MetadataValue.class);
mvPredicates.add(criteriaBuilder.equal(
- mvRoot.get(MetadataValue_.D_SPACE_OBJECT), root.get(DSpaceObject_.ID)));
+ mvRoot.get(MetadataValue_.D_SPACE_OBJECT), root));
if (!predicate.getFields().isEmpty()) {
In inFields = criteriaBuilder.in(mvRoot.get(MetadataValue_.METADATA_FIELD));
@@ -309,11 +308,18 @@ public Iterator
- findByAuthorityValue(Context context, MetadataField metada
@Override
public Iterator
- findArchivedByCollection(Context context, Collection collection, Integer limit,
Integer offset) throws SQLException {
- Query query = createQuery(context,
- "select i.id from Item i join i.collections c " +
- "WHERE :collection IN c AND i.inArchive=:in_archive ORDER BY i.id");
- query.setParameter("collection", collection);
- query.setParameter("in_archive", true);
+ // Select UUID of all items which have this "collection" in their list of collections and are in_archive
+ CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context);
+ CriteriaQuery criteriaQuery = criteriaBuilder.createQuery(UUID.class);
+ Root
- itemRoot = criteriaQuery.from(Item.class);
+ criteriaQuery.select(itemRoot.get(Item_.id));
+ criteriaQuery.where(criteriaBuilder.and(
+ criteriaBuilder.isTrue((itemRoot.get(Item_.inArchive))),
+ criteriaBuilder.isMember(collection, itemRoot.get(Item_.collections))));
+ criteriaQuery.orderBy(criteriaBuilder.asc(itemRoot.get((Item_.id))));
+
+ // Transform into a query object to execute
+ Query query = createQuery(context, criteriaQuery);
if (offset != null) {
query.setFirstResult(offset);
}
@@ -337,16 +343,15 @@ public Iterator
- findArchivedByCollectionExcludingOwning(Context context, C
criteriaBuilder.isMember(collection, itemRoot.get(Item_.collections)),
criteriaBuilder.isTrue(itemRoot.get(Item_.inArchive))));
criteriaQuery.orderBy(criteriaBuilder.asc(itemRoot.get(DSpaceObject_.id)));
- criteriaQuery.groupBy(itemRoot.get(DSpaceObject_.id));
return list(context, criteriaQuery, false, Item.class, limit, offset).iterator();
}
@Override
public int countArchivedByCollectionExcludingOwning(Context context, Collection collection) throws SQLException {
CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context);
- CriteriaQuery
- criteriaQuery = getCriteriaQuery(criteriaBuilder, Item.class);
+ CriteriaQuery criteriaQuery = criteriaBuilder.createQuery(Long.class);
Root
- itemRoot = criteriaQuery.from(Item.class);
- criteriaQuery.select(itemRoot);
+ criteriaQuery.select(criteriaBuilder.count(itemRoot));
criteriaQuery.where(criteriaBuilder.and(
criteriaBuilder.notEqual(itemRoot.get(Item_.owningCollection), collection),
criteriaBuilder.isMember(collection, itemRoot.get(Item_.collections)),
@@ -356,9 +361,16 @@ public int countArchivedByCollectionExcludingOwning(Context context, Collection
@Override
public Iterator
- findAllByCollection(Context context, Collection collection) throws SQLException {
- Query query = createQuery(context,
- "select i.id from Item i join i.collections c WHERE :collection IN c ORDER BY i.id");
- query.setParameter("collection", collection);
+ // Select UUID of all items which have this "collection" in their list of collections
+ CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context);
+ CriteriaQuery criteriaQuery = criteriaBuilder.createQuery(UUID.class);
+ Root
- itemRoot = criteriaQuery.from(Item.class);
+ criteriaQuery.select(itemRoot.get(Item_.id));
+ criteriaQuery.where(criteriaBuilder.isMember(collection, itemRoot.get(Item_.collections)));
+ criteriaQuery.orderBy(criteriaBuilder.asc(itemRoot.get((Item_.id))));
+
+ // Transform into a query object to execute
+ Query query = createQuery(context, criteriaQuery);
@SuppressWarnings("unchecked")
List uuids = query.getResultList();
return new UUIDIterator
- (context, uuids, Item.class, this);
@@ -367,10 +379,16 @@ public Iterator
- findAllByCollection(Context context, Collection collection
@Override
public Iterator
- findAllByCollection(Context context, Collection collection, Integer limit, Integer offset)
throws SQLException {
- Query query = createQuery(context,
- "select i.id from Item i join i.collections c WHERE :collection IN c ORDER BY i.id");
- query.setParameter("collection", collection);
+ // Build Query to select UUID of all items which have this "collection" in their list of collections.
+ CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context);
+ CriteriaQuery criteriaQuery = criteriaBuilder.createQuery(UUID.class);
+ Root
- itemRoot = criteriaQuery.from(Item.class);
+ criteriaQuery.select(itemRoot.get(Item_.id));
+ criteriaQuery.where(criteriaBuilder.isMember(collection, itemRoot.get(Item_.collections)));
+ criteriaQuery.orderBy(criteriaBuilder.asc(itemRoot.get((Item_.id))));
+ // Transform into a query object to execute
+ Query query = createQuery(context, criteriaQuery);
if (offset != null) {
query.setFirstResult(offset);
}
@@ -385,14 +403,18 @@ public Iterator
- findAllByCollection(Context context, Collection collection
@Override
public int countItems(Context context, Collection collection, boolean includeArchived, boolean includeWithdrawn)
throws SQLException {
- Query query = createQuery(context,
- "select count(i) from Item i join i.collections c " +
- "WHERE :collection IN c AND i.inArchive=:in_archive AND i.withdrawn=:withdrawn");
- query.setParameter("collection", collection);
- query.setParameter("in_archive", includeArchived);
- query.setParameter("withdrawn", includeWithdrawn);
-
- return count(query);
+ // Build query to select all Items have this "collection" in their list of collections
+ // AND also have the inArchive or isWithdrawn set as specified
+ CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context);
+ CriteriaQuery criteriaQuery = criteriaBuilder.createQuery(Long.class);
+ Root
- itemRoot = criteriaQuery.from(Item.class);
+ criteriaQuery.select(criteriaBuilder.count(itemRoot));
+ criteriaQuery.where(criteriaBuilder.and(
+ criteriaBuilder.equal(itemRoot.get(Item_.inArchive), includeArchived),
+ criteriaBuilder.equal(itemRoot.get(Item_.withdrawn), includeWithdrawn),
+ criteriaBuilder.isMember(collection, itemRoot.get(Item_.collections))));
+ // Execute and return count
+ return count(context, criteriaQuery, criteriaBuilder, itemRoot);
}
@Override
diff --git a/dspace-api/src/main/java/org/dspace/content/dao/impl/MetadataFieldDAOImpl.java b/dspace-api/src/main/java/org/dspace/content/dao/impl/MetadataFieldDAOImpl.java
index e64aaa4dd29f..ddbde361d5ac 100644
--- a/dspace-api/src/main/java/org/dspace/content/dao/impl/MetadataFieldDAOImpl.java
+++ b/dspace-api/src/main/java/org/dspace/content/dao/impl/MetadataFieldDAOImpl.java
@@ -12,12 +12,12 @@
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
-import javax.persistence.Query;
-import javax.persistence.criteria.CriteriaBuilder;
-import javax.persistence.criteria.CriteriaQuery;
-import javax.persistence.criteria.Join;
-import javax.persistence.criteria.Root;
+import jakarta.persistence.Query;
+import jakarta.persistence.criteria.CriteriaBuilder;
+import jakarta.persistence.criteria.CriteriaQuery;
+import jakarta.persistence.criteria.Join;
+import jakarta.persistence.criteria.Root;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.Logger;
import org.dspace.content.MetadataField;
@@ -158,7 +158,7 @@ public List findAll(Context context, Class clazz)
Join join = metadataFieldRoot.join("metadataSchema");
criteriaQuery.select(metadataFieldRoot);
- List orderList = new LinkedList<>();
+ List orderList = new LinkedList<>();
orderList.add(criteriaBuilder.asc(join.get(MetadataSchema_.name)));
orderList.add(criteriaBuilder.asc(metadataFieldRoot.get(MetadataField_.element)));
orderList.add(criteriaBuilder.asc(metadataFieldRoot.get(MetadataField_.qualifier)));
diff --git a/dspace-api/src/main/java/org/dspace/content/dao/impl/MetadataSchemaDAOImpl.java b/dspace-api/src/main/java/org/dspace/content/dao/impl/MetadataSchemaDAOImpl.java
index 71eb487b8395..4630bed90b16 100644
--- a/dspace-api/src/main/java/org/dspace/content/dao/impl/MetadataSchemaDAOImpl.java
+++ b/dspace-api/src/main/java/org/dspace/content/dao/impl/MetadataSchemaDAOImpl.java
@@ -10,11 +10,11 @@
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
-import javax.persistence.Query;
-import javax.persistence.criteria.CriteriaBuilder;
-import javax.persistence.criteria.CriteriaQuery;
-import javax.persistence.criteria.Root;
+import jakarta.persistence.Query;
+import jakarta.persistence.criteria.CriteriaBuilder;
+import jakarta.persistence.criteria.CriteriaQuery;
+import jakarta.persistence.criteria.Root;
import org.dspace.content.MetadataSchema;
import org.dspace.content.MetadataSchema_;
import org.dspace.content.dao.MetadataSchemaDAO;
@@ -63,7 +63,7 @@ public List findAll(Context context, Class clazz) throws SQLExce
Root metadataSchemaRoot = criteriaQuery.from(MetadataSchema.class);
criteriaQuery.select(metadataSchemaRoot);
- List orderList = new ArrayList<>();
+ List orderList = new ArrayList<>();
orderList.add(criteriaBuilder.asc(metadataSchemaRoot.get(MetadataSchema_.id)));
criteriaQuery.orderBy(orderList);
diff --git a/dspace-api/src/main/java/org/dspace/content/dao/impl/MetadataValueDAOImpl.java b/dspace-api/src/main/java/org/dspace/content/dao/impl/MetadataValueDAOImpl.java
index f37ced9ab7d4..dc624c98c6aa 100644
--- a/dspace-api/src/main/java/org/dspace/content/dao/impl/MetadataValueDAOImpl.java
+++ b/dspace-api/src/main/java/org/dspace/content/dao/impl/MetadataValueDAOImpl.java
@@ -10,12 +10,12 @@
import java.sql.SQLException;
import java.util.Iterator;
import java.util.List;
-import javax.persistence.Query;
-import javax.persistence.criteria.CriteriaBuilder;
-import javax.persistence.criteria.CriteriaQuery;
-import javax.persistence.criteria.Join;
-import javax.persistence.criteria.Root;
+import jakarta.persistence.Query;
+import jakarta.persistence.criteria.CriteriaBuilder;
+import jakarta.persistence.criteria.CriteriaQuery;
+import jakarta.persistence.criteria.Join;
+import jakarta.persistence.criteria.Root;
import org.dspace.content.MetadataField;
import org.dspace.content.MetadataField_;
import org.dspace.content.MetadataValue;
@@ -53,7 +53,7 @@ public Iterator findItemValuesByFieldAndValue(Context context,
MetadataField metadataField, String value)
throws SQLException {
String queryString = "SELECT m from MetadataValue m " +
- "join Item i on m.dSpaceObject = i.id where m.metadataField.id = :metadata_field_id " +
+ "join Item i on m.dSpaceObject = i where m.metadataField.id = :metadata_field_id " +
"and m.value = :text_value";
Query query = createQuery(context, queryString);
query.setParameter("metadata_field_id", metadataField.getID());
@@ -84,7 +84,7 @@ public void deleteByMetadataField(Context context, MetadataField metadataField)
public MetadataValue getMinimum(Context context, int metadataFieldId)
throws SQLException {
String queryString = "SELECT m FROM MetadataValue m JOIN FETCH m.metadataField WHERE m.metadataField.id = " +
- ":metadata_field_id ORDER BY text_value";
+ ":metadata_field_id ORDER BY value";
Query query = createQuery(context, queryString);
query.setParameter("metadata_field_id", metadataFieldId);
query.setMaxResults(1);
diff --git a/dspace-api/src/main/java/org/dspace/content/dao/impl/ProcessDAOImpl.java b/dspace-api/src/main/java/org/dspace/content/dao/impl/ProcessDAOImpl.java
index d719b5006c14..829dd3280078 100644
--- a/dspace-api/src/main/java/org/dspace/content/dao/impl/ProcessDAOImpl.java
+++ b/dspace-api/src/main/java/org/dspace/content/dao/impl/ProcessDAOImpl.java
@@ -14,11 +14,11 @@
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
-import javax.persistence.criteria.CriteriaBuilder;
-import javax.persistence.criteria.CriteriaQuery;
-import javax.persistence.criteria.Predicate;
-import javax.persistence.criteria.Root;
+import jakarta.persistence.criteria.CriteriaBuilder;
+import jakarta.persistence.criteria.CriteriaQuery;
+import jakarta.persistence.criteria.Predicate;
+import jakarta.persistence.criteria.Root;
import org.apache.commons.lang3.StringUtils;
import org.dspace.content.ProcessStatus;
import org.dspace.content.dao.ProcessDAO;
@@ -75,9 +75,9 @@ public List findAll(Context context, int limit, int offset) throws SQLE
public int countRows(Context context) throws SQLException {
CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context);
- CriteriaQuery criteriaQuery = getCriteriaQuery(criteriaBuilder, Process.class);
+ CriteriaQuery criteriaQuery = criteriaBuilder.createQuery(Long.class);
Root processRoot = criteriaQuery.from(Process.class);
- criteriaQuery.select(processRoot);
+ criteriaQuery.select(criteriaBuilder.count(processRoot));
return count(context, criteriaQuery, criteriaBuilder, processRoot);
@@ -143,9 +143,9 @@ public int countTotalWithParameters(Context context, ProcessQueryParameterContai
throws SQLException {
CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context);
- CriteriaQuery criteriaQuery = getCriteriaQuery(criteriaBuilder, Process.class);
+ CriteriaQuery criteriaQuery = criteriaBuilder.createQuery(Long.class);
Root processRoot = criteriaQuery.from(Process.class);
- criteriaQuery.select(processRoot);
+ criteriaQuery.select(criteriaBuilder.count(processRoot));
addProcessQueryParameters(processQueryParameterContainer, criteriaBuilder, criteriaQuery, processRoot);
return count(context, criteriaQuery, criteriaBuilder, processRoot);
@@ -178,7 +178,7 @@ public List findByUser(Context context, EPerson user, int limit, int of
criteriaQuery.select(processRoot);
criteriaQuery.where(criteriaBuilder.equal(processRoot.get(Process_.E_PERSON), user));
- List orderList = new LinkedList<>();
+ List orderList = new LinkedList<>();
orderList.add(criteriaBuilder.desc(processRoot.get(Process_.PROCESS_ID)));
criteriaQuery.orderBy(orderList);
@@ -188,10 +188,10 @@ public List findByUser(Context context, EPerson user, int limit, int of
@Override
public int countByUser(Context context, EPerson user) throws SQLException {
CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context);
- CriteriaQuery criteriaQuery = getCriteriaQuery(criteriaBuilder, Process.class);
+ CriteriaQuery criteriaQuery = criteriaBuilder.createQuery(Long.class);
Root processRoot = criteriaQuery.from(Process.class);
- criteriaQuery.select(processRoot);
+ criteriaQuery.select(criteriaBuilder.count(processRoot));
criteriaQuery.where(criteriaBuilder.equal(processRoot.get(Process_.E_PERSON), user));
return count(context, criteriaQuery, criteriaBuilder, processRoot);
}
diff --git a/dspace-api/src/main/java/org/dspace/content/dao/impl/RelationshipDAOImpl.java b/dspace-api/src/main/java/org/dspace/content/dao/impl/RelationshipDAOImpl.java
index e2f84bc1cb64..43bbc15c31b8 100644
--- a/dspace-api/src/main/java/org/dspace/content/dao/impl/RelationshipDAOImpl.java
+++ b/dspace-api/src/main/java/org/dspace/content/dao/impl/RelationshipDAOImpl.java
@@ -12,13 +12,13 @@
import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors;
-import javax.persistence.Query;
-import javax.persistence.Tuple;
-import javax.persistence.criteria.CriteriaBuilder;
-import javax.persistence.criteria.CriteriaQuery;
-import javax.persistence.criteria.Predicate;
-import javax.persistence.criteria.Root;
+import jakarta.persistence.Query;
+import jakarta.persistence.Tuple;
+import jakarta.persistence.criteria.CriteriaBuilder;
+import jakarta.persistence.criteria.CriteriaQuery;
+import jakarta.persistence.criteria.Predicate;
+import jakarta.persistence.criteria.Root;
import org.dspace.content.Item;
import org.dspace.content.Item_;
import org.dspace.content.Relationship;
@@ -167,9 +167,9 @@ public int countByItem(
Context context, Item item, boolean excludeTilted, boolean excludeNonLatest
) throws SQLException {
CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context);
- CriteriaQuery criteriaQuery = getCriteriaQuery(criteriaBuilder, Relationship.class);
+ CriteriaQuery criteriaQuery = criteriaBuilder.createQuery(Long.class);
Root relationshipRoot = criteriaQuery.from(Relationship.class);
- criteriaQuery.select(relationshipRoot);
+ criteriaQuery.select(criteriaBuilder.count(relationshipRoot));
criteriaQuery.where(
criteriaBuilder.or(
@@ -355,9 +355,9 @@ public List findByTypeName(Context context, String typeName, Integ
public int countByRelationshipType(Context context, RelationshipType relationshipType) throws SQLException {
CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context);
- CriteriaQuery criteriaQuery = getCriteriaQuery(criteriaBuilder, Relationship.class);
+ CriteriaQuery criteriaQuery = criteriaBuilder.createQuery(Long.class);
Root relationshipRoot = criteriaQuery.from(Relationship.class);
- criteriaQuery.select(relationshipRoot);
+ criteriaQuery.select(criteriaBuilder.count(relationshipRoot));
criteriaQuery
.where(criteriaBuilder.equal(relationshipRoot.get(Relationship_.relationshipType), relationshipType));
return count(context, criteriaQuery, criteriaBuilder, relationshipRoot);
@@ -366,9 +366,9 @@ public int countByRelationshipType(Context context, RelationshipType relationshi
@Override
public int countRows(Context context) throws SQLException {
CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context);
- CriteriaQuery criteriaQuery = getCriteriaQuery(criteriaBuilder, Relationship.class);
+ CriteriaQuery criteriaQuery = criteriaBuilder.createQuery(Long.class);
Root relationshipRoot = criteriaQuery.from(Relationship.class);
- criteriaQuery.select(relationshipRoot);
+ criteriaQuery.select(criteriaBuilder.count(relationshipRoot));
return count(context, criteriaQuery, criteriaBuilder, relationshipRoot);
}
@@ -377,9 +377,9 @@ public int countByItemAndRelationshipType(
Context context, Item item, RelationshipType relationshipType, boolean isLeft, boolean excludeNonLatest
) throws SQLException {
CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context);
- CriteriaQuery criteriaQuery = getCriteriaQuery(criteriaBuilder, Relationship.class);
+ CriteriaQuery criteriaQuery = criteriaBuilder.createQuery(Long.class);
Root relationshipRoot = criteriaQuery.from(Relationship.class);
- criteriaQuery.select(relationshipRoot);
+ criteriaQuery.select(criteriaBuilder.count(relationshipRoot));
if (isLeft) {
criteriaQuery.where(
@@ -407,8 +407,9 @@ public int countByTypeName(Context context, String typeName)
ids.add(relationshipType.getID());
}
CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context);
- CriteriaQuery criteriaQuery = getCriteriaQuery(criteriaBuilder, Relationship.class);
+ CriteriaQuery criteriaQuery = criteriaBuilder.createQuery(Long.class);
Root relationshipRoot = criteriaQuery.from(Relationship.class);
+ criteriaQuery.select(criteriaBuilder.count(relationshipRoot));
criteriaQuery.where(relationshipRoot.get(Relationship_.relationshipType).in(ids));
return count(context, criteriaQuery, criteriaBuilder, relationshipRoot);
}
@@ -417,14 +418,14 @@ public int countByTypeName(Context context, String typeName)
public List findByItemAndRelationshipTypeAndList(Context context, UUID focusUUID,
RelationshipType relationshipType, List items, boolean isLeft,
int offset, int limit) throws SQLException {
- String side = isLeft ? "left_id" : "right_id";
- String otherSide = !isLeft ? "left_id" : "right_id";
+ String side = isLeft ? "leftItem.id" : "rightItem.id";
+ String otherSide = !isLeft ? "leftItem.id" : "rightItem.id";
Query query = createQuery(context, "FROM " + Relationship.class.getSimpleName() +
- " WHERE type_id = (:typeId) " +
+ " WHERE relationshipType = :type " +
"AND " + side + " = (:focusUUID) " +
"AND " + otherSide + " in (:list) " +
"ORDER BY id");
- query.setParameter("typeId", relationshipType.getID());
+ query.setParameter("type", relationshipType);
query.setParameter("focusUUID", focusUUID);
query.setParameter("list", items);
return list(query, limit, offset);
@@ -433,14 +434,14 @@ public List findByItemAndRelationshipTypeAndList(Context context,
@Override
public int countByItemAndRelationshipTypeAndList(Context context, UUID focusUUID, RelationshipType relationshipType,
List items, boolean isLeft) throws SQLException {
- String side = isLeft ? "left_id" : "right_id";
- String otherSide = !isLeft ? "left_id" : "right_id";
+ String side = isLeft ? "leftItem.id" : "rightItem.id";
+ String otherSide = !isLeft ? "leftItem.id" : "rightItem.id";
Query query = createQuery(context, "SELECT count(*) " +
"FROM " + Relationship.class.getSimpleName() +
- " WHERE type_id = (:typeId) " +
+ " WHERE relationshipType = :type " +
"AND " + side + " = (:focusUUID) " +
"AND " + otherSide + " in (:list)");
- query.setParameter("typeId", relationshipType.getID());
+ query.setParameter("type", relationshipType);
query.setParameter("focusUUID", focusUUID);
query.setParameter("list", items);
return count(query);
diff --git a/dspace-api/src/main/java/org/dspace/content/dao/impl/RelationshipTypeDAOImpl.java b/dspace-api/src/main/java/org/dspace/content/dao/impl/RelationshipTypeDAOImpl.java
index 7fff2a1f57da..7b0e33fd41d9 100644
--- a/dspace-api/src/main/java/org/dspace/content/dao/impl/RelationshipTypeDAOImpl.java
+++ b/dspace-api/src/main/java/org/dspace/content/dao/impl/RelationshipTypeDAOImpl.java
@@ -10,10 +10,10 @@
import java.sql.SQLException;
import java.util.LinkedList;
import java.util.List;
-import javax.persistence.criteria.CriteriaBuilder;
-import javax.persistence.criteria.CriteriaQuery;
-import javax.persistence.criteria.Root;
+import jakarta.persistence.criteria.CriteriaBuilder;
+import jakarta.persistence.criteria.CriteriaQuery;
+import jakarta.persistence.criteria.Root;
import org.dspace.content.EntityType;
import org.dspace.content.RelationshipType;
import org.dspace.content.RelationshipType_;
@@ -93,7 +93,7 @@ public List findByEntityType(Context context, EntityType entit
.equal(relationshipTypeRoot.get(RelationshipType_.rightType), entityType)
)
);
- List orderList = new LinkedList<>();
+ List orderList = new LinkedList<>();
orderList.add(criteriaBuilder.asc(relationshipTypeRoot.get(RelationshipType_.ID)));
criteriaQuery.orderBy(orderList);
return list(context, criteriaQuery, false, RelationshipType.class, limit, offset);
@@ -128,9 +128,9 @@ public List findByEntityType(Context context, EntityType entit
@Override
public int countByEntityType(Context context, EntityType entityType) throws SQLException {
CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context);
- CriteriaQuery criteriaQuery = getCriteriaQuery(criteriaBuilder, RelationshipType.class);
+ CriteriaQuery criteriaQuery = criteriaBuilder.createQuery(Long.class);
Root relationshipTypeRoot = criteriaQuery.from(RelationshipType.class);
- criteriaQuery.select(relationshipTypeRoot);
+ criteriaQuery.select(criteriaBuilder.count(relationshipTypeRoot));
criteriaQuery.where(criteriaBuilder.or(
criteriaBuilder.equal(relationshipTypeRoot.get(RelationshipType_.leftType), entityType),
criteriaBuilder.equal(relationshipTypeRoot.get(RelationshipType_.rightType), entityType)
diff --git a/dspace-api/src/main/java/org/dspace/content/dao/impl/SiteDAOImpl.java b/dspace-api/src/main/java/org/dspace/content/dao/impl/SiteDAOImpl.java
index 8889909b1a49..ebaa78ae3788 100644
--- a/dspace-api/src/main/java/org/dspace/content/dao/impl/SiteDAOImpl.java
+++ b/dspace-api/src/main/java/org/dspace/content/dao/impl/SiteDAOImpl.java
@@ -8,10 +8,10 @@
package org.dspace.content.dao.impl;
import java.sql.SQLException;
-import javax.persistence.criteria.CriteriaBuilder;
-import javax.persistence.criteria.CriteriaQuery;
-import javax.persistence.criteria.Root;
+import jakarta.persistence.criteria.CriteriaBuilder;
+import jakarta.persistence.criteria.CriteriaQuery;
+import jakarta.persistence.criteria.Root;
import org.dspace.content.Site;
import org.dspace.content.dao.SiteDAO;
import org.dspace.core.AbstractHibernateDAO;
diff --git a/dspace-api/src/main/java/org/dspace/content/dao/impl/WorkspaceItemDAOImpl.java b/dspace-api/src/main/java/org/dspace/content/dao/impl/WorkspaceItemDAOImpl.java
index 138451365522..0862a81e8678 100644
--- a/dspace-api/src/main/java/org/dspace/content/dao/impl/WorkspaceItemDAOImpl.java
+++ b/dspace-api/src/main/java/org/dspace/content/dao/impl/WorkspaceItemDAOImpl.java
@@ -12,11 +12,11 @@
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
-import javax.persistence.Query;
-import javax.persistence.criteria.CriteriaBuilder;
-import javax.persistence.criteria.CriteriaQuery;
-import javax.persistence.criteria.Root;
+import jakarta.persistence.Query;
+import jakarta.persistence.criteria.CriteriaBuilder;
+import jakarta.persistence.criteria.CriteriaQuery;
+import jakarta.persistence.criteria.Root;
import org.dspace.content.Collection;
import org.dspace.content.Item;
import org.dspace.content.WorkspaceItem;
@@ -88,7 +88,7 @@ public List findAll(Context context) throws SQLException {
Root workspaceItemRoot = criteriaQuery.from(WorkspaceItem.class);
criteriaQuery.select(workspaceItemRoot);
- List orderList = new LinkedList<>();
+ List orderList = new LinkedList<>();
orderList.add(criteriaBuilder.asc(workspaceItemRoot.get(WorkspaceItem_.workspaceItemId)));
criteriaQuery.orderBy(orderList);
@@ -103,7 +103,7 @@ public List findAll(Context context, Integer limit, Integer offse
Root workspaceItemRoot = criteriaQuery.from(WorkspaceItem.class);
criteriaQuery.select(workspaceItemRoot);
- List orderList = new LinkedList<>();
+ List orderList = new LinkedList<>();
orderList.add(criteriaBuilder.asc(workspaceItemRoot.get(WorkspaceItem_.workspaceItemId)));
criteriaQuery.orderBy(orderList);
diff --git a/dspace-api/src/main/java/org/dspace/content/factory/ContentServiceFactory.java b/dspace-api/src/main/java/org/dspace/content/factory/ContentServiceFactory.java
index 0b06b34038e1..3a897081f07c 100644
--- a/dspace-api/src/main/java/org/dspace/content/factory/ContentServiceFactory.java
+++ b/dspace-api/src/main/java/org/dspace/content/factory/ContentServiceFactory.java
@@ -20,6 +20,7 @@
import org.dspace.content.service.CommunityService;
import org.dspace.content.service.DSpaceObjectLegacySupportService;
import org.dspace.content.service.DSpaceObjectService;
+import org.dspace.content.service.DuplicateDetectionService;
import org.dspace.content.service.EntityService;
import org.dspace.content.service.EntityTypeService;
import org.dspace.content.service.InProgressSubmissionService;
@@ -113,6 +114,13 @@ public InProgressSubmissionService getInProgressSubmissionService(InProgressSubm
}
}
+ /**
+ * Return the implementation of the DuplicateDetectionService interface
+ *
+ * @return the DuplicateDetectionService
+ */
+ public abstract DuplicateDetectionService getDuplicateDetectionService();
+
public DSpaceObjectService getDSpaceObjectService(T dso) {
return getDSpaceObjectService(dso.getType());
}
diff --git a/dspace-api/src/main/java/org/dspace/content/factory/ContentServiceFactoryImpl.java b/dspace-api/src/main/java/org/dspace/content/factory/ContentServiceFactoryImpl.java
index e970f0bdab12..3c3c2bf162bb 100644
--- a/dspace-api/src/main/java/org/dspace/content/factory/ContentServiceFactoryImpl.java
+++ b/dspace-api/src/main/java/org/dspace/content/factory/ContentServiceFactoryImpl.java
@@ -18,6 +18,7 @@
import org.dspace.content.service.CommunityService;
import org.dspace.content.service.DSpaceObjectLegacySupportService;
import org.dspace.content.service.DSpaceObjectService;
+import org.dspace.content.service.DuplicateDetectionService;
import org.dspace.content.service.EntityService;
import org.dspace.content.service.EntityTypeService;
import org.dspace.content.service.InstallItemService;
@@ -81,6 +82,8 @@ public class ContentServiceFactoryImpl extends ContentServiceFactory {
private EntityTypeService entityTypeService;
@Autowired(required = true)
private EntityService entityService;
+ @Autowired(required = true)
+ private DuplicateDetectionService duplicateDetectionService;
@Override
public List> getDSpaceObjectServices() {
@@ -181,4 +184,9 @@ public EntityService getEntityService() {
public RelationshipMetadataService getRelationshipMetadataService() {
return relationshipMetadataService;
}
+
+ @Override
+ public DuplicateDetectionService getDuplicateDetectionService() {
+ return duplicateDetectionService;
+ }
}
diff --git a/dspace-api/src/main/java/org/dspace/content/packager/PackageParameters.java b/dspace-api/src/main/java/org/dspace/content/packager/PackageParameters.java
index b472a52c3bad..f2b95118675b 100644
--- a/dspace-api/src/main/java/org/dspace/content/packager/PackageParameters.java
+++ b/dspace-api/src/main/java/org/dspace/content/packager/PackageParameters.java
@@ -9,7 +9,8 @@
import java.util.Enumeration;
import java.util.Properties;
-import javax.servlet.ServletRequest;
+
+import jakarta.servlet.ServletRequest;
/**
* Parameter list for SIP and DIP packagers. It's really just
diff --git a/dspace-api/src/main/java/org/dspace/content/packager/PackageUtils.java b/dspace-api/src/main/java/org/dspace/content/packager/PackageUtils.java
index 9e7d870076aa..9a8ae4606487 100644
--- a/dspace-api/src/main/java/org/dspace/content/packager/PackageUtils.java
+++ b/dspace-api/src/main/java/org/dspace/content/packager/PackageUtils.java
@@ -503,7 +503,7 @@ public static DSpaceObject createDSpaceObject(Context context, DSpaceObject pare
wsi = workspaceItemService.create(context, (Collection)parent, params.useCollectionTemplate());
} else {
wsi = workspaceItemService.create(context, (Collection)parent,
- uuid, params.useCollectionTemplate());
+ uuid, params.useCollectionTemplate(), false);
}
// Please note that we are returning an Item which is *NOT* yet in the Archive,
diff --git a/dspace-api/src/main/java/org/dspace/content/service/BitstreamService.java b/dspace-api/src/main/java/org/dspace/content/service/BitstreamService.java
index 8effabf28435..c22428f11a96 100644
--- a/dspace-api/src/main/java/org/dspace/content/service/BitstreamService.java
+++ b/dspace-api/src/main/java/org/dspace/content/service/BitstreamService.java
@@ -13,8 +13,8 @@
import java.util.Iterator;
import java.util.List;
import java.util.UUID;
-import javax.annotation.Nullable;
+import jakarta.annotation.Nullable;
import org.dspace.authorize.AuthorizeException;
import org.dspace.content.Bitstream;
import org.dspace.content.BitstreamFormat;
diff --git a/dspace-api/src/main/java/org/dspace/content/service/DuplicateDetectionService.java b/dspace-api/src/main/java/org/dspace/content/service/DuplicateDetectionService.java
new file mode 100644
index 000000000000..1f0d3495b1d6
--- /dev/null
+++ b/dspace-api/src/main/java/org/dspace/content/service/DuplicateDetectionService.java
@@ -0,0 +1,85 @@
+/**
+ * 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.content.service;
+
+import java.sql.SQLException;
+import java.util.List;
+import java.util.Optional;
+
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.dspace.authorize.AuthorizeException;
+import org.dspace.content.DuplicateDetectionServiceImpl;
+import org.dspace.content.Item;
+import org.dspace.content.virtual.PotentialDuplicate;
+import org.dspace.core.Context;
+import org.dspace.discovery.DiscoverResult;
+import org.dspace.discovery.IndexableObject;
+import org.dspace.discovery.SearchServiceException;
+
+/**
+ * Duplicate Detection Service handles get, search and validation operations for duplicate detection.
+ * @see DuplicateDetectionServiceImpl for implementation details
+ *
+ * @author Kim Shepherd
+ */
+public interface DuplicateDetectionService {
+
+ /**
+ * Logger
+ */
+ Logger log = LogManager.getLogger(DuplicateDetectionService.class);
+
+ /**
+ * Get a list of PotentialDuplicate objects (wrappers with some metadata included for previewing) that
+ * are identified as potential duplicates of the given item
+ *
+ * @param context DSpace context
+ * @param item Item to check
+ * @return List of potential duplicates (empty if none found)
+ * @throws SearchServiceException if an error occurs performing the discovery search
+ */
+ List getPotentialDuplicates(Context context, Item item)
+ throws SearchServiceException;
+
+ /**
+ * Validate an indexable object (returned by discovery search) to ensure it is permissible, readable and valid
+ * and can be added to a list of results.
+ * An Optional is returned, if it is empty then it was invalid or did not pass validation.
+ *
+ * @param context The DSpace context
+ * @param indexableObject The discovery search result
+ * @param original The original item (to compare IDs, submitters, etc)
+ * @return An Optional potential duplicate
+ * @throws SQLException
+ * @throws AuthorizeException
+ */
+ Optional validateDuplicateResult(Context context, IndexableObject indexableObject,
+ Item original) throws SQLException, AuthorizeException;
+
+ /**
+ * Search discovery for potential duplicates of a given item. The search uses levenshtein distance (configurable)
+ * and a single-term "comparison value" constructed out of the item title
+ *
+ * @param context DSpace context
+ * @param item The item to check
+ * @return DiscoverResult as a result of performing search. Null if invalid.
+ *
+ * @throws SearchServiceException if an error was encountered during the discovery search itself.
+ */
+ DiscoverResult searchDuplicates(Context context, Item item) throws SearchServiceException;
+
+ /**
+ * Build a comparison value string made up of values of configured fields, used when indexing and querying
+ * items for deduplication
+ * @param context DSpace context
+ * @param item The DSpace item
+ * @return a constructed, normalised string
+ */
+ String buildComparisonValue(Context context, Item item);
+}
diff --git a/dspace-api/src/main/java/org/dspace/content/service/FeedbackService.java b/dspace-api/src/main/java/org/dspace/content/service/FeedbackService.java
index d21afd678000..7eac0ee61dc2 100644
--- a/dspace-api/src/main/java/org/dspace/content/service/FeedbackService.java
+++ b/dspace-api/src/main/java/org/dspace/content/service/FeedbackService.java
@@ -7,9 +7,9 @@
*/
package org.dspace.content.service;
import java.io.IOException;
-import javax.mail.MessagingException;
-import javax.servlet.http.HttpServletRequest;
+import jakarta.mail.MessagingException;
+import jakarta.servlet.http.HttpServletRequest;
import org.dspace.core.Context;
/**
diff --git a/dspace-api/src/main/java/org/dspace/content/service/WorkspaceItemService.java b/dspace-api/src/main/java/org/dspace/content/service/WorkspaceItemService.java
index c8df68e43498..8559bcc61402 100644
--- a/dspace-api/src/main/java/org/dspace/content/service/WorkspaceItemService.java
+++ b/dspace-api/src/main/java/org/dspace/content/service/WorkspaceItemService.java
@@ -56,6 +56,23 @@ public interface WorkspaceItemService extends InProgressSubmissionServicetrue, the workspace item starts as a copy
+ * of the collection's template item
+ * @param isNewVersion whether we are creating a new workspace item version of an existing item
+ * @return the newly created workspace item
+ * @throws SQLException if database error
+ * @throws AuthorizeException if authorization error
+ */
+ public WorkspaceItem create(Context context, Collection collection, boolean template, boolean isNewVersion)
+ throws AuthorizeException, SQLException;
+
/**
* Create a new workspace item, with a new ID. An Item is also created. The
* submitter is the current user in the context.
@@ -65,11 +82,13 @@ public WorkspaceItem create(Context context, Collection collection, boolean temp
* @param uuid the preferred uuid of the new item (used if restoring an item and retaining old uuid)
* @param template if
true
, the workspace item starts as a copy
* of the collection's template item
+ * @param isNewVersion whether we are creating a new workspace item version of an existing item
* @return the newly created workspace item
* @throws SQLException if database error
* @throws AuthorizeException if authorization error
*/
- public WorkspaceItem create(Context context, Collection collection, UUID uuid, boolean template)
+ public WorkspaceItem create(Context context, Collection collection, UUID uuid, boolean template,
+ boolean isNewVersion)
throws AuthorizeException, SQLException;
public WorkspaceItem create(Context c, WorkflowItem wfi) throws SQLException, AuthorizeException;
diff --git a/dspace-api/src/main/java/org/dspace/content/virtual/PotentialDuplicate.java b/dspace-api/src/main/java/org/dspace/content/virtual/PotentialDuplicate.java
new file mode 100644
index 000000000000..6c193bb28506
--- /dev/null
+++ b/dspace-api/src/main/java/org/dspace/content/virtual/PotentialDuplicate.java
@@ -0,0 +1,176 @@
+/**
+ * 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.content.virtual;
+
+import java.util.LinkedList;
+import java.util.List;
+import java.util.UUID;
+
+import org.dspace.content.Item;
+import org.dspace.content.MetadataValue;
+
+/**
+ * Model of potential duplicate item. Provides as little data as possible, but enough to be useful
+ * about the context / state of the duplicate, and metadata for preview purposes.
+ * This class lives in the virtual package because it is not stored, addressable data, it's a stub / preview
+ * based on an items' search result and metadata.
+ *
+ * @author Kim Shepherd
+ */
+public class PotentialDuplicate {
+ /**
+ * Title of duplicate object
+ */
+ private String title;
+ /**
+ * UUID of duplicate object
+ */
+ private UUID uuid;
+ /**
+ * Owning collection name (title) for duplicate item
+ */
+ private String owningCollectionName;
+ /**
+ * Workspace item ID, if the duplicate is a workspace item
+ */
+ private Integer workspaceItemId;
+ /**
+ * Workflow item ID, if the duplicate is a workflow item
+ */
+ private Integer workflowItemId;
+
+ /**
+ * List of configured metadata values copied across from the duplicate item
+ */
+ private List metadataValueList;
+
+ /**
+ * Default constructor
+ */
+ public PotentialDuplicate() {
+ this.metadataValueList = new LinkedList<>();
+ }
+
+ /**
+ * Constructor that accepts an item and sets some values accordingly
+ * @param item the potential duplicate item
+ */
+ public PotentialDuplicate(Item item) {
+ // Throw error if item is null
+ if (item == null) {
+ throw new NullPointerException("Null item passed to potential duplicate constructor");
+ }
+ // Instantiate metadata value list
+ this.metadataValueList = new LinkedList<>();
+ // Set title
+ this.title = item.getName();
+ // Set UUID
+ this.uuid = item.getID();
+ // Set owning collection name
+ if (item.getOwningCollection() != null) {
+ this.owningCollectionName = item.getOwningCollection().getName();
+ }
+ }
+
+ /**
+ * Get UUID of duplicate item
+ * @return UUID of duplicate item
+ */
+ public UUID getUuid() {
+ return uuid;
+ }
+
+ /**
+ * Set UUID of duplicate item
+ * @param uuid UUID of duplicate item
+ */
+ public void setUuid(UUID uuid) {
+ this.uuid = uuid;
+ }
+
+ /**
+ * Get title of duplicate item
+ * @return title of duplicate item
+ */
+ public String getTitle() {
+ return title;
+ }
+
+ /**
+ * Set title of duplicate item
+ * @param title of duplicate item
+ */
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+ /**
+ * Get owning collection name (title) of duplicate item
+ * @return owning collection name (title) of duplicate item
+ */
+ public String getOwningCollectionName() {
+ return owningCollectionName;
+ }
+
+ /**
+ * Set owning collection name (title) of duplicate item
+ * @param owningCollectionName owning collection name (title) of duplicate item
+ */
+ public void setOwningCollectionName(String owningCollectionName) {
+ this.owningCollectionName = owningCollectionName;
+ }
+
+ /**
+ * Get workspace ID for duplicate item, if any
+ * @return workspace item ID or null
+ */
+ public Integer getWorkspaceItemId() {
+ return workspaceItemId;
+ }
+
+ /**
+ * Set workspace ID for duplicate item
+ * @param workspaceItemId workspace item ID
+ */
+ public void setWorkspaceItemId(Integer workspaceItemId) {
+ this.workspaceItemId = workspaceItemId;
+ }
+
+ /**
+ * Get workflow ID for duplicate item, if anh
+ * @return workflow item ID or null
+ */
+ public Integer getWorkflowItemId() {
+ return workflowItemId;
+ }
+
+ /**
+ * Set workflow ID for duplicate item
+ * @param workflowItemId workspace item ID
+ */
+ public void setWorkflowItemId(Integer workflowItemId) {
+ this.workflowItemId = workflowItemId;
+ }
+
+ /**
+ * Get metadata (sorted, field->value list) for duplicate item
+ * @return (sorted, field->value list) for duplicate item
+ */
+ public List getMetadataValueList() {
+ return metadataValueList;
+ }
+
+ /**
+ * Set metadata (sorted, field->value list) for duplicate item
+ * @param metadataValueList MetadataRest list of values mapped to field keys
+ */
+ public void setMetadataValueList(List metadataValueList) {
+ this.metadataValueList = metadataValueList;
+ }
+
+}
diff --git a/dspace-api/src/main/java/org/dspace/contentreport/QueryOperator.java b/dspace-api/src/main/java/org/dspace/contentreport/QueryOperator.java
index 1fb6e5fc0ffc..7cd8606f8348 100644
--- a/dspace-api/src/main/java/org/dspace/contentreport/QueryOperator.java
+++ b/dspace-api/src/main/java/org/dspace/contentreport/QueryOperator.java
@@ -8,13 +8,13 @@
package org.dspace.contentreport;
import java.util.Arrays;
-import javax.persistence.criteria.CriteriaBuilder;
-import javax.persistence.criteria.Expression;
-import javax.persistence.criteria.Path;
-import javax.persistence.criteria.Predicate;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
+import jakarta.persistence.criteria.CriteriaBuilder;
+import jakarta.persistence.criteria.Expression;
+import jakarta.persistence.criteria.Path;
+import jakarta.persistence.criteria.Predicate;
import org.apache.commons.lang3.function.TriFunction;
import org.dspace.content.MetadataValue;
import org.dspace.content.MetadataValue_;
diff --git a/dspace-api/src/main/java/org/dspace/core/AbstractHibernateDAO.java b/dspace-api/src/main/java/org/dspace/core/AbstractHibernateDAO.java
index 38923658f0dd..3658a3c92305 100644
--- a/dspace-api/src/main/java/org/dspace/core/AbstractHibernateDAO.java
+++ b/dspace-api/src/main/java/org/dspace/core/AbstractHibernateDAO.java
@@ -13,13 +13,13 @@
import java.util.Map;
import java.util.UUID;
import java.util.stream.Stream;
-import javax.persistence.Query;
-import javax.persistence.criteria.CriteriaBuilder;
-import javax.persistence.criteria.CriteriaQuery;
-import javax.persistence.criteria.Expression;
-import javax.persistence.criteria.Root;
import com.google.common.collect.AbstractIterator;
+import jakarta.persistence.Query;
+import jakarta.persistence.criteria.CriteriaBuilder;
+import jakarta.persistence.criteria.CriteriaQuery;
+import jakarta.persistence.criteria.Expression;
+import jakarta.persistence.criteria.Root;
import org.apache.commons.collections.CollectionUtils;
import org.hibernate.Session;
@@ -471,4 +471,15 @@ public List findByX(Context context, Class clazz, Map equals,
return executeCriteriaQuery(context, criteria, cacheable, maxResults, offset);
}
+ /**
+ * Create a Query object from a CriteriaQuery
+ * @param context current Context
+ * @param criteriaQuery CriteriaQuery built via CriteriaBuilder
+ * @return corresponding Query
+ * @throws SQLException if error occurs
+ */
+ public Query createQuery(Context context, CriteriaQuery criteriaQuery) throws SQLException {
+ return this.getHibernateSession(context).createQuery(criteriaQuery);
+ }
+
}
diff --git a/dspace-api/src/main/java/org/dspace/core/AbstractHibernateDSODAO.java b/dspace-api/src/main/java/org/dspace/core/AbstractHibernateDSODAO.java
index e9c6b95b7f05..d72a4d619003 100644
--- a/dspace-api/src/main/java/org/dspace/core/AbstractHibernateDSODAO.java
+++ b/dspace-api/src/main/java/org/dspace/core/AbstractHibernateDSODAO.java
@@ -10,10 +10,10 @@
import java.sql.SQLException;
import java.util.Collection;
import java.util.List;
-import javax.persistence.criteria.CriteriaBuilder;
-import javax.persistence.criteria.CriteriaQuery;
-import javax.persistence.criteria.Root;
+import jakarta.persistence.criteria.CriteriaBuilder;
+import jakarta.persistence.criteria.CriteriaQuery;
+import jakarta.persistence.criteria.Root;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.ListUtils;
import org.apache.commons.lang3.StringUtils;
diff --git a/dspace-api/src/main/java/org/dspace/core/Constants.java b/dspace-api/src/main/java/org/dspace/core/Constants.java
index f730ef6545f1..98bb1b7731a0 100644
--- a/dspace-api/src/main/java/org/dspace/core/Constants.java
+++ b/dspace-api/src/main/java/org/dspace/core/Constants.java
@@ -55,11 +55,16 @@ public class Constants {
*/
public static final int EPERSON = 7;
+ /**
+ * Type of LDN MESSAGE objects
+ */
+ public static final int LDN_MESSAGE = 8;
+
/**
* lets you look up type names from the type IDs
*/
public static final String[] typeText = { "BITSTREAM", "BUNDLE", "ITEM", "COLLECTION", "COMMUNITY", "SITE", "GROUP",
- "EPERSON"};
+ "EPERSON", "LDN_MESSAGE"};
/**
* Special Bundle and Bitstream Names:
diff --git a/dspace-api/src/main/java/org/dspace/core/Email.java b/dspace-api/src/main/java/org/dspace/core/Email.java
index f6df740a53ef..b36275e83bfa 100644
--- a/dspace-api/src/main/java/org/dspace/core/Email.java
+++ b/dspace-api/src/main/java/org/dspace/core/Email.java
@@ -23,23 +23,23 @@
import java.util.Enumeration;
import java.util.List;
import java.util.Properties;
-import javax.activation.DataHandler;
-import javax.activation.DataSource;
-import javax.activation.FileDataSource;
-import javax.mail.Address;
-import javax.mail.BodyPart;
-import javax.mail.Message;
-import javax.mail.MessagingException;
-import javax.mail.Multipart;
-import javax.mail.Session;
-import javax.mail.Transport;
-import javax.mail.internet.ContentType;
-import javax.mail.internet.InternetAddress;
-import javax.mail.internet.MimeBodyPart;
-import javax.mail.internet.MimeMessage;
-import javax.mail.internet.MimeMultipart;
-import javax.mail.internet.ParseException;
+import jakarta.activation.DataHandler;
+import jakarta.activation.DataSource;
+import jakarta.activation.FileDataSource;
+import jakarta.mail.Address;
+import jakarta.mail.BodyPart;
+import jakarta.mail.Message;
+import jakarta.mail.MessagingException;
+import jakarta.mail.Multipart;
+import jakarta.mail.Session;
+import jakarta.mail.Transport;
+import jakarta.mail.internet.ContentType;
+import jakarta.mail.internet.InternetAddress;
+import jakarta.mail.internet.MimeBodyPart;
+import jakarta.mail.internet.MimeMessage;
+import jakarta.mail.internet.MimeMultipart;
+import jakarta.mail.internet.ParseException;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.velocity.Template;
diff --git a/dspace-api/src/main/java/org/dspace/core/HibernateDBConnection.java b/dspace-api/src/main/java/org/dspace/core/HibernateDBConnection.java
index b371af80eede..a867849077a3 100644
--- a/dspace-api/src/main/java/org/dspace/core/HibernateDBConnection.java
+++ b/dspace-api/src/main/java/org/dspace/core/HibernateDBConnection.java
@@ -27,7 +27,6 @@
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.engine.spi.SessionFactoryImplementor;
-import org.hibernate.proxy.HibernateProxyHelper;
import org.hibernate.resource.transaction.spi.TransactionStatus;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
diff --git a/dspace-api/src/main/java/org/dspace/core/HibernateProxyHelper.java b/dspace-api/src/main/java/org/dspace/core/HibernateProxyHelper.java
new file mode 100644
index 000000000000..22f91a48aa7f
--- /dev/null
+++ b/dspace-api/src/main/java/org/dspace/core/HibernateProxyHelper.java
@@ -0,0 +1,39 @@
+/**
+ * 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.core;
+
+import org.hibernate.proxy.HibernateProxy;
+import org.hibernate.proxy.LazyInitializer;
+
+/**
+ * Utility methods for working with Hibernate proxies.
+ * This class existed in Hibernate 5 but was removed from v6.
+ * https://github.com/hibernate/hibernate-orm/blob/5.6/hibernate-core/src/main/java/org/hibernate/proxy/HibernateProxyHelper.java
+ * We've copied it into DSpace to utilize the below utility method.
+ */
+public final class HibernateProxyHelper {
+
+ /**
+ * Get the class of an instance or the underlying class
+ * of a proxy (without initializing the proxy!). It is
+ * almost always better to use the entity name!
+ */
+ public static Class getClassWithoutInitializingProxy(Object object) {
+ if (object instanceof HibernateProxy) {
+ HibernateProxy proxy = (HibernateProxy) object;
+ LazyInitializer li = proxy.getHibernateLazyInitializer();
+ return li.getPersistentClass();
+ } else {
+ return object.getClass();
+ }
+ }
+
+ private HibernateProxyHelper() {
+ //cant instantiate
+ }
+}
diff --git a/dspace-api/src/main/java/org/dspace/core/LDN.java b/dspace-api/src/main/java/org/dspace/core/LDN.java
index 283850eb1059..8ae5cddf5b4a 100644
--- a/dspace-api/src/main/java/org/dspace/core/LDN.java
+++ b/dspace-api/src/main/java/org/dspace/core/LDN.java
@@ -19,8 +19,8 @@
import java.util.Collections;
import java.util.List;
import java.util.Properties;
-import javax.mail.MessagingException;
+import jakarta.mail.MessagingException;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
diff --git a/dspace-api/src/main/java/org/dspace/core/LicenseServiceImpl.java b/dspace-api/src/main/java/org/dspace/core/LicenseServiceImpl.java
index 80bc0beac83a..766e72e94125 100644
--- a/dspace-api/src/main/java/org/dspace/core/LicenseServiceImpl.java
+++ b/dspace-api/src/main/java/org/dspace/core/LicenseServiceImpl.java
@@ -17,8 +17,8 @@
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
-import javax.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletRequest;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.dspace.core.service.LicenseService;
diff --git a/dspace-api/src/main/java/org/dspace/discovery/FullTextContentStreams.java b/dspace-api/src/main/java/org/dspace/discovery/FullTextContentStreams.java
index 21468def6866..58abf18698a1 100644
--- a/dspace-api/src/main/java/org/dspace/discovery/FullTextContentStreams.java
+++ b/dspace-api/src/main/java/org/dspace/discovery/FullTextContentStreams.java
@@ -20,10 +20,10 @@
import java.util.Enumeration;
import java.util.Iterator;
import java.util.List;
-import javax.annotation.Nullable;
import com.google.common.base.Function;
import com.google.common.collect.Iterables;
+import jakarta.annotation.Nullable;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.Logger;
diff --git a/dspace-api/src/main/java/org/dspace/discovery/IndexEventConsumer.java b/dspace-api/src/main/java/org/dspace/discovery/IndexEventConsumer.java
index 80602ac80459..611200e62a5d 100644
--- a/dspace-api/src/main/java/org/dspace/discovery/IndexEventConsumer.java
+++ b/dspace-api/src/main/java/org/dspace/discovery/IndexEventConsumer.java
@@ -73,17 +73,22 @@ public void consume(Context ctx, Event event) throws Exception {
int st = event.getSubjectType();
if (!(st == Constants.ITEM || st == Constants.BUNDLE
- || st == Constants.COLLECTION || st == Constants.COMMUNITY || st == Constants.SITE)) {
+ || st == Constants.COLLECTION || st == Constants.COMMUNITY || st == Constants.SITE
+ || st == Constants.LDN_MESSAGE)) {
log
.warn("IndexConsumer should not have been given this kind of Subject in an event, skipping: "
+ event.toString());
return;
}
- DSpaceObject subject = event.getSubject(ctx);
-
- DSpaceObject object = event.getObject(ctx);
-
+ DSpaceObject subject = null;
+ DSpaceObject object = null;
+ try {
+ subject = event.getSubject(ctx);
+ object = event.getObject(ctx);
+ } catch (Exception e) {
+ log.warn("Could not find the related DSpace Object for event subject: " + st);
+ }
// If event subject is a Bundle and event was Add or Remove,
// transform the event to be a Modify on the owning Item.
@@ -110,7 +115,7 @@ public void consume(Context ctx, Event event) throws Exception {
case Event.MODIFY:
case Event.MODIFY_METADATA:
if (subject == null) {
- if (st == Constants.SITE) {
+ if (st == Constants.SITE || st == Constants.LDN_MESSAGE) {
// Update the indexable objects of type in event.detail of objects with ids in event.identifiers
for (String id : event.getIdentifiers()) {
IndexFactory indexableObjectService = IndexObjectFactoryFactory.getInstance().
diff --git a/dspace-api/src/main/java/org/dspace/discovery/SolrSearchCore.java b/dspace-api/src/main/java/org/dspace/discovery/SolrSearchCore.java
index f31feab6123a..6304f39a8ca9 100644
--- a/dspace-api/src/main/java/org/dspace/discovery/SolrSearchCore.java
+++ b/dspace-api/src/main/java/org/dspace/discovery/SolrSearchCore.java
@@ -8,8 +8,8 @@
package org.dspace.discovery;
import java.io.IOException;
-import javax.inject.Named;
+import jakarta.inject.Named;
import org.apache.commons.validator.routines.UrlValidator;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
diff --git a/dspace-api/src/main/java/org/dspace/discovery/SolrServiceImpl.java b/dspace-api/src/main/java/org/dspace/discovery/SolrServiceImpl.java
index cd3797e3e34e..a0c1188d7132 100644
--- a/dspace-api/src/main/java/org/dspace/discovery/SolrServiceImpl.java
+++ b/dspace-api/src/main/java/org/dspace/discovery/SolrServiceImpl.java
@@ -30,8 +30,8 @@
import java.util.Optional;
import java.util.TimeZone;
import java.util.UUID;
-import javax.mail.MessagingException;
+import jakarta.mail.MessagingException;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.collections4.Transformer;
diff --git a/dspace-api/src/main/java/org/dspace/discovery/SolrServiceIndexComparisonPlugin.java b/dspace-api/src/main/java/org/dspace/discovery/SolrServiceIndexComparisonPlugin.java
new file mode 100644
index 000000000000..001d1c51a4dd
--- /dev/null
+++ b/dspace-api/src/main/java/org/dspace/discovery/SolrServiceIndexComparisonPlugin.java
@@ -0,0 +1,95 @@
+/**
+ * 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.discovery;
+
+import org.apache.logging.log4j.Logger;
+import org.apache.solr.common.SolrInputDocument;
+import org.apache.tika.utils.StringUtils;
+import org.dspace.content.Item;
+import org.dspace.content.WorkspaceItem;
+import org.dspace.content.service.DuplicateDetectionService;
+import org.dspace.content.service.ItemService;
+import org.dspace.core.Context;
+import org.dspace.discovery.indexobject.IndexableItem;
+import org.dspace.discovery.indexobject.IndexableWorkflowItem;
+import org.dspace.discovery.indexobject.IndexableWorkspaceItem;
+import org.dspace.services.ConfigurationService;
+import org.dspace.workflow.WorkflowItem;
+import org.springframework.beans.factory.annotation.Autowired;
+
+/**
+ * Indexes special normalised values used for comparing items, to be used in e.g. basic duplicate detection
+ *
+ * @author Kim Shepherd
+ */
+public class SolrServiceIndexComparisonPlugin implements SolrServiceIndexPlugin {
+
+ @Autowired
+ ConfigurationService configurationService;
+ @Autowired
+ ItemService itemService;
+ @Autowired
+ DuplicateDetectionService duplicateDetectionService;
+
+ private static final Logger log = org.apache.logging.log4j.LogManager
+ .getLogger(SolrServiceIndexComparisonPlugin.class);
+
+ /**
+ * Index the normalised name of the item to a solr field
+ *
+ * @param context DSpace context
+ * @param idxObj the indexable item
+ * @param document the Solr document
+ */
+ @Override
+ public void additionalIndex(Context context, IndexableObject idxObj, SolrInputDocument document) {
+ // Immediately return if this feature is not configured
+ if (!configurationService.getBooleanProperty("duplicate.enable", false)) {
+ return;
+ }
+ // Otherwise, continue with item indexing. Handle items, workflow items, and workspace items
+ if (idxObj instanceof IndexableItem) {
+ indexItemComparisonValue(context, ((IndexableItem) idxObj).getIndexedObject(), document);
+ } else if (idxObj instanceof IndexableWorkspaceItem) {
+ WorkspaceItem workspaceItem = ((IndexableWorkspaceItem) idxObj).getIndexedObject();
+ if (workspaceItem != null) {
+ Item item = workspaceItem.getItem();
+ if (item != null) {
+ indexItemComparisonValue(context, item, document);
+ }
+ }
+ } else if (idxObj instanceof IndexableWorkflowItem) {
+ WorkflowItem workflowItem = ((IndexableWorkflowItem) idxObj).getIndexedObject();
+ if (workflowItem != null) {
+ Item item = workflowItem.getItem();
+ if (item != null) {
+ indexItemComparisonValue(context, item, document);
+ }
+ }
+ }
+ }
+
+ /**
+ * Add the actual comparison value field to the given solr doc
+ *
+ * @param context DSpace context
+ * @param item DSpace item
+ * @param document Solr document
+ */
+ private void indexItemComparisonValue(Context context, Item item, SolrInputDocument document) {
+ if (item != null) {
+ // Build normalised comparison value and add to the document
+ String comparisonValue = duplicateDetectionService.buildComparisonValue(context, item);
+ if (!StringUtils.isBlank(comparisonValue)) {
+ // Add the field to the document
+ document.addField(configurationService.getProperty("duplicate.comparison.solr.field",
+ "deduplication_keyword"), comparisonValue);
+ }
+ }
+ }
+}
diff --git a/dspace-api/src/main/java/org/dspace/discovery/configuration/DiscoverySortConfiguration.java b/dspace-api/src/main/java/org/dspace/discovery/configuration/DiscoverySortConfiguration.java
index cd1a4eecb8d4..066e3c73e9ee 100644
--- a/dspace-api/src/main/java/org/dspace/discovery/configuration/DiscoverySortConfiguration.java
+++ b/dspace-api/src/main/java/org/dspace/discovery/configuration/DiscoverySortConfiguration.java
@@ -9,8 +9,8 @@
import java.util.ArrayList;
import java.util.List;
-import javax.annotation.Nullable;
+import jakarta.annotation.Nullable;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
diff --git a/dspace-api/src/main/java/org/dspace/discovery/indexobject/IndexableLDNNotification.java b/dspace-api/src/main/java/org/dspace/discovery/indexobject/IndexableLDNNotification.java
new file mode 100644
index 000000000000..86d600b6c97e
--- /dev/null
+++ b/dspace-api/src/main/java/org/dspace/discovery/indexobject/IndexableLDNNotification.java
@@ -0,0 +1,53 @@
+/**
+ * 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.discovery.indexobject;
+
+import org.dspace.app.ldn.LDNMessageEntity;
+import org.dspace.discovery.IndexableObject;
+
+/**
+ * {@link LDNMessageEntity} implementation for the {@link IndexableObject}
+ *
+ * @author Stefano Maffei at 4science.com
+ */
+public class IndexableLDNNotification extends AbstractIndexableObject {
+
+ private LDNMessageEntity ldnMessage;
+ public static final String TYPE = LDNMessageEntity.class.getSimpleName();
+
+ public IndexableLDNNotification(LDNMessageEntity ldnMessage) {
+ super();
+ this.ldnMessage = ldnMessage;
+ }
+
+ @Override
+ public String getType() {
+ return getTypeText();
+ }
+
+ @Override
+ public String getID() {
+ return ldnMessage.getID();
+ }
+
+ @Override
+ public LDNMessageEntity getIndexedObject() {
+ return ldnMessage;
+ }
+
+ @Override
+ public void setIndexedObject(LDNMessageEntity object) {
+ this.ldnMessage = object;
+ }
+
+ @Override
+ public String getTypeText() {
+ return TYPE;
+ }
+
+}
diff --git a/dspace-api/src/main/java/org/dspace/discovery/indexobject/LDNMessageEntityIndexFactoryImpl.java b/dspace-api/src/main/java/org/dspace/discovery/indexobject/LDNMessageEntityIndexFactoryImpl.java
new file mode 100644
index 000000000000..7752ae58627f
--- /dev/null
+++ b/dspace-api/src/main/java/org/dspace/discovery/indexobject/LDNMessageEntityIndexFactoryImpl.java
@@ -0,0 +1,157 @@
+/**
+ * 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.discovery.indexobject;
+
+import static org.apache.commons.lang3.time.DateFormatUtils.format;
+
+import java.io.IOException;
+import java.sql.SQLException;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Optional;
+
+import org.apache.solr.common.SolrInputDocument;
+import org.dspace.app.ldn.LDNMessageEntity;
+import org.dspace.app.ldn.NotifyServiceEntity;
+import org.dspace.app.ldn.service.LDNMessageService;
+import org.dspace.content.Item;
+import org.dspace.content.service.ItemService;
+import org.dspace.core.Context;
+import org.springframework.beans.factory.annotation.Autowired;
+
+/**
+ * Factory implementation implementation for the
+ * {@link IndexableLDNNotification}
+ *
+ * @author Stefano Maffei at 4science.com
+ */
+public class LDNMessageEntityIndexFactoryImpl extends IndexFactoryImpl {
+
+ @Autowired(required = true)
+ private LDNMessageService ldnMessageService;
+ @Autowired(required = true)
+ private ItemService itemService;
+
+ @Override
+ public Iterator findAll(Context context) throws SQLException {
+ final Iterator ldnNotifications = ldnMessageService.findAll(context).iterator();
+ return new Iterator<>() {
+ @Override
+ public boolean hasNext() {
+ return ldnNotifications.hasNext();
+ }
+
+ @Override
+ public IndexableLDNNotification next() {
+ return new IndexableLDNNotification(ldnNotifications.next());
+ }
+ };
+ }
+
+ @Override
+ public String getType() {
+ return IndexableLDNNotification.TYPE;
+ }
+
+ @Override
+ public Optional findIndexableObject(Context context, String id) throws SQLException {
+ final LDNMessageEntity ldnMessage = ldnMessageService.find(context, id);
+ return ldnMessage == null ? Optional.empty() : Optional.of(new IndexableLDNNotification(ldnMessage));
+ }
+
+ @Override
+ public boolean supports(Object object) {
+ return object instanceof LDNMessageEntity;
+ }
+
+ @Override
+ public List getIndexableObjects(Context context, LDNMessageEntity object)
+ throws SQLException {
+ return Arrays.asList(new IndexableLDNNotification(object));
+ }
+
+ @Override
+ public SolrInputDocument buildDocument(Context context, IndexableLDNNotification indexableObject)
+ throws SQLException, IOException {
+ // Add the ID's, types and call the SolrServiceIndexPlugins
+ final SolrInputDocument doc = super.buildDocument(context, indexableObject);
+ final LDNMessageEntity ldnMessage = indexableObject.getIndexedObject();
+ // add schema, element, qualifier and full fieldName
+ doc.addField("notification_id", ldnMessage.getID());
+ doc.addField("queue_status_i", ldnMessage.getQueueStatus());
+ doc.addField("queue_status_s", LDNMessageEntity.getQueueStatus(ldnMessage));
+ addFacetIndex(doc, "queue_status", String.valueOf(ldnMessage.getQueueStatus()),
+ LDNMessageEntity.getQueueStatus(ldnMessage));
+ if (ldnMessage.getObject() != null && ldnMessage.getObject().getID() != null) {
+ Item item = itemService.findByIdOrLegacyId(context, ldnMessage.getObject().getID().toString());
+ if (item != null) {
+ addFacetIndex(doc, "object", item.getID().toString(), itemService.getMetadata(item, "dc.title"));
+ addFacetIndex(doc, "relateditem", item.getID().toString(), itemService.getMetadata(item, "dc.title"));
+ }
+ }
+ if (ldnMessage.getContext() != null && ldnMessage.getContext().getID() != null) {
+ Item item = itemService.findByIdOrLegacyId(context, ldnMessage.getContext().getID().toString());
+ if (item != null) {
+ addFacetIndex(doc, "context", item.getID().toString(), itemService.getMetadata(item, "dc.title"));
+ addFacetIndex(doc, "relateditem", item.getID().toString(), itemService.getMetadata(item, "dc.title"));
+ }
+ }
+ NotifyServiceEntity origin = ldnMessage.getOrigin();
+ if (origin != null) {
+ addFacetIndex(doc, "origin", String.valueOf(origin.getID()),
+ LDNMessageEntity.getServiceNameForNotifyServ(origin));
+ addFacetIndex(doc, "ldn_service", String.valueOf(origin.getID()),
+ LDNMessageEntity.getServiceNameForNotifyServ(origin));
+ }
+ NotifyServiceEntity target = ldnMessage.getTarget();
+ if (target != null) {
+ addFacetIndex(doc, "target", String.valueOf(target.getID()),
+ LDNMessageEntity.getServiceNameForNotifyServ(target));
+ addFacetIndex(doc, "ldn_service", String.valueOf(target.getID()),
+ LDNMessageEntity.getServiceNameForNotifyServ(target));
+ }
+ if (ldnMessage.getInReplyTo() != null) {
+ doc.addField("in_reply_to", ldnMessage.getInReplyTo().getID());
+ }
+ doc.addField("message", ldnMessage.getMessage());
+ doc.addField("type", ldnMessage.getType());
+ addFacetIndex(doc, "activity_stream_type", ldnMessage.getActivityStreamType(),
+ ldnMessage.getActivityStreamType());
+ addFacetIndex(doc, "coar_notify_type", ldnMessage.getCoarNotifyType(), ldnMessage.getCoarNotifyType());
+ doc.addField("queue_attempts", ldnMessage.getQueueAttempts());
+ doc.addField("queue_attempts_sort", ldnMessage.getQueueAttempts());
+
+ indexDateFieldForFacet(doc, ldnMessage.getQueueLastStartTime());
+
+ doc.addField("queue_timeout", ldnMessage.getQueueTimeout());
+ String notificationType = LDNMessageEntity.getNotificationType(ldnMessage);
+ addFacetIndex(doc, "notification_type", notificationType, notificationType);
+
+ return doc;
+ }
+
+ private void indexDateFieldForFacet(SolrInputDocument doc, Date queueLastStartTime) {
+ if (queueLastStartTime != null) {
+ String value = format(queueLastStartTime, "yyyy-MM-dd");
+ addFacetIndex(doc, "queue_last_start_time", value, value);
+ doc.addField("queue_last_start_time", value);
+ doc.addField("queue_last_start_time_dt", queueLastStartTime);
+ doc.addField("queue_last_start_time_min", value);
+ doc.addField("queue_last_start_time_min_sort", value);
+ doc.addField("queue_last_start_time_max", value);
+ doc.addField("queue_last_start_time_max_sort", value);
+ doc.addField("queue_last_start_time.year",
+ Integer.parseInt(format(queueLastStartTime, "yyyy")));
+ doc.addField("queue_last_start_time.year_sort",
+ Integer.parseInt(format(queueLastStartTime, "yyyy")));
+ }
+ }
+
+}
diff --git a/dspace-api/src/main/java/org/dspace/eperson/AccountServiceImpl.java b/dspace-api/src/main/java/org/dspace/eperson/AccountServiceImpl.java
index 3d4eab125f92..4fb95962b2e6 100644
--- a/dspace-api/src/main/java/org/dspace/eperson/AccountServiceImpl.java
+++ b/dspace-api/src/main/java/org/dspace/eperson/AccountServiceImpl.java
@@ -10,8 +10,8 @@
import java.io.IOException;
import java.sql.SQLException;
import java.util.Locale;
-import javax.mail.MessagingException;
+import jakarta.mail.MessagingException;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.dspace.authenticate.service.AuthenticationService;
@@ -73,7 +73,7 @@ protected AccountServiceImpl() {
* @param email Email address to send the registration email to
* @throws java.sql.SQLException passed through.
* @throws java.io.IOException passed through.
- * @throws javax.mail.MessagingException passed through.
+ * @throws jakarta.mail.MessagingException passed through.
* @throws org.dspace.authorize.AuthorizeException passed through.
*/
@Override
@@ -105,7 +105,7 @@ public void sendRegistrationInfo(Context context, String email)
* @param email Email address to send the forgot-password email to
* @throws java.sql.SQLException passed through.
* @throws java.io.IOException passed through.
- * @throws javax.mail.MessagingException passed through.
+ * @throws jakarta.mail.MessagingException passed through.
* @throws org.dspace.authorize.AuthorizeException passed through.
*/
@Override
diff --git a/dspace-api/src/main/java/org/dspace/eperson/CaptchaServiceImpl.java b/dspace-api/src/main/java/org/dspace/eperson/CaptchaServiceImpl.java
index 0ab66aea5c2e..b213675b163e 100644
--- a/dspace-api/src/main/java/org/dspace/eperson/CaptchaServiceImpl.java
+++ b/dspace-api/src/main/java/org/dspace/eperson/CaptchaServiceImpl.java
@@ -14,9 +14,9 @@
import java.util.List;
import java.util.Objects;
import java.util.regex.Pattern;
-import javax.annotation.PostConstruct;
import com.fasterxml.jackson.databind.ObjectMapper;
+import jakarta.annotation.PostConstruct;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.HttpClient;
diff --git a/dspace-api/src/main/java/org/dspace/eperson/EPerson.java b/dspace-api/src/main/java/org/dspace/eperson/EPerson.java
index da83a1cafd37..996fc96e3aa8 100644
--- a/dspace-api/src/main/java/org/dspace/eperson/EPerson.java
+++ b/dspace-api/src/main/java/org/dspace/eperson/EPerson.java
@@ -11,27 +11,25 @@
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
-import javax.persistence.Cacheable;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.FetchType;
-import javax.persistence.ManyToMany;
-import javax.persistence.Table;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
-import javax.persistence.Transient;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.FetchType;
+import jakarta.persistence.ManyToMany;
+import jakarta.persistence.Table;
+import jakarta.persistence.Temporal;
+import jakarta.persistence.TemporalType;
+import jakarta.persistence.Transient;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
-import org.dspace.content.DSpaceObject;
+import org.dspace.content.CacheableDSpaceObject;
import org.dspace.content.DSpaceObjectLegacySupport;
import org.dspace.content.Item;
import org.dspace.core.Constants;
import org.dspace.core.Context;
+import org.dspace.core.HibernateProxyHelper;
import org.dspace.eperson.factory.EPersonServiceFactory;
import org.dspace.eperson.service.EPersonService;
-import org.hibernate.annotations.CacheConcurrencyStrategy;
-import org.hibernate.proxy.HibernateProxyHelper;
/**
* Class representing an e-person.
@@ -39,10 +37,8 @@
* @author David Stuve
*/
@Entity
-@Cacheable
-@org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE, include = "non-lazy")
@Table(name = "eperson")
-public class EPerson extends DSpaceObject implements DSpaceObjectLegacySupport {
+public class EPerson extends CacheableDSpaceObject implements DSpaceObjectLegacySupport {
@Column(name = "eperson_id", insertable = false, updatable = false)
private Integer legacyId;
diff --git a/dspace-api/src/main/java/org/dspace/eperson/EPersonConsumer.java b/dspace-api/src/main/java/org/dspace/eperson/EPersonConsumer.java
index feefe65717df..8679d74b2421 100644
--- a/dspace-api/src/main/java/org/dspace/eperson/EPersonConsumer.java
+++ b/dspace-api/src/main/java/org/dspace/eperson/EPersonConsumer.java
@@ -10,8 +10,8 @@
import java.io.IOException;
import java.util.Date;
import java.util.UUID;
-import javax.mail.MessagingException;
+import jakarta.mail.MessagingException;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.Logger;
import org.dspace.core.Constants;
diff --git a/dspace-api/src/main/java/org/dspace/eperson/Group.java b/dspace-api/src/main/java/org/dspace/eperson/Group.java
index 67655e0e0aaf..24b44b8149a4 100644
--- a/dspace-api/src/main/java/org/dspace/eperson/Group.java
+++ b/dspace-api/src/main/java/org/dspace/eperson/Group.java
@@ -10,23 +10,21 @@
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
-import javax.persistence.Cacheable;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.FetchType;
-import javax.persistence.JoinColumn;
-import javax.persistence.JoinTable;
-import javax.persistence.ManyToMany;
-import javax.persistence.Table;
-import javax.persistence.Transient;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.FetchType;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.JoinTable;
+import jakarta.persistence.ManyToMany;
+import jakarta.persistence.Table;
+import jakarta.persistence.Transient;
import org.apache.commons.lang3.StringUtils;
-import org.dspace.content.DSpaceObject;
+import org.dspace.content.CacheableDSpaceObject;
import org.dspace.content.DSpaceObjectLegacySupport;
import org.dspace.core.Constants;
import org.dspace.core.Context;
-import org.hibernate.annotations.CacheConcurrencyStrategy;
-import org.hibernate.proxy.HibernateProxyHelper;
+import org.dspace.core.HibernateProxyHelper;
/**
* Class representing a group of e-people.
@@ -34,10 +32,8 @@
* @author David Stuve
*/
@Entity
-@Cacheable
-@org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE, include = "non-lazy")
@Table(name = "epersongroup")
-public class Group extends DSpaceObject implements DSpaceObjectLegacySupport {
+public class Group extends CacheableDSpaceObject implements DSpaceObjectLegacySupport {
@Transient
public static final String ANONYMOUS = "Anonymous";
diff --git a/dspace-api/src/main/java/org/dspace/eperson/Group2GroupCache.java b/dspace-api/src/main/java/org/dspace/eperson/Group2GroupCache.java
index 09bdf34d4cad..a1c12371f5ff 100644
--- a/dspace-api/src/main/java/org/dspace/eperson/Group2GroupCache.java
+++ b/dspace-api/src/main/java/org/dspace/eperson/Group2GroupCache.java
@@ -8,14 +8,14 @@
package org.dspace.eperson;
import java.io.Serializable;
-import javax.persistence.Entity;
-import javax.persistence.FetchType;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.Table;
-import org.hibernate.proxy.HibernateProxyHelper;
+import jakarta.persistence.Entity;
+import jakarta.persistence.FetchType;
+import jakarta.persistence.Id;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.Table;
+import org.dspace.core.HibernateProxyHelper;
/**
* Database entity representation of the group2groupcache table
diff --git a/dspace-api/src/main/java/org/dspace/eperson/RegistrationData.java b/dspace-api/src/main/java/org/dspace/eperson/RegistrationData.java
index f4f41bdff2eb..0d0c5e7db851 100644
--- a/dspace-api/src/main/java/org/dspace/eperson/RegistrationData.java
+++ b/dspace-api/src/main/java/org/dspace/eperson/RegistrationData.java
@@ -8,16 +8,16 @@
package org.dspace.eperson;
import java.util.Date;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.SequenceGenerator;
-import javax.persistence.Table;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.SequenceGenerator;
+import jakarta.persistence.Table;
+import jakarta.persistence.Temporal;
+import jakarta.persistence.TemporalType;
import org.dspace.core.Context;
import org.dspace.core.ReloadableEntity;
diff --git a/dspace-api/src/main/java/org/dspace/eperson/Subscription.java b/dspace-api/src/main/java/org/dspace/eperson/Subscription.java
index 5db63740f477..0f473a5a750d 100644
--- a/dspace-api/src/main/java/org/dspace/eperson/Subscription.java
+++ b/dspace-api/src/main/java/org/dspace/eperson/Subscription.java
@@ -9,19 +9,19 @@
import java.util.ArrayList;
import java.util.List;
-import javax.persistence.CascadeType;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.FetchType;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.OneToMany;
-import javax.persistence.SequenceGenerator;
-import javax.persistence.Table;
+import jakarta.persistence.CascadeType;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.FetchType;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.OneToMany;
+import jakarta.persistence.SequenceGenerator;
+import jakarta.persistence.Table;
import org.dspace.content.DSpaceObject;
import org.dspace.core.Context;
import org.dspace.core.ReloadableEntity;
diff --git a/dspace-api/src/main/java/org/dspace/eperson/SubscriptionParameter.java b/dspace-api/src/main/java/org/dspace/eperson/SubscriptionParameter.java
index 7526535d7fcd..8d372966b10a 100644
--- a/dspace-api/src/main/java/org/dspace/eperson/SubscriptionParameter.java
+++ b/dspace-api/src/main/java/org/dspace/eperson/SubscriptionParameter.java
@@ -7,16 +7,15 @@
*/
package org.dspace.eperson;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.SequenceGenerator;
-import javax.persistence.Table;
-
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.SequenceGenerator;
+import jakarta.persistence.Table;
import org.dspace.core.ReloadableEntity;
/**
diff --git a/dspace-api/src/main/java/org/dspace/eperson/dao/impl/EPersonDAOImpl.java b/dspace-api/src/main/java/org/dspace/eperson/dao/impl/EPersonDAOImpl.java
index 87d6c5869b09..7d8e0720c45f 100644
--- a/dspace-api/src/main/java/org/dspace/eperson/dao/impl/EPersonDAOImpl.java
+++ b/dspace-api/src/main/java/org/dspace/eperson/dao/impl/EPersonDAOImpl.java
@@ -15,11 +15,11 @@
import java.util.List;
import java.util.Set;
import java.util.UUID;
-import javax.persistence.Query;
-import javax.persistence.criteria.CriteriaBuilder;
-import javax.persistence.criteria.CriteriaQuery;
-import javax.persistence.criteria.Root;
+import jakarta.persistence.Query;
+import jakarta.persistence.criteria.CriteriaBuilder;
+import jakarta.persistence.criteria.CriteriaQuery;
+import jakarta.persistence.criteria.Root;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.ListUtils;
import org.apache.commons.lang3.StringUtils;
diff --git a/dspace-api/src/main/java/org/dspace/eperson/dao/impl/Group2GroupCacheDAOImpl.java b/dspace-api/src/main/java/org/dspace/eperson/dao/impl/Group2GroupCacheDAOImpl.java
index 83fb48aaf03d..1cd359188ca3 100644
--- a/dspace-api/src/main/java/org/dspace/eperson/dao/impl/Group2GroupCacheDAOImpl.java
+++ b/dspace-api/src/main/java/org/dspace/eperson/dao/impl/Group2GroupCacheDAOImpl.java
@@ -10,12 +10,12 @@
import java.sql.SQLException;
import java.util.LinkedList;
import java.util.List;
-import javax.persistence.Query;
-import javax.persistence.criteria.CriteriaBuilder;
-import javax.persistence.criteria.CriteriaQuery;
-import javax.persistence.criteria.Predicate;
-import javax.persistence.criteria.Root;
+import jakarta.persistence.Query;
+import jakarta.persistence.criteria.CriteriaBuilder;
+import jakarta.persistence.criteria.CriteriaQuery;
+import jakarta.persistence.criteria.Predicate;
+import jakarta.persistence.criteria.Root;
import org.dspace.core.AbstractHibernateDAO;
import org.dspace.core.Context;
import org.dspace.eperson.Group;
diff --git a/dspace-api/src/main/java/org/dspace/eperson/dao/impl/GroupDAOImpl.java b/dspace-api/src/main/java/org/dspace/eperson/dao/impl/GroupDAOImpl.java
index 6aea9ecd8d67..abd9fc830fa4 100644
--- a/dspace-api/src/main/java/org/dspace/eperson/dao/impl/GroupDAOImpl.java
+++ b/dspace-api/src/main/java/org/dspace/eperson/dao/impl/GroupDAOImpl.java
@@ -11,8 +11,8 @@
import java.util.Collections;
import java.util.List;
import java.util.UUID;
-import javax.persistence.Query;
+import jakarta.persistence.Query;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.Pair;
import org.dspace.content.MetadataField;
diff --git a/dspace-api/src/main/java/org/dspace/eperson/dao/impl/RegistrationDataDAOImpl.java b/dspace-api/src/main/java/org/dspace/eperson/dao/impl/RegistrationDataDAOImpl.java
index 4a15dcc86796..63e87400ce36 100644
--- a/dspace-api/src/main/java/org/dspace/eperson/dao/impl/RegistrationDataDAOImpl.java
+++ b/dspace-api/src/main/java/org/dspace/eperson/dao/impl/RegistrationDataDAOImpl.java
@@ -8,11 +8,11 @@
package org.dspace.eperson.dao.impl;
import java.sql.SQLException;
-import javax.persistence.Query;
-import javax.persistence.criteria.CriteriaBuilder;
-import javax.persistence.criteria.CriteriaQuery;
-import javax.persistence.criteria.Root;
+import jakarta.persistence.Query;
+import jakarta.persistence.criteria.CriteriaBuilder;
+import jakarta.persistence.criteria.CriteriaQuery;
+import jakarta.persistence.criteria.Root;
import org.dspace.core.AbstractHibernateDAO;
import org.dspace.core.Context;
import org.dspace.eperson.RegistrationData;
diff --git a/dspace-api/src/main/java/org/dspace/eperson/dao/impl/SubscriptionDAOImpl.java b/dspace-api/src/main/java/org/dspace/eperson/dao/impl/SubscriptionDAOImpl.java
index 6c36211f310c..d3d4748728ce 100644
--- a/dspace-api/src/main/java/org/dspace/eperson/dao/impl/SubscriptionDAOImpl.java
+++ b/dspace-api/src/main/java/org/dspace/eperson/dao/impl/SubscriptionDAOImpl.java
@@ -11,12 +11,12 @@
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
-import javax.persistence.Query;
-import javax.persistence.criteria.CriteriaBuilder;
-import javax.persistence.criteria.CriteriaQuery;
-import javax.persistence.criteria.Join;
-import javax.persistence.criteria.Root;
+import jakarta.persistence.Query;
+import jakarta.persistence.criteria.CriteriaBuilder;
+import jakarta.persistence.criteria.CriteriaQuery;
+import jakarta.persistence.criteria.Join;
+import jakarta.persistence.criteria.Root;
import org.dspace.content.DSpaceObject;
import org.dspace.core.AbstractHibernateDAO;
import org.dspace.core.Context;
@@ -44,11 +44,12 @@ protected SubscriptionDAOImpl() {
public List findByEPerson(Context context, EPerson eperson, Integer limit, Integer offset)
throws SQLException {
CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context);
- javax.persistence.criteria.CriteriaQuery criteriaQuery = getCriteriaQuery(criteriaBuilder, Subscription.class);
+ jakarta.persistence.criteria.CriteriaQuery criteriaQuery =
+ getCriteriaQuery(criteriaBuilder, Subscription.class);
Root subscriptionRoot = criteriaQuery.from(Subscription.class);
criteriaQuery.select(subscriptionRoot);
criteriaQuery.where(criteriaBuilder.equal(subscriptionRoot.get(Subscription_.ePerson), eperson));
- List orderList = new LinkedList<>();
+ List orderList = new LinkedList<>();
orderList.add(criteriaBuilder.asc(subscriptionRoot.get(Subscription_.dSpaceObject)));
criteriaQuery.orderBy(orderList);
return list(context, criteriaQuery, false, Subscription.class, limit, offset);
@@ -59,7 +60,7 @@ public List findByEPersonAndDso(Context context, EPerson eperson,
DSpaceObject dSpaceObject,
Integer limit, Integer offset) throws SQLException {
CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context);
- javax.persistence.criteria.CriteriaQuery criteriaQuery =
+ jakarta.persistence.criteria.CriteriaQuery criteriaQuery =
getCriteriaQuery(criteriaBuilder, Subscription.class);
Root subscriptionRoot = criteriaQuery.from(Subscription.class);
criteriaQuery.select(subscriptionRoot);
@@ -67,7 +68,7 @@ public List findByEPersonAndDso(Context context, EPerson eperson,
subscriptionRoot.get(Subscription_.ePerson), eperson),
criteriaBuilder.equal(subscriptionRoot.get(Subscription_.dSpaceObject), dSpaceObject)
));
- List orderList = new LinkedList<>();
+ List orderList = new LinkedList<>();
orderList.add(criteriaBuilder.asc(subscriptionRoot.get(Subscription_.dSpaceObject)));
criteriaQuery.orderBy(orderList);
return list(context, criteriaQuery, false, Subscription.class, limit, offset);
@@ -104,7 +105,7 @@ public void deleteByDSOAndEPerson(Context context, DSpaceObject dSpaceObject, EP
public List findAllOrderedByIDAndResourceType(Context context, String resourceType,
Integer limit, Integer offset) throws SQLException {
String hqlQuery = "select s from Subscription s join %s dso " +
- "ON dso.id = s.dSpaceObject ORDER BY subscription_id";
+ "ON dso = s.dSpaceObject ORDER BY s.id";
if (resourceType != null) {
hqlQuery = String.format(hqlQuery, resourceType);
}
@@ -125,7 +126,7 @@ public List findAllOrderedByDSO(Context context, Integer limit, In
CriteriaQuery criteriaQuery = getCriteriaQuery(criteriaBuilder, Subscription.class);
Root subscriptionRoot = criteriaQuery.from(Subscription.class);
criteriaQuery.select(subscriptionRoot);
- List orderList = new LinkedList<>();
+ List orderList = new LinkedList<>();
orderList.add(criteriaBuilder.asc(subscriptionRoot.get(Subscription_.dSpaceObject)));
criteriaQuery.orderBy(orderList);
return list(context, criteriaQuery, false, Subscription.class, limit, offset);
@@ -145,7 +146,7 @@ public List findAllSubscriptionsBySubscriptionTypeAndFrequency(Con
criteriaBuilder.equal(childJoin.get(SubscriptionParameter_.name), "frequency"),
criteriaBuilder.equal(childJoin.get(SubscriptionParameter_.value), frequencyValue)
));
- List orderList = new ArrayList<>(1);
+ List orderList = new ArrayList<>(1);
orderList.add(criteriaBuilder.asc(subscriptionRoot.get(Subscription_.ePerson)));
orderList.add(criteriaBuilder.asc(subscriptionRoot.get(Subscription_.id)));
criteriaQuery.orderBy(orderList);
diff --git a/dspace-api/src/main/java/org/dspace/eperson/service/AccountService.java b/dspace-api/src/main/java/org/dspace/eperson/service/AccountService.java
index c8ecb0cc67d4..637b81c41da2 100644
--- a/dspace-api/src/main/java/org/dspace/eperson/service/AccountService.java
+++ b/dspace-api/src/main/java/org/dspace/eperson/service/AccountService.java
@@ -9,8 +9,8 @@
import java.io.IOException;
import java.sql.SQLException;
-import javax.mail.MessagingException;
+import jakarta.mail.MessagingException;
import org.dspace.authorize.AuthorizeException;
import org.dspace.core.Context;
import org.dspace.eperson.EPerson;
diff --git a/dspace-api/src/main/java/org/dspace/eperson/service/EPersonService.java b/dspace-api/src/main/java/org/dspace/eperson/service/EPersonService.java
index 2afec161a672..b3583155f354 100644
--- a/dspace-api/src/main/java/org/dspace/eperson/service/EPersonService.java
+++ b/dspace-api/src/main/java/org/dspace/eperson/service/EPersonService.java
@@ -13,8 +13,8 @@
import java.util.Date;
import java.util.List;
import java.util.Set;
-import javax.validation.constraints.NotNull;
+import jakarta.validation.constraints.NotNull;
import org.dspace.authorize.AuthorizeException;
import org.dspace.content.Item;
import org.dspace.content.MetadataFieldName;
diff --git a/dspace-api/src/main/java/org/dspace/event/Event.java b/dspace-api/src/main/java/org/dspace/event/Event.java
index af8b2d45713f..a673cd985274 100644
--- a/dspace-api/src/main/java/org/dspace/event/Event.java
+++ b/dspace-api/src/main/java/org/dspace/event/Event.java
@@ -104,8 +104,10 @@ public class Event implements Serializable {
protected static final int EPERSON = 1 << Constants.EPERSON; // 7
+ protected static final int LDN_MESSAGE = 1 << Constants.LDN_MESSAGE; // 8
+
protected static final int ALL_OBJECTS_MASK = BITSTREAM | BUNDLE | ITEM
- | COLLECTION | COMMUNITY | SITE | GROUP | EPERSON;
+ | COLLECTION | COMMUNITY | SITE | GROUP | EPERSON | LDN_MESSAGE;
protected static Map objTypeToMask = new HashMap();
@@ -135,6 +137,9 @@ public class Event implements Serializable {
objTypeToMask.put(Constants.EPERSON, EPERSON);
objMaskToType.put(EPERSON, Constants.EPERSON);
+
+ objTypeToMask.put(Constants.LDN_MESSAGE, LDN_MESSAGE);
+ objMaskToType.put(LDN_MESSAGE, Constants.LDN_MESSAGE);
}
/** ---------- Event Fields ------------- * */
diff --git a/dspace-api/src/main/java/org/dspace/external/OpenaireRestConnector.java b/dspace-api/src/main/java/org/dspace/external/OpenaireRestConnector.java
index c96fad1de01c..27688df6c758 100644
--- a/dspace-api/src/main/java/org/dspace/external/OpenaireRestConnector.java
+++ b/dspace-api/src/main/java/org/dspace/external/OpenaireRestConnector.java
@@ -16,7 +16,6 @@
import java.util.ArrayList;
import java.util.Base64;
import java.util.List;
-import javax.xml.bind.JAXBException;
import eu.openaire.jaxb.helper.OpenAIREHandler;
import eu.openaire.jaxb.model.Response;
@@ -278,7 +277,7 @@ public Response search(String path, int page, int size) {
if (result != null) {
try {
return OpenAIREHandler.unmarshal(result);
- } catch (JAXBException e) {
+ } catch (Exception e) {
log.error("Error extracting result from request: " + queryString);
getGotError(e, path);
}
diff --git a/dspace-api/src/main/java/org/dspace/external/provider/impl/OrcidPublicationDataProvider.java b/dspace-api/src/main/java/org/dspace/external/provider/impl/OrcidPublicationDataProvider.java
index 9a4f9c9b423c..05dabe0a5bdc 100644
--- a/dspace-api/src/main/java/org/dspace/external/provider/impl/OrcidPublicationDataProvider.java
+++ b/dspace-api/src/main/java/org/dspace/external/provider/impl/OrcidPublicationDataProvider.java
@@ -485,7 +485,7 @@ private boolean doesNotContains(ExternalDataObject externalDataObject, Metadatum
private boolean hasRole(Contributor contributor, ContributorRole role) {
ContributorAttributes attributes = contributor.getContributorAttributes();
- return attributes != null ? role.equals(attributes.getContributorRole()) : false;
+ return attributes != null ? role.value().equals(attributes.getContributorRole()) : false;
}
private Optional getContributorName(Contributor contributor) {
diff --git a/dspace-api/src/main/java/org/dspace/external/provider/orcid/xml/Converter.java b/dspace-api/src/main/java/org/dspace/external/provider/orcid/xml/Converter.java
index 756b8654f285..578db6c56749 100644
--- a/dspace-api/src/main/java/org/dspace/external/provider/orcid/xml/Converter.java
+++ b/dspace-api/src/main/java/org/dspace/external/provider/orcid/xml/Converter.java
@@ -9,13 +9,13 @@
import java.io.InputStream;
import java.net.URISyntaxException;
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Unmarshaller;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
+import jakarta.xml.bind.JAXBContext;
+import jakarta.xml.bind.JAXBException;
+import jakarta.xml.bind.Unmarshaller;
import org.xml.sax.SAXException;
/**
diff --git a/dspace-api/src/main/java/org/dspace/google/GoogleAsyncEventListener.java b/dspace-api/src/main/java/org/dspace/google/GoogleAsyncEventListener.java
index c1c59acf4a63..68c492d1a9a0 100644
--- a/dspace-api/src/main/java/org/dspace/google/GoogleAsyncEventListener.java
+++ b/dspace-api/src/main/java/org/dspace/google/GoogleAsyncEventListener.java
@@ -13,9 +13,9 @@
import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors;
-import javax.annotation.PostConstruct;
-import javax.servlet.http.HttpServletRequest;
+import jakarta.annotation.PostConstruct;
+import jakarta.servlet.http.HttpServletRequest;
import org.apache.commons.collections.Buffer;
import org.apache.commons.collections.BufferUtils;
import org.apache.commons.collections.buffer.CircularFifoBuffer;
diff --git a/dspace-api/src/main/java/org/dspace/google/GoogleRecorderEventListener.java b/dspace-api/src/main/java/org/dspace/google/GoogleRecorderEventListener.java
index 4159661b1ced..fb4e9c04de5b 100644
--- a/dspace-api/src/main/java/org/dspace/google/GoogleRecorderEventListener.java
+++ b/dspace-api/src/main/java/org/dspace/google/GoogleRecorderEventListener.java
@@ -13,8 +13,8 @@
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
-import javax.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletRequest;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.NameValuePair;
import org.apache.http.client.entity.UrlEncodedFormEntity;
diff --git a/dspace-api/src/main/java/org/dspace/handle/Handle.java b/dspace-api/src/main/java/org/dspace/handle/Handle.java
index c35511353a3a..29182ad56c89 100644
--- a/dspace-api/src/main/java/org/dspace/handle/Handle.java
+++ b/dspace-api/src/main/java/org/dspace/handle/Handle.java
@@ -7,17 +7,16 @@
*/
package org.dspace.handle;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.FetchType;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.SequenceGenerator;
-import javax.persistence.Table;
-
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.FetchType;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.SequenceGenerator;
+import jakarta.persistence.Table;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.dspace.content.DSpaceObject;
diff --git a/dspace-api/src/main/java/org/dspace/handle/dao/impl/HandleDAOImpl.java b/dspace-api/src/main/java/org/dspace/handle/dao/impl/HandleDAOImpl.java
index 71bb798ae387..495f1f05a446 100644
--- a/dspace-api/src/main/java/org/dspace/handle/dao/impl/HandleDAOImpl.java
+++ b/dspace-api/src/main/java/org/dspace/handle/dao/impl/HandleDAOImpl.java
@@ -13,11 +13,11 @@
import java.sql.SQLException;
import java.util.Collections;
import java.util.List;
-import javax.persistence.Query;
-import javax.persistence.criteria.CriteriaBuilder;
-import javax.persistence.criteria.CriteriaQuery;
-import javax.persistence.criteria.Root;
+import jakarta.persistence.Query;
+import jakarta.persistence.criteria.CriteriaBuilder;
+import jakarta.persistence.criteria.CriteriaQuery;
+import jakarta.persistence.criteria.Root;
import org.dspace.content.DSpaceObject;
import org.dspace.core.AbstractHibernateDAO;
import org.dspace.core.Context;
@@ -91,10 +91,9 @@ public List findByPrefix(Context context, String prefix) throws SQLExcep
@Override
public long countHandlesByPrefix(Context context, String prefix) throws SQLException {
CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context);
- CriteriaQuery criteriaQuery = getCriteriaQuery(criteriaBuilder, Handle.class);
+ CriteriaQuery criteriaQuery = criteriaBuilder.createQuery(Long.class);
Root handleRoot = criteriaQuery.from(Handle.class);
- criteriaQuery.select(handleRoot);
criteriaQuery.where(criteriaBuilder.like(handleRoot.get(Handle_.handle), prefix + "%"));
return countLong(context, criteriaQuery, criteriaBuilder, handleRoot);
}
@@ -137,7 +136,7 @@ public Long execute(Connection connection) throws SQLException {
// Find the next value in our sequence (based on DB dialect)
try (PreparedStatement preparedStatement = connection
- .prepareStatement(dialect.getSequenceNextValString(HANDLE_SEQUENCE))) {
+ .prepareStatement("SELECT nextval('" + HANDLE_SEQUENCE + "')")) {
// Execute query and return results
try (ResultSet resultSet = preparedStatement.executeQuery()) {
if (resultSet.next()) {
diff --git a/dspace-api/src/main/java/org/dspace/harvest/HarvestedCollection.java b/dspace-api/src/main/java/org/dspace/harvest/HarvestedCollection.java
index 9fe2bed67d32..dc65ce254222 100644
--- a/dspace-api/src/main/java/org/dspace/harvest/HarvestedCollection.java
+++ b/dspace-api/src/main/java/org/dspace/harvest/HarvestedCollection.java
@@ -8,20 +8,20 @@
package org.dspace.harvest;
import java.util.Date;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.FetchType;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.OneToOne;
-import javax.persistence.SequenceGenerator;
-import javax.persistence.Table;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
-import javax.persistence.Transient;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.FetchType;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.OneToOne;
+import jakarta.persistence.SequenceGenerator;
+import jakarta.persistence.Table;
+import jakarta.persistence.Temporal;
+import jakarta.persistence.TemporalType;
+import jakarta.persistence.Transient;
import org.dspace.content.Collection;
import org.dspace.core.Context;
import org.dspace.core.ReloadableEntity;
diff --git a/dspace-api/src/main/java/org/dspace/harvest/HarvestedItem.java b/dspace-api/src/main/java/org/dspace/harvest/HarvestedItem.java
index 343347136bc3..943543f405de 100644
--- a/dspace-api/src/main/java/org/dspace/harvest/HarvestedItem.java
+++ b/dspace-api/src/main/java/org/dspace/harvest/HarvestedItem.java
@@ -8,19 +8,19 @@
package org.dspace.harvest;
import java.util.Date;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.FetchType;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.OneToOne;
-import javax.persistence.SequenceGenerator;
-import javax.persistence.Table;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.FetchType;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.OneToOne;
+import jakarta.persistence.SequenceGenerator;
+import jakarta.persistence.Table;
+import jakarta.persistence.Temporal;
+import jakarta.persistence.TemporalType;
import org.dspace.content.Item;
import org.dspace.core.Context;
import org.dspace.core.ReloadableEntity;
diff --git a/dspace-api/src/main/java/org/dspace/harvest/dao/impl/HarvestedCollectionDAOImpl.java b/dspace-api/src/main/java/org/dspace/harvest/dao/impl/HarvestedCollectionDAOImpl.java
index 95a0bdf2163e..ab942a74ef07 100644
--- a/dspace-api/src/main/java/org/dspace/harvest/dao/impl/HarvestedCollectionDAOImpl.java
+++ b/dspace-api/src/main/java/org/dspace/harvest/dao/impl/HarvestedCollectionDAOImpl.java
@@ -11,11 +11,11 @@
import java.util.Date;
import java.util.LinkedList;
import java.util.List;
-import javax.persistence.criteria.CriteriaBuilder;
-import javax.persistence.criteria.CriteriaQuery;
-import javax.persistence.criteria.Predicate;
-import javax.persistence.criteria.Root;
+import jakarta.persistence.criteria.CriteriaBuilder;
+import jakarta.persistence.criteria.CriteriaQuery;
+import jakarta.persistence.criteria.Predicate;
+import jakarta.persistence.criteria.Root;
import org.dspace.content.Collection;
import org.dspace.core.AbstractHibernateDAO;
import org.dspace.core.Context;
@@ -46,7 +46,7 @@ public HarvestedCollection findByStatusAndMinimalTypeOrderByLastHarvestedDesc(Co
Root harvestedCollectionRoot = criteriaQuery.from(HarvestedCollection.class);
criteriaQuery.select(harvestedCollectionRoot);
- List orderList = new LinkedList<>();
+ List orderList = new LinkedList<>();
orderList.add(criteriaBuilder.desc(harvestedCollectionRoot.get(HarvestedCollection_.lastHarvested)));
criteriaQuery.orderBy(orderList);
@@ -61,7 +61,7 @@ public HarvestedCollection findByStatusAndMinimalTypeOrderByLastHarvestedAsc(Con
Root harvestedCollectionRoot = criteriaQuery.from(HarvestedCollection.class);
criteriaQuery.select(harvestedCollectionRoot);
- List orderList = new LinkedList<>();
+ List orderList = new LinkedList<>();
orderList.add(criteriaBuilder.asc(harvestedCollectionRoot.get(HarvestedCollection_.lastHarvested)));
criteriaQuery.orderBy(orderList);
@@ -138,7 +138,7 @@ public HarvestedCollection findByCollection(Context context, Collection collecti
)
);
- List orderList = new LinkedList<>();
+ List orderList = new LinkedList<>();
orderList.add(criteriaBuilder.asc(harvestedCollectionRoot.get(HarvestedCollection_.lastHarvested)));
criteriaQuery.orderBy(orderList);
@@ -150,11 +150,10 @@ public HarvestedCollection findByCollection(Context context, Collection collecti
@Override
public int count(Context context) throws SQLException {
-
CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context);
CriteriaQuery criteriaQuery = criteriaBuilder.createQuery(Long.class);
-
Root harvestedCollectionRoot = criteriaQuery.from(HarvestedCollection.class);
+ criteriaQuery.select(criteriaBuilder.count(harvestedCollectionRoot));
return count(context, criteriaQuery, criteriaBuilder, harvestedCollectionRoot);
}
diff --git a/dspace-api/src/main/java/org/dspace/harvest/dao/impl/HarvestedItemDAOImpl.java b/dspace-api/src/main/java/org/dspace/harvest/dao/impl/HarvestedItemDAOImpl.java
index 9e9838be6c1c..bb7ff0ee7cc4 100644
--- a/dspace-api/src/main/java/org/dspace/harvest/dao/impl/HarvestedItemDAOImpl.java
+++ b/dspace-api/src/main/java/org/dspace/harvest/dao/impl/HarvestedItemDAOImpl.java
@@ -8,11 +8,11 @@
package org.dspace.harvest.dao.impl;
import java.sql.SQLException;
-import javax.persistence.criteria.CriteriaBuilder;
-import javax.persistence.criteria.CriteriaQuery;
-import javax.persistence.criteria.Join;
-import javax.persistence.criteria.Root;
+import jakarta.persistence.criteria.CriteriaBuilder;
+import jakarta.persistence.criteria.CriteriaQuery;
+import jakarta.persistence.criteria.Join;
+import jakarta.persistence.criteria.Root;
import org.dspace.content.Collection;
import org.dspace.content.Item;
import org.dspace.content.Item_;
diff --git a/dspace-api/src/main/java/org/dspace/health/Report.java b/dspace-api/src/main/java/org/dspace/health/Report.java
index ebb2ffd688c0..d083a45b13d1 100644
--- a/dspace-api/src/main/java/org/dspace/health/Report.java
+++ b/dspace-api/src/main/java/org/dspace/health/Report.java
@@ -15,8 +15,8 @@
import java.util.List;
import java.util.Map.Entry;
import java.util.StringTokenizer;
-import javax.mail.MessagingException;
+import jakarta.mail.MessagingException;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.DefaultParser;
import org.apache.commons.cli.HelpFormatter;
diff --git a/dspace-api/src/main/java/org/dspace/identifier/DOI.java b/dspace-api/src/main/java/org/dspace/identifier/DOI.java
index e99472e45c78..2e699e990fc1 100644
--- a/dspace-api/src/main/java/org/dspace/identifier/DOI.java
+++ b/dspace-api/src/main/java/org/dspace/identifier/DOI.java
@@ -8,17 +8,16 @@
package org.dspace.identifier;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.FetchType;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.OneToOne;
-import javax.persistence.SequenceGenerator;
-import javax.persistence.Table;
-
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.FetchType;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.OneToOne;
+import jakarta.persistence.SequenceGenerator;
+import jakarta.persistence.Table;
import org.dspace.content.DSpaceObject;
import org.dspace.core.Context;
import org.dspace.core.ReloadableEntity;
diff --git a/dspace-api/src/main/java/org/dspace/identifier/HandleIdentifierProvider.java b/dspace-api/src/main/java/org/dspace/identifier/HandleIdentifierProvider.java
index 82358362da85..54ab9f90a633 100644
--- a/dspace-api/src/main/java/org/dspace/identifier/HandleIdentifierProvider.java
+++ b/dspace-api/src/main/java/org/dspace/identifier/HandleIdentifierProvider.java
@@ -27,7 +27,6 @@
import org.dspace.services.ConfigurationService;
import org.dspace.services.factory.DSpaceServicesFactory;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
/**
* The old DSpace handle identifier service, used to create handles or retrieve objects based on their handle
@@ -36,7 +35,6 @@
* @author Mark Diggory (markd at atmire dot com)
* @author Ben Bosman (ben at atmire dot com)
*/
-@Component
public class HandleIdentifierProvider extends IdentifierProvider {
/**
* log4j category
diff --git a/dspace-api/src/main/java/org/dspace/identifier/VersionedHandleIdentifierProvider.java b/dspace-api/src/main/java/org/dspace/identifier/VersionedHandleIdentifierProvider.java
index 4f9efd220695..1678fb423a8f 100644
--- a/dspace-api/src/main/java/org/dspace/identifier/VersionedHandleIdentifierProvider.java
+++ b/dspace-api/src/main/java/org/dspace/identifier/VersionedHandleIdentifierProvider.java
@@ -37,7 +37,6 @@
import org.dspace.versioning.service.VersioningService;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
/**
* @author Fabio Bolognesi (fabio at atmire dot com)
@@ -45,7 +44,6 @@
* @author Ben Bosman (ben at atmire dot com)
* @author Pascal-Nicolas Becker (dspace at pascal dash becker dot de)
*/
-@Component
public class VersionedHandleIdentifierProvider extends IdentifierProvider implements InitializingBean {
/**
* log4j category
diff --git a/dspace-api/src/main/java/org/dspace/identifier/VersionedHandleIdentifierProviderWithCanonicalHandles.java b/dspace-api/src/main/java/org/dspace/identifier/VersionedHandleIdentifierProviderWithCanonicalHandles.java
index 9993f78b4dd5..51458b4ad6e3 100644
--- a/dspace-api/src/main/java/org/dspace/identifier/VersionedHandleIdentifierProviderWithCanonicalHandles.java
+++ b/dspace-api/src/main/java/org/dspace/identifier/VersionedHandleIdentifierProviderWithCanonicalHandles.java
@@ -32,14 +32,12 @@
import org.dspace.versioning.service.VersioningService;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
/**
* @author Fabio Bolognesi (fabio at atmire dot com)
* @author Mark Diggory (markd at atmire dot com)
* @author Ben Bosman (ben at atmire dot com)
*/
-@Component
public class VersionedHandleIdentifierProviderWithCanonicalHandles extends IdentifierProvider
implements InitializingBean {
/**
diff --git a/dspace-api/src/main/java/org/dspace/identifier/dao/impl/DOIDAOImpl.java b/dspace-api/src/main/java/org/dspace/identifier/dao/impl/DOIDAOImpl.java
index 784fec1d8894..b045061a5fb9 100644
--- a/dspace-api/src/main/java/org/dspace/identifier/dao/impl/DOIDAOImpl.java
+++ b/dspace-api/src/main/java/org/dspace/identifier/dao/impl/DOIDAOImpl.java
@@ -10,11 +10,11 @@
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
-import javax.persistence.criteria.CriteriaBuilder;
-import javax.persistence.criteria.CriteriaQuery;
-import javax.persistence.criteria.Predicate;
-import javax.persistence.criteria.Root;
+import jakarta.persistence.criteria.CriteriaBuilder;
+import jakarta.persistence.criteria.CriteriaQuery;
+import jakarta.persistence.criteria.Predicate;
+import jakarta.persistence.criteria.Root;
import org.dspace.content.DSpaceObject;
import org.dspace.core.AbstractHibernateDAO;
import org.dspace.core.Context;
diff --git a/dspace-api/src/main/java/org/dspace/identifier/doi/DOIOrganiser.java b/dspace-api/src/main/java/org/dspace/identifier/doi/DOIOrganiser.java
index 088e2b1cbc87..78507a0edf13 100644
--- a/dspace-api/src/main/java/org/dspace/identifier/doi/DOIOrganiser.java
+++ b/dspace-api/src/main/java/org/dspace/identifier/doi/DOIOrganiser.java
@@ -17,8 +17,8 @@
import java.util.List;
import java.util.Locale;
import java.util.UUID;
-import javax.mail.MessagingException;
+import jakarta.mail.MessagingException;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
import org.apache.commons.cli.DefaultParser;
diff --git a/dspace-api/src/main/java/org/dspace/importer/external/MultipleParallelImportMetadataSourceServiceImpl.java b/dspace-api/src/main/java/org/dspace/importer/external/MultipleParallelImportMetadataSourceServiceImpl.java
index 4c253b0502f7..1bb7e9269596 100644
--- a/dspace-api/src/main/java/org/dspace/importer/external/MultipleParallelImportMetadataSourceServiceImpl.java
+++ b/dspace-api/src/main/java/org/dspace/importer/external/MultipleParallelImportMetadataSourceServiceImpl.java
@@ -16,8 +16,8 @@
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
-import javax.el.MethodNotFoundException;
+import jakarta.el.MethodNotFoundException;
import org.dspace.content.Item;
import org.dspace.importer.external.datamodel.ImportRecord;
import org.dspace.importer.external.datamodel.Query;
diff --git a/dspace-api/src/main/java/org/dspace/importer/external/ads/ADSFieldMapping.java b/dspace-api/src/main/java/org/dspace/importer/external/ads/ADSFieldMapping.java
index e7d2d3398b6f..0f05e9bb4cc0 100644
--- a/dspace-api/src/main/java/org/dspace/importer/external/ads/ADSFieldMapping.java
+++ b/dspace-api/src/main/java/org/dspace/importer/external/ads/ADSFieldMapping.java
@@ -8,8 +8,8 @@
package org.dspace.importer.external.ads;
import java.util.Map;
-import javax.annotation.Resource;
+import jakarta.annotation.Resource;
import org.dspace.importer.external.metadatamapping.AbstractMetadataFieldMapping;
/**
diff --git a/dspace-api/src/main/java/org/dspace/importer/external/ads/ADSImportMetadataSourceServiceImpl.java b/dspace-api/src/main/java/org/dspace/importer/external/ads/ADSImportMetadataSourceServiceImpl.java
index 8fbe4ef2cf57..4c72c46732b7 100644
--- a/dspace-api/src/main/java/org/dspace/importer/external/ads/ADSImportMetadataSourceServiceImpl.java
+++ b/dspace-api/src/main/java/org/dspace/importer/external/ads/ADSImportMetadataSourceServiceImpl.java
@@ -17,11 +17,11 @@
import java.util.List;
import java.util.Map;
import java.util.concurrent.Callable;
-import javax.el.MethodNotFoundException;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
+import jakarta.el.MethodNotFoundException;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.client.utils.URIBuilder;
diff --git a/dspace-api/src/main/java/org/dspace/importer/external/arxiv/metadatamapping/ArXivFieldMapping.java b/dspace-api/src/main/java/org/dspace/importer/external/arxiv/metadatamapping/ArXivFieldMapping.java
index 272b14901514..48e7df89b387 100644
--- a/dspace-api/src/main/java/org/dspace/importer/external/arxiv/metadatamapping/ArXivFieldMapping.java
+++ b/dspace-api/src/main/java/org/dspace/importer/external/arxiv/metadatamapping/ArXivFieldMapping.java
@@ -8,8 +8,8 @@
package org.dspace.importer.external.arxiv.metadatamapping;
import java.util.Map;
-import javax.annotation.Resource;
+import jakarta.annotation.Resource;
import org.dspace.importer.external.metadatamapping.AbstractMetadataFieldMapping;
/**
diff --git a/dspace-api/src/main/java/org/dspace/importer/external/arxiv/service/ArXivImportMetadataSourceServiceImpl.java b/dspace-api/src/main/java/org/dspace/importer/external/arxiv/service/ArXivImportMetadataSourceServiceImpl.java
index 96689e62ba75..a1df4a7f40c1 100644
--- a/dspace-api/src/main/java/org/dspace/importer/external/arxiv/service/ArXivImportMetadataSourceServiceImpl.java
+++ b/dspace-api/src/main/java/org/dspace/importer/external/arxiv/service/ArXivImportMetadataSourceServiceImpl.java
@@ -14,14 +14,14 @@
import java.util.Collection;
import java.util.List;
import java.util.concurrent.Callable;
-import javax.el.MethodNotFoundException;
-import javax.ws.rs.client.Client;
-import javax.ws.rs.client.ClientBuilder;
-import javax.ws.rs.client.Invocation;
-import javax.ws.rs.client.WebTarget;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
+import jakarta.el.MethodNotFoundException;
+import jakarta.ws.rs.client.Client;
+import jakarta.ws.rs.client.ClientBuilder;
+import jakarta.ws.rs.client.Invocation;
+import jakarta.ws.rs.client.WebTarget;
+import jakarta.ws.rs.core.MediaType;
+import jakarta.ws.rs.core.Response;
import org.apache.commons.lang3.StringUtils;
import org.dspace.content.Item;
import org.dspace.importer.external.datamodel.ImportRecord;
diff --git a/dspace-api/src/main/java/org/dspace/importer/external/bibtex/service/BibtexImportMetadataSourceServiceImpl.java b/dspace-api/src/main/java/org/dspace/importer/external/bibtex/service/BibtexImportMetadataSourceServiceImpl.java
index 0014088c8650..7dcc8d64c784 100644
--- a/dspace-api/src/main/java/org/dspace/importer/external/bibtex/service/BibtexImportMetadataSourceServiceImpl.java
+++ b/dspace-api/src/main/java/org/dspace/importer/external/bibtex/service/BibtexImportMetadataSourceServiceImpl.java
@@ -16,8 +16,8 @@
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
-import javax.annotation.Resource;
+import jakarta.annotation.Resource;
import org.dspace.importer.external.exception.FileSourceException;
import org.dspace.importer.external.service.components.AbstractPlainMetadataSource;
import org.dspace.importer.external.service.components.dto.PlainMetadataKeyValueItem;
diff --git a/dspace-api/src/main/java/org/dspace/importer/external/cinii/CiniiFieldMapping.java b/dspace-api/src/main/java/org/dspace/importer/external/cinii/CiniiFieldMapping.java
index f266ff3d8512..aad756fbb06e 100644
--- a/dspace-api/src/main/java/org/dspace/importer/external/cinii/CiniiFieldMapping.java
+++ b/dspace-api/src/main/java/org/dspace/importer/external/cinii/CiniiFieldMapping.java
@@ -8,8 +8,8 @@
package org.dspace.importer.external.cinii;
import java.util.Map;
-import javax.annotation.Resource;
+import jakarta.annotation.Resource;
import org.dspace.importer.external.metadatamapping.AbstractMetadataFieldMapping;
/**
diff --git a/dspace-api/src/main/java/org/dspace/importer/external/cinii/CiniiImportMetadataSourceServiceImpl.java b/dspace-api/src/main/java/org/dspace/importer/external/cinii/CiniiImportMetadataSourceServiceImpl.java
index 587ad5b25838..66572f9a3d16 100644
--- a/dspace-api/src/main/java/org/dspace/importer/external/cinii/CiniiImportMetadataSourceServiceImpl.java
+++ b/dspace-api/src/main/java/org/dspace/importer/external/cinii/CiniiImportMetadataSourceServiceImpl.java
@@ -19,8 +19,8 @@
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.Callable;
-import javax.el.MethodNotFoundException;
+import jakarta.el.MethodNotFoundException;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.http.HttpException;
diff --git a/dspace-api/src/main/java/org/dspace/importer/external/crossref/CrossRefFieldMapping.java b/dspace-api/src/main/java/org/dspace/importer/external/crossref/CrossRefFieldMapping.java
index 5e879b4d266e..81571ed7bb5e 100644
--- a/dspace-api/src/main/java/org/dspace/importer/external/crossref/CrossRefFieldMapping.java
+++ b/dspace-api/src/main/java/org/dspace/importer/external/crossref/CrossRefFieldMapping.java
@@ -8,8 +8,8 @@
package org.dspace.importer.external.crossref;
import java.util.Map;
-import javax.annotation.Resource;
+import jakarta.annotation.Resource;
import org.dspace.importer.external.metadatamapping.AbstractMetadataFieldMapping;
/**
diff --git a/dspace-api/src/main/java/org/dspace/importer/external/crossref/CrossRefImportMetadataSourceServiceImpl.java b/dspace-api/src/main/java/org/dspace/importer/external/crossref/CrossRefImportMetadataSourceServiceImpl.java
index 71b088ff162b..6338cd95a3a4 100644
--- a/dspace-api/src/main/java/org/dspace/importer/external/crossref/CrossRefImportMetadataSourceServiceImpl.java
+++ b/dspace-api/src/main/java/org/dspace/importer/external/crossref/CrossRefImportMetadataSourceServiceImpl.java
@@ -16,11 +16,11 @@
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.Callable;
-import javax.el.MethodNotFoundException;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
+import jakarta.el.MethodNotFoundException;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.client.utils.URIBuilder;
diff --git a/dspace-api/src/main/java/org/dspace/importer/external/datacite/DataCiteFieldMapping.java b/dspace-api/src/main/java/org/dspace/importer/external/datacite/DataCiteFieldMapping.java
index f8540307b916..a67b73480dfa 100644
--- a/dspace-api/src/main/java/org/dspace/importer/external/datacite/DataCiteFieldMapping.java
+++ b/dspace-api/src/main/java/org/dspace/importer/external/datacite/DataCiteFieldMapping.java
@@ -8,8 +8,8 @@
package org.dspace.importer.external.datacite;
import java.util.Map;
-import javax.annotation.Resource;
+import jakarta.annotation.Resource;
import org.dspace.importer.external.metadatamapping.AbstractMetadataFieldMapping;
/**
diff --git a/dspace-api/src/main/java/org/dspace/importer/external/datacite/DataCiteImportMetadataSourceServiceImpl.java b/dspace-api/src/main/java/org/dspace/importer/external/datacite/DataCiteImportMetadataSourceServiceImpl.java
index a11f2bc2471d..2f723c24df4c 100644
--- a/dspace-api/src/main/java/org/dspace/importer/external/datacite/DataCiteImportMetadataSourceServiceImpl.java
+++ b/dspace-api/src/main/java/org/dspace/importer/external/datacite/DataCiteImportMetadataSourceServiceImpl.java
@@ -13,11 +13,11 @@
import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import javax.el.MethodNotFoundException;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
+import jakarta.el.MethodNotFoundException;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
diff --git a/dspace-api/src/main/java/org/dspace/importer/external/epo/service/EpoFieldMapping.java b/dspace-api/src/main/java/org/dspace/importer/external/epo/service/EpoFieldMapping.java
index 64ec53ffb92b..955550ce0fe5 100644
--- a/dspace-api/src/main/java/org/dspace/importer/external/epo/service/EpoFieldMapping.java
+++ b/dspace-api/src/main/java/org/dspace/importer/external/epo/service/EpoFieldMapping.java
@@ -8,8 +8,8 @@
package org.dspace.importer.external.epo.service;
import java.util.Map;
-import javax.annotation.Resource;
+import jakarta.annotation.Resource;
import org.dspace.importer.external.metadatamapping.AbstractMetadataFieldMapping;
diff --git a/dspace-api/src/main/java/org/dspace/importer/external/metadatamapping/contributor/EpoIdMetadataContributor.java b/dspace-api/src/main/java/org/dspace/importer/external/metadatamapping/contributor/EpoIdMetadataContributor.java
index e32f45a4d5f3..64d2deaca3b3 100644
--- a/dspace-api/src/main/java/org/dspace/importer/external/metadatamapping/contributor/EpoIdMetadataContributor.java
+++ b/dspace-api/src/main/java/org/dspace/importer/external/metadatamapping/contributor/EpoIdMetadataContributor.java
@@ -13,8 +13,8 @@
import java.util.List;
import java.util.Map;
import java.util.Objects;
-import javax.annotation.Resource;
+import jakarta.annotation.Resource;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.dspace.importer.external.metadatamapping.MetadataFieldConfig;
@@ -28,7 +28,7 @@
import org.jdom2.filter.Filters;
import org.jdom2.xpath.XPathExpression;
import org.jdom2.xpath.XPathFactory;
-import org.springframework.beans.factory.annotation.Required;
+import org.springframework.beans.factory.annotation.Autowired;
/**
* Custom MetadataContributor to manage Epo ID.
@@ -77,6 +77,7 @@ public MetadataFieldMapping> getMetadataFi
*
* @param metadataFieldMapping the new mapping.
*/
+ @Override
public void setMetadataFieldMapping(
MetadataFieldMapping> metadataFieldMapping) {
this.metadataFieldMapping = metadataFieldMapping;
@@ -95,7 +96,8 @@ public void setPrefixToNamespaceMapping(Map prefixToNamespaceMap
protected Map prefixToNamespaceMapping;
/**
- * Initialize EpoIdMetadataContributor with a query, prefixToNamespaceMapping and MetadataFieldConfig
+ * Initialize EpoIdMetadataContributor with all required fields: a query, prefixToNamespaceMapping
+ * and MetadataFieldConfig
*
* @param query query string
* @param prefixToNamespaceMapping metadata prefix to namespace mapping
@@ -113,7 +115,6 @@ public EpoIdMetadataContributor(String query, Map prefixToNamesp
* Empty constructor for EpoIdMetadataContributor
*/
public EpoIdMetadataContributor() {
-
}
protected String query;
@@ -132,7 +133,7 @@ public MetadataFieldConfig getField() {
*
* @param field MetadataFieldConfig used while retrieving MetadatumDTO
*/
- @Required
+ @Autowired(required = true)
public void setField(MetadataFieldConfig field) {
this.field = field;
}
@@ -146,7 +147,11 @@ public String getQuery() {
return query;
}
- @Required
+ /**
+ * Setting the query
+ * @param query query used
+ */
+ @Autowired(required = true)
public void setQuery(String query) {
this.query = query;
}
diff --git a/dspace-api/src/main/java/org/dspace/importer/external/metadatamapping/contributor/SimpleXpathMetadatumContributor.java b/dspace-api/src/main/java/org/dspace/importer/external/metadatamapping/contributor/SimpleXpathMetadatumContributor.java
index 05f8647d7867..3fa32376990c 100644
--- a/dspace-api/src/main/java/org/dspace/importer/external/metadatamapping/contributor/SimpleXpathMetadatumContributor.java
+++ b/dspace-api/src/main/java/org/dspace/importer/external/metadatamapping/contributor/SimpleXpathMetadatumContributor.java
@@ -12,8 +12,8 @@
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
-import javax.annotation.Resource;
+import jakarta.annotation.Resource;
import org.apache.logging.log4j.Logger;
import org.dspace.importer.external.metadatamapping.MetadataFieldConfig;
import org.dspace.importer.external.metadatamapping.MetadataFieldMapping;
diff --git a/dspace-api/src/main/java/org/dspace/importer/external/metadatamapping/contributor/WosAttribute2ValueContributor.java b/dspace-api/src/main/java/org/dspace/importer/external/metadatamapping/contributor/WosAttribute2ValueContributor.java
index 66e16f7ae866..9c10218a99bd 100644
--- a/dspace-api/src/main/java/org/dspace/importer/external/metadatamapping/contributor/WosAttribute2ValueContributor.java
+++ b/dspace-api/src/main/java/org/dspace/importer/external/metadatamapping/contributor/WosAttribute2ValueContributor.java
@@ -12,8 +12,8 @@
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
-import javax.annotation.Resource;
+import jakarta.annotation.Resource;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
diff --git a/dspace-api/src/main/java/org/dspace/importer/external/openaire/metadatamapping/OpenAIREPublicationFieldMapping.java b/dspace-api/src/main/java/org/dspace/importer/external/openaire/metadatamapping/OpenAIREPublicationFieldMapping.java
index d58ffc8ca9d5..cf326fb63d71 100644
--- a/dspace-api/src/main/java/org/dspace/importer/external/openaire/metadatamapping/OpenAIREPublicationFieldMapping.java
+++ b/dspace-api/src/main/java/org/dspace/importer/external/openaire/metadatamapping/OpenAIREPublicationFieldMapping.java
@@ -8,8 +8,8 @@
package org.dspace.importer.external.openaire.metadatamapping;
import java.util.Map;
-import javax.annotation.Resource;
+import jakarta.annotation.Resource;
import org.dspace.importer.external.metadatamapping.AbstractMetadataFieldMapping;
/**
diff --git a/dspace-api/src/main/java/org/dspace/importer/external/openaire/service/OpenAireImportMetadataSourceServiceImpl.java b/dspace-api/src/main/java/org/dspace/importer/external/openaire/service/OpenAireImportMetadataSourceServiceImpl.java
index 0e59c9eb0e42..7a0a92564f72 100644
--- a/dspace-api/src/main/java/org/dspace/importer/external/openaire/service/OpenAireImportMetadataSourceServiceImpl.java
+++ b/dspace-api/src/main/java/org/dspace/importer/external/openaire/service/OpenAireImportMetadataSourceServiceImpl.java
@@ -14,13 +14,13 @@
import java.util.Collection;
import java.util.List;
import java.util.concurrent.Callable;
-import javax.el.MethodNotFoundException;
-import javax.ws.rs.client.Client;
-import javax.ws.rs.client.ClientBuilder;
-import javax.ws.rs.client.Invocation;
-import javax.ws.rs.client.WebTarget;
-import javax.ws.rs.core.Response;
+import jakarta.el.MethodNotFoundException;
+import jakarta.ws.rs.client.Client;
+import jakarta.ws.rs.client.ClientBuilder;
+import jakarta.ws.rs.client.Invocation;
+import jakarta.ws.rs.client.WebTarget;
+import jakarta.ws.rs.core.Response;
import org.dspace.content.Item;
import org.dspace.importer.external.datamodel.ImportRecord;
import org.dspace.importer.external.datamodel.Query;
diff --git a/dspace-api/src/main/java/org/dspace/importer/external/pubmed/metadatamapping/PubmedFieldMapping.java b/dspace-api/src/main/java/org/dspace/importer/external/pubmed/metadatamapping/PubmedFieldMapping.java
index 2d315377669a..0d4dcf0c1e72 100644
--- a/dspace-api/src/main/java/org/dspace/importer/external/pubmed/metadatamapping/PubmedFieldMapping.java
+++ b/dspace-api/src/main/java/org/dspace/importer/external/pubmed/metadatamapping/PubmedFieldMapping.java
@@ -9,8 +9,8 @@
package org.dspace.importer.external.pubmed.metadatamapping;
import java.util.Map;
-import javax.annotation.Resource;
+import jakarta.annotation.Resource;
import org.dspace.importer.external.metadatamapping.AbstractMetadataFieldMapping;
/**
diff --git a/dspace-api/src/main/java/org/dspace/importer/external/pubmedeurope/PubmedEuropeFieldMapping.java b/dspace-api/src/main/java/org/dspace/importer/external/pubmedeurope/PubmedEuropeFieldMapping.java
index 8c8e23fe989a..35d10af58443 100644
--- a/dspace-api/src/main/java/org/dspace/importer/external/pubmedeurope/PubmedEuropeFieldMapping.java
+++ b/dspace-api/src/main/java/org/dspace/importer/external/pubmedeurope/PubmedEuropeFieldMapping.java
@@ -8,8 +8,8 @@
package org.dspace.importer.external.pubmedeurope;
import java.util.Map;
-import javax.annotation.Resource;
+import jakarta.annotation.Resource;
import org.dspace.importer.external.metadatamapping.AbstractMetadataFieldMapping;
/**
diff --git a/dspace-api/src/main/java/org/dspace/importer/external/pubmedeurope/PubmedEuropeMetadataSourceServiceImpl.java b/dspace-api/src/main/java/org/dspace/importer/external/pubmedeurope/PubmedEuropeMetadataSourceServiceImpl.java
index 92d7d9fbd3fe..5aae8ca8cf50 100644
--- a/dspace-api/src/main/java/org/dspace/importer/external/pubmedeurope/PubmedEuropeMetadataSourceServiceImpl.java
+++ b/dspace-api/src/main/java/org/dspace/importer/external/pubmedeurope/PubmedEuropeMetadataSourceServiceImpl.java
@@ -17,8 +17,8 @@
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.Callable;
-import javax.el.MethodNotFoundException;
+import jakarta.el.MethodNotFoundException;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpException;
import org.apache.http.client.ClientProtocolException;
diff --git a/dspace-api/src/main/java/org/dspace/importer/external/ris/service/RisImportMetadataSourceServiceImpl.java b/dspace-api/src/main/java/org/dspace/importer/external/ris/service/RisImportMetadataSourceServiceImpl.java
index 1f460c19e697..e4e027016e13 100644
--- a/dspace-api/src/main/java/org/dspace/importer/external/ris/service/RisImportMetadataSourceServiceImpl.java
+++ b/dspace-api/src/main/java/org/dspace/importer/external/ris/service/RisImportMetadataSourceServiceImpl.java
@@ -17,8 +17,8 @@
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import javax.annotation.Resource;
+import jakarta.annotation.Resource;
import org.dspace.importer.external.exception.FileSourceException;
import org.dspace.importer.external.service.components.AbstractPlainMetadataSource;
import org.dspace.importer.external.service.components.dto.PlainMetadataKeyValueItem;
diff --git a/dspace-api/src/main/java/org/dspace/importer/external/ror/service/RorFieldMapping.java b/dspace-api/src/main/java/org/dspace/importer/external/ror/service/RorFieldMapping.java
index d7caeffdbaf2..3096a92f95dd 100644
--- a/dspace-api/src/main/java/org/dspace/importer/external/ror/service/RorFieldMapping.java
+++ b/dspace-api/src/main/java/org/dspace/importer/external/ror/service/RorFieldMapping.java
@@ -8,8 +8,8 @@
package org.dspace.importer.external.ror.service;
import java.util.Map;
-import javax.annotation.Resource;
+import jakarta.annotation.Resource;
import org.dspace.importer.external.metadatamapping.AbstractMetadataFieldMapping;
diff --git a/dspace-api/src/main/java/org/dspace/importer/external/ror/service/RorImportMetadataSourceServiceImpl.java b/dspace-api/src/main/java/org/dspace/importer/external/ror/service/RorImportMetadataSourceServiceImpl.java
index 59063271f365..aa11ac0bb710 100644
--- a/dspace-api/src/main/java/org/dspace/importer/external/ror/service/RorImportMetadataSourceServiceImpl.java
+++ b/dspace-api/src/main/java/org/dspace/importer/external/ror/service/RorImportMetadataSourceServiceImpl.java
@@ -15,11 +15,11 @@
import java.util.List;
import java.util.Map;
import java.util.concurrent.Callable;
-import javax.el.MethodNotFoundException;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
+import jakarta.el.MethodNotFoundException;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.client.utils.URIBuilder;
diff --git a/dspace-api/src/main/java/org/dspace/importer/external/scielo/service/ScieloFieldMapping.java b/dspace-api/src/main/java/org/dspace/importer/external/scielo/service/ScieloFieldMapping.java
index 0d7183a1f058..f8c4f93a1757 100644
--- a/dspace-api/src/main/java/org/dspace/importer/external/scielo/service/ScieloFieldMapping.java
+++ b/dspace-api/src/main/java/org/dspace/importer/external/scielo/service/ScieloFieldMapping.java
@@ -7,8 +7,8 @@
*/
package org.dspace.importer.external.scielo.service;
import java.util.Map;
-import javax.annotation.Resource;
+import jakarta.annotation.Resource;
import org.dspace.importer.external.metadatamapping.AbstractMetadataFieldMapping;
/**
diff --git a/dspace-api/src/main/java/org/dspace/importer/external/scielo/service/ScieloImportMetadataSourceServiceImpl.java b/dspace-api/src/main/java/org/dspace/importer/external/scielo/service/ScieloImportMetadataSourceServiceImpl.java
index 4f83ffe978f7..ce0c20435ecf 100644
--- a/dspace-api/src/main/java/org/dspace/importer/external/scielo/service/ScieloImportMetadataSourceServiceImpl.java
+++ b/dspace-api/src/main/java/org/dspace/importer/external/scielo/service/ScieloImportMetadataSourceServiceImpl.java
@@ -20,9 +20,9 @@
import java.util.concurrent.Callable;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import javax.el.MethodNotFoundException;
-import javax.ws.rs.BadRequestException;
+import jakarta.el.MethodNotFoundException;
+import jakarta.ws.rs.BadRequestException;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.http.client.utils.URIBuilder;
import org.dspace.content.Item;
diff --git a/dspace-api/src/main/java/org/dspace/importer/external/scopus/service/ScopusFieldMapping.java b/dspace-api/src/main/java/org/dspace/importer/external/scopus/service/ScopusFieldMapping.java
index c8143339b483..93e9753c42d5 100644
--- a/dspace-api/src/main/java/org/dspace/importer/external/scopus/service/ScopusFieldMapping.java
+++ b/dspace-api/src/main/java/org/dspace/importer/external/scopus/service/ScopusFieldMapping.java
@@ -8,8 +8,8 @@
package org.dspace.importer.external.scopus.service;
import java.util.Map;
-import javax.annotation.Resource;
+import jakarta.annotation.Resource;
import org.dspace.importer.external.metadatamapping.AbstractMetadataFieldMapping;
diff --git a/dspace-api/src/main/java/org/dspace/importer/external/scopus/service/ScopusImportMetadataSourceServiceImpl.java b/dspace-api/src/main/java/org/dspace/importer/external/scopus/service/ScopusImportMetadataSourceServiceImpl.java
index 944d467e3156..7c9e53f9ec0c 100644
--- a/dspace-api/src/main/java/org/dspace/importer/external/scopus/service/ScopusImportMetadataSourceServiceImpl.java
+++ b/dspace-api/src/main/java/org/dspace/importer/external/scopus/service/ScopusImportMetadataSourceServiceImpl.java
@@ -21,8 +21,8 @@
import java.util.concurrent.Callable;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import javax.el.MethodNotFoundException;
+import jakarta.el.MethodNotFoundException;
import org.apache.commons.lang3.StringUtils;
import org.dspace.content.Item;
import org.dspace.importer.external.datamodel.ImportRecord;
diff --git a/dspace-api/src/main/java/org/dspace/importer/external/service/components/AbstractRemoteMetadataSource.java b/dspace-api/src/main/java/org/dspace/importer/external/service/components/AbstractRemoteMetadataSource.java
index 29801433e3b3..83b5d4eaab25 100644
--- a/dspace-api/src/main/java/org/dspace/importer/external/service/components/AbstractRemoteMetadataSource.java
+++ b/dspace-api/src/main/java/org/dspace/importer/external/service/components/AbstractRemoteMetadataSource.java
@@ -14,8 +14,8 @@
import java.util.UUID;
import java.util.concurrent.Callable;
import java.util.concurrent.locks.ReentrantLock;
-import javax.annotation.Resource;
+import jakarta.annotation.Resource;
import org.apache.logging.log4j.Logger;
import org.dspace.importer.external.exception.MetadataSourceException;
import org.dspace.importer.external.exception.SourceExceptionHandler;
diff --git a/dspace-api/src/main/java/org/dspace/importer/external/vufind/VuFindImportMetadataSourceServiceImpl.java b/dspace-api/src/main/java/org/dspace/importer/external/vufind/VuFindImportMetadataSourceServiceImpl.java
index a4f90fa5ba61..8933569a060f 100644
--- a/dspace-api/src/main/java/org/dspace/importer/external/vufind/VuFindImportMetadataSourceServiceImpl.java
+++ b/dspace-api/src/main/java/org/dspace/importer/external/vufind/VuFindImportMetadataSourceServiceImpl.java
@@ -15,11 +15,11 @@
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.Callable;
-import javax.el.MethodNotFoundException;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
+import jakarta.el.MethodNotFoundException;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.client.utils.URIBuilder;
import org.apache.logging.log4j.LogManager;
diff --git a/dspace-api/src/main/java/org/dspace/importer/external/vufind/metadatamapping/VuFindFieldMapping.java b/dspace-api/src/main/java/org/dspace/importer/external/vufind/metadatamapping/VuFindFieldMapping.java
index b14927a14ccc..d96265372f31 100644
--- a/dspace-api/src/main/java/org/dspace/importer/external/vufind/metadatamapping/VuFindFieldMapping.java
+++ b/dspace-api/src/main/java/org/dspace/importer/external/vufind/metadatamapping/VuFindFieldMapping.java
@@ -8,8 +8,8 @@
package org.dspace.importer.external.vufind.metadatamapping;
import java.util.Map;
-import javax.annotation.Resource;
+import jakarta.annotation.Resource;
import org.dspace.importer.external.metadatamapping.AbstractMetadataFieldMapping;
/**
diff --git a/dspace-api/src/main/java/org/dspace/importer/external/wos/service/WOSFieldMapping.java b/dspace-api/src/main/java/org/dspace/importer/external/wos/service/WOSFieldMapping.java
index be4acfbcea8c..6cf58fdd7bc9 100644
--- a/dspace-api/src/main/java/org/dspace/importer/external/wos/service/WOSFieldMapping.java
+++ b/dspace-api/src/main/java/org/dspace/importer/external/wos/service/WOSFieldMapping.java
@@ -7,8 +7,8 @@
*/
package org.dspace.importer.external.wos.service;
import java.util.Map;
-import javax.annotation.Resource;
+import jakarta.annotation.Resource;
import org.dspace.importer.external.metadatamapping.AbstractMetadataFieldMapping;
/**
diff --git a/dspace-api/src/main/java/org/dspace/importer/external/wos/service/WOSImportMetadataSourceServiceImpl.java b/dspace-api/src/main/java/org/dspace/importer/external/wos/service/WOSImportMetadataSourceServiceImpl.java
index f550b659952b..c7b5aaa49e27 100644
--- a/dspace-api/src/main/java/org/dspace/importer/external/wos/service/WOSImportMetadataSourceServiceImpl.java
+++ b/dspace-api/src/main/java/org/dspace/importer/external/wos/service/WOSImportMetadataSourceServiceImpl.java
@@ -21,8 +21,8 @@
import java.util.concurrent.Callable;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import javax.el.MethodNotFoundException;
+import jakarta.el.MethodNotFoundException;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
diff --git a/dspace-api/src/main/java/org/dspace/orcid/OrcidHistory.java b/dspace-api/src/main/java/org/dspace/orcid/OrcidHistory.java
index 07a79384c77c..4665fe4428be 100644
--- a/dspace-api/src/main/java/org/dspace/orcid/OrcidHistory.java
+++ b/dspace-api/src/main/java/org/dspace/orcid/OrcidHistory.java
@@ -8,24 +8,23 @@
package org.dspace.orcid;
import java.util.Date;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.EnumType;
-import javax.persistence.Enumerated;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.Lob;
-import javax.persistence.ManyToOne;
-import javax.persistence.SequenceGenerator;
-import javax.persistence.Table;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.EnumType;
+import jakarta.persistence.Enumerated;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.SequenceGenerator;
+import jakarta.persistence.Table;
+import jakarta.persistence.Temporal;
+import jakarta.persistence.TemporalType;
import org.dspace.content.Item;
import org.dspace.core.ReloadableEntity;
-import org.hibernate.annotations.Type;
+import org.hibernate.Length;
/**
* The ORCID history entity that it contains information relating to an attempt
@@ -79,18 +78,14 @@ public class OrcidHistory implements ReloadableEntity {
/**
* A description of the synchronized resource.
*/
- @Lob
- @Type(type = "org.hibernate.type.TextType")
- @Column(name = "description")
+ @Column(name = "description", length = Length.LONG32)
private String description;
/**
* The signature of the synchronized metadata. This is used when the entity is
* the owner itself.
*/
- @Lob
- @Type(type = "org.hibernate.type.TextType")
- @Column(name = "metadata")
+ @Column(name = "metadata", length = Length.LONG32)
private String metadata;
/**
@@ -103,9 +98,7 @@ public class OrcidHistory implements ReloadableEntity {
/**
* The response message incoming from ORCID.
*/
- @Lob
- @Type(type = "org.hibernate.type.TextType")
- @Column(name = "response_message")
+ @Column(name = "response_message", length = Length.LONG32)
private String responseMessage;
/**
diff --git a/dspace-api/src/main/java/org/dspace/orcid/OrcidQueue.java b/dspace-api/src/main/java/org/dspace/orcid/OrcidQueue.java
index 65b66cd20c3e..dfcb531401d7 100644
--- a/dspace-api/src/main/java/org/dspace/orcid/OrcidQueue.java
+++ b/dspace-api/src/main/java/org/dspace/orcid/OrcidQueue.java
@@ -11,22 +11,21 @@
import static org.apache.commons.lang3.StringUtils.isNotEmpty;
import java.util.Objects;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.EnumType;
-import javax.persistence.Enumerated;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.Lob;
-import javax.persistence.ManyToOne;
-import javax.persistence.SequenceGenerator;
-import javax.persistence.Table;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.EnumType;
+import jakarta.persistence.Enumerated;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.SequenceGenerator;
+import jakarta.persistence.Table;
import org.dspace.content.Item;
import org.dspace.core.ReloadableEntity;
-import org.hibernate.annotations.Type;
+import org.hibernate.Length;
/**
* Entity that model a record on the ORCID synchronization queue. Each record in
@@ -64,9 +63,7 @@ public class OrcidQueue implements ReloadableEntity {
/**
* A description of the resource to be synchronized.
*/
- @Lob
- @Type(type = "org.hibernate.type.TextType")
- @Column(name = "description")
+ @Column(name = "description", length = Length.LONG32)
private String description;
/**
@@ -87,9 +84,7 @@ public class OrcidQueue implements ReloadableEntity {
* The signature of the metadata to be synchronized. This is used when the
* entity is the owner itself.
*/
- @Lob
- @Column(name = "metadata")
- @Type(type = "org.hibernate.type.TextType")
+ @Column(name = "metadata", length = Length.LONG32)
private String metadata;
/**
diff --git a/dspace-api/src/main/java/org/dspace/orcid/OrcidToken.java b/dspace-api/src/main/java/org/dspace/orcid/OrcidToken.java
index def289daf41e..3e54a68a23ec 100644
--- a/dspace-api/src/main/java/org/dspace/orcid/OrcidToken.java
+++ b/dspace-api/src/main/java/org/dspace/orcid/OrcidToken.java
@@ -7,17 +7,16 @@
*/
package org.dspace.orcid;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.FetchType;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.OneToOne;
-import javax.persistence.SequenceGenerator;
-import javax.persistence.Table;
-
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.FetchType;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.OneToOne;
+import jakarta.persistence.SequenceGenerator;
+import jakarta.persistence.Table;
import org.dspace.content.Item;
import org.dspace.core.ReloadableEntity;
import org.dspace.eperson.EPerson;
diff --git a/dspace-api/src/main/java/org/dspace/orcid/client/OrcidClientImpl.java b/dspace-api/src/main/java/org/dspace/orcid/client/OrcidClientImpl.java
index 3e7ca7b21029..8356167692e3 100644
--- a/dspace-api/src/main/java/org/dspace/orcid/client/OrcidClientImpl.java
+++ b/dspace-api/src/main/java/org/dspace/orcid/client/OrcidClientImpl.java
@@ -21,14 +21,14 @@
import java.util.List;
import java.util.Map;
import java.util.Optional;
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Marshaller;
-import javax.xml.bind.Unmarshaller;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamReader;
import com.fasterxml.jackson.databind.ObjectMapper;
+import jakarta.xml.bind.JAXBContext;
+import jakarta.xml.bind.JAXBException;
+import jakarta.xml.bind.Marshaller;
+import jakarta.xml.bind.Unmarshaller;
import org.apache.commons.io.IOUtils;
import org.apache.http.Header;
import org.apache.http.HttpEntity;
diff --git a/dspace-api/src/main/java/org/dspace/orcid/dao/impl/OrcidHistoryDAOImpl.java b/dspace-api/src/main/java/org/dspace/orcid/dao/impl/OrcidHistoryDAOImpl.java
index 0b2c7099ffac..fe300751d1dd 100644
--- a/dspace-api/src/main/java/org/dspace/orcid/dao/impl/OrcidHistoryDAOImpl.java
+++ b/dspace-api/src/main/java/org/dspace/orcid/dao/impl/OrcidHistoryDAOImpl.java
@@ -10,8 +10,8 @@
import java.sql.SQLException;
import java.util.List;
import java.util.UUID;
-import javax.persistence.Query;
+import jakarta.persistence.Query;
import org.dspace.content.Item;
import org.dspace.core.AbstractHibernateDAO;
import org.dspace.core.Context;
diff --git a/dspace-api/src/main/java/org/dspace/orcid/dao/impl/OrcidQueueDAOImpl.java b/dspace-api/src/main/java/org/dspace/orcid/dao/impl/OrcidQueueDAOImpl.java
index 2114b2535759..c8e48e3f17d6 100644
--- a/dspace-api/src/main/java/org/dspace/orcid/dao/impl/OrcidQueueDAOImpl.java
+++ b/dspace-api/src/main/java/org/dspace/orcid/dao/impl/OrcidQueueDAOImpl.java
@@ -10,8 +10,8 @@
import java.sql.SQLException;
import java.util.List;
import java.util.UUID;
-import javax.persistence.Query;
+import jakarta.persistence.Query;
import org.dspace.content.Item;
import org.dspace.core.AbstractHibernateDAO;
import org.dspace.core.Context;
diff --git a/dspace-api/src/main/java/org/dspace/orcid/dao/impl/OrcidTokenDAOImpl.java b/dspace-api/src/main/java/org/dspace/orcid/dao/impl/OrcidTokenDAOImpl.java
index 01b03fc35455..f94f5ad3a44f 100644
--- a/dspace-api/src/main/java/org/dspace/orcid/dao/impl/OrcidTokenDAOImpl.java
+++ b/dspace-api/src/main/java/org/dspace/orcid/dao/impl/OrcidTokenDAOImpl.java
@@ -8,8 +8,8 @@
package org.dspace.orcid.dao.impl;
import java.sql.SQLException;
-import javax.persistence.Query;
+import jakarta.persistence.Query;
import org.dspace.content.Item;
import org.dspace.core.AbstractHibernateDAO;
import org.dspace.core.Context;
diff --git a/dspace-api/src/main/java/org/dspace/orcid/model/factory/impl/OrcidCommonObjectFactoryImpl.java b/dspace-api/src/main/java/org/dspace/orcid/model/factory/impl/OrcidCommonObjectFactoryImpl.java
index 2f47aa53d69d..1195d27c4fda 100644
--- a/dspace-api/src/main/java/org/dspace/orcid/model/factory/impl/OrcidCommonObjectFactoryImpl.java
+++ b/dspace-api/src/main/java/org/dspace/orcid/model/factory/impl/OrcidCommonObjectFactoryImpl.java
@@ -172,7 +172,7 @@ public Optional