mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-11 03:53:07 +00:00
Atmire dspace 3.0 versioning contribution
Versioning : Add Spring WebMVC Control Versioning : AIP Prototype Test Improvements.
This commit is contained in:
@@ -38,9 +38,13 @@ import org.dspace.event.Event;
|
||||
import org.dspace.eperson.EPerson;
|
||||
import org.dspace.eperson.Group;
|
||||
import org.dspace.handle.HandleManager;
|
||||
import org.dspace.identifier.IdentifierException;
|
||||
import org.dspace.identifier.IdentifierService;
|
||||
import org.dspace.storage.rdbms.DatabaseManager;
|
||||
import org.dspace.storage.rdbms.TableRow;
|
||||
import org.dspace.storage.rdbms.TableRowIterator;
|
||||
import org.dspace.utils.DSpace;
|
||||
import org.dspace.versioning.VersioningService;
|
||||
|
||||
/**
|
||||
* Class representing an item in DSpace.
|
||||
@@ -2039,10 +2043,30 @@ public class Item extends DSpaceObject
|
||||
// Remove any Handle
|
||||
HandleManager.unbindHandle(ourContext, this);
|
||||
|
||||
// remove version attached to the item
|
||||
removeVersion();
|
||||
|
||||
|
||||
// Finally remove item row
|
||||
DatabaseManager.delete(ourContext, itemRow);
|
||||
}
|
||||
|
||||
private void removeVersion() throws AuthorizeException, SQLException
|
||||
{
|
||||
VersioningService versioningService = new DSpace().getSingletonService(VersioningService.class);
|
||||
if(versioningService.getVersion(ourContext, this)!=null)
|
||||
{
|
||||
versioningService.removeVersion(ourContext, this);
|
||||
}else{
|
||||
IdentifierService identifierService = new DSpace().getSingletonService(IdentifierService.class);
|
||||
try {
|
||||
identifierService.delete(ourContext, this);
|
||||
} catch (IdentifierException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove item and all its sub-structure from the context cache.
|
||||
* Useful in batch processes where a single context has a long,
|
||||
|
Reference in New Issue
Block a user