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
Modifier and TypeMethodDescriptionClone the given bitstream by firstly creating a new bitstream, with a new ID.intcountBitstreamsWithoutPolicy(Context context) countByStoreNumber(Context context, Integer storeNumber) intcountDeletedBitstreams(Context context) intcountTotal(Context context) create(Context context, InputStream is) Create a new bitstream, with a new ID.create(Context context, Bundle bundle, InputStream is) Create a new bitstream, with a new ID.voidRemove a bitstream that has been set to "deleted" from the databaseGeneric find for when the precise type of an Entity is not knownfindByStoreNumber(Context context, Integer storeNumber) findDeletedBitstreams(Context context, int limit, int offset) Retrieve all bitstreams with the deleted flag set to truefindDuplicateInternalIdentifier(Context context, Bitstream bitstream) getBitstreamByName(Item item, String bundleName, String bitstreamName) getCollectionBitstreams(Context context, Collection collection) getCommunityBitstreams(Context context, Community community) getFirstBitstream(Item item, String bundleName) getFormatDescription(Context context, Bitstream bitstream) Get the description of the format - either the user's or the description of the format defined by the system.getItemBitstreams(Context context, Item item) getLastModified(Bitstream bitstream) Gets the last modified timestamp of the the given bitstream's content, if known.getNotReferencedBitstreams(Context context) getThumbnail(Context context, Bitstream bitstream) booleanisInBundle(Bitstream bitstream, Collection<String> bundleNames) Checks if the given bitstream is inside one of the bundlebooleanisRegisteredBitstream(Bitstream bitstream) Determine if this bitstream is registered (available elsewhere on filesystem than in assetstore).Register a new bitstream, with a new ID.Register a new bitstream, with a new ID.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, getSupportsTypeConstantMethods 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 Details
-
find
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
- Throws:
SQLException
-
findAll
- Throws:
SQLException
-
clone
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
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
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
Determine if this bitstream is registered (available elsewhere on filesystem than in assetstore). More about registered items: https://wiki.lyrasis.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
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
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
- 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
- Throws:
SQLException
-
getBitstreamByName
Bitstream getBitstreamByName(Item item, String bundleName, String bitstreamName) throws SQLException - Throws:
SQLException
-
getFirstBitstream
- Throws:
SQLException
-
getThumbnail
- Throws:
SQLException
-
getFormat
- Throws:
SQLException
-
findByStoreNumber
- Throws:
SQLException
-
countByStoreNumber
- Throws:
SQLException
-
countTotal
- Throws:
SQLException
-
countDeletedBitstreams
- Throws:
SQLException
-
countBitstreamsWithoutPolicy
- Throws:
SQLException
-
getNotReferencedBitstreams
- Throws:
SQLException
-
getLastModified
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.
-
isInBundle
Checks if the given bitstream is inside one of the bundle- Parameters:
bitstream- bitstream to verifybundleNames- names of the bundles to serch for- Returns:
- true if is in one of the bundles, false otherwise
- Throws:
SQLException
-