use of edu.internet2.middleware.grouperClient.api.GcGetSubjects in project uPortal by Jasig.
the class GrouperEntityGroupStore method searchForEntities.
/** @see IEntitySearcher#searchForEntities(java.lang.String, int, java.lang.Class) */
@SuppressWarnings("unchecked")
public EntityIdentifier[] searchForEntities(String query, int method, Class type) throws GroupsException {
// only search for groups
if (type != IPerson.class) {
return new EntityIdentifier[] {};
}
List<EntityIdentifier> entityIdentifiers = new ArrayList<EntityIdentifier>();
try {
GcGetSubjects subjects = new GcGetSubjects();
subjects.assignIncludeSubjectDetail(true);
WsGetSubjectsResults results = subjects.assignSearchString(query).execute();
if (results != null && results.getWsSubjects() != null) {
for (WsSubject wsSubject : results.getWsSubjects()) {
entityIdentifiers.add(new EntityIdentifier(wsSubject.getName(), ICompositeGroupService.LEAF_ENTITY_TYPE));
}
}
return entityIdentifiers.toArray(new EntityIdentifier[entityIdentifiers.size()]);
} catch (Exception e) {
LOGGER.warn("Exception while attempting to retrieve " + "search results for query " + query + " and entity type " + type.getCanonicalName() + " : " + e.getMessage());
return new EntityIdentifier[] {};
}
}
use of edu.internet2.middleware.grouperClient.api.GcGetSubjects in project uPortal by Jasig.
the class GrouperEntityGroupStore method searchForEntities.
/**
* @see IEntitySearcher#searchForEntities(java.lang.String,
* org.apereo.portal.groups.IGroupConstants.SearchMethod, java.lang.Class)
*/
@Override
@SuppressWarnings("unchecked")
public EntityIdentifier[] searchForEntities(String query, SearchMethod method, Class type) throws GroupsException {
// only search for groups
if (type != IPerson.class) {
return new EntityIdentifier[] {};
}
List<EntityIdentifier> entityIdentifiers = new ArrayList<EntityIdentifier>();
try {
GcGetSubjects subjects = new GcGetSubjects();
subjects.assignIncludeSubjectDetail(true);
WsGetSubjectsResults results = subjects.assignSearchString(query).execute();
if (results != null && results.getWsSubjects() != null) {
for (WsSubject wsSubject : results.getWsSubjects()) {
entityIdentifiers.add(new EntityIdentifier(wsSubject.getName(), ICompositeGroupService.LEAF_ENTITY_TYPE));
}
}
return entityIdentifiers.toArray(new EntityIdentifier[entityIdentifiers.size()]);
} catch (Exception e) {
LOGGER.warn("Exception while attempting to retrieve " + "search results for query " + query + " and entity type " + type.getCanonicalName() + " : " + e.getMessage());
return new EntityIdentifier[] {};
}
}
Aggregations