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:
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>This is the repository responsible to manage WorkspaceItem Rest object- Author:
- Andrea Bollini (andrea.bollini 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(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 voiddelete(Context context, Integer id)Method to implement to support delete of a single object instanceorg.springframework.data.domain.Page<WorkspaceItemRest>findAll(Context context, org.springframework.data.domain.Pageable pageable)Method to implement to support scroll of entity instances from the collection resource endpointorg.springframework.data.domain.Page<WorkspaceItemRest>findBySubmitter(UUID submitterID, org.springframework.data.domain.Pageable pageable)WorkspaceItemRestfindOne(Context context, Integer id)Method to implement to support retrieval of a specific REST object instanceClass<WorkspaceItemRest>getDomainClass()The REST model supported by the repositoryvoidpatch(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 Patchprotected WorkspaceItemRestsave(Context context, WorkspaceItemRest wsi)Method to implement to support full update of a REST object.WorkspaceItemRestupload(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(Context context, javax.servlet.http.HttpServletRequest request, org.springframework.web.multipart.MultipartFile uploadfile)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, 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
-
-
Constructor Detail
-
WorkspaceItemRestRepository
public WorkspaceItemRestRepository() throws SubmissionConfigReaderException- Throws:
SubmissionConfigReaderException
-
-
Method Detail
-
findOne
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
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
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
-
save
protected WorkspaceItemRest save(Context context, WorkspaceItemRest wsi)
Description copied from class:DSpaceRestRepositoryMethod to implement to support full update of a REST object. This is usually required by a PUT request.- Overrides:
savein classDSpaceRestRepository<WorkspaceItemRest,Integer>- Parameters:
context- the dspace contextwsi- the REST object to update- Returns:
- the new state of the REST object after persistence
-
getDomainClass
public Class<WorkspaceItemRest> getDomainClass()
Description copied from class:DSpaceRestRepositoryThe REST model supported by the repository- Specified by:
getDomainClassin classDSpaceRestRepository<WorkspaceItemRest,Integer>
-
upload
public WorkspaceItemRest upload(javax.servlet.http.HttpServletRequest request, String apiCategory, String model, Integer id, org.springframework.web.multipart.MultipartFile file) throws Exception
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:
Exception
-
patch
public void patch(Context context, javax.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
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, javax.servlet.http.HttpServletRequest request, org.springframework.web.multipart.MultipartFile uploadfile) 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 requestuploadfile- 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
-
-