Package org.dspace.app.rest.repository
Class BitstreamRestRepository
- java.lang.Object
-
- org.dspace.app.rest.repository.AbstractDSpaceRestRepository
-
- org.dspace.app.rest.repository.DSpaceRestRepository<R,UUID>
-
- org.dspace.app.rest.repository.DSpaceObjectRestRepository<Bitstream,BitstreamRest>
-
- org.dspace.app.rest.repository.BitstreamRestRepository
-
- All Implemented Interfaces:
ReloadableEntityObjectRepository<Bitstream,UUID>,org.springframework.data.repository.CrudRepository<BitstreamRest,UUID>,org.springframework.data.repository.PagingAndSortingRepository<BitstreamRest,UUID>,org.springframework.data.repository.Repository<BitstreamRest,UUID>
@Component("core.bitstream") public class BitstreamRestRepository extends DSpaceObjectRestRepository<Bitstream,BitstreamRest>This is the repository responsible to manage Bitstream Rest object- Author:
- Andrea Bollini (andrea.bollini at 4science.it)
-
-
Field Summary
-
Fields inherited from class org.dspace.app.rest.repository.AbstractDSpaceRestRepository
converter, requestService, utils
-
-
Constructor Summary
Constructors Constructor Description BitstreamRestRepository(BitstreamService dsoService)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voiddelete(Context context, UUID id)Method to implement to support delete of a single object instanceorg.springframework.data.domain.Page<BitstreamRest>findAll(Context context, org.springframework.data.domain.Pageable pageable)Method to implement to support scroll of entity instances from the collection resource endpointBitstreamRestfindByItemHandle(String handle, Integer sequence, String filename)Find the bitstream for the provided handle and sequence or filename.BitstreamRestfindOne(Context context, UUID id)Method to implement to support retrieval of a specific REST object instanceClass<BitstreamRest>getDomainClass()The REST model supported by the repositoryprotected voidpatch(Context context, javax.servlet.http.HttpServletRequest request, String apiCategory, String model, UUID id, Patch patch)Method to implement to allow partial update of the REST object via JSON PatchBundleRestperformBitstreamMove(Context context, Bitstream bitstream, Bundle targetBundle)Method that will move the bitstream corresponding to the uuid to the target bundleInputStreamretrieve(UUID uuid)-
Methods inherited from class org.dspace.app.rest.repository.DSpaceObjectRestRepository
findDomainObjectByPk, getPKClass, patchDSpaceObject
-
Methods inherited from class org.dspace.app.rest.repository.DSpaceRestRepository
action, action, count, createAndReturn, createAndReturn, createAndReturn, createAndReturn, createAndReturn, createAndReturn, delete, deleteAll, deleteAll, deleteById, existsById, findAll, findAll, findAll, findAllById, findById, patch, put, put, put, put, save, save, saveAll, upload, upload, upload
-
Methods inherited from class org.dspace.app.rest.repository.AbstractDSpaceRestRepository
getRequestService, obtainContext
-
-
-
-
Constructor Detail
-
BitstreamRestRepository
@Autowired public BitstreamRestRepository(BitstreamService dsoService)
-
-
Method Detail
-
findOne
@PreAuthorize("hasPermission(#id, \'BITSTREAM\', \'METADATA_READ\')") public BitstreamRest findOne(Context context, UUID id)Description copied from class:DSpaceRestRepositoryMethod to implement to support retrieval of a specific REST object instance- Specified by:
findOnein classDSpaceRestRepository<BitstreamRest,UUID>- Parameters:
context- the dspace contextid- the rest object id- Returns:
- the REST object identified by its ID
-
findAll
@PreAuthorize("hasAuthority(\'ADMIN\')") public org.springframework.data.domain.Page<BitstreamRest> findAll(Context context, org.springframework.data.domain.Pageable pageable)Description copied from class:DSpaceRestRepositoryMethod to implement to support scroll of entity instances from the collection resource endpoint- Specified by:
findAllin classDSpaceRestRepository<BitstreamRest,UUID>- Parameters:
context- the dspace contextpageable- object embedding the requested pagination info- Returns:
-
patch
@PreAuthorize("hasPermission(#id, \'BITSTREAM\', \'WRITE\')") protected void patch(Context context, javax.servlet.http.HttpServletRequest request, String apiCategory, String model, UUID id, Patch patch) throws AuthorizeException, SQLExceptionDescription copied from class:DSpaceRestRepositoryMethod to implement to allow partial update of the REST object via JSON Patch- Overrides:
patchin classDSpaceRestRepository<BitstreamRest,UUID>request- the http requestid- the ID of the target REST objectpatch- the JSON Patch (https://tools.ietf.org/html/rfc6902) operation- Throws:
AuthorizeExceptionSQLException
-
getDomainClass
public Class<BitstreamRest> getDomainClass()
Description copied from class:DSpaceRestRepositoryThe REST model supported by the repository- Specified by:
getDomainClassin classDSpaceRestRepository<BitstreamRest,UUID>
-
delete
protected void delete(Context context, UUID id) throws AuthorizeException
Description copied from class:DSpaceRestRepositoryMethod to implement to support delete of a single object instance- Overrides:
deletein classDSpaceRestRepository<BitstreamRest,UUID>- Parameters:
context- the dspace contextid- the id of the rest object to delete- Throws:
AuthorizeException
-
findByItemHandle
public BitstreamRest findByItemHandle(String handle, Integer sequence, String filename)
Find the bitstream for the provided handle and sequence or filename. When a bitstream can be found with the sequence ID it will be returned if the user has "METADATA_READ" access.- Parameters:
handle- The handle of the itemsequence- The sequence ID of the bitstreamfilename- The filename of the bitstream- Returns:
- a Page of BitstreamRest instance matching the user query
-
retrieve
public InputStream retrieve(UUID uuid)
-
performBitstreamMove
public BundleRest performBitstreamMove(Context context, Bitstream bitstream, Bundle targetBundle) throws SQLException, IOException, AuthorizeException
Method that will move the bitstream corresponding to the uuid to the target bundle- Parameters:
context- The contextbitstream- The bitstream to be movedtargetBundle- The target bundle- Returns:
- The target bundle with the bitstream attached
- Throws:
SQLExceptionIOExceptionAuthorizeException
-
-