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<org.dspace.content.WorkspaceItem,Integer>,org.springframework.data.repository.CrudRepository<WorkspaceItemRest,Integer>,org.springframework.data.repository.PagingAndSortingRepository<WorkspaceItemRest,Integer>,org.springframework.data.repository.Repository<WorkspaceItemRest,Integer>
@Component("submission.workspaceitem") public class WorkspaceItemRestRepository extends DSpaceRestRepository<WorkspaceItemRest,Integer> implements ReloadableEntityObjectRepository<org.dspace.content.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
Fields Modifier and Type Field Description static StringOPERATION_PATH_SECTIONS-
Fields inherited from class org.dspace.app.rest.repository.AbstractDSpaceRestRepository
converter, requestService, utils
-
-
Constructor Summary
Constructors Constructor Description WorkspaceItemRestRepository()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected WorkspaceItemRestcreateAndReturn(org.dspace.core.Context context)Method to implement to support the creation of a new instance.protected WorkspaceItemRestcreateAndReturn(org.dspace.core.Context context, List<String> stringList)Method to implement to support the creation of a new instance.protected voiddelete(org.dspace.core.Context context, Integer id)Method to implement to support delete of a single object instanceorg.springframework.data.domain.Page<WorkspaceItemRest>findAll(org.dspace.core.Context context, org.springframework.data.domain.Pageable pageable)Method to implement to support scroll of entity instances from the collection resource endpointWorkspaceItemRestfindByItemUuid(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)org.dspace.content.WorkspaceItemfindDomainObjectByPk(org.dspace.core.Context context, Integer id)WorkspaceItemRestfindOne(org.dspace.core.Context context, Integer id)Method to implement to support retrieval of a specific REST object instanceClass<WorkspaceItemRest>getDomainClass()The REST model supported by the repositoryClass<Integer>getPKClass()voidpatch(org.dspace.core.Context context, javax.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 PatchWorkspaceItemRestupload(javax.servlet.http.HttpServletRequest request, String apiCategory, String model, Integer id, org.springframework.web.multipart.MultipartFile file)Method to implement to attach/upload a file to a specific REST objectIterable<WorkspaceItemRest>upload(org.dspace.core.Context context, javax.servlet.http.HttpServletRequest request, List<org.springframework.web.multipart.MultipartFile> uploadfiles)Method to implement to support bulk creation of objects from a file-
Methods inherited from class org.dspace.app.rest.repository.DSpaceRestRepository
action, action, count, createAndReturn, createAndReturn, createAndReturn, createAndReturn, delete, deleteAll, deleteAll, deleteById, existsById, findAll, findAll, findAll, findAllById, findById, patch, put, put, put, put, save, save, saveAll, upload
-
Methods inherited from class org.dspace.app.rest.repository.AbstractDSpaceRestRepository
getRequestService, obtainContext
-
-
-
-
Field Detail
-
OPERATION_PATH_SECTIONS
public static final String OPERATION_PATH_SECTIONS
- See Also:
- Constant Field Values
-
-
Method Detail
-
findOne
@PreAuthorize("hasPermission(#id, \'WORKSPACEITEM\', \'READ\')") public WorkspaceItemRest findOne(org.dspace.core.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(org.dspace.core.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(org.dspace.core.Context context) throws SQLException, org.dspace.authorize.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:
SQLExceptionorg.dspace.authorize.AuthorizeException
-
getDomainClass
public Class<WorkspaceItemRest> 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(javax.servlet.http.HttpServletRequest request, String apiCategory, String model, Integer id, org.springframework.web.multipart.MultipartFile file) throws SQLExceptionDescription 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(org.dspace.core.Context context, javax.servlet.http.HttpServletRequest request, String apiCategory, String model, Integer id, Patch patch) throws SQLException, org.dspace.authorize.AuthorizeExceptionDescription 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:
SQLExceptionorg.dspace.authorize.AuthorizeException
-
delete
@PreAuthorize("hasPermission(#id, \'WORKSPACEITEM\', \'DELETE\')") protected void delete(org.dspace.core.Context context, Integer id) throws org.dspace.authorize.AuthorizeExceptionDescription 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:
org.dspace.authorize.AuthorizeException
-
upload
public Iterable<WorkspaceItemRest> upload(org.dspace.core.Context context, javax.servlet.http.HttpServletRequest request, List<org.springframework.web.multipart.MultipartFile> uploadfiles) throws SQLException, FileNotFoundException, IOException, org.dspace.authorize.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:
SQLExceptionFileNotFoundExceptionIOExceptionorg.dspace.authorize.AuthorizeException
-
createAndReturn
protected WorkspaceItemRest createAndReturn(org.dspace.core.Context context, List<String> stringList) throws org.dspace.authorize.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:
org.dspace.authorize.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
public org.dspace.content.WorkspaceItem findDomainObjectByPk(org.dspace.core.Context context, Integer id) throws SQLException- Specified by:
findDomainObjectByPkin interfaceReloadableEntityObjectRepository<org.dspace.content.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
public Class<Integer> getPKClass()
- Specified by:
getPKClassin interfaceReloadableEntityObjectRepository<org.dspace.content.WorkspaceItem,Integer>- Returns:
- the class of the primary key
-
-