IExecutionFactory
Execution factory provides several methods to create a prepared execution from different types of inputs.
export interface IExecutionFactory
Remarks
Note: the execution factory WILL perform extensive input validation to ensure that the created instance of prepared execution is semantically correct.
Methods
Method | Description |
|---|---|
Prepares a new execution for a list of buckets. | |
Prepares a new execution for the provided execution definition. | |
Prepares a new execution for the provided insight. | |
Prepares new, by-reference execution for an existing insight. | |
Prepares a new execution for a list of attributes and measures, filtered using the provided filters. |
Method details
IExecutionFactory.forBuckets()method
Prepares a new execution for a list of buckets.
forBuckets(buckets: IBucket[], filters?: INullableFilter[], options?: IPreparedExecutionOptions): IPreparedExecution;
Parameters
Parameter | Type | Description |
|---|---|---|
buckets | IBucket[] | list of buckets with attributes and measures, must be non empty, must have at least one attr or measure |
filters | (Optional) optional, may not be provided, may contain null or undefined values which must be ignored | |
options | (Optional) additional options for the prepared execution |
Returns
Remarks
Attributes and measures WILL be transferred to the execution in natural order:
- Order of items within a bucket is retained in the execution - Items from first bucket appear before items from second bucket
Or more specifically, given two buckets with items as [A1, A2, M1] and [A3, M2, M3], the resulting prepared execution WILL have definition with attributes = [A1, A2, A3] and measures = [M1, M2, M3]
The contract is that prepared executions created by this method MUST be executable and MUST come with pre-filled dimensions created using the defaultDimensionsGenerator().
IExecutionFactory.forDefinition()method
Prepares a new execution for the provided execution definition.
forDefinition(def: IExecutionDefinition, options?: IPreparedExecutionOptions): IPreparedExecution;
Parameters
Parameter | Type | Description |
|---|---|---|
def | execution definition | |
options | (Optional) additional options for the prepared execution |
Returns
new prepared execution
Remarks
The contract is that the definition is taken and used in the prepared execution AS IS. Compared to the other convenience methods, this method MUST NOT create prepared executions with automatically generated dimensions.
IExecutionFactory.forInsight()method
Prepares a new execution for the provided insight.
forInsight(insightDefinition: IInsightDefinition, filters?: INullableFilter[], options?: IPreparedExecutionOptions): IPreparedExecution;
Parameters
Parameter | Type | Description |
|---|---|---|
insightDefinition | insight definition to create execution for, must have buckets which must have some attributes or measures in them | |
filters | (Optional) optional, may not be provided, may contain null or undefined values which must be ignored | |
options | (Optional) additional options for the prepared execution |
Returns
Remarks
Buckets with attributes and measures WILL be used to obtain attributes and measures - the behavior WILL be same as in forBuckets() function. Filters, sort by and totals in the insight WILL be included in the prepared execution.
Additionally, an optional list of additional filters WILL be merged with the filters already defined in the insight.
The contract is that prepared executions created by this method MUST be executable and MUST come with pre-filled dimensions greated using the defaultDimensionsGenerator().
IExecutionFactory.forInsightByRef()method
Prepares new, by-reference execution for an existing insight.
forInsightByRef(insight: IInsight, filters?: INullableFilter[], options?: IPreparedExecutionOptions): IPreparedExecution;
Parameters
Parameter | Type | Description |
|---|---|---|
insight | saved insight | |
filters | (Optional) optional list of filters to merge with filters already defined in the insight, may contain null or undefined values which must be ignored | |
options | (Optional) additional options for the prepared execution |
Returns
Remarks
Execution prepared using this method MAY be realized using different backend API than the executions where attributes and measures are provided ‘freeform’. In return, this different backend API may provide additional authorization guarantees - for instance the backend MAY only allow end user to execute these stored insights and not do any ‘freeform’ execution.
If the backend does not support execution by reference, then it MUST fall back to freeform execution.
The contract is that prepared executions created by this method MUST be executable and MUST come with pre-filled dimensions created using the defaultDimensionsGenerator().
IExecutionFactory.forItems()method
Prepares a new execution for a list of attributes and measures, filtered using the provided filters.
forItems(items: IAttributeOrMeasure[], filters?: INullableFilter[], options?: IPreparedExecutionOptions): IPreparedExecution;
Parameters
Parameter | Type | Description |
|---|---|---|
items | list of attributes and measures, must not be empty | |
filters | (Optional) list of filters, may not be provided | |
options | (Optional) additional options for the prepared execution |
Returns
Remarks
The contract is that prepared executions created by this method MUST be executable and MUST come with pre-filled dimensions created using the defaultDimensionsGenerator().