Class ConversationHelper
java.lang.Object
com.finconsgroup.itserr.marketplace.usercommunication.dm.component.ConversationHelper
Helper class for some common functions related to Conversations.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionloadConversations(UUID userId, Set<UUID> conversationIds) Load conversations for the provided ids.mapUserIdsToDtos(Set<UUID> userIds, boolean loadUserProfiles) Maps the user ids to the dtos populating details like imageUrl etc.voidpopulateDetailsForDirect(List<OutputConversationDto> conversationDtos, Set<UUID> directConversationUserIds) Populate the name and receiver for direct conversations from the other user.populateDetailsForDirect(UUID userId, Conversation conversation) Populate the name and receiver for direct conversation from the other user.populateDetailsForDirect(UUID userId, List<Conversation> conversations) Populate the name and receiver for direct conversations from the other user.voidsaveConversationUsers(Set<UUID> userIds) Saves the users from the conversation in the user table.
-
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 idconversationIds- 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 idconversations- 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 idconversation- 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 updatedirectConversationUserIds- 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
-