Class PromptTypeService

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

public class PromptTypeService extends Object implements BDOService<PromptType>
Service layer for managing PromptType business objects.

Maps between PromptType and PromptTypeDTO via PromptTypeMapper and persists through PromptTypeDAOImpl. Implements a singleton (use getInstance()) and synchronizes public operations for basic thread safety. Provides dependant lookup (e.g., Prompt referencing a given prompt type).

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

    • getInstance

      public static PromptTypeService getInstance()
    • getAll

      public Set<PromptType> getAll()
      Retrieves all persisted prompt types and maps them to business objects.

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

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

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

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

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

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

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