mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-14 21:43:11 +00:00
Merge remote-tracking branch 'origin/main' into duracom-136_CST-9634
# Conflicts: # dspace/config/spring/api/discovery.xml
This commit is contained in:
@@ -64,7 +64,9 @@ import org.dspace.eperson.service.SubscribeService;
|
||||
import org.dspace.event.Event;
|
||||
import org.dspace.harvest.HarvestedItem;
|
||||
import org.dspace.harvest.service.HarvestedItemService;
|
||||
import org.dspace.identifier.DOI;
|
||||
import org.dspace.identifier.IdentifierException;
|
||||
import org.dspace.identifier.service.DOIService;
|
||||
import org.dspace.identifier.service.IdentifierService;
|
||||
import org.dspace.orcid.OrcidHistory;
|
||||
import org.dspace.orcid.OrcidQueue;
|
||||
@@ -123,6 +125,8 @@ public class ItemServiceImpl extends DSpaceObjectServiceImpl<Item> implements It
|
||||
@Autowired(required = true)
|
||||
protected IdentifierService identifierService;
|
||||
@Autowired(required = true)
|
||||
protected DOIService doiService;
|
||||
@Autowired(required = true)
|
||||
protected VersioningService versioningService;
|
||||
@Autowired(required = true)
|
||||
protected HarvestedItemService harvestedItemService;
|
||||
@@ -786,6 +790,16 @@ public class ItemServiceImpl extends DSpaceObjectServiceImpl<Item> implements It
|
||||
// Remove any Handle
|
||||
handleService.unbindHandle(context, item);
|
||||
|
||||
// Delete a DOI if linked to the item.
|
||||
// If no DOI consumer or provider is configured, but a DOI remains linked to this item's uuid,
|
||||
// hibernate will throw a foreign constraint exception.
|
||||
// Here we use the DOI service directly as it is able to manage DOIs even without any configured
|
||||
// consumer or provider.
|
||||
DOI doi = doiService.findDOIByDSpaceObject(context, item);
|
||||
if (doi != null) {
|
||||
doi.setDSpaceObject(null);
|
||||
}
|
||||
|
||||
// remove version attached to the item
|
||||
removeVersion(context, item);
|
||||
|
||||
|
Reference in New Issue
Block a user