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.generic;
016    
017    import com.liferay.portal.kernel.search.BaseQueryImpl;
018    import com.liferay.portal.kernel.search.Query;
019    import com.liferay.portal.kernel.search.query.QueryVisitor;
020    
021    /**
022     * @author Michael C. Han
023     */
024    public class NestedQuery extends BaseQueryImpl {
025    
026            public NestedQuery(String path, Query query) {
027                    _path = path;
028                    _query = query;
029            }
030    
031            @Override
032            public <T> T accept(QueryVisitor<T> queryVisitor) {
033                    return queryVisitor.visitQuery(this);
034            }
035    
036            public String getPath() {
037                    return _path;
038            }
039    
040            public Query getQuery() {
041                    return _query;
042            }
043    
044            @Override
045            public boolean hasChildren() {
046                    if (_query == null) {
047                            return true;
048                    }
049    
050                    return false;
051            }
052    
053            private final String _path;
054            private final Query _query;
055    
056    }