Package org.dspace.content.service
Interface BitstreamService
-
- All Superinterfaces:
DSpaceObjectLegacySupportService<Bitstream>,DSpaceObjectService<Bitstream>
- All Known Implementing Classes:
BitstreamServiceImpl
public interface BitstreamService extends DSpaceObjectService<Bitstream>, DSpaceObjectLegacySupportService<Bitstream>
Service interface class for the Bitstream object. The implementation of this class is responsible for all business logic calls for the Bitstream object and is autowired by spring- Author:
- kevinvandevelde at atmire.com
-
-
Field Summary
-
Fields inherited from interface org.dspace.content.service.DSpaceObjectService
MD_COPYRIGHT_TEXT, MD_INTRODUCTORY_TEXT, MD_LICENSE, MD_NAME, MD_PROVENANCE_DESCRIPTION, MD_SHORT_DESCRIPTION, MD_SIDEBAR_TEXT, MD_SOURCE, MD_USER_FORMAT_DESCRIPTION
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Bitstreamclone(Context context, Bitstream bitstream)Clone the given bitstream by firstly creating a new bitstream, with a new ID.intcountBitstreamsWithoutPolicy(Context context)LongcountByStoreNumber(Context context, Integer storeNumber)intcountDeletedBitstreams(Context context)intcountTotal(Context context)Bitstreamcreate(Context context, InputStream is)Create a new bitstream, with a new ID.Bitstreamcreate(Context context, Bundle bundle, InputStream is)Create a new bitstream, with a new ID.voidexpunge(Context context, Bitstream bitstream)Remove a bitstream that has been set to "deleted" from the databaseBitstreamfind(Context context, UUID id)Generic find for when the precise type of an Entity is not knownList<Bitstream>findAll(Context context)Iterator<Bitstream>findAll(Context context, int limit, int offset)List<Bitstream>findBitstreamsWithNoRecentChecksum(Context context)Iterator<Bitstream>findByStoreNumber(Context context, Integer storeNumber)List<Bitstream>findDeletedBitstreams(Context context, int limit, int offset)Retrieve all bitstreams with the deleted flag set to trueList<Bitstream>findDuplicateInternalIdentifier(Context context, Bitstream bitstream)BitstreamgetBitstreamByName(Item item, String bundleName, String bitstreamName)Iterator<Bitstream>getCollectionBitstreams(Context context, Collection collection)Iterator<Bitstream>getCommunityBitstreams(Context context, Community community)BitstreamgetFirstBitstream(Item item, String bundleName)BitstreamFormatgetFormat(Context context, Bitstream bitstream)StringgetFormatDescription(Context context, Bitstream bitstream)Get the description of the format - either the user's or the description of the format defined by the system.Iterator<Bitstream>getItemBitstreams(Context context, Item item)LonggetLastModified(Bitstream bitstream)Gets the last modified timestamp of the the given bitstream's content, if known.List<Bitstream>getNotReferencedBitstreams(Context context)BitstreamgetThumbnail(Context context, Bitstream bitstream)booleanisRegisteredBitstream(Bitstream bitstream)Determine if this bitstream is registered (available elsewhere on filesystem than in assetstore).Bitstreamregister(Context context, int assetstore, String bitstreamPath)Register a new bitstream, with a new ID.Bitstreamregister(Context context, Bundle bundle, int assetstore, String bitstreamPath)Register a new bitstream, with a new ID.InputStreamretrieve(Context context, Bitstream bitstream)Retrieve the contents of the bitstreamvoidsetFormat(Context context, Bitstream bitstream, BitstreamFormat bitstreamFormat)Set the format of the bitstream.voidsetUserFormatDescription(Context context, Bitstream bitstream, String desc)Set the user's format description.-
Methods inherited from interface org.dspace.content.service.DSpaceObjectLegacySupportService
findByIdOrLegacyId, findByLegacyId, getSupportsTypeConstant
-
Methods inherited from interface org.dspace.content.service.DSpaceObjectService
addAndShiftRightMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, clearMetadata, delete, getAdminObject, getIdentifiers, getMetadata, getMetadata, getMetadata, getMetadata, getMetadataByMetadataString, getMetadataFirstValue, getMetadataFirstValue, getName, getParentObject, getSupportsTypeConstant, getTypeText, moveMetadata, removeMetadataValues, replaceMetadata, setMetadataModified, setMetadataSingleValue, setMetadataSingleValue, update, updateLastModified
-
-
-
-
Method Detail
-
find
Bitstream find(Context context, UUID id) throws SQLException
Description copied from interface:DSpaceObjectServiceGeneric find for when the precise type of an Entity is not known- Specified by:
findin interfaceDSpaceObjectService<Bitstream>- Parameters:
context- - the contextid- - uuid within table of typed dspace objects- Returns:
- the dspace object found, or null if it does not exist.
- Throws:
SQLException- only upon failure accessing the database.
-
findAll
List<Bitstream> findAll(Context context) throws SQLException
- Throws:
SQLException
-
findAll
Iterator<Bitstream> findAll(Context context, int limit, int offset) throws SQLException
- Throws:
SQLException
-
clone
Bitstream clone(Context context, Bitstream bitstream) throws SQLException, AuthorizeException
Clone the given bitstream by firstly creating a new bitstream, with a new ID. Then set the internal identifier, file size, checksum, and checksum algorithm as same as the given bitstream. This allows multiple bitstreams to share the same internal identifier of assets . An example of such a use case scenario is versioning.- Parameters:
context- DSpace context objectbitstream- Bitstream to be cloned- Returns:
- the clone
- Throws:
SQLException- if database errorAuthorizeException
-
create
Bitstream create(Context context, InputStream is) throws IOException, SQLException
Create a new bitstream, with a new ID. The checksum and file size are calculated. No authorization checks are made in this method. The newly created bitstream has the "unknown" format.- Parameters:
context- DSpace context objectis- the bits to put in the bitstream- Returns:
- the newly created bitstream
- Throws:
IOException- if IO errorSQLException- if database error
-
create
Bitstream create(Context context, Bundle bundle, InputStream is) throws IOException, SQLException, AuthorizeException
Create a new bitstream, with a new ID. The checksum and file size are calculated. The newly created bitstream has the "unknown" format.- Parameters:
context- DSpace context objectbundle- The bundle in which our bitstream should be added.is- the bits to put in the bitstream- Returns:
- the newly created bitstream
- Throws:
IOException- if IO errorSQLException- if database errorAuthorizeException- if authorization error
-
register
Bitstream register(Context context, Bundle bundle, int assetstore, String bitstreamPath) throws IOException, SQLException, AuthorizeException
Register a new bitstream, with a new ID. The checksum and file size are calculated. The newly created bitstream has the "unknown" format.- Parameters:
context- DSpace context objectbundle- The bundle in which our bitstream should be added.assetstore- corresponds to an assetstore in dspace.cfgbitstreamPath- the path and filename relative to the assetstore- Returns:
- the newly registered bitstream
- Throws:
IOException- if IO errorSQLException- if database errorAuthorizeException- if authorization error
-
register
Bitstream register(Context context, int assetstore, String bitstreamPath) throws IOException, SQLException, AuthorizeException
Register a new bitstream, with a new ID. The checksum and file size are calculated. The newly created bitstream has the "unknown" format.- Parameters:
context- DSpace context objectassetstore- corresponds to an assetstore in dspace.cfgbitstreamPath- the path and filename relative to the assetstore- Returns:
- the newly registered bitstream
- Throws:
IOException- if IO errorSQLException- if database errorAuthorizeException- if authorization error
-
setUserFormatDescription
void setUserFormatDescription(Context context, Bitstream bitstream, String desc) throws SQLException
Set the user's format description. This implies that the format of the bitstream is uncertain, and the format is set to "unknown."- Parameters:
context- DSpace context objectbitstream- DSpace bitstreamdesc- the user's description of the format- Throws:
SQLException- if database error
-
getFormatDescription
String getFormatDescription(Context context, Bitstream bitstream) throws SQLException
Get the description of the format - either the user's or the description of the format defined by the system.- Parameters:
context- DSpace context objectbitstream- DSpace bitstream- Returns:
- a description of the format.
- Throws:
SQLException- if database error
-
setFormat
void setFormat(Context context, Bitstream bitstream, BitstreamFormat bitstreamFormat) throws SQLException
Set the format of the bitstream. If the user has supplied a type description, it is cleared. Passing innullsets the type of this bitstream to "unknown".- Parameters:
context- DSpace context objectbitstream- DSpace bitstreambitstreamFormat- the format of this bitstream, ornullfor unknown- Throws:
SQLException- if database error
-
retrieve
InputStream retrieve(Context context, Bitstream bitstream) throws IOException, SQLException, AuthorizeException
Retrieve the contents of the bitstream- Parameters:
context- DSpace context objectbitstream- DSpace bitstream- Returns:
- a stream from which the bitstream can be read.
- Throws:
IOException- if IO errorSQLException- if database errorAuthorizeException- if authorization error
-
isRegisteredBitstream
boolean isRegisteredBitstream(Bitstream bitstream)
Determine if this bitstream is registered (available elsewhere on filesystem than in assetstore). More about registered items: https://wiki.duraspace.org/display/DSDOC3x/Registering+(not+Importing)+Bitstreams+via+Simple+Archive+Format- Parameters:
bitstream- DSpace bitstream- Returns:
- true if the bitstream is registered, false otherwise
-
findDeletedBitstreams
List<Bitstream> findDeletedBitstreams(Context context, int limit, int offset) throws SQLException
Retrieve all bitstreams with the deleted flag set to true- Parameters:
context- the dspace context- Returns:
- a list of all bitstreams that have been "deleted"
- Throws:
SQLException- if database error
-
expunge
void expunge(Context context, Bitstream bitstream) throws SQLException, AuthorizeException
Remove a bitstream that has been set to "deleted" from the database- Parameters:
context- the dspace contextbitstream- the bitstream to deleted from the database- Throws:
SQLException- if database errorAuthorizeException- if authorization error
-
findDuplicateInternalIdentifier
List<Bitstream> findDuplicateInternalIdentifier(Context context, Bitstream bitstream) throws SQLException
- Throws:
SQLException
-
getItemBitstreams
Iterator<Bitstream> getItemBitstreams(Context context, Item item) throws SQLException
- Throws:
SQLException
-
getCollectionBitstreams
Iterator<Bitstream> getCollectionBitstreams(Context context, Collection collection) throws SQLException
- Throws:
SQLException
-
getCommunityBitstreams
Iterator<Bitstream> getCommunityBitstreams(Context context, Community community) throws SQLException
- Throws:
SQLException
-
findBitstreamsWithNoRecentChecksum
List<Bitstream> findBitstreamsWithNoRecentChecksum(Context context) throws SQLException
- Throws:
SQLException
-
getBitstreamByName
Bitstream getBitstreamByName(Item item, String bundleName, String bitstreamName) throws SQLException
- Throws:
SQLException
-
getFirstBitstream
Bitstream getFirstBitstream(Item item, String bundleName) throws SQLException
- Throws:
SQLException
-
getThumbnail
Bitstream getThumbnail(Context context, Bitstream bitstream) throws SQLException
- Throws:
SQLException
-
getFormat
BitstreamFormat getFormat(Context context, Bitstream bitstream) throws SQLException
- Throws:
SQLException
-
findByStoreNumber
Iterator<Bitstream> findByStoreNumber(Context context, Integer storeNumber) throws SQLException
- Throws:
SQLException
-
countByStoreNumber
Long countByStoreNumber(Context context, Integer storeNumber) throws SQLException
- Throws:
SQLException
-
countTotal
int countTotal(Context context) throws SQLException
- Throws:
SQLException
-
countDeletedBitstreams
int countDeletedBitstreams(Context context) throws SQLException
- Throws:
SQLException
-
countBitstreamsWithoutPolicy
int countBitstreamsWithoutPolicy(Context context) throws SQLException
- Throws:
SQLException
-
getNotReferencedBitstreams
List<Bitstream> getNotReferencedBitstreams(Context context) throws SQLException
- Throws:
SQLException
-
getLastModified
@Nullable Long getLastModified(Bitstream bitstream) throws IOException
Gets the last modified timestamp of the the given bitstream's content, if known.- Parameters:
bitstream- the bitstream.- Returns:
- the timestamp in milliseconds, or
nullif unknown. - Throws:
IOException- if an unexpected io error occurs.
-
-