java.lang.Object
com.finconsgroup.itserr.marketplace.usercommunication.dm.component.ConversationHelper

@Component public class ConversationHelper extends Object
Helper class for some common functions related to Conversations.
  • Constructor Details

    • ConversationHelper

      public ConversationHelper()
  • Method Details

    • saveConversationUsers

      @Transactional(propagation=REQUIRED, rollbackFor=java.lang.Exception.class) public void saveConversationUsers(Set<UUID> userIds)
      Saves the users from the conversation in the user table. This will allow to search for conversations that contain name of the users.
      Parameters:
      userIds - the ids of the user to save.
    • loadConversations

      @Transactional(propagation=REQUIRED, readOnly=true, noRollbackFor=java.lang.Exception.class) @NonNull public List<OutputConversationDto> loadConversations(@NonNull UUID userId, @NonNull Set<UUID> conversationIds)
      Load conversations for the provided ids. Also populate the name and receiver for direct conversations from the other user.
      Parameters:
      userId - the user id
      conversationIds - the conversation ids to load
      Returns:
      the list of OutputConversationDto
    • populateDetailsForDirect

      @Transactional(propagation=REQUIRED, readOnly=true, noRollbackFor=java.lang.Exception.class) @NonNull public List<OutputConversationDto> populateDetailsForDirect(@NonNull UUID userId, @NonNull List<Conversation> conversations)
      Populate the name and receiver for direct conversations from the other user.
      Parameters:
      userId - the user id
      conversations - the conversations to map from
      Returns:
      the list of OutputConversationDto
    • populateDetailsForDirect

      @Transactional(propagation=REQUIRED, readOnly=true, noRollbackFor=java.lang.Exception.class) @NonNull public OutputConversationDto populateDetailsForDirect(@NonNull UUID userId, @NonNull Conversation conversation)
      Populate the name and receiver for direct conversation from the other user.
      Parameters:
      userId - the user id
      conversation - the conversation to map from
      Returns:
      the OutputConversationDto
    • populateDetailsForDirect

      @Transactional(propagation=REQUIRED, readOnly=true, noRollbackFor=java.lang.Exception.class) public void populateDetailsForDirect(@NonNull List<OutputConversationDto> conversationDtos, @NonNull Set<UUID> directConversationUserIds)
      Populate the name and receiver for direct conversations from the other user.
      Parameters:
      conversationDtos - the conversationDtos to update
      directConversationUserIds - the user ids of conversation that are of DIRECT type
    • mapUserIdsToDtos

      @NonNull public Map<UUID,OutputUserDto> mapUserIdsToDtos(@NonNull Set<UUID> userIds, boolean loadUserProfiles)
      Maps the user ids to the dtos populating details like imageUrl etc.
      Parameters:
      userIds - the user ids
      Returns:
      the map containing the user dto by user id