Class SampleQueryService

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

public class SampleQueryService extends Object implements BDOService<SampleQuery>
Service layer for managing SampleQuery business objects.

Maps between SampleQuery and SampleQueryDTO via SampleQueryMapper and persists through SampleQueryDAOImpl. Implements a singleton (use getInstance()) and synchronizes public operations for basic thread safety. Provides dependant lookup (e.g., Prompt referencing a sample query).

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

    • getInstance

      public static SampleQueryService getInstance()
    • getAll

      public Set<SampleQuery> getAll()
      Retrieves all persisted sample queries and maps them to business objects.

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

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

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

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

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

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

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