Search in sources :

Example 1 with WsGetSubjectsResults

use of edu.internet2.middleware.grouperClient.ws.beans.WsGetSubjectsResults 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)
 */
@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[] {};
    }
}
Also used : WsGetSubjectsResults(edu.internet2.middleware.grouperClient.ws.beans.WsGetSubjectsResults) ArrayList(java.util.ArrayList) EntityIdentifier(org.apereo.portal.EntityIdentifier) WsSubject(edu.internet2.middleware.grouperClient.ws.beans.WsSubject) GcGetSubjects(edu.internet2.middleware.grouperClient.api.GcGetSubjects) GroupsException(org.apereo.portal.groups.GroupsException)

Example 2 with WsGetSubjectsResults

use of edu.internet2.middleware.grouperClient.ws.beans.WsGetSubjectsResults 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[] {};
    }
}
Also used : WsGetSubjectsResults(edu.internet2.middleware.grouperClient.ws.beans.WsGetSubjectsResults) ArrayList(java.util.ArrayList) EntityIdentifier(org.apereo.portal.EntityIdentifier) WsSubject(edu.internet2.middleware.grouperClient.ws.beans.WsSubject) GcGetSubjects(edu.internet2.middleware.grouperClient.api.GcGetSubjects) GroupsException(org.apereo.portal.groups.GroupsException)

Aggregations

GcGetSubjects (edu.internet2.middleware.grouperClient.api.GcGetSubjects)2 WsGetSubjectsResults (edu.internet2.middleware.grouperClient.ws.beans.WsGetSubjectsResults)2 WsSubject (edu.internet2.middleware.grouperClient.ws.beans.WsSubject)2 ArrayList (java.util.ArrayList)2 EntityIdentifier (org.apereo.portal.EntityIdentifier)2 GroupsException (org.apereo.portal.groups.GroupsException)2