[seam-commits] Seam SVN: r13446 - modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/picketlink.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Tue Jul 20 03:48:58 EDT 2010
Author: shane.bryzak at jboss.com
Date: 2010-07-20 03:48:58 -0400 (Tue, 20 Jul 2010)
New Revision: 13446
Modified:
modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/picketlink/JpaIdentityStore.java
Log:
fix removeIdentityObject() for identities with credentials and relationships
Modified: modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/picketlink/JpaIdentityStore.java
===================================================================
--- modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/picketlink/JpaIdentityStore.java 2010-07-20 05:47:48 UTC (rev 13445)
+++ modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/picketlink/JpaIdentityStore.java 2010-07-20 07:48:58 UTC (rev 13446)
@@ -1408,6 +1408,7 @@
EntityManager em = getEntityManager(ctx);
CriteriaBuilder builder = em.getCriteriaBuilder();
+
CriteriaQuery<?> criteria = builder.createQuery(identityClass);
Root<?> root = criteria.from(identityClass);
@@ -1422,6 +1423,27 @@
try
{
Object instance = em.createQuery(criteria).getSingleResult();
+
+ // If there is a credential class, delete any credentials
+ if (credentialClass != null)
+ {
+ Property<?> credentialIdentityProp = modelProperties.get(PROPERTY_CREDENTIAL_IDENTITY);
+
+ criteria = builder.createQuery(credentialClass);
+ root = criteria.from(credentialClass);
+
+ predicates = new ArrayList<Predicate>();
+ predicates.add(builder.equal(root.get(credentialIdentityProp.getName()),
+ lookupIdentity(identity, em)));
+ criteria.where(predicates.toArray(new Predicate[0]));
+
+ List<?> results = em.createQuery(criteria).getResultList();
+ for (Object result : results)
+ {
+ em.remove(result);
+ }
+ }
+
em.remove(instance);
}
catch (NoResultException ex)
@@ -1700,8 +1722,11 @@
IdentityObject identityObject, IdentityObjectCredential credential)
throws IdentityException
{
+
+
// TODO Auto-generated method stub
System.out.println("*** Invoked unimplemented method updateCredential()");
+
}
public boolean validateCredential(IdentityStoreInvocationContext ctx,
More information about the seam-commits
mailing list