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

public class PromptService extends Object implements BDOService<Prompt>
Service layer for managing Prompt business objects.

Maps between Prompt and PromptDTO via PromptMapper and persists through PromptDAOImpl. Implements a singleton (use getInstance()) and synchronizes public operations for basic thread safety. Provides dependant lookup (e.g., GeneratedQuery referencing a given prompt).

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

    • getInstance

      public static PromptService getInstance()
    • getAll

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

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

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

      public void delete(Prompt bdo)
      Deletes the given prompt 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<Prompt>
      Parameters:
      bdo - the prompt to delete
    • saveOrUpdate

      public void saveOrUpdate(Prompt bdo)
      Saves a new prompt 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<Prompt>
      Parameters:
      bdo - the prompt to save or update
    • getDependants

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

      Scans all GeneratedQuery instances and collects those whose getPrompt() is the same instance as object (reference equality).

      Specified by:
      getDependants in interface BDOService<Prompt>
      Parameters:
      object - the prompt whose dependants to collect
      Returns:
      list of dependants; empty if none