Class UploadServiceImpl

  • All Implemented Interfaces:
    UploadService

    @Service
    public class UploadServiceImpl
    extends Object
    implements UploadService
    An implementation of the Business-logic.
    Author:
    swaroop_nath
    • Constructor Detail

      • UploadServiceImpl

        public UploadServiceImpl()
    • Method Detail

      • updateUserObject

        public void updateUserObject​(User currentUser,
                                     Memory memory)
        The implementation of updating the user object with their new memory.
        Specified by:
        updateUserObject in interface UploadService
        Parameters:
        currentUser - The current user.
        memory - The memory object signifying the uploaded memory.
      • convertToMemoryObject

        public Memory convertToMemoryObject​(Map<String,​Object> payload)
        The implementation that converts the passed in memory representation into a Memory POJO
        Specified by:
        convertToMemoryObject in interface UploadService
        Parameters:
        payload - The map object that contains the fields of the Memory
        Returns:
        Returns the well-formed Java object. string doesn't correctly represent the Java bean.
      • updateUserMemories

        public boolean updateUserMemories​(List<Memory> uploadedMemories,
                                          String userID)
                                   throws UploadNotCompleteException
        The implementation that helps in updating the list of memories for the user in the database
        Specified by:
        updateUserMemories in interface UploadService
        Parameters:
        uploadedMemories - The list of memories that the user has uploaded, including the recently uploaded memory
        userID - The user id of the user who has uploaded the image
        Returns:
        Returns true if the memory could be uploaded on the database
        Throws:
        UploadNotCompleteException - Thrown incase the upload action couldn't be completed
      • fetchUser

        public User fetchUser​(String currentUserID)
                       throws InternalServerException
        The implementation that helps in fetching the current logged in user from the database
        Specified by:
        fetchUser in interface UploadService
        Parameters:
        currentUserID - The user id that identifies the currently logged in user
        Returns:
        A User object representing the currently logged in user
        Throws:
        InternalServerException - Thrown in case there is some error while loading the User