You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by il...@apache.org on 2022/06/08 04:59:37 UTC

[syncope] branch 2_1_X updated: Simplifying assignable cond term search

This is an automated email from the ASF dual-hosted git repository.

ilgrosso pushed a commit to branch 2_1_X
in repository https://gitbox.apache.org/repos/asf/syncope.git


The following commit(s) were added to refs/heads/2_1_X by this push:
     new 8bc5f8609a Simplifying assignable cond term search
8bc5f8609a is described below

commit 8bc5f8609a87bdbed0c3898839b9d70e6f3c3951
Author: Francesco Chicchiriccò <il...@apache.org>
AuthorDate: Tue Jun 7 16:52:33 2022 +0200

    Simplifying assignable cond term search
---
 .../src/main/java/org/apache/syncope/core/logic/SyncopeLogic.java | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/SyncopeLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/SyncopeLogic.java
index 54d4dc5b10..63a2176e9e 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/SyncopeLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/SyncopeLogic.java
@@ -483,13 +483,7 @@ public class SyncopeLogic extends AbstractLogic<EntityTO> {
             AnyCond termCond = new AnyCond(AttrCond.Type.ILIKE);
             termCond.setSchema("name");
 
-            String termSearchableValue = (term.startsWith("*") && !term.endsWith("*"))
-                    ? term + "%"
-                    : (!term.startsWith("*") && term.endsWith("*"))
-                    ? "%" + term
-                    : (term.startsWith("*") && term.endsWith("*")
-                    ? term : "%" + term + "%");
-            termCond.setExpression(termSearchableValue);
+            termCond.setExpression(term.replace("*", "%"));
 
             searchCond = SearchCond.getAnd(
                     SearchCond.getLeaf(assignableCond),