Search in sources :

Example 1 with QueryType

use of com.yahoo.elide.async.models.QueryType in project elide by yahoo.

the class TableExportHook method getOperation.

@Override
public Callable<AsyncAPIResult> getOperation(AsyncAPI export, RequestScope requestScope) {
    Callable<AsyncAPIResult> operation = null;
    TableExport exportObj = (TableExport) export;
    ResultType resultType = exportObj.getResultType();
    QueryType queryType = exportObj.getQueryType();
    com.yahoo.elide.core.RequestScope scope = (com.yahoo.elide.core.RequestScope) requestScope;
    TableExportFormatter formatter = supportedFormatters.get(resultType);
    if (formatter == null) {
        throw new InvalidOperationException("Formatter unavailable for " + resultType);
    }
    if (queryType.equals(QueryType.GRAPHQL_V1_0)) {
        operation = new GraphQLTableExportOperation(formatter, getAsyncExecutorService(), export, scope, engine);
    } else if (queryType.equals(QueryType.JSONAPI_V1_0)) {
        operation = new JSONAPITableExportOperation(formatter, getAsyncExecutorService(), export, scope, engine);
    } else {
        throw new InvalidOperationException(queryType + "is not supported");
    }
    return operation;
}
Also used : JSONAPITableExportOperation(com.yahoo.elide.async.operation.JSONAPITableExportOperation) ResultType(com.yahoo.elide.async.models.ResultType) RequestScope(com.yahoo.elide.core.security.RequestScope) TableExport(com.yahoo.elide.async.models.TableExport) InvalidOperationException(com.yahoo.elide.core.exceptions.InvalidOperationException) GraphQLTableExportOperation(com.yahoo.elide.async.operation.GraphQLTableExportOperation) AsyncAPIResult(com.yahoo.elide.async.models.AsyncAPIResult) QueryType(com.yahoo.elide.async.models.QueryType) TableExportFormatter(com.yahoo.elide.async.export.formatter.TableExportFormatter)

Aggregations

TableExportFormatter (com.yahoo.elide.async.export.formatter.TableExportFormatter)1 AsyncAPIResult (com.yahoo.elide.async.models.AsyncAPIResult)1 QueryType (com.yahoo.elide.async.models.QueryType)1 ResultType (com.yahoo.elide.async.models.ResultType)1 TableExport (com.yahoo.elide.async.models.TableExport)1 GraphQLTableExportOperation (com.yahoo.elide.async.operation.GraphQLTableExportOperation)1 JSONAPITableExportOperation (com.yahoo.elide.async.operation.JSONAPITableExportOperation)1 InvalidOperationException (com.yahoo.elide.core.exceptions.InvalidOperationException)1 RequestScope (com.yahoo.elide.core.security.RequestScope)1