Skip to content

Commit

Permalink
lib: fix sonar issues, #TASK-4768, #TASK-4761
Browse files Browse the repository at this point in the history
  • Loading branch information
jtarraga committed Jul 18, 2023
1 parent d01db92 commit a28c81f
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package org.opencb.cellbase.lib.impl.core;

import com.mongodb.client.model.Filters;
import org.apache.commons.collections4.CollectionUtils;
import org.bson.Document;
import org.bson.conversions.Bson;
import org.opencb.biodata.models.pharma.PharmaChemical;
Expand Down Expand Up @@ -109,7 +110,6 @@ public CellBaseDataResult<PharmaChemical> groupBy(PharmaChemicalQuery query) thr

public Bson parseQuery(PharmaChemicalQuery pharmaQuery) {
List<Bson> andBsonList = new ArrayList<>();
boolean visited = false;
try {
for (Map.Entry<String, Object> entry : pharmaQuery.toObjectMap().entrySet()) {
String dotNotationName = entry.getKey();
Expand All @@ -121,8 +121,8 @@ public Bson parseQuery(PharmaChemicalQuery pharmaQuery) {
break;
case "geneName":
List<Bson> orBsonList = new ArrayList<>();
orBsonList.add(getLogicalListFilter(new LogicalList((List) value), "variants.geneNames"));
orBsonList.add(getLogicalListFilter(new LogicalList((List) value), "genes.xrefs.id"));
orBsonList.add(getLogicalListFilter(new LogicalList<String>((List) value), "variants.geneNames"));
orBsonList.add(getLogicalListFilter(new LogicalList<String>((List) value), "genes.xrefs.id"));
andBsonList.add(Filters.or(orBsonList));
break;
default:
Expand All @@ -133,8 +133,8 @@ public Bson parseQuery(PharmaChemicalQuery pharmaQuery) {
} catch (IllegalAccessException e) {
e.printStackTrace();
}
logger.debug("pharmacogenomics parsed query: " + andBsonList);
if (andBsonList.size() > 0) {
logger.debug("Pharmacogenomics parsed query: {}", andBsonList);
if (CollectionUtils.isNotEmpty(andBsonList)) {
return Filters.and(andBsonList);
} else {
return new Document();
Expand Down

0 comments on commit a28c81f

Please sign in to comment.