Class SelectService
java.lang.Object
com.invirgance.convirgance.web.service.SelectService
- All Implemented Interfaces:
Service
Service implementation for retrieving and returning data in response to
HTTP requests. SelectService processes data retrieval operations (typically GET requests) by
extracting parameters from requests, retrieving data through a Binding,
applying transformations, and formatting the results for the response.
The service follows a configurable pipeline: - Extract parameters from the request - Store parameters in thread-local storage for filter access - Retrieve data using a configured Binding - Apply optional transformations - Format and return the results using an OutputUse this service when you need to create endpoints for data retrieval, search interfaces, or implementing GET operations in REST APIs.
- Author:
- jbanes
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
execute
(HttpRequest request, HttpResponse response) Executes the select service, retrieving and returning data in response to an HTTP request.Gets the binding that provides the data source.com.invirgance.convirgance.output.Output
Gets the output formatter for the response.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 retrieved data.Iterable
<com.invirgance.convirgance.json.JSONObject> process
(HttpRequest request) Processes an HTTP request to retrieve data without generating a response.void
setBinding
(Binding binding) Sets the binding that provides the data source.void
setOutput
(com.invirgance.convirgance.output.Output output) Sets the output formatter for the response.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 retrieved data.
-
Constructor Details
-
SelectService
public SelectService()
-
-
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
-
getBinding
Gets the binding that provides the data source.- Returns:
- The binding
-
setBinding
Sets the binding that provides the data source.- Parameters:
binding
- The binding
-
getTransformers
Gets the list of transformers to apply to the retrieved data.- Returns:
- The transformers list
-
setTransformers
Sets the list of transformers to apply to the retrieved data.- Parameters:
transformers
- The transformers list
-
getOutput
public com.invirgance.convirgance.output.Output getOutput()Gets the output formatter for the response.- Returns:
- The output formatter
-
setOutput
public void setOutput(com.invirgance.convirgance.output.Output output) Sets the output formatter for the response.- Parameters:
output
- The output formatter
-
process
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
- Parameters:
request
- The HTTP request containing the parameters- Returns:
- An iterable of JSONObjects containing the retrieved and transformed data
-
execute
Executes the select service, retrieving and returning data in response to an HTTP request.
-