@SuppressWarnings("unchecked")
    @Override
    public Set<JsonEntityBean> search(String entityType, String searchTerm) {

        Set<JsonEntityBean> results = new HashSet<>();

        EntityEnum entityEnum = EntityEnum.getEntityEnum(entityType);
        if (entityEnum == null) {
            throw new IllegalArgumentException(
                    String.format("Parameter entityType has an unknown value of [%s]", entityType));
        }

        EntityIdentifier[] identifiers;

        Class identifierType;

        // if the entity type is a group, use the group service's findGroup method
        // to locate it
        if (entityEnum.isGroup()) {
            identifiers =
                    GroupService.searchForGroups(
                            searchTerm,
                            GroupService.SearchMethod.CONTAINS_CI,
                            entityEnum.getClazz());
            identifierType = IEntityGroup.class;
        }

        // otherwise use the getGroupMember method
        else {
            identifiers =
                    GroupService.searchForEntities(
                            searchTerm,
                            GroupService.SearchMethod.CONTAINS_CI,
                            entityEnum.getClazz());
            identifierType = entityEnum.getClazz();
        }

        for (int i = 0; i < identifiers.length; i++) {
            if (identifiers[i].getType().equals(identifierType)) {
                IGroupMember entity = GroupService.getGroupMember(identifiers[i]);
                if (entity != null) {
                    JsonEntityBean jsonBean = getEntity(entity);
                    results.add(jsonBean);
                } else {
                    log.warn("Grouper member entity of " + identifiers[i].getKey() + " is null.");
                }
            }
        }

        return results;
    }
@ SuppressWarnings ( "unchecked" ) @ Override public Set < JsonEntityBean > search ( String entityType , String searchTerm ) { Set < JsonEntityBean > results = new HashSet < > ( ) ; EntityEnum entityEnum = EntityEnum . getEntityEnum ( entityType ) ; if ( entityEnum == null ) { throw new IllegalArgumentException ( String . format ( "Parameter entityType has an unknown value of [%s]" , entityType ) ) ; } EntityIdentifier [ ] identifiers ; Class identifierType ; if ( entityEnum . isGroup ( ) ) { identifiers = GroupService . searchForGroups ( searchTerm , GroupService . SearchMethod . CONTAINS_CI , entityEnum . getClazz ( ) ) ; identifierType = IEntityGroup . class ; } else { identifiers = GroupService . searchForEntities ( searchTerm , GroupService . SearchMethod . CONTAINS_CI , entityEnum . getClazz ( ) ) ; identifierType = entityEnum . getClazz ( ) ; } for ( int i = 0 ; i < identifiers . length ; i ++ ) { if ( identifiers [ i ] . getType ( ) . equals ( identifierType ) ) { IGroupMember entity = GroupService . getGroupMember ( identifiers [ i ] ) ; if ( entity != null ) { JsonEntityBean jsonBean = getEntity ( entity ) ; results . add ( jsonBean ) ; } else { log . warn ( "Grouper member entity of " + identifiers [ i ] . getKey ( ) + " is null." ) ; } } } return results ; }
/*
(non-Javadoc)
@see org.apereo.portal.layout.dlm.remoting.IGroupListHelper#search(java.lang.String, java.lang.String)

External search, thus case insensitive.