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 2017/05/09 06:30:40 UTC

[2/2] syncope git commit: [SYNCOPE-1077] Missing order by implementation

[SYNCOPE-1077] Missing order by implementation


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

Branch: refs/heads/master
Commit: 648c45461ad9636ebdd5ac27eb8aa9502c8b74c6
Parents: a5e868b
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Tue May 9 08:30:23 2017 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Tue May 9 08:30:32 2017 +0200

----------------------------------------------------------------------
 .../client/console/commons/ITabComponent.java    | 19 -------------------
 .../jpa/dao/ElasticsearchAnySearchDAO.java       |  4 ++++
 2 files changed, 4 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/648c4546/client/console/src/main/java/org/apache/syncope/client/console/commons/ITabComponent.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/commons/ITabComponent.java b/client/console/src/main/java/org/apache/syncope/client/console/commons/ITabComponent.java
index 1c43d8d..300487a 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/commons/ITabComponent.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/commons/ITabComponent.java
@@ -18,7 +18,6 @@
  */
 package org.apache.syncope.client.console.commons;
 
-import java.util.Set;
 import java.util.UUID;
 import org.apache.wicket.Component;
 import org.apache.wicket.authroles.authorization.strategies.role.Roles;
@@ -43,15 +42,6 @@ public abstract class ITabComponent extends Component implements ITab {
      * @param title IModel used to represent the title of the tab. Must contain a string
      * @param roles authorized roles
      */
-    public ITabComponent(final IModel<String> title, final Set<String> roles) {
-        this(title, roles.toArray(new String[roles.size()]));
-    }
-    /**
-     * Constructor.
-     *
-     * @param title IModel used to represent the title of the tab. Must contain a string
-     * @param roles authorized roles
-     */
     public ITabComponent(final IModel<String> title, final String... roles) {
         super(UUID.randomUUID().toString());
         this.title = title;
@@ -65,17 +55,11 @@ public abstract class ITabComponent extends Component implements ITab {
         }
     }
 
-    /**
-     * {@inheritDoc}
-     */
     @Override
     public IModel<String> getTitle() {
         return title;
     }
 
-    /**
-     * {@inheritDoc}
-     */
     @Override
     public boolean isVisible() {
         return true;
@@ -89,9 +73,6 @@ public abstract class ITabComponent extends Component implements ITab {
         internalRenderComponent();
     }
 
-    /**
-     * {@inheritDoc}
-     */
     @Override
     public abstract WebMarkupContainer getPanel(final String panelId);
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/648c4546/ext/elasticsearch/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/ElasticsearchAnySearchDAO.java
----------------------------------------------------------------------
diff --git a/ext/elasticsearch/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/ElasticsearchAnySearchDAO.java b/ext/elasticsearch/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/ElasticsearchAnySearchDAO.java
index 34651e1..d2beabc 100644
--- a/ext/elasticsearch/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/ElasticsearchAnySearchDAO.java
+++ b/ext/elasticsearch/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/ElasticsearchAnySearchDAO.java
@@ -56,6 +56,7 @@ import org.elasticsearch.index.query.MatchNoneQueryBuilder;
 import org.elasticsearch.index.query.QueryBuilder;
 import org.elasticsearch.index.query.QueryBuilders;
 import org.elasticsearch.search.SearchHit;
+import org.elasticsearch.search.sort.SortOrder;
 import org.springframework.beans.factory.annotation.Autowired;
 
 /**
@@ -123,6 +124,9 @@ public class ElasticsearchAnySearchDAO extends AbstractAnySearchDAO {
         SearchRequestBuilder builder = searchRequestBuilder(adminRealms, cond, kind).
                 setFrom(page <= 0 ? 0 : page - 1).
                 setSize(itemsPerPage < 0 ? elasticsearchUtils.getIndexMaxResultWindow() : itemsPerPage);
+        for (OrderByClause clause : orderBy) {
+            builder.addSort(clause.getField(), SortOrder.valueOf(clause.getDirection().name()));
+        }
 
         return buildResult(
                 CollectionUtils.collect(Arrays.asList(builder.get().getHits().getHits()),