Class ImageService

java.lang.Object
com.mt.ecommerce.product.service.ImageService

@Service public class ImageService extends Object
Service class for managing images. Provides methods for creating, updating, deleting, and retrieving images.
  • Constructor Details

  • Method Details

    • findImage

      public ImageBO findImage(UUID imageID)
      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

      public List<ImageBO> findAll(String userId)
      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

      public void createImage(String imageUrl, String altText, String userId)
      Creates a new image.
      Parameters:
      imageUrl - the URL of the image
      altText - the alternative text for the image
      userId - the ID of the user uploading the image
    • updateImage

      public void updateImage(UUID imageID, String altText, String imageUrl)
      Updates an existing image.
      Parameters:
      imageID - the ID of the image to update
      altText - the new alternative text for the image
      imageUrl - the new URL of the image
    • deleteImage

      public void deleteImage(UUID imageID, Path imageUrl) throws IOException
      Deletes an image by its ID and removes the associated file from the filesystem.
      Parameters:
      imageID - the ID of the image to delete
      imageUrl - the path to the image file to delete
      Throws:
      IOException - if an I/O error occurs while deleting the file