java.lang.Object
de.seggebaeing.sqlanalyzer.logic.service.LLMService
All Implemented Interfaces:
BDOService<LLM>

public class LLMService extends Object implements BDOService<LLM>
Service layer for managing LLM business objects.

Provides CRUD-style operations by mapping between LLM and LLMDTO via LLMMapper and persisting through LLMDAOImpl. Initializes the mapper with an id supplier from the DAO. Implements a singleton pattern (use getInstance()) and synchronizes public mutating/access methods for basic thread safety. Also exposes direct dependants lookup (e.g., GeneratedQuery that reference an LLM).

Since:
1.0
Author:
Felix Seggebäing
  • Method Details

    • getInstance

      public static LLMService getInstance()
    • getAll

      public Set<LLM> getAll()
      Retrieves all persisted LLMs and maps them to business objects.

      Thread-safe: synchronized to guard access to the underlying DAO and mapper.

      Specified by:
      getAll in interface BDOService<LLM>
      Returns:
      a set of LLM; may be empty
    • delete

      public void delete(LLM bdo)
      Deletes the given LLM by mapping it to its DTO and delegating to the DAO.

      Thread-safe: synchronized to guard DAO/mapper access.

      Specified by:
      delete in interface BDOService<LLM>
      Parameters:
      bdo - the LLM to delete
    • saveOrUpdate

      public void saveOrUpdate(LLM bdo)
      Saves a new LLM or updates an existing one by mapping it to its DTO and delegating to the DAO.

      Thread-safe: synchronized to guard DAO/mapper access.

      Specified by:
      saveOrUpdate in interface BDOService<LLM>
      Parameters:
      bdo - the LLM to save or update
    • getDependants

      public List<BusinessDomainObject> getDependants(LLM object)
      Returns business objects that directly reference the given LLM.

      Scans all GeneratedQuery instances and collects those whose generator is the provided object.

      Specified by:
      getDependants in interface BDOService<LLM>
      Parameters:
      object - the LLM whose dependants to collect
      Returns:
      list of dependants; empty if none
      Implementation Note:
      Uses reference equality on gq.getGenerator().