Package org.imageconverter.application
Class ImageTypeService
java.lang.Object
org.imageconverter.application.ImageTypeService
Application service that manages (CRUD) image types.
- Author:
- Fernando Romulo da Silva
-
Method Summary
Modifier and TypeMethodDescriptioncreateImageType
(@NotNull @Valid CreateImageTypeRequest request) Create a image type.void
deleteImageType
(@NotNull Long id) Delete a image type.findAll()
Find all stored image types or a empty list.Find a image type by id.org.springframework.data.domain.Page<ImageTypeResponse>
findBySpecification
(org.springframework.data.jpa.domain.Specification<ImageType> spec, org.springframework.data.domain.Pageable pageable) Find image types by spring specification.updateImageType
(@NotNull Long id, @NotNull @Valid UpdateImageTypeRequest request) Update a image type.
-
Method Details
-
createImageType
@Transactional public ImageTypeResponse createImageType(@NotNull @Valid @NotNull @Valid CreateImageTypeRequest request) Create a image type.- Parameters:
request
- A image type (CreateImageTypeRequest
) request to create- Returns:
- A
ImageTypeResponse
with the conversion - Throws:
ElementAlreadyExistsException
- if image type (file extension) has already exists
-
updateImageType
@Transactional public ImageTypeResponse updateImageType(@NotNull @NotNull Long id, @NotNull @Valid @NotNull @Valid UpdateImageTypeRequest request) Update a image type.- Parameters:
id
- The image type's idrequest
- A image type (UpdateImageTypeRequest
) requested to update- Returns:
- A
ImageTypeResponse
with the update's result - Throws:
ElementNotFoundException
- if image type (file extension) doesn't exists
-
deleteImageType
Delete a image type.- Parameters:
id
- The image type's id- Throws:
ElementNotFoundException
- if image type (file extension) doesn't existsElementConflictException
- if amage type already been used on image conversion
-
findById
Find 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
-
findAll
Find all stored image types or a empty list.- Returns:
- A list of
ImageTypeResponse
or a empty list
-
findBySpecification
@Transactional(readOnly=true) public org.springframework.data.domain.Page<ImageTypeResponse> findBySpecification(org.springframework.data.jpa.domain.Specification<ImageType> spec, org.springframework.data.domain.Pageable pageable) Find image types by spring specification.- Parameters:
spec
- The query specification, aSpecification
objectpageable
- The query page control, aPageable
object- Returns:
- A
ImageTypeResponse
's list with result or a empty list - Throws:
ElementInvalidException
- if a specification is invalid
-