public void setEntityType(String entityType) { this.entityType = EntityEnum.getEntityEnum(entityType); }
public EntityEnum getEntityType(IGroupMember entity) { if (IEntityGroup.class.isAssignableFrom(entity.getClass())) { return EntityEnum.getEntityEnum(entity.getLeafType(), true); } else { return EntityEnum.getEntityEnum(entity.getLeafType(), false); } }
@Override public EntityEnum getEntityType(IGroupMember entity) { if (entity == null) { throw new IllegalArgumentException("Parameter must not be null"); } if (IEntityGroup.class.isAssignableFrom(entity.getClass())) { return EntityEnum.getEntityEnum(entity.getLeafType(), true); } else { return EntityEnum.getEntityEnum(entity.getLeafType(), false); } }
@Override public Set<String> getEntityTypesForGroupType(String groupType) { // add the group type itself to the allowed list Set<String> set = new HashSet<String>(); set.add(groupType); /* * If the supplied type is a person group, add the person entity type. * If the supplied type is a category, add the channel type. Otherwise, * throw an exception. * * This method will require an update if more entity types are added * in the future. */ EntityEnum type = EntityEnum.getEntityEnum(groupType); if (EntityEnum.GROUP.equals(type)) { set.add(EntityEnum.PERSON.toString()); } else if (EntityEnum.CATEGORY.equals(type)) { set.add(EntityEnum.PORTLET.toString()); } else { throw new IllegalArgumentException( "Unable to determine a root entity for group type '" + groupType + "'"); } return set; }
/** * Convenience method that looks up the name of the given group member. Used for person types. * * @param entity Entity to look up * @return groupMember's name or null if there's an error */ public String lookupEntityName(Entity entity) { if (entity == null) { return null; } EntityEnum entityEnum = EntityEnum.getEntityEnum(entity.getEntityType()); return lookupEntityName(entityEnum, entity.getId()); }
@Override public Set<Entity> getGroupsForMember(String memberName) { Set<Entity> groups = new HashSet<Entity>(); if (StringUtils.isNotEmpty(memberName)) { EntityIdentifier[] identifiers = GroupService.searchForEntities( memberName, GroupService.SearchMethod.DISCRETE, EntityEnum.PERSON.getClazz()); for (EntityIdentifier entityIdentifier : identifiers) { if (entityIdentifier.getType().equals(EntityEnum.PERSON.getClazz())) { IGroupMember groupMember = GroupService.getGroupMember(entityIdentifier); if (memberName.equalsIgnoreCase(groupMember.getKey())) { Iterator it = GroupService.findParentGroups(groupMember); while (it.hasNext()) { IEntityGroup g = (IEntityGroup) it.next(); Entity e = EntityFactory.createEntity( g, EntityEnum.getEntityEnum(g.getLeafType(), true)); groups.add(e); } return groups; } } } } return groups; }
@Override public JsonEntityBean getRootEntity(String groupType) { EntityEnum type = EntityEnum.getEntityEnum(groupType); String rootKey; if (EntityEnum.GROUP.equals(type)) { rootKey = "local.0"; } else if (EntityEnum.CATEGORY.equals(type)) { IEntityGroup categoryGroup = GroupService.getDistinguishedGroup(IPortletDefinition.DISTINGUISHED_GROUP); return new JsonEntityBean(categoryGroup, EntityEnum.CATEGORY); } else { throw new IllegalArgumentException( "Unable to determine a root entity for group type '" + groupType + "'"); } JsonEntityBean bean = getEntity(groupType, rootKey, false); return bean; }
EntityEnum entityEnum = EntityEnum.getEntityEnum(entityType); EntityIdentifier[] identifiers; Class<?> identifierType;
EntityEnum entityEnum = EntityEnum.getEntityEnum(entityType); if (entityEnum == null) { throw new IllegalArgumentException(
public IAuthorizationPrincipal getPrincipalForEntity(Entity entity) { // attempt to determine the entity type class for this principal if (entity == null) { return null; } Class entityType; if (entity.getEntityType().equals(EntityEnum.GROUP.toString())) { entityType = IEntityGroup.class; } else { entityType = EntityEnum.getEntityEnum(entity.getEntityType()).getClazz(); } // construct an authorization principal for this JsonEntityBean AuthorizationServiceFacade authService = AuthorizationServiceFacade.instance(); IAuthorizationPrincipal p = authService.newPrincipal(entity.getId(), entityType); return p; }
groupListHelper.getEntityForPrincipal(permission.getIdentifier()); Class<?> clazz; EntityEnum entityType = EntityEnum.getEntityEnum(e.getEntityTypeAsString()); if (entityType.isGroup()) { clazz = IEntityGroup.class; groupListHelper.getEntityForPrincipal(permission.getIdentifier()); Class<?> clazz; EntityEnum entityType = EntityEnum.getEntityEnum(e.getEntityTypeAsString()); if (entityType.isGroup()) { clazz = IEntityGroup.class;
return null; EntityEnum entityEnum = EntityEnum.getEntityEnum(entityType);
EntityEnum type = EntityEnum.getEntityEnum(child.getEntityTypeAsString()); if (type.isGroup()) { IEntityGroup member = GroupService.findGroup(child.getId());
IEntityGroup group = (IEntityGroup) it.next(); EntityEnum beanType = EntityEnum.getEntityEnum(group.getLeafType(), true);
EntityEnum type = EntityEnum.getEntityEnum(groupForm.getType()); EntityEnum childType = EntityEnum.getEntityEnum(child.getEntityTypeAsString()); if (childType.isGroup()) { IEntityGroup member = GroupService.findGroup(child.getId());
EntityEnum entityEnum = EntityEnum.getEntityEnum(entityType); if (entityEnum == null) { throw new IllegalArgumentException(