Skip to content

Commit

Permalink
TRUNK-6202 Fix test failures when run on PostgreSQL
Browse files Browse the repository at this point in the history
  • Loading branch information
dkayiwa committed Jan 8, 2024
1 parent f0f0677 commit 5933a75
Showing 1 changed file with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -361,9 +361,9 @@ public List<Drug> getDrugs(String drugName, Concept concept, boolean includeReti

if (drugName != null) {
if (Context.getAdministrationService().isDatabaseStringComparisonCaseSensitive()) {
predicates.add(cb.equal(drugRoot.get("name"), MatchMode.EXACT.toCaseSensitivePattern(drugName)));
} else {
predicates.add(cb.equal(cb.lower(drugRoot.get("name")), MatchMode.EXACT.toLowerCasePattern(drugName)));
} else {
predicates.add(cb.equal(drugRoot.get("name"), MatchMode.EXACT.toCaseSensitivePattern(drugName)));
}
}

Expand Down Expand Up @@ -1964,9 +1964,9 @@ public Concept getConceptByName(final String name) {

predicates.add(cb.or(cb.equal(root.get("locale"), locale), cb.like(root.get("locale").as(String.class), language.toString())));
if (Context.getAdministrationService().isDatabaseStringComparisonCaseSensitive()) {
predicates.add(cb.equal(root.get("name"), name));
} else {
predicates.add(cb.like(cb.lower(root.get("name")), name.toLowerCase()));
} else {
predicates.add(cb.equal(root.get("name"), name));
}
predicates.add(cb.isFalse(root.get("voided")));
predicates.add(cb.isFalse(conceptJoin.get("retired")));
Expand Down Expand Up @@ -2062,9 +2062,9 @@ public boolean isConceptNameDuplicate(ConceptName name) {
cb.equal(root.get("locale"), new Locale(name.getLocale().getLanguage()))));

if (Context.getAdministrationService().isDatabaseStringComparisonCaseSensitive()) {
predicates.add(cb.equal(root.get("name"), name.getName()));
} else {
predicates.add(cb.equal(cb.lower(root.get("name")), name.getName().toLowerCase()));
} else {
predicates.add(cb.equal(root.get("name"), name.getName()));
}

cq.where(predicates.toArray(new Predicate[0]));
Expand Down Expand Up @@ -2318,11 +2318,11 @@ private List<Predicate> createSearchConceptMapCriteria(CriteriaBuilder cb, Root<
Join<ConceptReferenceTerm, ConceptSource> sourceJoin = termJoin.join("conceptSource");

Predicate namePredicate = Context.getAdministrationService().isDatabaseStringComparisonCaseSensitive() ?
cb.equal(sourceJoin.get("name"), sourceName) :
cb.equal(cb.lower(sourceJoin.get("name")), sourceName.toLowerCase());
cb.equal(cb.lower(sourceJoin.get("name")), sourceName.toLowerCase()) :
cb.equal(sourceJoin.get("name"), sourceName);
Predicate hl7CodePredicate = Context.getAdministrationService().isDatabaseStringComparisonCaseSensitive() ?
cb.equal(sourceJoin.get("hl7Code"), sourceName) :
cb.equal(cb.lower(sourceJoin.get("hl7Code")), sourceName.toLowerCase());
cb.equal(cb.lower(sourceJoin.get("hl7Code")), sourceName.toLowerCase()) :
cb.equal(sourceJoin.get("hl7Code"), sourceName);

predicates.add(cb.or(namePredicate, hl7CodePredicate));

Expand Down

0 comments on commit 5933a75

Please sign in to comment.