protected String buildQueryFilter ( String streamId , String query ) { checkArgument ( streamId != null , "streamId parameter cannot be null" ) ; final String trimmedStreamId = streamId . trim ( ) ; checkArgument ( ! trimmedStreamId . isEmpty ( ) , "streamId parameter cannot be empty" ) ; final StringBuilder builder = new StringBuilder ( ) . append ( "streams:" ) . append ( trimmedStreamId ) ; if ( query != null ) { final String trimmedQuery = query . trim ( ) ; if ( ! trimmedQuery . isEmpty ( ) && ! "*" . equals ( trimmedQuery ) ) { builder . append ( " AND (" ) . append ( trimmedQuery ) . append ( ")" ) ; } } return builder . toString ( ) ; }
Combines the given stream ID and query string into a single filter string .