directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smckin...@apache.org
Subject directory-fortress-commander git commit: FC-69 - Sort lists in fortress web
Date Tue, 17 Feb 2015 21:59:20 GMT
Repository: directory-fortress-commander
Updated Branches:
  refs/heads/master 95d291ea6 -> c147d3580


FC-69 - Sort lists in fortress web


Project: http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/repo
Commit: http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/commit/c147d358
Tree: http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/tree/c147d358
Diff: http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/diff/c147d358

Branch: refs/heads/master
Commit: c147d35802e4a9536ac84cee7b27f4cb62e16183
Parents: 95d291e
Author: Shawn McKinney <smckinney@apache.org>
Authored: Tue Feb 17 15:59:08 2015 -0600
Committer: Shawn McKinney <smckinney@apache.org>
Committed: Tue Feb 17 15:59:08 2015 -0600

----------------------------------------------------------------------
 .../directory/fortress/web/GroupListModel.java  | 14 +++++++++++
 .../directory/fortress/web/OUListModel.java     | 15 +++++++++++
 .../directory/fortress/web/ObjectListModel.java | 15 +++++++++++
 .../directory/fortress/web/PermListModel.java   | 15 +++++++++++
 .../fortress/web/PwPolicyListModel.java         | 15 +++++++++++
 .../directory/fortress/web/RoleListModel.java   | 26 ++++++++++++++++++++
 .../directory/fortress/web/SDListModel.java     | 14 +++++++++++
 .../directory/fortress/web/UserListModel.java   | 14 +++++++++++
 .../fortress/web/panel/OUSearchModalPanel.java  | 16 ++++++++++++
 .../web/panel/ObjectSearchModalPanel.java       | 16 ++++++++++++
 .../web/panel/PermSearchModalPanel.java         | 15 +++++++++++
 .../web/panel/PwPolicySearchModalPanel.java     | 15 +++++++++++
 .../web/panel/RoleSearchModalPanel.java         | 18 +++++++++++++-
 .../web/panel/UserSearchModalPanel.java         | 17 +++++++++++++
 14 files changed, 224 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/c147d358/src/main/java/org/apache/directory/fortress/web/GroupListModel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/GroupListModel.java b/src/main/java/org/apache/directory/fortress/web/GroupListModel.java
index 524d73c..803a98f 100644
--- a/src/main/java/org/apache/directory/fortress/web/GroupListModel.java
+++ b/src/main/java/org/apache/directory/fortress/web/GroupListModel.java
@@ -31,6 +31,8 @@ import org.apache.directory.fortress.core.util.attr.VUtil;
 import org.apache.directory.fortress.core.SecurityException;
 
 import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
 import java.util.List;
 
 /**
@@ -133,6 +135,18 @@ public class GroupListModel extends Model<SerializableList<Group>>
                 LOG.debug( ".getList group name: " + group != null ? group.getName() : "null"
);
                 groupList = groupMgr.find( group );
             }
+            // sort list by name:
+            if( VUtil.isNotNullOrEmpty( groupList ))
+            {
+                Collections.sort( ( List<Group> ) groupList, new Comparator<Group>()
+                {
+                    @Override
+                    public int compare(Group g1, Group g2)
+                    {
+                        return g1.getName().compareToIgnoreCase( g2.getName() );
+                    }
+                } );
+            }
         }
         catch ( SecurityException se )
         {

http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/c147d358/src/main/java/org/apache/directory/fortress/web/OUListModel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/OUListModel.java b/src/main/java/org/apache/directory/fortress/web/OUListModel.java
index aa7916c..eace0da 100644
--- a/src/main/java/org/apache/directory/fortress/web/OUListModel.java
+++ b/src/main/java/org/apache/directory/fortress/web/OUListModel.java
@@ -19,6 +19,7 @@
  */
 package org.apache.directory.fortress.web;
 
+import org.apache.directory.fortress.core.util.attr.VUtil;
 import org.apache.log4j.Logger;
 import org.apache.wicket.injection.Injector;
 import org.apache.wicket.model.Model;
@@ -29,6 +30,8 @@ import org.apache.directory.fortress.core.rbac.Session;
 import org.apache.directory.fortress.core.SecurityException;
 
 import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
 import java.util.List;
 
 /**
@@ -124,6 +127,18 @@ public class OUListModel extends Model<SerializableList<OrgUnit>>
             String szOrgUnitNm = orgUnit != null && orgUnit.getName() != null ? orgUnit.getName()
: "";
             LOG.debug( ".getList orgUnitNm: " + szOrgUnitNm );
             orgUnitList = delReviewMgr.search( orgUnit.getType(), orgUnit.getName() );
+            // sort list by name:
+            if( VUtil.isNotNullOrEmpty( orgUnitList ))
+            {
+                Collections.sort( ( List<OrgUnit> ) orgUnitList, new Comparator<OrgUnit>()
+                {
+                    @Override
+                    public int compare(OrgUnit o1, OrgUnit o2)
+                    {
+                        return o1.getName().compareToIgnoreCase( o2.getName() );
+                    }
+                } );
+            }
         }
         catch ( SecurityException se )
         {

http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/c147d358/src/main/java/org/apache/directory/fortress/web/ObjectListModel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/ObjectListModel.java b/src/main/java/org/apache/directory/fortress/web/ObjectListModel.java
index e8a9042..c8e7960 100644
--- a/src/main/java/org/apache/directory/fortress/web/ObjectListModel.java
+++ b/src/main/java/org/apache/directory/fortress/web/ObjectListModel.java
@@ -19,6 +19,7 @@
  */
 package org.apache.directory.fortress.web;
 
+import org.apache.directory.fortress.core.util.attr.VUtil;
 import org.apache.log4j.Logger;
 import org.apache.wicket.injection.Injector;
 import org.apache.wicket.model.Model;
@@ -31,6 +32,8 @@ import org.apache.directory.fortress.core.rbac.Session;
 import org.apache.directory.fortress.core.SecurityException;
 
 import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
 import java.util.List;
 
 
@@ -145,6 +148,18 @@ public class ObjectListModel extends Model<SerializableList<PermObj>>
                 // TODO: make this work with administrative permissions:
                 permObjList = reviewMgr.findPermObjs( new OrgUnit( ou ) );
             }
+            // sort list by objName:
+            if( VUtil.isNotNullOrEmpty( permObjList ))
+            {
+                Collections.sort( ( List<PermObj> ) permObjList, new Comparator<PermObj>()
+                {
+                    @Override
+                    public int compare(PermObj p1, PermObj p2)
+                    {
+                        return p1.getObjName().compareToIgnoreCase( p2.getObjName() );
+                    }
+                } );
+            }
         }
         catch ( SecurityException se )
         {

http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/c147d358/src/main/java/org/apache/directory/fortress/web/PermListModel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/PermListModel.java b/src/main/java/org/apache/directory/fortress/web/PermListModel.java
index d6f9da1..7d1b638 100644
--- a/src/main/java/org/apache/directory/fortress/web/PermListModel.java
+++ b/src/main/java/org/apache/directory/fortress/web/PermListModel.java
@@ -19,6 +19,7 @@
  */
 package org.apache.directory.fortress.web;
 
+import org.apache.directory.fortress.core.util.attr.VUtil;
 import org.apache.log4j.Logger;
 import org.apache.wicket.injection.Injector;
 import org.apache.wicket.model.Model;
@@ -29,6 +30,8 @@ import org.apache.directory.fortress.core.rbac.Session;
 import org.apache.directory.fortress.core.SecurityException;
 
 import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
 import java.util.List;
 
 /**
@@ -128,6 +131,18 @@ public class PermListModel extends Model<SerializableList<Permission>>
             LOG.debug( ".getList objectNm: " + szObjectNm + " opNm: " + szOpNm );
             perm.setAdmin( isAdmin );
             permsList = reviewMgr.findPermissions( perm );
+            // sort list by abstract name:
+            if( VUtil.isNotNullOrEmpty( permsList ))
+            {
+                Collections.sort( ( List<Permission> ) permsList, new Comparator<Permission>()
+                {
+                    @Override
+                    public int compare(Permission p1, Permission p2)
+                    {
+                        return p1.getAbstractName().compareToIgnoreCase( p2.getAbstractName()
);
+                    }
+                } );
+            }
         }
         catch ( SecurityException se )
         {

http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/c147d358/src/main/java/org/apache/directory/fortress/web/PwPolicyListModel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/PwPolicyListModel.java b/src/main/java/org/apache/directory/fortress/web/PwPolicyListModel.java
index 6fdf428..e2ee21b 100644
--- a/src/main/java/org/apache/directory/fortress/web/PwPolicyListModel.java
+++ b/src/main/java/org/apache/directory/fortress/web/PwPolicyListModel.java
@@ -19,6 +19,7 @@
  */
 package org.apache.directory.fortress.web;
 
+import org.apache.directory.fortress.core.util.attr.VUtil;
 import org.apache.log4j.Logger;
 import org.apache.wicket.injection.Injector;
 import org.apache.wicket.model.Model;
@@ -29,6 +30,8 @@ import org.apache.directory.fortress.core.rbac.Session;
 import org.apache.directory.fortress.core.SecurityException;
 
 import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
 import java.util.List;
 
 /**
@@ -125,6 +128,18 @@ public class PwPolicyListModel extends Model<SerializableList<PwPolicy>>
             String szPolicyNm = policy != null ? policy.getName() : "";
             LOG.debug( ".getList policyNm: " + szPolicyNm );
             policiesList = pwPolicyMgr.search( szPolicyNm );
+            // sort list by policy name:
+            if( VUtil.isNotNullOrEmpty( policiesList ))
+            {
+                Collections.sort( ( List<PwPolicy> ) policiesList, new Comparator<PwPolicy>()
+                {
+                    @Override
+                    public int compare(PwPolicy p1, PwPolicy p2)
+                    {
+                        return p1.getName().compareToIgnoreCase( p2.getName() );
+                    }
+                } );
+            }
         }
         catch ( SecurityException se )
         {

http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/c147d358/src/main/java/org/apache/directory/fortress/web/RoleListModel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/RoleListModel.java b/src/main/java/org/apache/directory/fortress/web/RoleListModel.java
index 55b0971..721bf16 100644
--- a/src/main/java/org/apache/directory/fortress/web/RoleListModel.java
+++ b/src/main/java/org/apache/directory/fortress/web/RoleListModel.java
@@ -19,6 +19,7 @@
  */
 package org.apache.directory.fortress.web;
 
+import org.apache.directory.fortress.core.util.attr.VUtil;
 import org.apache.log4j.Logger;
 import org.apache.wicket.injection.Injector;
 import org.apache.wicket.model.Model;
@@ -31,6 +32,8 @@ import org.apache.directory.fortress.core.rbac.Session;
 import org.apache.directory.fortress.core.SecurityException;
 
 import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
 import java.util.List;
 
 /**
@@ -136,6 +139,18 @@ public class RoleListModel extends Model<SerializableList<? extends
Role>>
         {
             LOG.debug( ".getList roleNm: " + szRoleNm );
             rolesList = reviewMgr.findRoles( szRoleNm );
+            // sort list by role name:
+            if( VUtil.isNotNullOrEmpty( rolesList ))
+            {
+                Collections.sort( ( List<Role> ) rolesList, new Comparator<Role>()
+                {
+                    @Override
+                    public int compare(Role r1, Role r2)
+                    {
+                        return r1.getName().compareToIgnoreCase( r2.getName() );
+                    }
+                } );
+            }
         }
         catch ( org.apache.directory.fortress.core.SecurityException se )
         {
@@ -155,6 +170,17 @@ public class RoleListModel extends Model<SerializableList<? extends
Role>>
         {
             LOG.debug( ".getList roleNm: " + szRoleNm );
             rolesList = (List<AdminRole>)delReviewMgr.findRoles( szRoleNm );
+            if( VUtil.isNotNullOrEmpty( rolesList ))
+            {
+                Collections.sort( ( List<AdminRole> ) rolesList, new Comparator<AdminRole>()
+                {
+                    @Override
+                    public int compare(AdminRole r1, AdminRole r2)
+                    {
+                        return r1.getName().compareToIgnoreCase( r2.getName() );
+                    }
+                } );
+            }
         }
         catch ( SecurityException se )
         {

http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/c147d358/src/main/java/org/apache/directory/fortress/web/SDListModel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/SDListModel.java b/src/main/java/org/apache/directory/fortress/web/SDListModel.java
index 8d0306e..65b5949 100644
--- a/src/main/java/org/apache/directory/fortress/web/SDListModel.java
+++ b/src/main/java/org/apache/directory/fortress/web/SDListModel.java
@@ -31,6 +31,8 @@ import org.apache.directory.fortress.core.util.attr.VUtil;
 import org.apache.directory.fortress.core.SecurityException;
 
 import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
 import java.util.List;
 
 /**
@@ -152,6 +154,18 @@ public class SDListModel extends Model<SerializableList<SDSet>>
                     sdSetList = reviewMgr.dsdSets( sdSet );
                 }
             }
+            // sort list by set name:
+            if( VUtil.isNotNullOrEmpty( sdSetList ))
+            {
+                Collections.sort( ( List<SDSet> ) sdSetList, new Comparator<SDSet>()
+                {
+                    @Override
+                    public int compare(SDSet s1, SDSet s2)
+                    {
+                        return s1.getName().compareToIgnoreCase( s2.getName() );
+                    }
+                } );
+            }
         }
         catch ( SecurityException se )
         {

http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/c147d358/src/main/java/org/apache/directory/fortress/web/UserListModel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/UserListModel.java b/src/main/java/org/apache/directory/fortress/web/UserListModel.java
index cd736b1..97d5638 100644
--- a/src/main/java/org/apache/directory/fortress/web/UserListModel.java
+++ b/src/main/java/org/apache/directory/fortress/web/UserListModel.java
@@ -36,6 +36,8 @@ import org.apache.directory.fortress.core.util.attr.VUtil;
 import org.apache.directory.fortress.core.SecurityException;
 
 import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
 import java.util.List;
 import java.util.Set;
 
@@ -177,6 +179,18 @@ public class UserListModel extends Model<SerializableList<User>>
             {
                 usersList = reviewMgr.findUsers( user );
             }
+            // sort list by userId:
+            if( VUtil.isNotNullOrEmpty( usersList ))
+            {
+                Collections.sort( ( List<User> ) usersList, new Comparator<User>()
+                {
+                    @Override
+                    public int compare(User u1, User u2)
+                    {
+                        return u1.getUserId().compareToIgnoreCase( u2.getUserId() );
+                    }
+                } );
+            }
         }
         catch ( SecurityException se )
         {

http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/c147d358/src/main/java/org/apache/directory/fortress/web/panel/OUSearchModalPanel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/panel/OUSearchModalPanel.java
b/src/main/java/org/apache/directory/fortress/web/panel/OUSearchModalPanel.java
index 1f46e92..7f86b58 100644
--- a/src/main/java/org/apache/directory/fortress/web/panel/OUSearchModalPanel.java
+++ b/src/main/java/org/apache/directory/fortress/web/panel/OUSearchModalPanel.java
@@ -21,8 +21,11 @@
 package org.apache.directory.fortress.web.panel;
 
 
+import java.util.Collections;
+import java.util.Comparator;
 import java.util.List;
 
+import org.apache.directory.fortress.core.util.attr.VUtil;
 import org.apache.log4j.Logger;
 import org.apache.wicket.ajax.AjaxRequestTarget;
 import org.apache.wicket.ajax.markup.html.AjaxLink;
@@ -133,6 +136,19 @@ public class OUSearchModalPanel extends Panel
                         ous = delReviewMgr.search( OrgUnit.Type.USER, ouSearchVal );
                     else
                         ous = delReviewMgr.search( OrgUnit.Type.PERM, ouSearchVal );
+                    // sort list by name:
+                    if( VUtil.isNotNullOrEmpty( ous ))
+                    {
+                        Collections.sort( ( List<OrgUnit> ) ous, new Comparator<OrgUnit>()
+                        {
+                            @Override
+                            public int compare(OrgUnit o1, OrgUnit o2)
+                            {
+                                return o1.getName().compareToIgnoreCase( o2.getName() );
+                            }
+                        } );
+                    }
+
                 }
                 catch ( org.apache.directory.fortress.core.SecurityException se )
                 {

http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/c147d358/src/main/java/org/apache/directory/fortress/web/panel/ObjectSearchModalPanel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/panel/ObjectSearchModalPanel.java
b/src/main/java/org/apache/directory/fortress/web/panel/ObjectSearchModalPanel.java
index eb87c90..c243722 100644
--- a/src/main/java/org/apache/directory/fortress/web/panel/ObjectSearchModalPanel.java
+++ b/src/main/java/org/apache/directory/fortress/web/panel/ObjectSearchModalPanel.java
@@ -21,8 +21,11 @@
 package org.apache.directory.fortress.web.panel;
 
 
+import java.util.Collections;
+import java.util.Comparator;
 import java.util.List;
 
+import org.apache.directory.fortress.core.util.attr.VUtil;
 import org.apache.log4j.Logger;
 import org.apache.wicket.ajax.AjaxRequestTarget;
 import org.apache.wicket.ajax.markup.html.AjaxLink;
@@ -134,6 +137,19 @@ public class ObjectSearchModalPanel extends Panel
                     PermObj permObj = new PermObj( objectSearchVal );
                     permObj.setAdmin( isAdmin );
                     objects = reviewMgr.findPermObjs( permObj );
+                    // sort list by objName:
+                    if( VUtil.isNotNullOrEmpty( objects ))
+                    {
+                        Collections.sort( ( List<PermObj> ) objects, new Comparator<PermObj>()
+                        {
+                            @Override
+                            public int compare(PermObj p1, PermObj p2)
+                            {
+                                return p1.getObjName().compareToIgnoreCase( p2.getObjName()
);
+                            }
+                        } );
+                    }
+
                 }
                 catch ( org.apache.directory.fortress.core.SecurityException se )
                 {

http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/c147d358/src/main/java/org/apache/directory/fortress/web/panel/PermSearchModalPanel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/panel/PermSearchModalPanel.java
b/src/main/java/org/apache/directory/fortress/web/panel/PermSearchModalPanel.java
index 3c75842..b68cff9 100644
--- a/src/main/java/org/apache/directory/fortress/web/panel/PermSearchModalPanel.java
+++ b/src/main/java/org/apache/directory/fortress/web/panel/PermSearchModalPanel.java
@@ -21,8 +21,11 @@
 package org.apache.directory.fortress.web.panel;
 
 
+import java.util.Collections;
+import java.util.Comparator;
 import java.util.List;
 
+import org.apache.directory.fortress.core.util.attr.VUtil;
 import org.apache.log4j.Logger;
 import org.apache.wicket.ajax.AjaxRequestTarget;
 import org.apache.wicket.ajax.markup.html.AjaxLink;
@@ -137,6 +140,18 @@ public class PermSearchModalPanel extends Panel
                     Permission permission = new Permission( objectSearchVal, "" );
                     permission.setAdmin( isAdmin );
                     objects = reviewMgr.findPermissions( permission );
+                    // sort list by abstract name:
+                    if( VUtil.isNotNullOrEmpty( objects ))
+                    {
+                        Collections.sort( ( List<Permission> ) objects, new Comparator<Permission>()
+                        {
+                            @Override
+                            public int compare(Permission p1, Permission p2)
+                            {
+                                return p1.getAbstractName().compareToIgnoreCase( p2.getAbstractName()
);
+                            }
+                        } );
+                    }
                 }
                 catch ( org.apache.directory.fortress.core.SecurityException se )
                 {

http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/c147d358/src/main/java/org/apache/directory/fortress/web/panel/PwPolicySearchModalPanel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/panel/PwPolicySearchModalPanel.java
b/src/main/java/org/apache/directory/fortress/web/panel/PwPolicySearchModalPanel.java
index a96697c..ba12612 100644
--- a/src/main/java/org/apache/directory/fortress/web/panel/PwPolicySearchModalPanel.java
+++ b/src/main/java/org/apache/directory/fortress/web/panel/PwPolicySearchModalPanel.java
@@ -21,8 +21,11 @@
 package org.apache.directory.fortress.web.panel;
 
 
+import java.util.Collections;
+import java.util.Comparator;
 import java.util.List;
 
+import org.apache.directory.fortress.core.util.attr.VUtil;
 import org.apache.log4j.Logger;
 import org.apache.wicket.ajax.AjaxRequestTarget;
 import org.apache.wicket.ajax.markup.html.AjaxLink;
@@ -143,6 +146,18 @@ public class PwPolicySearchModalPanel extends Panel
                     if ( policySearchVal == null )
                         policySearchVal = "";
                     policies = pwPolicyMgr.search( policySearchVal );
+                    // sort list by name:
+                    if( VUtil.isNotNullOrEmpty( policies ))
+                    {
+                        Collections.sort( ( List<PwPolicy> ) policies, new Comparator<PwPolicy>()
+                        {
+                            @Override
+                            public int compare(PwPolicy p1, PwPolicy p2)
+                            {
+                                return p1.getName().compareToIgnoreCase( p2.getName() );
+                            }
+                        } );
+                    }
                 }
                 catch ( org.apache.directory.fortress.core.SecurityException se )
                 {

http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/c147d358/src/main/java/org/apache/directory/fortress/web/panel/RoleSearchModalPanel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/panel/RoleSearchModalPanel.java
b/src/main/java/org/apache/directory/fortress/web/panel/RoleSearchModalPanel.java
index 9fa100f..6d7ef4d 100644
--- a/src/main/java/org/apache/directory/fortress/web/panel/RoleSearchModalPanel.java
+++ b/src/main/java/org/apache/directory/fortress/web/panel/RoleSearchModalPanel.java
@@ -22,12 +22,16 @@ package org.apache.directory.fortress.web.panel;
 
 
 import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
 import java.util.List;
 
+import org.apache.directory.fortress.core.util.attr.VUtil;
 import org.apache.log4j.Logger;
 import org.apache.wicket.ajax.AjaxRequestTarget;
 import org.apache.wicket.ajax.markup.html.AjaxLink;
 import org.apache.wicket.ajax.markup.html.navigation.paging.AjaxPagingNavigator;
+import org.apache.wicket.authroles.authorization.strategies.role.Roles;
 import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
 import org.apache.wicket.markup.html.basic.Label;
 import org.apache.wicket.markup.html.list.ListItem;
@@ -174,13 +178,25 @@ public class RoleSearchModalPanel extends Panel
                     String error = "loadPanel caught SecurityException=" + se;
                     LOG.error( error );
                 }
+
+                // sort list by name:
+                if( VUtil.isNotNullOrEmpty( roles ))
+                {
+                    Collections.sort( (List<Role>)roles, new Comparator<Role>()
+                    {
+                        @Override
+                        public int compare(Role r1, Role r2)
+                        {
+                            return r1.getName().compareToIgnoreCase( r2.getName() );
+                        }
+                    } );
+                }
                 return roles;
             }
         };
         return ret;
     }
 
-
     public UserRole getRoleSelection()
     {
         UserRole userRoleSelection = new UserRole();

http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/c147d358/src/main/java/org/apache/directory/fortress/web/panel/UserSearchModalPanel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/panel/UserSearchModalPanel.java
b/src/main/java/org/apache/directory/fortress/web/panel/UserSearchModalPanel.java
index 45fb19c..1278b14 100644
--- a/src/main/java/org/apache/directory/fortress/web/panel/UserSearchModalPanel.java
+++ b/src/main/java/org/apache/directory/fortress/web/panel/UserSearchModalPanel.java
@@ -21,8 +21,12 @@
 package org.apache.directory.fortress.web.panel;
 
 
+import java.util.Collections;
+import java.util.Comparator;
 import java.util.List;
 
+import org.apache.directory.fortress.core.rbac.Role;
+import org.apache.directory.fortress.core.util.attr.VUtil;
 import org.apache.log4j.Logger;
 import org.apache.wicket.ajax.AjaxRequestTarget;
 import org.apache.wicket.ajax.markup.html.AjaxLink;
@@ -147,6 +151,19 @@ public class UserSearchModalPanel extends Panel
                     if ( userSearchVal == null )
                         userSearchVal = "";
                     users = reviewMgr.findUsers( new User( userSearchVal ) );
+                    // sort list by userId:
+                    if( VUtil.isNotNullOrEmpty( users ))
+                    {
+                        Collections.sort( ( List<User> ) users, new Comparator<User>()
+                        {
+                            @Override
+                            public int compare(User u1, User u2)
+                            {
+                                return u1.getUserId().compareToIgnoreCase( u2.getUserId()
);
+                            }
+                        } );
+                    }
+
                 }
                 catch ( org.apache.directory.fortress.core.SecurityException se )
                 {


Mime
View raw message