Module de.seggebaeing.sqlanalyzer
Class SampleQueryService
java.lang.Object
de.seggebaeing.sqlanalyzer.logic.service.SampleQueryService
- All Implemented Interfaces:
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 Summary
Modifier and TypeMethodDescriptionvoid
delete
(SampleQuery bdo) Deletes the given sample query by mapping it to its DTO and delegating to the DAO.getAll()
Retrieves all persisted sample queries and maps them to business objects.getDependants
(SampleQuery object) Returns business objects that directly reference the given sample query.static SampleQueryService
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.
-
Method Details
-
getInstance
-
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 interfaceBDOService<SampleQuery>
- Returns:
- a set of
SampleQuery
; may be empty
-
delete
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 interfaceBDOService<SampleQuery>
- Parameters:
bdo
- the sample query to delete
-
saveOrUpdate
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 interfaceBDOService<SampleQuery>
- Parameters:
bdo
- the sample query to save or update
-
getDependants
Returns business objects that directly reference the given sample query.Scans all
Prompt
instances and collects those whosegetSampleQuery()
is the same instance asobject
(reference equality).- Specified by:
getDependants
in interfaceBDOService<SampleQuery>
- Parameters:
object
- the sample query whose dependants to collect- Returns:
- list of dependants; empty if none
-