Class ConversationServiceImpl
java.lang.Object
com.finconsgroup.itserr.marketplace.usercommunication.dm.service.impl.ConversationServiceImpl
- All Implemented Interfaces:
ConversationService
Service implementation for conversation management (direct and group).
Contains business rules for participants, permissions, read receipts, and stats.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetConversation(UUID userId, UUID conversationId) Get conversation details by ID.org.springframework.data.domain.Page<OutputChatMessageDto> getConversationMessages(UUID userId, UUID conversationId, org.springframework.data.domain.Pageable pageable) Get recent messages for conversation.getConversationParticipants(UUID conversationId) Get all participants for a conversation.Get aggregated counts for direct and group conversations.Get conversations along with unread message information for a user.org.springframework.data.domain.Page<OutputConversationDto> getRecentConversationsForUser(UUID userId, org.springframework.data.domain.Pageable pageable) Get recently active conversations for a user.booleanisUserParticipant(UUID conversationId, UUID userId) Check if a user is a participant in the conversation.voidleaveConversation(UUID conversationId, UUID userId) Leave the conversation as a user.voidmarkBulkMessagesAsRead(UUID userId, UUID conversationId, InputBulkMessagesDto request) Mark all messages in the conversation as read for a user for the bulk messages request.voidmarkConversationAsRead(UUID userId, UUID conversationId) Mark all messages in the conversation as read for a user.voidmarkConversationUptoMessageAsRead(UUID userId, UUID conversationId, UUID messageId) Mark all messages in the conversation as read for a user upto the message id provided.voidmuteConversation(UUID conversationId, UUID userId, boolean muted) Mute or unmute a conversation for a user.searchConversations(UUID userId, String searchTerm, org.springframework.data.domain.Pageable pageable) Search conversations by a free-text term (e.g., by name/description for non-direct chats).
-
Constructor Details
-
ConversationServiceImpl
public ConversationServiceImpl()
-
-
Method Details
-
getConversation
@Transactional(propagation=REQUIRED, readOnly=true, noRollbackFor=java.lang.Exception.class) public OutputConversationDto getConversation(UUID userId, UUID conversationId) Description copied from interface:ConversationServiceGet conversation details by ID.- Specified by:
getConversationin interfaceConversationService- Parameters:
userId- the user idconversationId- the conversation ID- Returns:
- Output conversation if found
-
getRecentConversationsForUser
@Transactional(propagation=REQUIRED, readOnly=true, noRollbackFor=java.lang.Exception.class) public org.springframework.data.domain.Page<OutputConversationDto> getRecentConversationsForUser(UUID userId, org.springframework.data.domain.Pageable pageable) Description copied from interface:ConversationServiceGet recently active conversations for a user.- Specified by:
getRecentConversationsForUserin interfaceConversationService- Parameters:
userId- the user IDpageable- the pageable containing requested paging and sorting information- Returns:
- page of conversations ordered by recent activity
-
getConversationMessages
@Transactional(propagation=REQUIRED, readOnly=true, noRollbackFor=java.lang.Exception.class) public org.springframework.data.domain.Page<OutputChatMessageDto> getConversationMessages(UUID userId, UUID conversationId, org.springframework.data.domain.Pageable pageable) Description copied from interface:ConversationServiceGet recent messages for conversation.- Specified by:
getConversationMessagesin interfaceConversationService- Parameters:
userId- the user IDconversationId- the conversation IDpageable- the pageable containing requested paging and sorting information- Returns:
- page of conversations ordered by recent activity
-
getConversationParticipants
@Transactional(propagation=REQUIRED, readOnly=true, noRollbackFor=java.lang.Exception.class) public List<OutputConversationParticipantDto> getConversationParticipants(UUID conversationId) Description copied from interface:ConversationServiceGet all participants for a conversation.- Specified by:
getConversationParticipantsin interfaceConversationService- Parameters:
conversationId- the conversation ID- Returns:
- list of participants
-
isUserParticipant
@Transactional(propagation=REQUIRED, readOnly=true, noRollbackFor=java.lang.Exception.class) public boolean isUserParticipant(UUID conversationId, UUID userId) Description copied from interface:ConversationServiceCheck if a user is a participant in the conversation.- Specified by:
isUserParticipantin interfaceConversationService- Parameters:
conversationId- the conversation IDuserId- the user ID- Returns:
- true if the user is an active participant
-
muteConversation
@Transactional(propagation=REQUIRED, rollbackFor=java.lang.Exception.class) public void muteConversation(UUID conversationId, UUID userId, boolean muted) Description copied from interface:ConversationServiceMute or unmute a conversation for a user.- Specified by:
muteConversationin interfaceConversationService- Parameters:
conversationId- the conversation IDuserId- the user IDmuted- true to mute, false to unmute
-
markConversationAsRead
@Transactional(propagation=REQUIRED, rollbackFor=java.lang.Exception.class) public void markConversationAsRead(@NonNull UUID userId, @NonNull UUID conversationId) Description copied from interface:ConversationServiceMark all messages in the conversation as read for a user.- Specified by:
markConversationAsReadin interfaceConversationService- Parameters:
userId- the user IDconversationId- the conversation ID
-
markConversationUptoMessageAsRead
@Transactional(propagation=REQUIRED, rollbackFor=java.lang.Exception.class) public void markConversationUptoMessageAsRead(@NonNull UUID userId, @NonNull UUID conversationId, @NonNull UUID messageId) Description copied from interface:ConversationServiceMark all messages in the conversation as read for a user upto the message id provided.- Specified by:
markConversationUptoMessageAsReadin interfaceConversationService- Parameters:
userId- the user IDconversationId- the conversation IDmessageId- the message ID
-
markBulkMessagesAsRead
@Transactional(propagation=REQUIRED, rollbackFor=java.lang.Exception.class) public void markBulkMessagesAsRead(@NonNull UUID userId, @NonNull UUID conversationId, @NonNull InputBulkMessagesDto request) Description copied from interface:ConversationServiceMark all messages in the conversation as read for a user for the bulk messages request.- Specified by:
markBulkMessagesAsReadin interfaceConversationService- Parameters:
userId- the user IDconversationId- the conversation IDrequest- the input bulk messages request
-
getConversationsWithUnreadMessages
@Transactional(propagation=REQUIRED, readOnly=true, noRollbackFor=java.lang.Exception.class) public List<ConversationParticipant> getConversationsWithUnreadMessages(UUID userId) Description copied from interface:ConversationServiceGet conversations along with unread message information for a user.- Specified by:
getConversationsWithUnreadMessagesin interfaceConversationService- Parameters:
userId- the user ID- Returns:
- list of participant records including unread state
-
leaveConversation
@Transactional(propagation=REQUIRED, rollbackFor=java.lang.Exception.class) public void leaveConversation(UUID conversationId, UUID userId) Description copied from interface:ConversationServiceLeave the conversation as a user.- Specified by:
leaveConversationin interfaceConversationService- Parameters:
conversationId- the conversation IDuserId- the user ID
-
searchConversations
@Transactional(propagation=REQUIRED, readOnly=true, noRollbackFor=java.lang.Exception.class) public OutputSearchResultDto searchConversations(UUID userId, String searchTerm, org.springframework.data.domain.Pageable pageable) Description copied from interface:ConversationServiceSearch conversations by a free-text term (e.g., by name/description for non-direct chats).- Specified by:
searchConversationsin interfaceConversationService- Parameters:
userId- the user IDsearchTerm- free-text termpageable- the pageable containing requested paging and sorting information- Returns:
- list of matching conversations/messages
-
getConversationStats
@Transactional(propagation=REQUIRED, readOnly=true, noRollbackFor=java.lang.Exception.class) public OutputConversationStatsDto getConversationStats()Description copied from interface:ConversationServiceGet aggregated counts for direct and group conversations.- Specified by:
getConversationStatsin interfaceConversationService- Returns:
- conversation statistics DTO
-