Commit b3323574 authored by Matija Obreza's avatar Matija Obreza
Browse files

Image API method listImages updated to include /_list

parent c555613c
......@@ -46,7 +46,6 @@ import org.springframework.http.HttpEntity;
import org.springframework.http.MediaType;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -97,7 +96,7 @@ public class InstituteGalleriesController extends RestController {
*
* @throws NonUniqueAccessionException
*/
@RequestMapping(value = "/{instCode}/acn/{acceNumb:.+}", method = { RequestMethod.GET }, produces = { MediaType.APPLICATION_JSON_VALUE })
@RequestMapping(value = "/{instCode}/acn/{acceNumb:.+}/_list", method = { RequestMethod.GET }, produces = { MediaType.APPLICATION_JSON_VALUE })
public @ResponseBody List<UUID> listAccessionGallery(@PathVariable("instCode") final String instCode, @PathVariable("acceNumb") final String acceNumb) throws NonUniqueAccessionException {
final FaoInstitute institute = this.instituteService.findInstitute(instCode);
......@@ -234,7 +233,7 @@ public class InstituteGalleriesController extends RestController {
* @throws NonUniqueAccessionException
*/
@RequestMapping(value = "/{instCode}/acn/{acceNumb:.+}/{uuid}", method = { RequestMethod.DELETE })
public void deleteImage(final HttpServletRequest request, final HttpServletResponse response, @PathVariable("instCode") final String instCode, @PathVariable("acceNumb") final String acceNumb,
public void deleteImage(@PathVariable("instCode") final String instCode, @PathVariable("acceNumb") final String acceNumb,
@PathVariable("uuid") final UUID uuid) throws IOException, NonUniqueAccessionException {
final FaoInstitute institute = this.instituteService.findInstitute(instCode);
......@@ -261,7 +260,7 @@ public class InstituteGalleriesController extends RestController {
}
/**
* Add or update image bytes. Content-Type is extracted from request headers, the request body represents the bytes.
* Add image bytes. Content-Type is extracted from request headers, the request body represents the bytes.
*
* @param originalFilename
*
......
......@@ -244,7 +244,7 @@ public class ApiImagesDocsTest extends AbstractRestTest {
fieldWithPath("lastModifiedDate").ignored(), fieldWithPath("originalUrl").ignored(), fieldWithPath("dateRetrieved").ignored(), fieldWithPath("dateSubmitted").ignored(),
fieldWithPath("modified").ignored())));
mockMvc.perform(get("/api/v0/img/{instCode}/acn/{acceNumb}", TEST_INSTCODE, ACCENUMB)).andExpect(status().isOk()).andExpect(content().contentType(MediaType.APPLICATION_JSON)).andDo(r -> {
mockMvc.perform(get("/api/v0/img/{instCode}/acn/{acceNumb}/_list", TEST_INSTCODE, ACCENUMB)).andExpect(status().isOk()).andExpect(content().contentType(MediaType.APPLICATION_JSON)).andDo(r -> {
LOG.info("Listing image UUIDs: " + r.getResponse().getContentAsString());
}).andDo(document("img-instgallery-accelist",
pathParameters(parameterWithName("instCode").description("Institute WIEWS code (e.g. NGA039)"), parameterWithName("acceNumb").description("Existing ACCENUMB in the institute"))));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment