Package org.imageconverter.controller
Class ImageTypeRestController
java.lang.Object
org.imageconverter.controller.ImageTypeRestController
@Loggable
@RestController
@Description("Controller for image type API")
@RequestMapping("/rest/images/type")
public class ImageTypeRestController
extends Object
Image type CRUD.
- Author:
- Fernando Romulo da Silva
-
Method Summary
Modifier and TypeMethodDescriptionvoid
create
(@Valid CreateImageTypeRequest request, javax.servlet.http.HttpServletResponse response) Create a image type.void
Delete a image type.org.springframework.data.domain.Page<ImageTypeResponse>
getByFilter
(org.springframework.data.jpa.domain.Specification<ImageType> filter, org.springframework.data.domain.Pageable page) Get image types.Get a image type by id.void
update
(Long id, @Valid UpdateImageTypeRequest request) Update a image type.
-
Method Details
-
getById
@ResponseStatus(OK) @GetMapping(value="/{id:[\\d]*}", produces="application/json") public ImageTypeResponse getById(@PathVariable(name="id",required=true) Long id) Get a image type by id.- Parameters:
id
- The image type's id- Returns:
- A
ImageTypeResponse
object - Throws:
ElementNotFoundException
- if a element with id not found
-
getByFilter
@ResponseStatus(OK) @GetMapping(produces="application/json") public org.springframework.data.domain.Page<ImageTypeResponse> getByFilter(org.springframework.data.jpa.domain.Specification<ImageType> filter, @PageableDefault(value=10,page=0) org.springframework.data.domain.Pageable page) Get image types.- Parameters:
filter
- A objectSpecification
that specific the filter the search, if you omit, bring allpage
- A objectPageable
that page the result- Returns:
- A
List
or a empty list
-
create
@ResponseStatus(CREATED) @PostMapping(consumes="application/json", produces={"text/plain","application/json"}) public void create(@Valid @RequestBody @Valid CreateImageTypeRequest request, javax.servlet.http.HttpServletResponse response) Create a image type.- Parameters:
request
- ACreateImageTypeRequest
object. It works as a structure to create aImageType
-
update
@ResponseStatus(NO_CONTENT) @PutMapping(value="/{id:[\\d]*}", consumes="application/json") public void update(@PathVariable(name="id",required=true) Long id, @Valid @RequestBody @Valid UpdateImageTypeRequest request) Update a image type.- Parameters:
request
- AUpdateImageTypeRequest
object. It works as a structure to update aImageType
-
delete
@ResponseStatus(NO_CONTENT) @DeleteMapping("/{id:[\\d]*}") public void delete(@PathVariable(name="id",required=true) Long id) Delete a image type.- Parameters:
id
- The image type's id
-