Package org.dspace.app.rest.repository
Class WorkspaceItemRestRepository
java.lang.Object
org.dspace.app.rest.repository.AbstractDSpaceRestRepository
org.dspace.app.rest.repository.DSpaceRestRepository<WorkspaceItemRest,Integer>
org.dspace.app.rest.repository.WorkspaceItemRestRepository
- All Implemented Interfaces:
ReloadableEntityObjectRepository<WorkspaceItem,,Integer> Aware,BeanNameAware,org.springframework.data.repository.CrudRepository<WorkspaceItemRest,,Integer> org.springframework.data.repository.PagingAndSortingRepository<WorkspaceItemRest,,Integer> org.springframework.data.repository.Repository<WorkspaceItemRest,Integer>
@Component("submission.workspaceitems")
public class WorkspaceItemRestRepository
extends DSpaceRestRepository<WorkspaceItemRest,Integer>
implements ReloadableEntityObjectRepository<WorkspaceItem,Integer>
This is the repository responsible to manage WorkspaceItem Rest object
- Author:
- Andrea Bollini (andrea.bollini at 4science.it), Pasquale Cavallo (pasquale.cavallo at 4science.it)
-
Field Summary
FieldsFields inherited from class org.dspace.app.rest.repository.AbstractDSpaceRestRepository
converter, requestService, utils -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected WorkspaceItemRestcreateAndReturn(Context context) Method to implement to support the creation of a new instance.protected WorkspaceItemRestcreateAndReturn(Context context, List<String> stringList) Method to implement to support the creation of a new instance.protected voidMethod to implement to support delete of a single object instanceorg.springframework.data.domain.Page<WorkspaceItemRest>Method to implement to support scroll of entity instances from the collection resource endpointfindByItemUuid(UUID itemUuid, org.springframework.data.domain.Pageable pageable) This is a search method that will return the WorkspaceItemRest object found through the UUID of an item.org.springframework.data.domain.Page<WorkspaceItemRest>findBySubmitter(UUID submitterID, org.springframework.data.domain.Pageable pageable) findDomainObjectByPk(Context context, Integer id) Method to implement to support retrieval of a specific REST object instanceThe REST model supported by the repositoryvoidpatch(Context context, jakarta.servlet.http.HttpServletRequest request, String apiCategory, String model, Integer id, Patch patch) Method to implement to allow partial update of the REST object via JSON Patchupload(jakarta.servlet.http.HttpServletRequest request, String apiCategory, String model, Integer id, MultipartFile file) Method to implement to attach/upload a file to a specific REST objectupload(Context context, jakarta.servlet.http.HttpServletRequest request, List<MultipartFile> uploadfiles) Method to implement to support bulk creation of objects from a fileMethods inherited from class org.dspace.app.rest.repository.DSpaceRestRepository
action, action, count, createAndReturn, createAndReturn, createAndReturn, createAndReturn, delete, deleteAll, deleteAll, deleteAllById, deleteById, existsById, findAll, findAll, findAll, findAllById, findById, patch, put, put, put, put, save, save, saveAll, setBeanName, uploadMethods inherited from class org.dspace.app.rest.repository.AbstractDSpaceRestRepository
getRequestService, obtainContext
-
Field Details
-
OPERATION_PATH_SECTIONS
- See Also:
-
-
Constructor Details
-
WorkspaceItemRestRepository
- Throws:
SubmissionConfigReaderException
-
-
Method Details
-
findOne
@PreAuthorize("hasPermission(#id, \'WORKSPACEITEM\', \'READ\')") public WorkspaceItemRest findOne(Context context, Integer id) Description copied from class:DSpaceRestRepositoryMethod to implement to support retrieval of a specific REST object instance- Specified by:
findOnein classDSpaceRestRepository<WorkspaceItemRest,Integer> - 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<WorkspaceItemRest> 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<WorkspaceItemRest,Integer> - Parameters:
context- the dspace contextpageable- object embedding the requested pagination info- Returns:
-
findBySubmitter
@PreAuthorize("hasPermission(#submitterID, \'EPERSON\', \'READ\')") public org.springframework.data.domain.Page<WorkspaceItemRest> findBySubmitter(UUID submitterID, org.springframework.data.domain.Pageable pageable) -
createAndReturn
protected WorkspaceItemRest createAndReturn(Context context) throws SQLException, AuthorizeException Description copied from class:DSpaceRestRepositoryMethod to implement to support the creation of a new instance. Usually require to retrieve the http request from the thread bound attribute- Overrides:
createAndReturnin classDSpaceRestRepository<WorkspaceItemRest,Integer> - Parameters:
context- the dspace context- Returns:
- the created REST object
- Throws:
SQLExceptionAuthorizeException
-
getDomainClass
Description copied from class:DSpaceRestRepositoryThe REST model supported by the repository- Specified by:
getDomainClassin classDSpaceRestRepository<WorkspaceItemRest,Integer>
-
upload
@PreAuthorize("hasPermission(#id, \'WORKSPACEITEM\', \'WRITE\')") public WorkspaceItemRest upload(jakarta.servlet.http.HttpServletRequest request, String apiCategory, String model, Integer id, MultipartFile file) throws SQLException Description copied from class:DSpaceRestRepositoryMethod to implement to attach/upload a file to a specific REST object- Overrides:
uploadin classDSpaceRestRepository<WorkspaceItemRest,Integer> - Parameters:
request- the http requestid- the ID of the target REST objectfile- the uploaded file- Returns:
- the new state of the REST object
- Throws:
SQLException
-
patch
@PreAuthorize("hasPermission(#id, \'WORKSPACEITEM\', \'WRITE\')") public void patch(Context context, jakarta.servlet.http.HttpServletRequest request, String apiCategory, String model, Integer id, Patch patch) throws SQLException, AuthorizeException Description copied from class:DSpaceRestRepositoryMethod to implement to allow partial update of the REST object via JSON Patch- Overrides:
patchin classDSpaceRestRepository<WorkspaceItemRest,Integer> request- the http requestid- the ID of the target REST objectpatch- the JSON Patch (https://tools.ietf.org/html/rfc6902) operation- Throws:
SQLExceptionAuthorizeException
-
delete
@PreAuthorize("hasPermission(#id, \'WORKSPACEITEM\', \'DELETE\')") protected void delete(Context context, Integer id) throws AuthorizeException Description copied from class:DSpaceRestRepositoryMethod to implement to support delete of a single object instance- Overrides:
deletein classDSpaceRestRepository<WorkspaceItemRest,Integer> - Parameters:
context- the dspace contextid- the id of the rest object to delete- Throws:
AuthorizeException
-
upload
public Iterable<WorkspaceItemRest> upload(Context context, jakarta.servlet.http.HttpServletRequest request, List<MultipartFile> uploadfiles) throws SQLException, FileNotFoundException, IOException, AuthorizeException Description copied from class:DSpaceRestRepositoryMethod to implement to support bulk creation of objects from a file- Overrides:
uploadin classDSpaceRestRepository<WorkspaceItemRest,Integer> request- the http requestuploadfiles- the file to process- Returns:
- the created objects
- Throws:
SQLExceptionFileNotFoundExceptionIOExceptionAuthorizeException
-
createAndReturn
protected WorkspaceItemRest createAndReturn(Context context, List<String> stringList) throws AuthorizeException, SQLException, RepositoryMethodNotImplementedException Description copied from class:DSpaceRestRepositoryMethod to implement to support the creation of a new instance. Usually require to retrieve the http request from the thread bound attribute- Overrides:
createAndReturnin classDSpaceRestRepository<WorkspaceItemRest,Integer> - Parameters:
context- the dspace contextstringList- The list of Strings that will be used as data for the object that's to be created This list is retrieved from the uri-list body- Returns:
- the created REST object
- Throws:
AuthorizeExceptionSQLExceptionRepositoryMethodNotImplementedException- returned by the default implementation when the operation is not supported for the entity
-
findByItemUuid
public WorkspaceItemRest findByItemUuid(UUID itemUuid, org.springframework.data.domain.Pageable pageable) This is a search method that will return the WorkspaceItemRest object found through the UUID of an item. It'll find the Item through the given UUID and try to resolve the WorkspaceItem relevant for that item and return it. It'll return a 401/403 if the current user isn't allowed to view the WorkspaceItem. It'll return a 204 if nothing was found- Parameters:
itemUuid- The UUID for the Item to be usedpageable- The pageable if present- Returns:
- The resulting WorkspaceItem object
-
findDomainObjectByPk
- Specified by:
findDomainObjectByPkin interfaceReloadableEntityObjectRepository<WorkspaceItem,Integer> - Parameters:
context- the DSpace contextid- the primary key shared between the rest and dspace api object- Returns:
- the dspace api model object related to the specified id
- Throws:
SQLException- if a database error occurs
-
getPKClass
- Specified by:
getPKClassin interfaceReloadableEntityObjectRepository<WorkspaceItem,Integer> - Returns:
- the class of the primary key
-