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>,org.springframework.data.repository.CrudRepository<ItemRest,UUID>,org.springframework.data.repository.PagingAndSortingRepository<ItemRest,UUID>,org.springframework.data.repository.Repository<ItemRest,UUID>
@Component("core.item") 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
Fields Modifier and Type Field Description static String[]COPYVIRTUAL_ALLstatic String[]COPYVIRTUAL_CONFIGUREDstatic StringREQUESTPARAMETER_COPYVIRTUALMETADATA-
Fields inherited from class org.dspace.app.rest.repository.AbstractDSpaceRestRepository
converter, requestService, utils
-
-
Constructor Summary
Constructors Constructor Description ItemRestRepository(ItemService dsoService)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BundleaddBundleToItem(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 voiddelete(Context context, UUID id)Method to implement to support delete of a single object instanceorg.springframework.data.domain.Page<ItemRest>findAll(Context context, org.springframework.data.domain.Pageable pageable)Method to implement to support scroll of entity instances from the collection resource endpointItemRestfindOne(Context context, UUID id)Method to implement to support retrieval of a specific REST object instanceClass<ItemRest>getDomainClass()The REST model supported by the repositoryprotected voidpatch(Context context, javax.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, javax.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, patchDSpaceObject
-
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, save, save, saveAll, upload, upload, upload
-
Methods inherited from class org.dspace.app.rest.repository.AbstractDSpaceRestRepository
getRequestService, obtainContext
-
-
-
-
Field Detail
-
COPYVIRTUAL_ALL
public static final String[] COPYVIRTUAL_ALL
-
COPYVIRTUAL_CONFIGURED
public static final String[] COPYVIRTUAL_CONFIGURED
-
REQUESTPARAMETER_COPYVIRTUALMETADATA
public static final String REQUESTPARAMETER_COPYVIRTUALMETADATA
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ItemRestRepository
public ItemRestRepository(ItemService dsoService)
-
-
Method Detail
-
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, javax.servlet.http.HttpServletRequest request, String apiCategory, String model, UUID id, Patch patch) throws AuthorizeException, SQLExceptionDescription 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
public Class<ItemRest> 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 AuthorizeExceptionDescription 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, SQLExceptionDescription 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, javax.servlet.http.HttpServletRequest request, String apiCategory, String model, UUID uuid, com.fasterxml.jackson.databind.JsonNode jsonNode) throws RepositoryMethodNotImplementedException, SQLException, AuthorizeExceptionDescription 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
-
-