Examples of JetspeedPrincipalAssociationHandler


Examples of org.apache.jetspeed.security.spi.JetspeedPrincipalAssociationHandler

    // JetspeedPrincipalAssociationHandler interface invocations
    //
    public void addAssociation(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)
        {
            throw new SecurityException(SecurityException.PRINCIPAL_ASSOCIATION_UNSUPPORTED.createScoped(from.getType().getName(), associationName, to.getType().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.add(from, to);
        notifyAddedAssociation(from,to, associationName);
    }
View Full Code Here

Examples of org.apache.jetspeed.security.spi.JetspeedPrincipalAssociationHandler

    }

    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);
        }
    }
View Full Code Here

Examples of org.apache.jetspeed.security.spi.JetspeedPrincipalAssociationHandler

    // JetspeedPrincipalAssociationHandler interface invocations
    //
    public void addAssociation(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)
        {
            throw new SecurityException(SecurityException.PRINCIPAL_ASSOCIATION_UNSUPPORTED.createScoped(from.getType().getName(), associationName, to.getType().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.add(from, to);
        notifyAddedAssociation(from,to, associationName);
    }
View Full Code Here

Examples of org.apache.jetspeed.security.spi.JetspeedPrincipalAssociationHandler

    }

    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);
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.