[security-dev] Sorting support in IDM

Pedro Igor Silva psilva at redhat.com
Wed Feb 6 10:09:58 EST 2013


+1. I'm working with an example app that provides some management features for users/roles/groups and I missed that too.

Regards.
Pedro Igor

----- Original Message -----
From: "Marek Posolda" <mposolda at redhat.com>
To: security-dev at lists.jboss.org
Sent: Wednesday, February 6, 2013 11:38:00 AM
Subject: [security-dev] Sorting support in IDM

Hi,

I've looked that currently there is no support for sorting of query 
results by some attributes. So I've added some support for sorting into 
IDM API into IdentityQuery class. Especially those four methods:

     /**
      * Parameters used to sort the results. First parameter has biggest 
priority.
      * For example: setSortParameter(User.LAST_NAME, User.FIRST_NAME) 
means that results will be sorted primarily by lastName
      * and firstName will be used to sort only records with same lastName
      *
      * @param sortParameters parameters to specify sort criteria
      * @return this query
      */
     IdentityQuery<T> setSortParameters(QueryParameter... sortParameters);

     /**
      * @see #setSortParameters(QueryParameter...)
      */
     QueryParameter[] getSortParameters();

     /**
      * Specify if sorting will be ascending (true) or descending (false)
      * @param sortAscending to specify if sorting will be ascending or 
descending
      * @return this query
      */
     IdentityQuery<T> setSortAscending(boolean sortAscending);

     /**
      * @return true if sorting will be ascending
      * @see #setSortAscending(boolean)
      */
     boolean isSortAscending();

This adds support for sort by more attributes (if attribute1 has same 
value for some records, attribute2 will be used) and I hope that having 
this in API is sufficient to cover majority of usecases. WDYT?

I've added support for sorting into JPAIdentityStore for now. Will try 
to add support also into FileIdentityStore and LDAPIdentityStore if you 
are ok with my proposal. I've added some unit tests to test this (they 
are enabled only for JPAIdentityStoreTestSuite now because it's 
implemented only here)

WDYT?

Cheers,
Marek
_______________________________________________
security-dev mailing list
security-dev at lists.jboss.org
https://lists.jboss.org/mailman/listinfo/security-dev


More information about the security-dev mailing list