Class AiConversationDataService
java.lang.Object
io.jmix.aitoolsflowuidata.service.impl.AiConversationDataService
- All Implemented Interfaces:
AiConversationService
Default
AiConversationService backed by persisted AiConversationEntity entities,
mapped to and from the persistence-agnostic AiConversation model.
The underlying entities are an internal detail, accessed through UnconstrainedDataManager
so the chat user needs no direct permissions on them. Access control is enforced here: every
operation is scoped to the current (effective) user, and modifying another user's conversation
is denied.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected AiConversationConverterprotected CurrentUserSubstitutionprotected UnconstrainedDataManagerprotected Messages -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcheckOwner(AiConversationEntity conversation) protected List<AiConversation> convert(List<AiConversationEntity> conversations) create()Creates a new conversation owned by the current user.protected Stringprotected booleanisOwner(AiConversationEntity conversation) protected @Nullable AiConversationEntityloadAiConversation(@Nullable UUID conversationId) @Nullable AiConversationloadConversation(UUID conversationId) Loads a conversation by id.Loads the current user's conversations, newest first.voidremove(AiConversation conversation) Removes the given conversation together with its messages.save(AiConversation conversation) Persists the given conversation (insert or update).
-
Field Details
-
conversationConverter
-
dataManager
-
messages
-
currentUserSubstitution
-
-
Constructor Details
-
AiConversationDataService
public AiConversationDataService()
-
-
Method Details
-
loadConversation
Description copied from interface:AiConversationServiceLoads a conversation by id.- Specified by:
loadConversationin interfaceAiConversationService- Parameters:
conversationId- id of the conversation to load- Returns:
- the conversation, or
nullif it does not exist or is not accessible to the current user
-
create
Description copied from interface:AiConversationServiceCreates a new conversation owned by the current user.- Specified by:
createin interfaceAiConversationService- Returns:
- the created conversation
-
save
Description copied from interface:AiConversationServicePersists the given conversation (insert or update).- Specified by:
savein interfaceAiConversationService- Parameters:
conversation- conversation to save- Returns:
- the saved conversation
-
remove
Description copied from interface:AiConversationServiceRemoves the given conversation together with its messages.- Specified by:
removein interfaceAiConversationService- Parameters:
conversation- conversation to remove
-
loadConversations
Description copied from interface:AiConversationServiceLoads the current user's conversations, newest first. Messages are not loaded; useAiChatMessageServiceto fetch a conversation's messages on demand.- Specified by:
loadConversationsin interfaceAiConversationService- Returns:
- the conversations, newest first; empty if there are none
-
convert
-
isOwner
-
checkOwner
-
currentUsername
-
loadAiConversation
-