Package org.dspace.app.rest
Class CollectionItemTemplateController
java.lang.Object
org.dspace.app.rest.CollectionItemTemplateController
@RestController
@RequestMapping("/api/core/collections/{uuid:[0-9a-fxA-FX]{8}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{12}}/itemtemplate")
public class CollectionItemTemplateController
extends Object
This RestController takes care of the creation and retrieval of Collection's Item templates
This class will receive the UUID of a Collection and it'll perform actions on its nested objects
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionResponseEntity<org.springframework.hateoas.RepresentationModel<?>>createTemplateItem(jakarta.servlet.http.HttpServletRequest request, UUID uuid, com.fasterxml.jackson.databind.JsonNode itemBody) This method will create an Item and add it as a template to a Collection.getTemplateItem(jakarta.servlet.http.HttpServletRequest request, UUID uuid) This method gets the template Item based on the owning Collection
-
Constructor Details
-
CollectionItemTemplateController
public CollectionItemTemplateController()
-
-
Method Details
-
createTemplateItem
@PreAuthorize("hasPermission(#uuid, \'COLLECTION\', \'WRITE\')") @RequestMapping(method=POST) public ResponseEntity<org.springframework.hateoas.RepresentationModel<?>> createTemplateItem(jakarta.servlet.http.HttpServletRequest request, @PathVariable UUID uuid, @RequestBody(required=false) com.fasterxml.jackson.databind.JsonNode itemBody) throws SQLException, AuthorizeException This method will create an Item and add it as a template to a Collection. Example:curl http://<dspace.server.url>/api/core/collections/51715dd3-5590-49f2-b227-6a663c849921/itemtemplate -XPOST -H 'Content-Type: Content-Type:application/json' \ -H 'Authorization: Bearer eyJhbGciOiJI...' \ --data '{ "metadata": { "dc.type": [ { "value": "Journal Article", "language": "en", "authority": null, "confidence": -1 } ] }, "inArchive": false, "discoverable": false, "withdrawn": false, "type": "item" }'- Parameters:
request- The request as described aboveuuid- The UUID of the Collection for which the template item should be madeitemBody- The new item- Returns:
- The created template
- Throws:
SQLExceptionAuthorizeException
-
getTemplateItem
@PreAuthorize("hasPermission(#uuid, \'COLLECTION\', \'READ\')") @RequestMapping(method=GET) public TemplateItemResource getTemplateItem(jakarta.servlet.http.HttpServletRequest request, @PathVariable UUID uuid) throws SQLException This method gets the template Item based on the owning Collectioncurl http://<dspace.server.url>/api/core/collections/51715dd3-5590-49f2-b227-6a663c849921/itemtemplate -XGET \ -H 'Authorization: Bearer eyJhbGciOiJI...'- Parameters:
request-uuid- The UUID of the Collection from which you want the template item- Returns:
- The template item from the Collection in the request
- Throws:
SQLException
-