Class ImageConversionRestController

java.lang.Object
org.imageconverter.controller.ImageConversionRestController

@Loggable @RestController @Description("Controller for image converstion API") @RequestMapping("/rest/images/conversion") public class ImageConversionRestController extends Object
Image converter http rest.
Author:
Fernando Romulo da Silva
  • Method Details

    • getById

      @ResponseStatus(OK) @GetMapping(value="/{id:[\\d]*}", produces="application/json") public ImageConversionResponse getById(@PathVariable(name="id",required=true) Long id)
      Get a conversion already done.
      Parameters:
      id - The image conversion's id
      Returns:
      A ImageConversionResponse object
      Throws:
      ElementNotFoundException - if a element with id not found
    • getByFilter

      @ResponseStatus(OK) @GetMapping(produces="application/json") public org.springframework.data.domain.Page<ImageConversionResponse> getByFilter(org.springframework.data.jpa.domain.Specification<ImageConversion> filter, @PageableDefault(value=10,page=0) org.springframework.data.domain.Pageable page)
      Get conversions by filter.
      Parameters:
      filter - A object Specification that specific the filter the search
      page - A object Pageable that page the result
      Returns:
      A List or a empty list
    • convert

      @ResponseStatus(CREATED) @PostMapping(consumes="multipart/form-data", produces="application/json") public ImageConversionPostResponse convert(@RequestPart(name="file",required=true) org.springframework.web.multipart.MultipartFile file, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
      Convert a image file on text.
      Parameters:
      file - The image to convert
      Returns:
      A ImageConversionResponse object with response.
    • convertWithArea

      @ResponseStatus(CREATED) @PostMapping(value="/area", consumes="multipart/form-data", produces="application/json") public ImageConversionPostResponse convertWithArea(@RequestPart(name="file",required=true) org.springframework.web.multipart.MultipartFile file, @RequestParam(required=true) Integer xAxis, @RequestParam(required=true) Integer yAxis, @RequestParam(required=true) Integer width, @RequestParam(required=true) Integer height, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
      Convert a image file with area on text.
      Parameters:
      file - The image to convert
      xAxis - The image's x coordinate
      yAxis - The image's y coordinate
      width - The image's width in pixels
      height - The image's height in pixels
      Returns:
      A ImageConversionResponse object with response.
    • convert

      @ResponseStatus(CREATED) @PostMapping(value="/multiple", consumes="multipart/form-data", produces="application/json") public List<ImageConversionPostResponse> convert(@RequestPart(name="files",required=true) org.springframework.web.multipart.MultipartFile[] files, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
      Convert multiple images file on text.
      Parameters:
      files - The images' collection to convert
      Returns:
      A list of ImageConversionResponse with each response.
    • delete

      @ResponseStatus(NO_CONTENT) @DeleteMapping("/{id:[\\d]*}") public void delete(@PathVariable(name="id",required=true) Long id)
      Delete a image conversion.
      Parameters:
      id - The conversion id
    • downloadImageConversionCsv

      @ResponseStatus(OK) @GetMapping(value="/export", produces="txt/csv") public org.springframework.http.ResponseEntity<org.springframework.core.io.InputStreamResource> downloadImageConversionCsv(org.springframework.data.jpa.domain.Specification<ImageConversion> filter)
      Create a CSV file using filter.
      Parameters:
      filter - A object Specification that specific the filter the search
      Returns:
      A Csv file