Author: bdaw
Date: 2011-10-06 08:17:14 -0400 (Thu, 06 Oct 2011)
New Revision: 1285
Modified:
idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/repository/WrapperIdentityStoreRepository.java
idm/trunk/picketlink-idm-hibernate/src/main/java/org/picketlink/idm/impl/store/hibernate/HibernateIdentityStoreImpl.java
Log:
- fix context handling and add sorting in relationship query
Modified:
idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/repository/WrapperIdentityStoreRepository.java
===================================================================
---
idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/repository/WrapperIdentityStoreRepository.java 2011-10-04
13:58:49 UTC (rev 1284)
+++
idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/repository/WrapperIdentityStoreRepository.java 2011-10-06
12:17:14 UTC (rev 1285)
@@ -184,14 +184,14 @@
return
defaultIdentityStore.findIdentityObject(resolveIdentityStoreInvocationContext(invocationCtx),
identityType, criteria);
}
- public int getIdentityObjectCount(IdentityStoreInvocationContext invocationCxt,
+ public int getIdentityObjectCount(IdentityStoreInvocationContext invocationCtx,
IdentityObject identity,
IdentityObjectRelationshipType relationshipType,
boolean parent,
IdentityObjectSearchCriteria criteria) throws
IdentityException
{
return defaultIdentityStore.getIdentityObjectCount(
- invocationCxt,
+ resolveIdentityStoreInvocationContext(invocationCtx),
identity,
relationshipType,
parent,
@@ -207,7 +207,7 @@
IdentityObjectSearchCriteria criteria) throws
IdentityException
{
return defaultIdentityStore.getIdentityObjectCount(
- ctx,
+ resolveIdentityStoreInvocationContext(ctx),
identity,
relationshipType,
excludes,
@@ -282,7 +282,7 @@
IdentityObjectSearchCriteria searchCriteria) throws
IdentityException
{
return defaultIdentityStore.getRelationshipsCount(
- ctx,
+ resolveIdentityStoreInvocationContext(ctx),
identity,
type,
parent,
Modified:
idm/trunk/picketlink-idm-hibernate/src/main/java/org/picketlink/idm/impl/store/hibernate/HibernateIdentityStoreImpl.java
===================================================================
---
idm/trunk/picketlink-idm-hibernate/src/main/java/org/picketlink/idm/impl/store/hibernate/HibernateIdentityStoreImpl.java 2011-10-04
13:58:49 UTC (rev 1284)
+++
idm/trunk/picketlink-idm-hibernate/src/main/java/org/picketlink/idm/impl/store/hibernate/HibernateIdentityStoreImpl.java 2011-10-06
12:17:14 UTC (rev 1285)
@@ -1439,7 +1439,33 @@
criteria.setFirstResult(searchCriteria.getFirstResult());
}
+ if (searchCriteria != null && searchCriteria.isSorted())
+ {
+ if (parent)
+ {
+ if (searchCriteria.isAscending())
+ {
+ criteria.addOrder(Order.asc("toIdentityObject.name"));
+ }
+ else
+ {
+ criteria.addOrder(Order.desc("toIdentityObject.name"));
+ }
+ }
+ else
+ {
+ if (searchCriteria.isAscending())
+ {
+ criteria.addOrder(Order.asc("fromIdentityObject.name"));
+ }
+ else
+ {
+ criteria.addOrder(Order.desc("fromIdentityObject.name"));
+ }
+ }
+ }
+
return criteria;
}
Show replies by date