Module de.seggebaeing.sqlanalyzer
Class PromptService
java.lang.Object
de.seggebaeing.sqlanalyzer.logic.service.PromptService
- All Implemented Interfaces:
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 Summary
Modifier and TypeMethodDescriptionvoid
Deletes the given prompt by mapping it to its DTO and delegating to the DAO.getAll()
Retrieves all persisted prompts and maps them to business objects.getDependants
(Prompt object) Returns business objects that directly reference the given prompt.static PromptService
void
saveOrUpdate
(Prompt bdo) Saves a new prompt or updates an existing one by mapping it to its DTO and delegating to the DAO.
-
Method Details
-
getInstance
-
getAll
Retrieves all persisted prompts and maps them to business objects.Thread-safe: synchronized to guard DAO/mapper access.
- Specified by:
getAll
in interfaceBDOService<Prompt>
- Returns:
- a set of
Prompt
; may be empty
-
delete
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 interfaceBDOService<Prompt>
- Parameters:
bdo
- the prompt to delete
-
saveOrUpdate
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 interfaceBDOService<Prompt>
- Parameters:
bdo
- the prompt to save or update
-
getDependants
Returns business objects that directly reference the given prompt.Scans all
GeneratedQuery
instances and collects those whosegetPrompt()
is the same instance asobject
(reference equality).- Specified by:
getDependants
in interfaceBDOService<Prompt>
- Parameters:
object
- the prompt whose dependants to collect- Returns:
- list of dependants; empty if none
-