Package org.imageconverter.application
Class ImageConversionService
java.lang.Object
org.imageconverter.application.ImageConversionService
Application service that execute conversion.
- Author:
- Fernando Romulo da Silva
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionconvert(@NotNull @NotEmpty @Valid List<ImageConverterRequestInterface> requests) Convert a list of image on text.convert(@NotNull @Valid ImageConverterRequestInterface request) Convert an image on text.voiddeleteImageConversion(@NotNull Long id) Delete a conversion image.findAll()Find all stored conversions or a empty list.Find a stored conversion by id.org.springframework.data.domain.Page<ImageConversionResponse>findBySpecification(org.springframework.data.jpa.domain.Specification<ImageConversion> spec, org.springframework.data.domain.Pageable page) Find image conversions by spring specificationbyte[]findBySpecificationToCsv(org.springframework.data.jpa.domain.Specification<ImageConversion> spec) Create a CSV file based on the result filtered by the spec
-
Field Details
-
HEADER_FILE
-
-
Method Details
-
convert
@Transactional public ImageConversionResponse convert(@NotNull @Valid @NotNull @Valid ImageConverterRequestInterface request) Convert an image on text.- Parameters:
request- A image (ImageConverterRequestorImageConverterRequestArea) that it'll be convert- Returns:
- A
ImageConversionResponsewith the conversion - Throws:
ElementAlreadyExistsException- if image (file name) has already converted
-
convert
@Transactional public List<ImageConversionResponse> convert(@NotNull @NotEmpty @Valid @NotNull @NotEmpty @Valid List<ImageConverterRequestInterface> requests) Convert a list of image on text.- Parameters:
request- A image (ImageConverterRequestorImageConverterRequestArea) that it'll be convert- Returns:
- A
ImageConversionResponsewith the conversion - Throws:
ElementAlreadyExistsException- if image (file name) has already converted
-
deleteImageConversion
Delete a conversion image.- Parameters:
id- The image type's id- Throws:
ElementNotFoundException- if conversion (id) doesn't exists
-
findAll
Find all stored conversions or a empty list.- Returns:
- A list of
ImageConversionResponseor a empty list
-
findById
Find a stored conversion by id.- Parameters:
id- The image conversion's id- Returns:
- A
ImageConversionResponseobject - Throws:
ElementNotFoundException- if a element with id not found
-
findBySpecification
@Transactional(readOnly=true) public org.springframework.data.domain.Page<ImageConversionResponse> findBySpecification(org.springframework.data.jpa.domain.Specification<ImageConversion> spec, org.springframework.data.domain.Pageable page) Find image conversions by spring specification- Parameters:
spec- The query specification, aSpecificationobjectpageable- The query page control, aPageableobject- Returns:
- A
ImageConversionResponse's list with result or a empty list - Throws:
ElementInvalidException- if a specification is invalid
-
findBySpecificationToCsv
@Transactional(readOnly=true) public byte[] findBySpecificationToCsv(org.springframework.data.jpa.domain.Specification<ImageConversion> spec) Create a CSV file based on the result filtered by the spec- Parameters:
spec- ASpecificationobject, the query filter- Returns:
- An array of bytes (file in memory)
-