syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmarte...@apache.org
Subject [2/2] syncope git commit: [SYNCOPE-1382] improves string check conditions
Date Thu, 11 Oct 2018 08:40:13 GMT
[SYNCOPE-1382] improves string check conditions


Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/3c3c0087
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/3c3c0087
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/3c3c0087

Branch: refs/heads/master
Commit: 3c3c00877e8249f52f64aa3ba4b71c9635b27717
Parents: 7de2d08
Author: fmartelli <fabio.martelli@gmail.com>
Authored: Thu Oct 11 10:15:21 2018 +0200
Committer: fmartelli <fabio.martelli@gmail.com>
Committed: Thu Oct 11 10:33:13 2018 +0200

----------------------------------------------------------------------
 .../syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java       | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/3c3c0087/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java
index 3ce2702..c6ebca1 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java
@@ -715,7 +715,7 @@ public class JPAAnySearchDAO extends AbstractAnySearchDAO {
         boolean ignoreCase = AttributeCond.Type.ILIKE == cond.getType() || AttributeCond.Type.IEQ
== cond.getType();
 
         String column = (cond instanceof AnyCond) ? cond.getSchema() : svs.fieldName(schema.getType());
-        if (ignoreCase) {
+        if ((schema.getType() == AttrSchemaType.String || schema.getType() == AttrSchemaType.Enum)
&& ignoreCase) {
             column = "LOWER (" + column + ")";
         }
         if (!(cond instanceof AnyCond)) {
@@ -766,7 +766,8 @@ public class JPAAnySearchDAO extends AbstractAnySearchDAO {
                 } else {
                     query.append('=');
                 }
-                if (ignoreCase) {
+                if ((schema.getType() == AttrSchemaType.String 
+                        || schema.getType() == AttrSchemaType.Enum) && ignoreCase)
{
                     query.append("LOWER(?").append(setParameter(parameters, attrValue.getValue())).append(')');
                 } else {
                     query.append('?').append(setParameter(parameters, attrValue.getValue()));


Mime
View raw message