Class InsertService
java.lang.Object
com.invirgance.convirgance.web.service.InsertService
- All Implemented Interfaces:
Processable
,Service
Service implementation for receiving and persisting data from HTTP requests.
InsertService processes data submission operations (typically POST requests) by
extracting data from HTTP requests, applying transformations, and persisting
the results.
The service follows: - Extract parameters from the request - Obtain raw data using an Origin component - Parse the data with an Input processor - Apply optional transformations - Persist the data through a Consumer - Return any generated keys or resultsUse this service when you need to create endpoints for data submission, form processing, or implementing POST/PUT operations in REST APIs.
- Author:
- jbanes
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
execute
(HttpRequest request, HttpResponse response) Executes the insert service, processing and persisting data from the HTTP request.Gets the consumer that will persist the processed data.com.invirgance.convirgance.input.Input
getInput()
Gets the input parser for the request data.Gets the origin of the data to be processed.com.invirgance.convirgance.output.Output
Gets the list of parameters to extract from the request.List
<com.invirgance.convirgance.transform.Transformer> Gets the list of transformers to apply to the data.Iterable
<com.invirgance.convirgance.json.JSONObject> process
(HttpRequest request) Processes an HTTP request to retrieve data without generating a response.void
setConsumer
(Consumer consumer) Sets the consumer that will persist the processed data.void
setInjectParameters
(List<String> injectParameters) void
setInput
(com.invirgance.convirgance.input.Input input) Sets the input parser for the request data.void
Sets the origin of the data to be processed.void
setOutput
(com.invirgance.convirgance.output.Output output) void
setParameters
(List<Parameter> parameters) Sets the list of parameters to extract from the request.void
setTransformers
(List<com.invirgance.convirgance.transform.Transformer> transformers) Sets the list of transformers to apply to the data.
-
Constructor Details
-
InsertService
public InsertService()
-
-
Method Details
-
getParameters
Gets the list of parameters to extract from the request.- Returns:
- The parameters list
-
setParameters
Sets the list of parameters to extract from the request.- Parameters:
parameters
- The parameters list
-
getInput
public com.invirgance.convirgance.input.Input getInput()Gets the input parser for the request data.- Returns:
- The input parser
-
setInput
public void setInput(com.invirgance.convirgance.input.Input input) Sets the input parser for the request data.- Parameters:
input
- The input parser
-
getOrigin
Gets the origin of the data to be processed.- Returns:
- The data origin
-
setOrigin
Sets the origin of the data to be processed.- Parameters:
origin
- The data origin
-
getInjectParameters
-
setInjectParameters
-
getTransformers
Gets the list of transformers to apply to the data.- Returns:
- The transformers list
-
setTransformers
Sets the list of transformers to apply to the data.- Parameters:
transformers
- The transformers list
-
getConsumer
Gets the consumer that will persist the processed data.- Returns:
- The consumer
-
setConsumer
Sets the consumer that will persist the processed data.- Parameters:
consumer
- The consumer
-
getOutput
public com.invirgance.convirgance.output.Output getOutput() -
setOutput
public void setOutput(com.invirgance.convirgance.output.Output output) -
process
Description copied from interface:Processable
Processes an HTTP request to retrieve data without generating a response.This method implements the core data retrieval pipeline and can be used by other components that need access to the data without writing to a response.
- Extract parameters from the HTTP request
- Store parameters in thread-local storage for access by other components
- Use the configured binding to retrieve data based on the parameters
- Apply any configured transformers to the data
- Specified by:
process
in interfaceProcessable
- Parameters:
request
- The HTTP request containing the parameters- Returns:
- An iterable of JSONObjects containing the retrieved and transformed data
-
execute
Executes the insert service, processing and persisting data from the HTTP request.
-