public void removeAssociation(JetspeedPrincipal from, JetspeedPrincipal to, String associationName) throws SecurityException
{
Criteria criteria = new Criteria();
criteria.addEqualTo("fromPrincipalId", from.getId());
criteria.addEqualTo("toPrincipalId", to.getId());
criteria.addEqualTo("associationName", associationName);
Query query = QueryFactory.newQuery(JetspeedPrincipalAssociation.class,criteria);
if (getPersistenceBrokerTemplate().getCount(query) != 0)
{
try
{
getPersistenceBrokerTemplate().delete(new JetspeedPrincipalAssociation(from, to, associationName));
jspmCache.evictPrincipal(from.getId());
jspmCache.evictPrincipal(to.getId());
}
catch (Exception pbe)
{
KeyedMessage msg = SecurityException.UNEXPECTED.create("JetspeedSecurityPersistenceManager",
"removeAssociation",
pbe.getMessage());
logger.error(msg, pbe);
throw new SecurityException(msg, pbe);
}
}
}