Class ImageService
- java.lang.Object
-
- edu.cnm.deepdive.albuquirky.service.ImageService
-
@Service public class ImageService extends Object
This class handles all of the business logic for getting, putting, posting, and deleting items from theImageon behalf of theImageServiceclass, using methods from theImageRepositoryinterface.
-
-
Constructor Summary
Constructors Constructor Description ImageService(ImageRepository imageRepository)Creates instances of the ImageRepository.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Optional<Image>get(long id)Method to get a specific image.List<Image>getAllByProduct(Product product)Method to get images tied to a specific product.Imageremove(Image image, Profile profile)This will remove an image if needed by the user it pertains to.Imagesave(Image image)Method to save images pertaining to the user profile or product listing.
-
-
-
Constructor Detail
-
ImageService
@Autowired public ImageService(ImageRepository imageRepository)
Creates instances of the ImageRepository.- Parameters:
imageRepository- TheImageRepositoryto be created.
-
-
Method Detail
-
save
public Image save(Image image)
Method to save images pertaining to the user profile or product listing.
-
remove
public Image remove(Image image, Profile profile)
This will remove an image if needed by the user it pertains to. It will also throw an exception if someone without access attempts to remove the photo.
-
-