public class Bundle extends DSpaceObject
The corresponding Bitstream objects are loaded into memory. At present, there
is no metadata associated with bundles - they are simple containers. Thus,
the update method doesn't do much yet. Creating, adding or
removing bitstreams has instant effect in the database.
| Modifier and Type | Method and Description |
|---|---|
void |
addBitstream(Bitstream b)
Add an existing bitstream to this bundle
|
Bitstream |
createBitstream(java.io.InputStream is)
Create a new bitstream in this bundle.
|
static Bundle |
find(Context context,
int id)
Get a bundle from the database.
|
DSpaceObject |
getAdminObject(int action)
Return the dspace object where an ADMIN action right is sufficient to
grant the initial authorize check.
|
Bitstream |
getBitstreamByName(java.lang.String name) |
java.util.List<ResourcePolicy> |
getBitstreamPolicies() |
Bitstream[] |
getBitstreams()
Get the bitstreams in this bundle
|
java.util.List<ResourcePolicy> |
getBundlePolicies() |
java.lang.String |
getHandle()
Get the Handle of the object.
|
int |
getID()
Get the internal identifier of this bundle
|
Item[] |
getItems()
Get the items this bundle appears in
|
java.lang.String |
getName()
Get the name of the bundle
|
DSpaceObject |
getParentObject()
Return the dspace object that "own" the current object in the hierarchy.
|
int |
getPrimaryBitstreamID()
Get the primary bitstream ID of the bundle
|
int |
getType()
return type found in Constants
|
void |
inheritCollectionDefaultPolicies(Collection c)
remove all policies on the bundle and its contents, and replace them with
the DEFAULT_BITSTREAM_READ policies belonging to the collection.
|
Bitstream |
registerBitstream(int assetstore,
java.lang.String bitstreamPath)
Create a new bitstream in this bundle.
|
void |
removeBitstream(Bitstream b)
Remove a bitstream from this bundle - the bitstream is only deleted if
this was the last reference to it
|
void |
replaceAllBitstreamPolicies(java.util.List<ResourcePolicy> newpolicies)
remove all of the policies for the bundle and bitstream contents and replace
them with a new list of policies
|
void |
setName(java.lang.String name)
Set the name of the bundle
|
void |
setOrder(int[] bitstreamIds)
Changes bitstream order according to the array
|
void |
setPrimaryBitstreamID(int bitstreamID)
Set the primary bitstream ID of the bundle
|
void |
unsetPrimaryBitstreamID()
Unset the primary bitstream ID of the bundle
|
void |
update()
Update the bundle metadata
|
void |
updateLastModified() |
addDetails, clearDetails, find, getDetails, getTypeTextpublic static Bundle find(Context context, int id) throws java.sql.SQLException
context - DSpace context objectid - ID of the bundlejava.sql.SQLExceptionpublic int getID()
getID in class DSpaceObjectpublic java.lang.String getName()
getName in class DSpaceObjectpublic void setName(java.lang.String name)
name - string name of the bundle (ORIGINAL, TEXT, THUMBNAIL) are the
values currently usedpublic int getPrimaryBitstreamID()
public void setPrimaryBitstreamID(int bitstreamID)
bitstreamID - int ID of primary bitstream (e.g. index html file)public void unsetPrimaryBitstreamID()
public java.lang.String getHandle()
DSpaceObjectnullgetHandle in class DSpaceObjectnull if it doesn't have
onepublic Bitstream getBitstreamByName(java.lang.String name)
name - name of the bitstream you're looking forpublic Bitstream[] getBitstreams()
public Item[] getItems() throws java.sql.SQLException
Item s this bundle appears injava.sql.SQLExceptionpublic Bitstream createBitstream(java.io.InputStream is) throws AuthorizeException, java.io.IOException, java.sql.SQLException
is - the stream to read the new bitstream fromAuthorizeExceptionjava.io.IOExceptionjava.sql.SQLExceptionpublic Bitstream registerBitstream(int assetstore, java.lang.String bitstreamPath) throws AuthorizeException, java.io.IOException, java.sql.SQLException
assetstore - corresponds to an assetstore in dspace.cfgbitstreamPath - the path and filename relative to the assetstorejava.io.IOExceptionjava.sql.SQLExceptionAuthorizeExceptionpublic void addBitstream(Bitstream b) throws java.sql.SQLException, AuthorizeException
b - the bitstream to addjava.sql.SQLExceptionAuthorizeExceptionpublic void setOrder(int[] bitstreamIds)
throws AuthorizeException,
java.sql.SQLException
bitstreamIds - the identifiers in the order they are to be setjava.sql.SQLException - when an SQL error has occurred (querying DSpace)AuthorizeException - If the user can't make the changespublic void removeBitstream(Bitstream b) throws AuthorizeException, java.sql.SQLException, java.io.IOException
If the bitstream in question is the primary bitstream recorded for the
bundle the primary bitstream field is unset in order to free the
bitstream from the foreign key constraint so that the
cleanup process can run normally.
b - the bitstream to removeAuthorizeExceptionjava.sql.SQLExceptionjava.io.IOExceptionpublic void update()
throws java.sql.SQLException,
AuthorizeException
update in class DSpaceObjectjava.sql.SQLExceptionAuthorizeExceptionpublic int getType()
getType in class DSpaceObjectpublic void inheritCollectionDefaultPolicies(Collection c) throws java.sql.SQLException, AuthorizeException
c - Collectionjava.sql.SQLException - if an SQL error or if no default policies found. It's a bit
draconian, but default policies must be enforced.AuthorizeExceptionpublic void replaceAllBitstreamPolicies(java.util.List<ResourcePolicy> newpolicies) throws java.sql.SQLException, AuthorizeException
newpolicies - -
this will be all of the new policies for the bundle and
bitstream contentsjava.sql.SQLExceptionAuthorizeExceptionpublic java.util.List<ResourcePolicy> getBundlePolicies() throws java.sql.SQLException
java.sql.SQLExceptionpublic java.util.List<ResourcePolicy> getBitstreamPolicies() throws java.sql.SQLException
java.sql.SQLExceptionpublic DSpaceObject getAdminObject(int action) throws java.sql.SQLException
DSpaceObjectDefault behaviour is ADMIN right on the object grant right on all other action on the object itself. Subclass should override this method as needed.
getAdminObject in class DSpaceObjectaction - ID of action being attempted, from
org.dspace.core.Constants. The ADMIN action is
not a valid parameter for this method, an
IllegalArgumentException should be thrownjava.sql.SQLExceptionpublic DSpaceObject getParentObject() throws java.sql.SQLException
DSpaceObjectgetParentObject in class DSpaceObjectjava.sql.SQLExceptionpublic void updateLastModified()
updateLastModified in class DSpaceObjectCopyright © 2018 DuraSpace. All Rights Reserved.