diff --git a/dao/src/main/java/org/thingsboard/server/dao/ai/AiModelServiceImpl.java b/dao/src/main/java/org/thingsboard/server/dao/ai/AiModelServiceImpl.java index ae0f575d44..398fedba90 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/ai/AiModelServiceImpl.java +++ b/dao/src/main/java/org/thingsboard/server/dao/ai/AiModelServiceImpl.java @@ -4,6 +4,7 @@ package org.thingsboard.server.dao.ai; import com.google.common.util.concurrent.FluentFuture; import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.event.TransactionalEventListener; @@ -29,12 +30,12 @@ import java.util.UUID; import static com.google.common.util.concurrent.MoreExecutors.directExecutor; import static org.thingsboard.server.dao.service.Validator.validatePageLink; +@Slf4j @Service @RequiredArgsConstructor class AiModelServiceImpl extends CachedVersionedEntityService implements AiModelService { private final DataValidator aiModelValidator; - private final JpaExecutorService jpaExecutor; private final AiModelDao aiModelDao; @@ -44,9 +45,12 @@ class AiModelServiceImpl extends CachedVersionedEntityService findAiModelById(TenantId tenantId, AiModelId modelId) { + log.debug("[{}] Fetching AI Model by Id: {}", tenantId, modelId); return Optional.ofNullable(aiModelDao.findById(tenantId, modelId.getId())); } @Override public PageData findAiModelsByTenantId(TenantId tenantId, PageLink pageLink) { validatePageLink(pageLink, AiModelEntity.ALLOWED_SORT_PROPERTIES); + log.debug("[{}] Fetching AI Models page: {}", tenantId, pageLink); return aiModelDao.findAllByTenantId(tenantId, pageLink); } @@ -126,7 +146,7 @@ class AiModelServiceImpl extends CachedVersionedEntityService>> findEntityAsync(TenantId tenantId, EntityId entityId) { return findAiModelByTenantIdAndIdAsync(tenantId, new AiModelId(entityId.getId())) - .transform(modelOpt -> modelOpt.map(model -> model), directExecutor()); // necessary to cast to HasId + .transform(modelOpt -> modelOpt.map(model -> model), directExecutor()); // necessary to cast to HasId } @Override @@ -143,15 +163,20 @@ class AiModelServiceImpl extends CachedVersionedEntityService deleted = aiModelDao.deleteByTenantId(tenantId); - deleted.forEach(id -> publishEvictEvent(new AiModelCacheEvictEvent.Deleted(AiModelCacheKey.of(tenantId, id)))); + deleted.forEach(id -> { + publishEvictEvent(new AiModelCacheEvictEvent.Deleted(AiModelCacheKey.of(tenantId, id))); + // CR FIX: Changed to debug level + log.debug("[{}][{}] Deleted AI Model as part of tenant cleanup", tenantId, id); + }); } @Override public EntityType getEntityType() { return EntityType.AI_MODEL; } - }