Interface QuerySource<T extends QueryConfig>
-
- All Known Implementing Classes:
AlarmJournalQuerySource,NamedQuerySource,PrepStmtQuerySource,SimpleSqlQuerySource,TagCalculationQuerySource,TagHistQuerySource
public interface QuerySource<T extends QueryConfig>A QuerySource executes a type of report query. It must be registered via the
GatewayDataSourceRegistry, and also there should be a matching (same ID) QueryConfigFactory registered in the designer.The QuerySource and QueryConfigFactory share the same string ID, and both deal with the same config object, which must be a subclass of
QueryConfig.Each query source needs to be able to execute some sort of query which returns a Dataset. Top level queries are treated differently than nested queries. This is to give query sources the chance to do special setup and teardown before and after the execution of a group of equivalent nested queries.
Created by carl.gould on 2/3/2015.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceQuerySource.SubQueryTransactionUsed to handle multiple executions of a nested query.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description QuerySource.SubQueryTransactionbegin(ReportExecutionContext execContext, T queryConfig, java.util.Map<java.lang.String,java.lang.Object> extraConfigs, QueryResults parent)Begin a nested query "transaction".java.lang.StringgetId()The unique ID for this query source.Datasetquery(ReportExecutionContext execContext, T queryConfig, java.util.Map<java.lang.String,java.lang.Object> extraConfigs)Execute a top level query.
-
-
-
Method Detail
-
getId
java.lang.String getId()
The unique ID for this query source. Should be qualified with module name first
-
query
Dataset query(ReportExecutionContext execContext, T queryConfig, java.util.Map<java.lang.String,java.lang.Object> extraConfigs) throws java.lang.Exception
Execute a top level query.- Parameters:
execContext- The context for the report being executed.queryConfig- The config object which was configured in the designer for this query.extraConfigs- Extra configuration data the designer may need to send. Unused by most data sources, because the queryConfig should contain all data needed to execute the query. May be null.- Returns:
- A dataset of results for executing this query
- Throws:
java.lang.Exception
-
begin
QuerySource.SubQueryTransaction begin(ReportExecutionContext execContext, T queryConfig, java.util.Map<java.lang.String,java.lang.Object> extraConfigs, QueryResults parent) throws java.lang.Exception
Begin a nested query "transaction". This means that a nested query (defined by a single query config) is about to be executed, and will probably be executed many times.- Parameters:
execContext- The context for the report being executedqueryConfig- The config object which was configured in designer for this nested query.extraConfigs- Extra configuration data the designer may need to send. Unused by most data sources, because the queryConfig should contain all data needed to execute the query. May be null.parent- The QueryResults object for the parent query of this nested query.- Returns:
- A new transaction object to handle the execution of this nested query.
- Throws:
java.lang.Exception
-
-