Return-Path: X-Original-To: apmail-cxf-commits-archive@www.apache.org Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 172D518751 for ; Fri, 12 Feb 2016 15:57:11 +0000 (UTC) Received: (qmail 39447 invoked by uid 500); 12 Feb 2016 15:57:10 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 39382 invoked by uid 500); 12 Feb 2016 15:57:10 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 39373 invoked by uid 99); 12 Feb 2016 15:57:10 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 12 Feb 2016 15:57:10 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 7F0A0E03CD; Fri, 12 Feb 2016 15:57:10 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sergeyb@apache.org To: commits@cxf.apache.org Message-Id: <67e628d3329c42f9a63fcba9331deb02@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: cxf-fediz git commit: Sorting registered clients by name for a start Date: Fri, 12 Feb 2016 15:57:10 +0000 (UTC) Repository: cxf-fediz Updated Branches: refs/heads/master 05cb33d60 -> 6461e3ba8 Sorting registered clients by name for a start Project: http://git-wip-us.apache.org/repos/asf/cxf-fediz/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf-fediz/commit/6461e3ba Tree: http://git-wip-us.apache.org/repos/asf/cxf-fediz/tree/6461e3ba Diff: http://git-wip-us.apache.org/repos/asf/cxf-fediz/diff/6461e3ba Branch: refs/heads/master Commit: 6461e3ba8134156013e4d837c0d78c62aad82b2b Parents: 05cb33d Author: Sergey Beryozkin Authored: Fri Feb 12 15:56:57 2016 +0000 Committer: Sergey Beryozkin Committed: Fri Feb 12 15:56:57 2016 +0000 ---------------------------------------------------------------------- .../oidc/clients/ClientRegistrationService.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/6461e3ba/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/clients/ClientRegistrationService.java ---------------------------------------------------------------------- diff --git a/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/clients/ClientRegistrationService.java b/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/clients/ClientRegistrationService.java index 87edee5..c0f7f8c 100644 --- a/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/clients/ClientRegistrationService.java +++ b/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/clients/ClientRegistrationService.java @@ -23,6 +23,7 @@ import java.net.URI; import java.net.URISyntaxException; import java.util.ArrayList; import java.util.Collection; +import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; @@ -363,7 +364,7 @@ public class ClientRegistrationService { protected Collection getClientRegistrations(String userName) { Collection userClientRegs = registrations.get(userName); if (userClientRegs == null) { - userClientRegs = new HashSet(); + userClientRegs = new TreeSet(new ClientComparator()); registrations.put(userName, userClientRegs); } return userClientRegs; @@ -412,4 +413,15 @@ public class ClientRegistrationService { public void setClientProvider(ClientRegistrationProvider clientProvider) { this.clientProvider = clientProvider; } + + private static class ClientComparator implements Comparator { + + @Override + public int compare(Client c1, Client c2) { + // or the registration date comparison - this can be driven from UI + // example, Sort Clients By Name/Date/etc + return c1.getApplicationName().compareTo(c2.getApplicationName()); + } + + } }