mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 01:54:22 +00:00
102052: Remove getPrimaryBitstream from PrimaryBitstreamController
This commit is contained in:
@@ -16,7 +16,6 @@ import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.dspace.app.rest.converter.ConverterService;
|
||||
import org.dspace.app.rest.exception.UnprocessableEntityException;
|
||||
import org.dspace.app.rest.model.BitstreamRest;
|
||||
import org.dspace.app.rest.model.BundleRest;
|
||||
import org.dspace.app.rest.model.hateoas.BundleResource;
|
||||
import org.dspace.app.rest.repository.BundlePrimaryBitstreamLinkRepository;
|
||||
@@ -53,30 +52,6 @@ public class PrimaryBitstreamController {
|
||||
@Autowired
|
||||
private Utils utils;
|
||||
|
||||
/**
|
||||
* This method retrieves a primaryBitstream on the given Bundle.
|
||||
* Returns null if Bundle doesn't have a primaryBitstream.
|
||||
* <br><code>
|
||||
* curl -X GET "http://{dspace.server.url}/api/core/bundles/{bundle-uuid}/primaryBitstream"
|
||||
* </code>
|
||||
*
|
||||
* @param uuid The UUID of the Bundle of which the primaryBitstream will be retrieved
|
||||
* @param request The HttpServletRequest
|
||||
* @return The primaryBitstream, or null if not found
|
||||
*/
|
||||
@PreAuthorize("hasPermission(#uuid, 'BUNDLE', 'READ')")
|
||||
@RequestMapping(method = RequestMethod.GET)
|
||||
public ResponseEntity<RepresentationModel<?>> getPrimaryBitstream(@PathVariable UUID uuid,
|
||||
HttpServletRequest request) {
|
||||
BitstreamRest bitstreamRest = repository.getPrimaryBitstream(null, uuid, null, utils.obtainProjection());
|
||||
if (bitstreamRest == null) {
|
||||
return ControllerUtils.toEmptyResponse(HttpStatus.NO_CONTENT);
|
||||
} else {
|
||||
return ControllerUtils.toResponseEntity(HttpStatus.OK, new HttpHeaders(),
|
||||
(RepresentationModel<?>) converter.toResource(bitstreamRest));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This method creates a primaryBitstream on the given Bundle.
|
||||
* <br><code>
|
||||
|
@@ -39,6 +39,10 @@ public class BundlePrimaryBitstreamLinkRepository extends AbstractDSpaceRestRepo
|
||||
|
||||
/**
|
||||
* Retrieves the primaryBitstream of a Bundle.
|
||||
* Returns null if Bundle doesn't have a primaryBitstream.
|
||||
* <br><code>
|
||||
* curl -X GET "http://{dspace.server.url}/api/core/bundles/{bundle-uuid}/primaryBitstream"
|
||||
* </code>
|
||||
*
|
||||
* @param request The HttpServletRequest if relevant
|
||||
* @param bundleId The UUID of the Bundle
|
||||
|
Reference in New Issue
Block a user