Add query db fallback for DMPs
This commit is contained in:
parent
4a4042d621
commit
d1df83f689
|
@ -130,11 +130,16 @@ public class DataManagementPlanManager {
|
||||||
QueryableList<DMP> items = null;
|
QueryableList<DMP> items = null;
|
||||||
QueryableList<DMP> authItems = null;
|
QueryableList<DMP> authItems = null;
|
||||||
if (apiContext.getOperationsContext().getElasticRepository().getDmpRepository() != null) {
|
if (apiContext.getOperationsContext().getElasticRepository().getDmpRepository() != null) {
|
||||||
DmpCriteria criteria = DmpCriteriaMapper.toElasticCriteria(dataManagementPlanTableRequest.getCriteria());
|
try {
|
||||||
dmps = apiContext.getOperationsContext().getElasticRepository().getDmpRepository().query(criteria);
|
DmpCriteria criteria = DmpCriteriaMapper.toElasticCriteria(dataManagementPlanTableRequest.getCriteria());
|
||||||
if (dmps != null && !dmps.isEmpty()) {
|
dmps = apiContext.getOperationsContext().getElasticRepository().getDmpRepository().query(criteria);
|
||||||
List<Dmp> finalDmps = dmps;
|
if (dmps != null && !dmps.isEmpty()) {
|
||||||
items = apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().asQueryable().where((builder, root) -> root.get("id").in(finalDmps.stream().map(Dmp::getId).collect(Collectors.toList())));
|
List<Dmp> finalDmps = dmps;
|
||||||
|
items = apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().asQueryable().where((builder, root) -> root.get("id").in(finalDmps.stream().map(Dmp::getId).collect(Collectors.toList())));
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
logger.error(ex.getMessage(), ex);
|
||||||
|
items = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (items == null) {
|
if (items == null) {
|
||||||
|
|
Loading…
Reference in New Issue