cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject cxf-fediz git commit: Sorting registered clients by name for a start
Date Fri, 12 Feb 2016 15:57:10 GMT
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 <sberyozkin@gmail.com>
Authored: Fri Feb 12 15:56:57 2016 +0000
Committer: Sergey Beryozkin <sberyozkin@gmail.com>
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<Client> getClientRegistrations(String userName) {
         Collection<Client> userClientRegs = registrations.get(userName);
         if (userClientRegs == null) {
-            userClientRegs = new HashSet<Client>();
+            userClientRegs = new TreeSet<Client>(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<Client> {
+
+        @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());
+        }
+        
+    }
 }


Mime
View raw message