public AssociationHandlerKey(JetspeedPrincipalAssociationHandler jpah) { this(jpah.getAssociationType().getAssociationName(), jpah.getAssociationType().getFromPrincipalType() .getName(), jpah.getAssociationType() .getToPrincipalType().getName()); }
public void addAssociationHandler(JetspeedPrincipalAssociationHandler jpah) { if (jpah.getAssociationType().getFromPrincipalType().getName().equals(principalType.getName()) || jpah.getAssociationType().getToPrincipalType().getName().equals(principalType.getName())) { AssociationHandlerKey key = new AssociationHandlerKey(jpah); if (assHandlers.containsKey(key)) { throw new IllegalStateException("An AssociationHandler for " + jpah.getAssociationType().getAssociationName() + " already defined"); } assHandlers.put(key, jpah); associationTypes.add(jpah.getAssociationType()); if (jpah.getAssociationType().isRequired() && jpah.getAssociationType().getFromPrincipalType().getName().equals(principalType.getName())) { reqAssociations.put(key,jpah.getAssociationType()); } } else { throw new IllegalArgumentException("AssociationHandler is not handling a " + principalType.getName() + " JetspeedPrincipal"); } }
public void removePrincipal(JetspeedPrincipal principal) throws SecurityException { validatePrincipal(principal); for (JetspeedPrincipalAssociationHandler jpah : assHandlers.values()) { if (jpah.getAssociationType().getFromPrincipalType().getName().equals(principalType.getName())) { jpah.beforeRemoveFrom(principal); } if (jpah.getAssociationType().getToPrincipalType().getName().equals(principalType.getName())) { jpah.beforeRemoveTo(principal); } } jpsm.removePrincipal(principal); notifyRemovedPrincipal(principal); }
if (jpah.getAssociationType().isRequired() && !isSynchronizing()) JetspeedPrincipalAssociationType assType = jpah.getAssociationType(); throw new SecurityException(SecurityException.PRINCIPAL_ASSOCIATION_REQUIRED.createScoped(assType.getFromPrincipalType().getName(), assType.getAssociationName(),