Search in sources :

Example 1 with AnnotationsQueryService

use of org.pentaho.di.trans.dataservice.clients.AnnotationsQueryService in project pdi-dataservice-server-plugin by pentaho.

the class DataServiceTestController method executeSql.

public void executeSql() throws KettleException {
    resetMetrics();
    dataServiceExec = getNewDataServiceExecutor(true);
    updateOptimizationImpact(dataServiceExec);
    updateModel(dataServiceExec);
    AnnotationsQueryService annotationsQuery = getAnnotationsQueryService();
    Query query;
    if (dataService.isStreaming()) {
        XulRadio timeBasedRadio = (XulRadio) document.getElementById("time-based-radio");
        IDataServiceClientService.StreamingMode windowMode = timeBasedRadio.isSelected() ? IDataServiceClientService.StreamingMode.TIME_BASED : IDataServiceClientService.StreamingMode.ROW_BASED;
        model.setWindowMode(windowMode);
        query = annotationsQuery.prepareQuery(model.getSql(), model.getWindowMode(), model.getWindowSize(), model.getWindowEvery(), model.getWindowLimit(), ImmutableMap.<String, String>of());
    } else {
        query = annotationsQuery.prepareQuery(model.getSql(), model.getMaxRows(), ImmutableMap.<String, String>of());
    }
    if (null != query) {
        writeAnnotations(query);
        handleCompletion(dataServiceExec);
    } else {
        callback.onLogChannelUpdate();
        dataServiceExec.executeQuery(getDataServiceRowListener());
        pollForCompletion(dataServiceExec);
    }
}
Also used : XulRadio(org.pentaho.ui.xul.components.XulRadio) IDataServiceClientService(org.pentaho.di.trans.dataservice.client.api.IDataServiceClientService) Query(org.pentaho.di.trans.dataservice.clients.Query) ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString) AnnotationsQueryService(org.pentaho.di.trans.dataservice.clients.AnnotationsQueryService)

Aggregations

ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)1 IDataServiceClientService (org.pentaho.di.trans.dataservice.client.api.IDataServiceClientService)1 AnnotationsQueryService (org.pentaho.di.trans.dataservice.clients.AnnotationsQueryService)1 Query (org.pentaho.di.trans.dataservice.clients.Query)1 XulRadio (org.pentaho.ui.xul.components.XulRadio)1