@ Override public EntityIdentifier [ ] searchForEntities ( String query , SearchMethod method ) throws GroupsException { boolean allowPartial = true ; switch ( method ) { case DISCRETE : allowPartial = false ; break ; case STARTS_WITH : query = query + "%" ; break ; case ENDS_WITH : query = "%" + query ; break ; case CONTAINS : query = "%" + query + "%" ; break ; default : throw new GroupsException ( "Unknown search type" ) ; } // get the list of matching portlet definitions final List < IPortletDefinition > definitions = this . portletDefinitionRegistry . searchForPortlets ( query , allowPartial ) ; if ( log . isDebugEnabled ( ) ) { log . debug ( "Found " + definitions . size ( ) + " matching definitions for query " + query ) ; } // initialize an appropriately-sized array of EntityIdentifiers final EntityIdentifier [ ] identifiers = new EntityIdentifier [ definitions . size ( ) ] ; // add an identifier for each matching portlet for ( final ListIterator < IPortletDefinition > defIter = definitions . listIterator ( ) ; defIter . hasNext ( ) ; ) { final IPortletDefinition definition = defIter . next ( ) ; identifiers [ defIter . previousIndex ( ) ] = new EntityIdentifier ( definition . getPortletDefinitionId ( ) . getStringId ( ) , this . getType ( ) ) ; } return identifiers ; }
Internal search so shouldn t be called as case insensitive .