mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-11 03:53:07 +00:00
Migrating current AIP Backup/Restore code (DS-466) from 'aip-external-1_6-prototype' Branch into Trunk! See https://wiki.duraspace.org/display/DSPACE/AipBackupRestorePrototype for much more details on this work, and how to export/import AIPs. WARNING -- This changes the PackageIngester and PackageDisseminator interfaces. Any of your local, custom Packagers will require refactoring to support the updated interfaces (obviously all DSpace out-of-the-box Packagers have already been refactored).
git-svn-id: http://scm.dspace.org/svn/repo/dspace/trunk@5265 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
@@ -235,10 +235,47 @@ public class Collection extends DSpaceObject
|
||||
*/
|
||||
static Collection create(Context context) throws SQLException,
|
||||
AuthorizeException
|
||||
{
|
||||
return create(context, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new collection, with a new ID. This method is not public, and
|
||||
* does not check authorisation.
|
||||
*
|
||||
* @param context
|
||||
* DSpace context object
|
||||
*
|
||||
* @param handle the pre-determined Handle to assign to the new community
|
||||
* @return the newly created collection
|
||||
* @throws SQLException
|
||||
* @throws AuthorizeException
|
||||
*/
|
||||
static Collection create(Context context, String handle) throws SQLException,
|
||||
AuthorizeException
|
||||
{
|
||||
TableRow row = DatabaseManager.create(context, "collection");
|
||||
Collection c = new Collection(context, row);
|
||||
c.handle = HandleManager.createHandle(context, c);
|
||||
|
||||
try
|
||||
{
|
||||
c.handle = (handle == null) ?
|
||||
HandleManager.createHandle(context, c) :
|
||||
HandleManager.createHandle(context, c, handle);
|
||||
}
|
||||
catch(IllegalStateException ie)
|
||||
{
|
||||
//If an IllegalStateException is thrown, then an existing object is already using this handle
|
||||
//Remove the collection we just created -- as it is incomplete
|
||||
try
|
||||
{
|
||||
if(c!=null)
|
||||
c.delete();
|
||||
} catch(Exception e) { }
|
||||
|
||||
//pass exception on up the chain
|
||||
throw ie;
|
||||
}
|
||||
|
||||
// create the default authorization policy for collections
|
||||
// of 'anonymous' READ
|
||||
@@ -1132,6 +1169,9 @@ public class Collection extends DSpaceObject
|
||||
// exception framework
|
||||
throw new RuntimeException(e.getMessage(), e);
|
||||
}
|
||||
|
||||
// Remove any Handle
|
||||
HandleManager.unbindHandle(ourContext, this);
|
||||
|
||||
// Delete collection row
|
||||
DatabaseManager.delete(ourContext, collectionRow);
|
||||
|
Reference in New Issue
Block a user