class QueryUtils {

    public static String convertCollectionValue( String value )
    {
        if ( StringUtils.isEmpty( value ) )
        {
            throw new QueryParserException( "Value is null" );
        }

        if ( !value.startsWith( "[" ) || !value.endsWith( "]" ) )
        {
            throw new QueryParserException( "Invalid query value" );
        }

        String[] split = value.substring( 1, value.length() - 1 ).split( "," );
        List<String> items = Lists.newArrayList( split );
        String str = "(";

        for ( int i = 0; i < items.size(); i++ )
        {
            Object item = QueryUtils.parseValue( items.get( i ) );
            if ( item != null )
            {
                str += item;
                if ( i < items.size() - 1 )
                {
                    str += ",";
                }
            }
        }

        str += ")";

        return str;
    }

}