use of org.obiba.mica.dataset.rest.entity.rql.RQLCriteriaOpalConverter in project mica2 by obiba.
the class StudyEntitiesCountService method newQueries.
/**
* Parse the RQL query and translate each node as a Opal query wrapped in a {@link StudyEntitiesCountQuery}.
*
* @param query
* @param entityType
* @return
*/
public List<StudyEntitiesCountQuery> newQueries(String query, String entityType) {
RQLCriteriaOpalConverter converter = applicationContext.getBean(RQLCriteriaOpalConverter.class);
converter.parse(query);
Map<BaseStudy, List<RQLCriterionOpalConverter>> studyConverters = converter.getCriterionConverters().stream().filter(// TODO include Dataschema variables
c -> !c.hasMultipleStudyTables()).collect(Collectors.groupingBy(c -> c.getVariableReferences().getStudy()));
return studyConverters.keySet().stream().map(study -> newQuery(entityType, study, studyConverters.get(study))).collect(Collectors.toList());
}
Aggregations