Package org.apache.jetspeed.security.mapping.impl

Examples of org.apache.jetspeed.security.mapping.impl.SecurityEntityRelationTypeImpl


                if (this.entityDAOs.get(relationType.getFromEntityType()) == null || this.entityDAOs.get(relationType.getToEntityType()) == null)
                {
                    throw new IllegalArgumentException("Missing EntityDAO for EntityRelationDAO fromEntityType: "+relationType.getFromEntityType() +
                                                       " and/or toEntityType: "+relationType.getToEntityType());
                }
                this.entityRelationDAOs.put(new SecurityEntityRelationTypeImpl(relationType.getRelationType(), relationType.getFromEntityType(), relationType.getToEntityType()),
                                            entityRelationDAO);
                this.entityRelationTypes.get(relationType.getFromEntityType()).add(relationType);
                this.entityRelationTypes.get(relationType.getToEntityType()).add(relationType);
            }
        }
View Full Code Here


        }
    }
   
    public SecurityEntityRelationType getSupportedEntityRelationType(String relationType, String fromEntityType, String toEntityType)
    {
        SecurityEntityRelationType key = new SecurityEntityRelationTypeImpl(relationType, fromEntityType, toEntityType);
        return entityRelationDAOs.containsKey(key) ? key : null;
    }
View Full Code Here

        return entityDAOs.get(entity.getType());
    }

    public void addRelation(String fromEntityId, String toEntityId, SecurityEntityRelationType relationType) throws SecurityException
    {
        EntityRelationDAO dao = entityRelationDAOs.get(relationType instanceof SecurityEntityRelationTypeImpl ? relationType : new SecurityEntityRelationTypeImpl(relationType));
        if (dao != null)
        {
            dao.addRelation(entityDAOs.get(relationType.getFromEntityType()), entityDAOs.get(relationType.getToEntityType()), fromEntityId, toEntityId);
        }
    }
View Full Code Here

        }
    }
   
    public void removeRelation(String fromEntityId, String toEntityId, SecurityEntityRelationType relationType) throws SecurityException
    {
        EntityRelationDAO dao = entityRelationDAOs.get(relationType instanceof SecurityEntityRelationTypeImpl ? relationType : new SecurityEntityRelationTypeImpl(relationType));
        if (dao != null)
        {
            dao.removeRelation(entityDAOs.get(relationType.getFromEntityType()), entityDAOs.get(relationType.getToEntityType()), fromEntityId, toEntityId);
        }
    }
View Full Code Here

        return dao != null ? dao.getEntity(entityId) : null;
    }

    public void getRelatedEntitiesTo(Entity toEntity, SecurityEntityRelationType relationType, EntitySearchResultHandler handler) throws SecurityException
    {
        EntityRelationDAO relationDAO = entityRelationDAOs.get(relationType instanceof SecurityEntityRelationTypeImpl ? relationType : new SecurityEntityRelationTypeImpl(relationType));
        if (relationDAO != null)
        {
            EntityDAO fromDAO = entityDAOs.get(relationType.getFromEntityType());
            EntityDAO toDAO = entityDAOs.get(relationType.getToEntityType());
            if (fromDAO != null && toDAO != null && toDAO.getEntityType().equals(toEntity.getType()))
View Full Code Here

        // todo : throw exception, since combination of entity types and relation type is not configured.
    }

    public void getRelatedEntitiesFrom(Entity fromEntity, SecurityEntityRelationType relationType, EntitySearchResultHandler handler) throws SecurityException
    {
        EntityRelationDAO relationDAO = entityRelationDAOs.get(relationType instanceof SecurityEntityRelationTypeImpl ? relationType : new SecurityEntityRelationTypeImpl(relationType));
        if (relationDAO != null)
        {
            EntityDAO fromDAO = entityDAOs.get(relationType.getFromEntityType());
            EntityDAO toDAO = entityDAOs.get(relationType.getToEntityType());
            if (fromDAO != null && toDAO != null && fromDAO.getEntityType().equals(fromEntity.getType()))
View Full Code Here

            Collection<Entity> expectedEntities) throws Exception
    {
        Entity randomEntity = entityManager.getEntity(toEntityType,toEntityId);
        TestCase.assertNotNull(randomEntity);
        Collection<Entity> resultEntities = entityManager.getRelatedEntitiesTo(
                randomEntity, new SecurityEntityRelationTypeImpl(relationType,fromEntityType,toEntityType));

        basicEntityResultSetChecks(expectedEntities, resultEntities);
    }
View Full Code Here

            Collection<Entity> expectedEntities) throws Exception
    {
        Entity randomEntity = entityManager.getEntity(fromEntityType,fromEntityId);
        TestCase.assertNotNull(randomEntity);
        Collection<Entity> resultEntities = entityManager.getRelatedEntitiesFrom(
                randomEntity, new SecurityEntityRelationTypeImpl(relationType,fromEntityType,toEntityType));

        basicEntityResultSetChecks(expectedEntities, resultEntities);
    }
View Full Code Here

        {
            EntityFactory entityFactory = ldapEntityManager.getEntityFactory(from.getType().getName());
            EntityFactory relatedFactory = ldapEntityManager.getEntityFactory(to.getType().getName());
            Entity fromEntity = entityFactory.createEntity(from);
            Entity toEntity = relatedFactory.createEntity(to);
            SecurityEntityRelationType relationType = new SecurityEntityRelationTypeImpl(associationName, fromEntity.getType(), toEntity.getType());
            ldapEntityManager.addRelation(fromEntity, toEntity, relationType);
        }
        databaseStorageManager.addAssociation(from, to, associationName);
    }
View Full Code Here

        {
            EntityFactory entityFactory = ldapEntityManager.getEntityFactory(from.getType().getName());
            EntityFactory relatedFactory = ldapEntityManager.getEntityFactory(to.getType().getName());
            Entity fromEntity = entityFactory.createEntity(from);
            Entity toEntity = relatedFactory.createEntity(to);
            SecurityEntityRelationType relationType = new SecurityEntityRelationTypeImpl(associationName, fromEntity.getType(), toEntity.getType());
            ldapEntityManager.removeRelation(fromEntity, toEntity, relationType);
            databaseStorageManager.removeAssociation(from, to, associationName);
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.security.mapping.impl.SecurityEntityRelationTypeImpl

Copyright © 2018 www.massapicom. 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.