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.voiddeleteImageType(@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
ImageTypeResponsewith 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
ImageTypeResponsewith 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
ImageTypeResponseobject - Throws:
ElementNotFoundException- if a element with id not found
-
findAll
Find all stored image types or a empty list.- Returns:
- A list of
ImageTypeResponseor 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, aSpecificationobjectpageable- The query page control, aPageableobject- Returns:
- A
ImageTypeResponse's list with result or a empty list - Throws:
ElementInvalidException- if a specification is invalid
-