102052: Remove getPrimaryBitstream from PrimaryBitstreamController

This commit is contained in:
Nona Luypaert
2023-06-08 21:49:13 +02:00
parent d6d6a3e074
commit 1b06c64454
2 changed files with 4 additions and 25 deletions

View File

@@ -16,7 +16,6 @@ import javax.servlet.http.HttpServletRequest;
import org.dspace.app.rest.converter.ConverterService; import org.dspace.app.rest.converter.ConverterService;
import org.dspace.app.rest.exception.UnprocessableEntityException; 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.BundleRest;
import org.dspace.app.rest.model.hateoas.BundleResource; import org.dspace.app.rest.model.hateoas.BundleResource;
import org.dspace.app.rest.repository.BundlePrimaryBitstreamLinkRepository; import org.dspace.app.rest.repository.BundlePrimaryBitstreamLinkRepository;
@@ -53,30 +52,6 @@ public class PrimaryBitstreamController {
@Autowired @Autowired
private Utils utils; 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. * This method creates a primaryBitstream on the given Bundle.
* <br><code> * <br><code>

View File

@@ -39,6 +39,10 @@ public class BundlePrimaryBitstreamLinkRepository extends AbstractDSpaceRestRepo
/** /**
* Retrieves the primaryBitstream of a Bundle. * 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 request The HttpServletRequest if relevant
* @param bundleId The UUID of the Bundle * @param bundleId The UUID of the Bundle