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> Aware,BeanNameAware,org.springframework.data.repository.CrudRepository<BitstreamRest,,UUID> org.springframework.data.repository.PagingAndSortingRepository<BitstreamRest,,UUID> org.springframework.data.repository.Repository<BitstreamRest,UUID>
@Component("core.bitstreams")
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 -
Method Summary
Modifier and TypeMethodDescriptionprotected voidMethod to implement to support delete of a single object instanceorg.springframework.data.domain.Page<BitstreamRest>Method to implement to support scroll of entity instances from the collection resource endpointfindByItemHandle(String handle, Integer sequence, String filename) Find the bitstream for the provided handle and sequence or filename.Method to implement to support retrieval of a specific REST object instanceThe REST model supported by the repositoryprotected voidpatch(Context context, jakarta.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 PatchvoidpatchBitstreamsInBulk(Context context, com.fasterxml.jackson.databind.JsonNode jsonNode) Method that will transform the provided PATCH json body into a list of operations.performBitstreamMove(Context context, Bitstream bitstream, Bundle targetBundle) Method that will move the bitstream corresponding to the uuid to the target bundleMethods inherited from class org.dspace.app.rest.repository.DSpaceObjectRestRepository
findDomainObjectByPk, getPKClass, patchDSpaceObjectMethods inherited from class org.dspace.app.rest.repository.DSpaceRestRepository
action, action, count, createAndReturn, createAndReturn, createAndReturn, createAndReturn, createAndReturn, createAndReturn, delete, deleteAll, deleteAll, deleteAllById, deleteById, existsById, findAll, findAll, findAll, findAllById, findById, patch, put, put, put, put, save, save, saveAll, setBeanName, upload, upload, uploadMethods inherited from class org.dspace.app.rest.repository.AbstractDSpaceRestRepository
getRequestService, obtainContext
-
Constructor Details
-
BitstreamRestRepository
-
-
Method Details
-
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, jakarta.servlet.http.HttpServletRequest request, String apiCategory, String model, UUID id, Patch patch) throws AuthorizeException, SQLException Description 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
Description copied from class:DSpaceRestRepositoryThe REST model supported by the repository- Specified by:
getDomainClassin classDSpaceRestRepository<BitstreamRest,UUID>
-
delete
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
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
-
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
-
patchBitstreamsInBulk
public void patchBitstreamsInBulk(Context context, com.fasterxml.jackson.databind.JsonNode jsonNode) throws SQLException Method that will transform the provided PATCH json body into a list of operations. The operations will be handled by a supporting class resolved by theResourcePatch.patch(org.dspace.core.Context, M, java.util.List<org.dspace.app.rest.model.patch.Operation>)method.- Parameters:
context- The contextjsonNode- the json body provided from the request body- Throws:
SQLException
-