mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 10:04:21 +00:00
Merged in CST-12864-notifyservice-unique-ldnurl (pull request #1430)
CST-12864 notifyservice unique ldnurl
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
--
|
||||
-- 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/
|
||||
--
|
||||
|
||||
-----------------------------------------------------------------------------------
|
||||
-- ADD CONSTRAINT on notifyservice table: ldn_url as unique
|
||||
-----------------------------------------------------------------------------------
|
||||
|
||||
ALTER TABLE notifyservice ADD CONSTRAINT ldn_url_unique UNIQUE (ldn_url);
|
||||
|
@@ -0,0 +1,14 @@
|
||||
--
|
||||
-- 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/
|
||||
--
|
||||
|
||||
-----------------------------------------------------------------------------------
|
||||
-- ADD CONSTRAINT on notifyservice table: ldn_url as unique
|
||||
-----------------------------------------------------------------------------------
|
||||
|
||||
ALTER TABLE notifyservice ADD CONSTRAINT ldn_url_unique UNIQUE (ldn_url);
|
||||
|
@@ -106,6 +106,11 @@ public class NotifyServiceRestRepository extends DSpaceRestRepository<NotifyServ
|
||||
}
|
||||
}
|
||||
|
||||
if (notifyService.findByLdnUrl(context,notifyServiceRest.getLdnUrl()) != null) {
|
||||
throw new UnprocessableEntityException(format("LDN url already in use %s",
|
||||
notifyServiceRest.getLdnUrl()));
|
||||
}
|
||||
|
||||
NotifyServiceEntity notifyServiceEntity = notifyService.create(context);
|
||||
notifyServiceEntity.setName(notifyServiceRest.getName());
|
||||
notifyServiceEntity.setDescription(notifyServiceRest.getDescription());
|
||||
|
@@ -7,6 +7,8 @@
|
||||
*/
|
||||
package org.dspace.app.rest.repository.patch.operation.ldn;
|
||||
|
||||
import static java.lang.String.format;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
import org.dspace.app.ldn.NotifyServiceEntity;
|
||||
@@ -50,6 +52,11 @@ public class NotifyServiceLdnUrlReplaceOperation extends PatchOperation<NotifySe
|
||||
throw new UnprocessableEntityException("The /ldnurl value must be a string");
|
||||
}
|
||||
|
||||
if (notifyService.findByLdnUrl(context,(String) ldnUrl) != null) {
|
||||
throw new UnprocessableEntityException(format("LDN url already in use %s",
|
||||
(String) ldnUrl));
|
||||
}
|
||||
|
||||
checkModelForExistingValue(notifyServiceEntity);
|
||||
notifyServiceEntity.setLdnUrl((String) ldnUrl);
|
||||
notifyService.update(context, notifyServiceEntity);
|
||||
|
@@ -780,7 +780,6 @@ event.dispatcher.default.class = org.dspace.event.BasicDispatcher
|
||||
# Add rdf here, if you are using dspace-rdf to export your repository content as RDF.
|
||||
# Add iiif here, if you are using dspace-iiif.
|
||||
# Add orcidqueue here, if the integration with ORCID is configured and wish to enable the synchronization queue functionality
|
||||
|
||||
event.dispatcher.default.consumers = versioning, discovery, eperson, submissionconfig, qaeventsdelete, ldnmessage
|
||||
|
||||
# The noindex dispatcher will not create search or browse indexes (useful for batch item imports)
|
||||
|
Reference in New Issue
Block a user