See: Description
Interface | Description |
---|---|
IndicatorController |
The entry point for indicator execution.
|
Class | Description |
---|---|
DQIdTrigger |
A trigger to declare on any tables under the control of
OnProbe indicators.If the table has any existing triggers, a call to IndicatorController.executeOnProbe(DECIndicatorExecutionContextOnProbe) must be made. |
IndicatorControllerFactory |
The factory class of
IndicatorController . |
Provides classes to execute indicators on-demand, or using triggers.
Indicators can be executed:
DECIndicatorExecutionContextOnDemand context = new DECIndicatorExecutionContextOnDemand(executionId, environment); IndicatorControllerFactory.getController().executeOnDemand(context);
where environment
is an instance of the DECIndicatorExecutionEnvironment
class, that is:
DECIndicatorExecutionEnvironment environment = new DECIndicatorExecutionEnvironment(session, dataset, table);
WorkflowIndicatorExecutionContext context = new WorkflowIndicatorExecutionContext(executionId, environment); IndicatorControllerFactory.getController().executeOnDemand(context);
where environment
is an instance of the WorkflowIndicatorExecutionEnvironment
class, that is:
WorkflowIndicatorExecutionEnvironment environment = new WorkflowIndicatorExecutionEnvironment(session, repository);
public class ExecuteIndicatorsTask extends ScheduledTask { public void execute(ScheduledExecutionContext context) throws OperationException, ScheduledTaskInterruption { IndicatorController controller = IndicatorControllerFactory.getController(); Repository repository = context.getRepository();// Get dataspace
AdaptationHome home = repository.lookupHome(HomeKey.forBranchName("Reference"
));// Get dataset
Adaptation dataset = home.findAdaptationOrNull(AdaptationName.forName("employee"
));// Get table
AdaptationTable table = dataset.getTable(Path.parse("/root/Employee"
));// Add indicator codes
List<PrimaryKey> indicatorsPk = new ArrayList<PrimaryKey>(); indicatorsPk.add(PrimaryKey.parseString("[ON] F-I01"
)); indicatorsPk.add(PrimaryKey.parseString("[ON] T-I02"
));// To execute indicators on a Dataspace
// DECIndicatorExecutionEnvironment executionEnvironment = new DECIndicatorExecutionEnvironment(context.getSession(), home);
// To execute indicators on a Dataset and Table
DECIndicatorExecutionEnvironment executionEnvironment = new DECIndicatorExecutionEnvironment(context.getSession(), dataset, table); DECIndicatorExecutionContextOnDemand executionContextOnDemand = new DECIndicatorExecutionContextOnDemand(UUID.randomUUID().toString(), executionEnvironment); executionContextOnDemand.setIndicatorCodes(indicatorsPk);// Get execution result of all indicators
IndicatorsExecutionResult indicatorsExecutionResult = controller.executeOnDemand(executionContextOnDemand); if (indicatorsExecutionResult.hasFailed()) {// Do something if at least one indicator has failed
} else { } } }
DECIndicatorExecutionContextOnProbe context = new DECIndicatorExecutionContextOnProbe(triggerContext, executionId); IndicatorControllerFactory.getController().executeOnProbe(context);
where triggerContext
is an interface of the TableTriggerExecutionContext
Interface. In which, executionId
is an immutable universally unique identifier (UUID) and is generated by UUID.randomUUID().toString()
.