use of org.apereo.portal.permission.target.IPermissionTarget.TargetType in project uPortal by Jasig.
the class EntityTargetProviderImpl method searchTargets.
/*
* (non-Javadoc)
* @see org.apereo.portal.permission.target.IPermissionTargetProvider#searchTargets(java.lang.String)
*/
public Collection<IPermissionTarget> searchTargets(String term) {
// Initialize a new collection of matching targets. We use a HashSet
// implementation here to prevent duplicate target entries.
Collection<IPermissionTarget> matching = new HashSet<IPermissionTarget>();
/*
* Attempt to find matching entities for each allowed entity type.
* Any matching entities will be added to our collection.
*/
for (TargetType targetType : allowedTargetTypes) {
Set<JsonEntityBean> entities = groupListHelper.search(targetType.toString(), term);
for (JsonEntityBean entity : entities) {
IPermissionTarget target = new PermissionTargetImpl(entity.getId(), entity.getName(), targetType);
matching.add(target);
}
}
if (IPermission.ALL_CATEGORIES_TARGET.contains(term)) {
matching.add(ALL_CATEGORIES_TARGET);
} else if (IPermission.ALL_PORTLETS_TARGET.contains(term)) {
matching.add(ALL_PORTLETS_TARGET);
} else if (IPermission.ALL_GROUPS_TARGET.contains(term)) {
matching.add(ALL_GROUPS_TARGET);
}
// return the list of matching targets
return matching;
}
Aggregations