[security-dev] deleting a partition

Bill Burke bburke at redhat.com
Fri Jun 14 11:38:12 EDT 2013


I'm looking at how to delete a partition and its not that simple.  Is 
this good enough?  First I delete all Agents, users, groups, and roles. 
  Relationships should be deleted too right?

         List<AttributedType> toRemove = new ArrayList<AttributedType>();
         {
             IdentityQuery<IdentityType> query = new 
DefaultIdentityQuery(context, Agent.class, this);
             List<IdentityType> resultSet = fetchQueryResults(context, 
query);
             toRemove.addAll(resultSet);
         }
         {
             IdentityQuery<IdentityType> query = new 
DefaultIdentityQuery(context, User.class, this);
             List<IdentityType> resultSet = fetchQueryResults(context, 
query);
             toRemove.addAll(resultSet);
         }
         {
             IdentityQuery<IdentityType> query = new 
DefaultIdentityQuery(context, Group.class, this);
             List<IdentityType> resultSet = fetchQueryResults(context, 
query);
             toRemove.addAll(resultSet);
         }
         {
             IdentityQuery<IdentityType> query = new 
DefaultIdentityQuery(context, Role.class, this);
             List<IdentityType> resultSet = fetchQueryResults(context, 
query);
             toRemove.addAll(resultSet);
         }

I do this all at the IdentityStore level, after this, I delete the 
partition entry using IdentityStore specific routines.


-- 
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com


More information about the security-dev mailing list