001    /**
002     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.kernel.search.filter;
016    
017    import com.liferay.portal.kernel.search.Query;
018    import com.liferay.portal.kernel.util.StringBundler;
019    
020    /**
021     * @author Michael C. Han
022     */
023    public class QueryFilter extends BaseFilter {
024    
025            public QueryFilter(Query query) {
026                    _query = query;
027            }
028    
029            @Override
030            public <T> T accept(FilterVisitor<T> filterVisitor) {
031                    return filterVisitor.visit(this);
032            }
033    
034            public Query getQuery() {
035                    return _query;
036            }
037    
038            @Override
039            public int getSortOrder() {
040                    return 30;
041            }
042    
043            @Override
044            public String toString() {
045                    StringBundler sb = new StringBundler(5);
046    
047                    sb.append("{(query=");
048                    sb.append(_query);
049                    sb.append("), ");
050                    sb.append(super.toString());
051                    sb.append("}");
052    
053                    return sb.toString();
054            }
055    
056            private final Query _query;
057    
058    }