class QueryUtils {

    public static String parseFilterOperator( String operator, String value )
    {

        if ( StringUtils.isEmpty( operator ) )
        {
            throw new QueryParserException( "Filter Operator is null" );
        }

        switch ( operator )
        {
            case "eq":
            {
                return "= " + QueryUtils.parseValue( value );
            }
            case "!eq":
            {
                return "!= " + QueryUtils.parseValue( value );
            }
            case "ne":
            {
                return "!= " + QueryUtils.parseValue( value );
            }
            case "neq":
            {
                return "!= " + QueryUtils.parseValue( value );
            }
            case "gt":
            {
                return "> " + QueryUtils.parseValue( value );
            }
            case "lt":
            {
                return "< " + QueryUtils.parseValue( value );
            }
            case "gte":
            {
                return ">= " + QueryUtils.parseValue( value );
            }
            case "ge":
            {
                return ">= " + QueryUtils.parseValue( value );
            }
            case "lte":
            {
                return "<= " + QueryUtils.parseValue( value );
            }
            case "le":
            {
                return "<= " + QueryUtils.parseValue( value );
            }
            case "like":
            {
                return "like '%" + value + "%'";
            }
            case "!like":
            {
                return "not like '%" + value + "%'";
            }
            case "^like":
            {
                return " like '" + value + "%'";
            }
            case "!^like":
            {
                return " not like '" + value + "%'";
            }
            case "$like":
            {
                return " like '%" + value + "'";
            }
            case "!$like":
            {
                return " not like '%" + value + "'";
            }
            case "ilike":
            {
                return " ilike '%" + value + "%'";
            }
            case "!ilike":
            {
                return " not ilike '%" + value + "%'";
            }
            case "^ilike":
            {
                return " ilike '" + value + "%'";
            }
            case "!^ilike":
            {
                return " not ilike '" + value + "%'";
            }
            case "$ilike":
            {
                return " ilike '%" + value + "'";
            }
            case "!$ilike":
            {
                return " not ilike '%" + value + "'";
            }
            case "in":
            {
                return "in " + QueryUtils.convertCollectionValue( value );
            }
            case "!in":
            {
                return " not in " + QueryUtils.convertCollectionValue( value );
            }
            case "null":
            {
                return "is null";
            }
            case "!null":
            {
                return "is not null";
            }
            default:
            {
                throw new QueryParserException( "`" + operator + "` is not a valid operator." );
            }
        }
    }

}