use of org.opencds.cqf.cql.engine.fhir.searchparam.SearchParameterMap in project cqf-ruler by DBCG.
the class JpaFhirRetrieveProvider method executeQuery.
protected List<IBaseResource> executeQuery(String dataType, SearchParameterMap map) {
// TODO: Once HAPI breaks this out from the server dependencies
// we can include it on its own.
ca.uhn.fhir.jpa.searchparam.SearchParameterMap hapiMap = ca.uhn.fhir.jpa.searchparam.SearchParameterMap.newSynchronous();
try {
Method[] methods = hapiMap.getClass().getDeclaredMethods();
List<Method> methodList = Arrays.asList(methods);
List<Method> puts = methodList.stream().filter(x -> x.getName().equals("put")).collect(Collectors.toList());
Method method = puts.get(0);
method.setAccessible(true);
for (Map.Entry<String, List<List<IQueryParameterType>>> entry : map.entrySet()) {
method.invoke(hapiMap, entry.getKey(), entry.getValue());
}
} catch (Exception e) {
logger.warn("Error converting search parameter map", e);
}
IBundleProvider bundleProvider = search(getClass(dataType), hapiMap, myRequestDetails);
if (bundleProvider.isEmpty()) {
return new ArrayList<>();
}
return bundleProvider.getAllResources();
}
Aggregations