Search in sources :

Example 1 with ParticipantConditionsColumns

use of org.pmiops.workbench.model.ParticipantConditionsColumns in project workbench by all-of-us.

the class ReviewTabQueryBuilder method buildQuery.

public QueryJobConfiguration buildQuery(ReviewTabQueries queries, Long participantId, PageRequest pageRequest) {
    ParticipantConditionsColumns sortColumn = ParticipantConditionsColumns.fromValue(pageRequest.getSortColumn());
    String finalSql = String.format(queries.getQuery(), ParticipantConditionDbInfo.fromName(sortColumn).getDbName(), pageRequest.getSortOrder().toString(), pageRequest.getPageSize(), pageRequest.getPageNumber() * pageRequest.getPageSize());
    Map<String, QueryParameterValue> params = new HashMap<>();
    params.put(queries.NAMED_PARTICIPANTID_PARAM, QueryParameterValue.int64(participantId));
    return QueryJobConfiguration.newBuilder(finalSql).setNamedParameters(params).setUseLegacySql(false).build();
}
Also used : QueryParameterValue(com.google.cloud.bigquery.QueryParameterValue) ParticipantConditionsColumns(org.pmiops.workbench.model.ParticipantConditionsColumns) HashMap(java.util.HashMap)

Aggregations

QueryParameterValue (com.google.cloud.bigquery.QueryParameterValue)1 HashMap (java.util.HashMap)1 ParticipantConditionsColumns (org.pmiops.workbench.model.ParticipantConditionsColumns)1