Class UploadServiceImpl
- java.lang.Object
-
- in.cs699.tensors.delagram.content_upload_service.service.UploadServiceImpl
-
- All Implemented Interfaces:
UploadService
@Service public class UploadServiceImpl extends Object implements UploadService
An implementation of the Business-logic.- Author:
- swaroop_nath
-
-
Constructor Summary
Constructors Constructor Description UploadServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MemoryconvertToMemoryObject(Map<String,Object> payload)The implementation that converts the passed in memory representation into a Memory POJOUserfetchUser(String currentUserID)The implementation that helps in fetching the current logged in user from the databasebooleanupdateUserMemories(List<Memory> uploadedMemories, String userID)The implementation that helps in updating the list of memories for the user in the databasevoidupdateUserObject(User currentUser, Memory memory)The implementation of updating the user object with their new memory.
-
-
-
Method Detail
-
updateUserObject
public void updateUserObject(User currentUser, Memory memory)
The implementation of updating the user object with their new memory.- Specified by:
updateUserObjectin interfaceUploadService- 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:
convertToMemoryObjectin interfaceUploadService- 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:
updateUserMemoriesin interfaceUploadService- Parameters:
uploadedMemories- The list of memories that the user has uploaded, including the recently uploaded memoryuserID- 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:
fetchUserin interfaceUploadService- 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
-
-