Package com.mt.ecommerce.product.service
Class ImageService
java.lang.Object
com.mt.ecommerce.product.service.ImageService
Service class for managing images.
Provides methods for creating, updating, deleting, and retrieving images.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
createImage
(String imageUrl, String altText, String userId) Creates a new image.void
deleteImage
(UUID imageID, Path imageUrl) Deletes an image by its ID and removes the associated file from the filesystem.Finds all images for a specific user.Finds an image by its ID.void
updateImage
(UUID imageID, String altText, String imageUrl) Updates an existing image.
-
Constructor Details
-
ImageService
-
-
Method Details
-
findImage
Finds an image by its ID.- Parameters:
imageID
- the ID of the image to find- Returns:
- the ImageBO representing the found image, or an empty ImageBO if not found
-
findAll
Finds all images for a specific user.- Parameters:
userId
- the ID of the user whose images are to be retrieved- Returns:
- a list of ImageBO objects representing the user's images
-
createImage
Creates a new image.- Parameters:
imageUrl
- the URL of the imagealtText
- the alternative text for the imageuserId
- the ID of the user uploading the image
-
updateImage
Updates an existing image.- Parameters:
imageID
- the ID of the image to updatealtText
- the new alternative text for the imageimageUrl
- the new URL of the image
-
deleteImage
Deletes an image by its ID and removes the associated file from the filesystem.- Parameters:
imageID
- the ID of the image to deleteimageUrl
- the path to the image file to delete- Throws:
IOException
- if an I/O error occurs while deleting the file
-