mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 01:54:22 +00:00
CST-12864 notifyservice ldn_url uniqueness backend check
This commit is contained in:
@@ -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);
|
||||
|
Reference in New Issue
Block a user