Atmire dspace 3.0 versioning contribution

Versioning : Add Spring WebMVC Control
Versioning : AIP Prototype Test Improvements.
This commit is contained in:
Mark Diggory
2012-08-21 14:43:02 +02:00
parent 538017d84c
commit db9f6e6f36
73 changed files with 6263 additions and 168 deletions

View File

@@ -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,