Package org.dspace.app.rest.repository
Class ItemRestRepository
java.lang.Object
org.dspace.app.rest.repository.AbstractDSpaceRestRepository
org.dspace.app.rest.repository.DSpaceRestRepository<R,UUID>
org.dspace.app.rest.repository.DSpaceObjectRestRepository<Item,ItemRest>
org.dspace.app.rest.repository.ItemRestRepository
- All Implemented Interfaces:
ReloadableEntityObjectRepository<Item,,UUID> Aware,BeanNameAware,org.springframework.data.repository.CrudRepository<ItemRest,,UUID> org.springframework.data.repository.PagingAndSortingRepository<ItemRest,,UUID> org.springframework.data.repository.Repository<ItemRest,UUID>
@Component("core.items")
public class ItemRestRepository
extends DSpaceObjectRestRepository<Item,ItemRest>
This is the repository responsible to manage Item Rest object
- Author:
- Andrea Bollini (andrea.bollini 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 TypeMethodDescriptionaddBundleToItem(Context context, Item item, BundleRest bundleRest) Method to add a bundle to an itemprotected ItemRestcreateAndReturn(Context context) Method to implement to support the creation of a new instance.protected ItemRestcreateAndReturn(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<ItemRest>Method to implement to support scroll of entity instances from the collection resource endpointMethod 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 Patchprotected ItemRestput(Context context, jakarta.servlet.http.HttpServletRequest request, String apiCategory, String model, UUID uuid, com.fasterxml.jackson.databind.JsonNode jsonNode) Implement this method in the subclass to support updating a REST object.Methods 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, delete, deleteAll, deleteAll, deleteAllById, deleteById, existsById, findAll, findAll, findAll, findAllById, findById, patch, put, put, put, save, save, saveAll, setBeanName, upload, upload, uploadMethods inherited from class org.dspace.app.rest.repository.AbstractDSpaceRestRepository
getRequestService, obtainContext
-
Field Details
-
COPYVIRTUAL_ALL
-
COPYVIRTUAL_CONFIGURED
-
REQUESTPARAMETER_COPYVIRTUALMETADATA
- See Also:
-
-
Constructor Details
-
ItemRestRepository
-
-
Method Details
-
findOne
@PreAuthorize("hasPermission(#id, \'ITEM\', \'STATUS\') || hasPermission(#id, \'ITEM\', \'READ\')") public ItemRest 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<ItemRest,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<ItemRest> 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<ItemRest,UUID> - Parameters:
context- the dspace contextpageable- object embedding the requested pagination info- Returns:
-
patch
@PreAuthorize("hasPermission(#id, \'ITEM\', #patch)") 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<ItemRest,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<ItemRest,UUID>
-
delete
@PreAuthorize("hasPermission(#id, \'ITEM\', \'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<ItemRest,UUID> - Parameters:
context- the dspace contextid- the id of the rest object to delete- Throws:
AuthorizeException
-
createAndReturn
@PreAuthorize("hasAuthority(\'ADMIN\')") protected ItemRest createAndReturn(Context context) throws AuthorizeException, SQLException 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<ItemRest,UUID> - Parameters:
context- the dspace context- Returns:
- the created REST object
- Throws:
AuthorizeExceptionSQLException
-
put
@PreAuthorize("hasPermission(#uuid, \'ITEM\', \'WRITE\')") protected ItemRest put(Context context, jakarta.servlet.http.HttpServletRequest request, String apiCategory, String model, UUID uuid, com.fasterxml.jackson.databind.JsonNode jsonNode) throws RepositoryMethodNotImplementedException, SQLException, AuthorizeException Description copied from class:DSpaceRestRepositoryImplement this method in the subclass to support updating a REST object.- Overrides:
putin classDSpaceRestRepository<ItemRest,UUID> - Parameters:
context- the dspace contextapiCategory- the API category e.g. "api"model- the DSpace model e.g. "metadatafield"uuid- the ID of the target REST objectjsonNode- the part of the request body representing the updated rest object- Returns:
- the updated REST object
- Throws:
RepositoryMethodNotImplementedException- returned by the default implementation when the operation is not supported for the entitySQLException- when the database returns an errorAuthorizeException- if the context user is not authorized to perform this operation
-
addBundleToItem
public Bundle addBundleToItem(Context context, Item item, BundleRest bundleRest) throws SQLException, AuthorizeException Method to add a bundle to an item- Parameters:
context- The contextitem- The item to which the bundle has to be addedbundleRest- The bundleRest that needs to be added to the item- Returns:
- The added bundle
- Throws:
SQLExceptionAuthorizeException
-
createAndReturn
protected ItemRest 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<ItemRest,UUID> - 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
-