Package com.orchestranetworks.addon.dqid.controller

Provides classes to execute indicators on-demand, or using triggers.

Indicators can be executed:

  • On-demand on a D.E.C through the user interface, or programmatically:

            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);   
                                    

  • On-demand in a workflow through the user interface, or programmatically:

            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);     
                                    

  • On-demand using the scheduler API to execute certain indicators:

            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
                            {
    
                            }
                    }
            }
                                            

  • On-probe on a D.E.C. by a provided, or custom trigger:

            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().