Class SelectService

java.lang.Object
com.invirgance.convirgance.web.service.SelectService
All Implemented Interfaces:
Service

@Wiring public class SelectService extends Object implements 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 Output
 
Use 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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    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>
    Processes an HTTP request to retrieve data without generating a response.
    void
    Sets the binding that provides the data source.
    void
    setOutput(com.invirgance.convirgance.output.Output output)
    Sets the output formatter for the response.
    void
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SelectService

      public SelectService()
  • Method Details

    • getParameters

      public List<Parameter> getParameters()
      Gets the list of parameters to extract from the request.
      Returns:
      The parameters list
    • setParameters

      public void setParameters(List<Parameter> parameters)
      Sets the list of parameters to extract from the request.
      Parameters:
      parameters - The parameters list
    • getBinding

      public Binding getBinding()
      Gets the binding that provides the data source.
      Returns:
      The binding
    • setBinding

      public void setBinding(Binding binding)
      Sets the binding that provides the data source.
      Parameters:
      binding - The binding
    • getTransformers

      public List<com.invirgance.convirgance.transform.Transformer> getTransformers()
      Gets the list of transformers to apply to the retrieved data.
      Returns:
      The transformers list
    • setTransformers

      public void setTransformers(List<com.invirgance.convirgance.transform.Transformer> transformers)
      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

      public Iterable<com.invirgance.convirgance.json.JSONObject> process(HttpRequest request)
      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.

      1. Extract parameters from the HTTP request
      2. Store parameters in thread-local storage for access by other components
      3. Use the configured binding to retrieve data based on the parameters
      4. 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

      public void execute(HttpRequest request, HttpResponse response)
      Executes the select service, retrieving and returning data in response to an HTTP request.
      Specified by:
      execute in interface Service
      Parameters:
      request - The HTTP request containing the parameters
      response - The HTTP response to write results to