syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ilgro...@apache.org
Subject [2/2] syncope git commit: [SYNCOPE-1214] Manage difference between Any's field and column name
Date Wed, 27 Sep 2017 13:06:07 GMT
[SYNCOPE-1214] Manage difference between Any's field and column name


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

Branch: refs/heads/master
Commit: 4fe8d084a6aa51fbf7fbfbf025b100df162bd27a
Parents: 79f96cd
Author: Francesco Chicchiriccò <ilgrosso@apache.org>
Authored: Wed Sep 27 15:05:44 2017 +0200
Committer: Francesco Chicchiriccò <ilgrosso@apache.org>
Committed: Wed Sep 27 15:05:56 2017 +0200

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


http://git-wip-us.apache.org/repos/asf/syncope/blob/4fe8d084/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 b6d37e6..0f0df60 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
@@ -18,7 +18,6 @@
  */
 package org.apache.syncope.core.persistence.jpa.dao;
 
-import java.lang.reflect.Field;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Date;
@@ -276,8 +275,8 @@ public class JPAAnySearchDAO extends AbstractAnySearchDAO {
         return orderBy;
     }
 
-    private OrderBySupport parseOrderBy(final AnyTypeKind kind, final SearchSupport svs,
-            final List<OrderByClause> orderByClauses) {
+    private OrderBySupport parseOrderBy(
+            final AnyTypeKind kind, final SearchSupport svs, final List<OrderByClause>
orderByClauses) {
 
         AnyUtils attrUtils = anyUtilsFactory.getInstance(kind);
 
@@ -289,8 +288,7 @@ public class JPAAnySearchDAO extends AbstractAnySearchDAO {
             // Manage difference among external key attribute and internal JPA @Id
             String fieldName = "key".equals(clause.getField()) ? "id" : clause.getField();
 
-            Field anyField = ReflectionUtils.findField(attrUtils.anyClass(), fieldName);
-            if (anyField == null) {
+            if (ReflectionUtils.findField(attrUtils.anyClass(), fieldName) == null) {
                 PlainSchema schema = schemaDAO.find(fieldName);
                 if (schema != null) {
                     // keep track of involvement of non-mandatory schemas in the order by
clauses
@@ -319,6 +317,9 @@ public class JPAAnySearchDAO extends AbstractAnySearchDAO {
                     }
                 }
             } else {
+                // Adjust field name to column name
+                fieldName = "realm".equals(fieldName) ? "realm_id" : fieldName;
+
                 obs.views.add(svs.field());
 
                 item.select = svs.field().alias + "." + fieldName;


Mime
View raw message