}
public void removeAssociation(JetspeedPrincipal from, JetspeedPrincipal to, String associationName) throws SecurityException
{
AssociationHandlerKey key = new AssociationHandlerKey(associationName, from.getType().getName(), to.getType().getName());
JetspeedPrincipalAssociationHandler jpah = assHandlers.get(key);
if (jpah != null)
{
if (jpah.getAssociationType().isRequired() && !isSynchronizing())
{
JetspeedPrincipalAssociationType assType = jpah.getAssociationType();
throw new SecurityException(SecurityException.PRINCIPAL_ASSOCIATION_REQUIRED.createScoped(assType.getFromPrincipalType().getName(),
assType.getAssociationName(),
assType.getToPrincipalType().getName()));
}
if (from.isTransient() || from.getId() == null)
{
JetspeedPrincipal pfrom = jpah.getManagerFrom().getPrincipal(from.getName());
if (pfrom == null)
{
throw new SecurityException(SecurityException.PRINCIPAL_DOES_NOT_EXIST.createScoped(from.getType().getName(), from.getName()));
}
from = pfrom;
}
if (to.isTransient() || to.getId() == null)
{
JetspeedPrincipal pto = jpah.getManagerTo().getPrincipal(to.getName());
if (pto == null)
{
throw new SecurityException(SecurityException.PRINCIPAL_DOES_NOT_EXIST.createScoped(to.getType().getName(), to.getName()));
}
to = pto;
}
jpah.remove(from, to);
notifyRemovedAssociation(from,to, associationName);
}
}